XFA - Support assist element
This commit is contained in:
parent
70434c132f
commit
9bbc194846
@ -501,6 +501,12 @@ class Assist extends XFAObject {
|
|||||||
this.speak = null;
|
this.speak = null;
|
||||||
this.toolTip = null;
|
this.toolTip = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[$toHTML]() {
|
||||||
|
return this.toolTip && this.toolTip[$content]
|
||||||
|
? this.toolTip[$content]
|
||||||
|
: null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Barcode extends XFAObject {
|
class Barcode extends XFAObject {
|
||||||
@ -1734,6 +1740,11 @@ class Draw extends XFAObject {
|
|||||||
children: [],
|
children: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const assist = this.assist ? this.assist[$toHTML]() : null;
|
||||||
|
if (assist) {
|
||||||
|
html.attributes.title = assist;
|
||||||
|
}
|
||||||
|
|
||||||
const bbox = computeBbox(this, html, availableSpace);
|
const bbox = computeBbox(this, html, availableSpace);
|
||||||
|
|
||||||
const value = this.value ? this.value[$toHTML](availableSpace).html : null;
|
const value = this.value ? this.value[$toHTML](availableSpace).html : null;
|
||||||
@ -2345,6 +2356,11 @@ class ExclGroup extends XFAObject {
|
|||||||
children,
|
children,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const assist = this.assist ? this.assist[$toHTML]() : null;
|
||||||
|
if (assist) {
|
||||||
|
html.attributes.title = assist;
|
||||||
|
}
|
||||||
|
|
||||||
delete this[$extra];
|
delete this[$extra];
|
||||||
|
|
||||||
return HTMLResult.success(createWrapper(this, html), bbox);
|
return HTMLResult.success(createWrapper(this, html), bbox);
|
||||||
@ -2621,6 +2637,11 @@ class Field extends XFAObject {
|
|||||||
children,
|
children,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const assist = this.assist ? this.assist[$toHTML]() : null;
|
||||||
|
if (assist) {
|
||||||
|
html.attributes.title = assist;
|
||||||
|
}
|
||||||
|
|
||||||
const borderStyle = this.border ? this.border[$toStyle]() : null;
|
const borderStyle = this.border ? this.border[$toStyle]() : null;
|
||||||
|
|
||||||
const bbox = computeBbox(this, html, availableSpace);
|
const bbox = computeBbox(this, html, availableSpace);
|
||||||
@ -4781,6 +4802,11 @@ class Subform extends XFAObject {
|
|||||||
children,
|
children,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const assist = this.assist ? this.assist[$toHTML]() : null;
|
||||||
|
if (assist) {
|
||||||
|
html.attributes.title = assist;
|
||||||
|
}
|
||||||
|
|
||||||
const result = HTMLResult.success(createWrapper(this, html), bbox);
|
const result = HTMLResult.success(createWrapper(this, html), bbox);
|
||||||
|
|
||||||
if (this.breakAfter.children.length >= 1) {
|
if (this.breakAfter.children.length >= 1) {
|
||||||
|
@ -44,6 +44,7 @@ describe("XFAFactory", function () {
|
|||||||
<contentArea x="123pt" w="456pt" h="789pt"/>
|
<contentArea x="123pt" w="456pt" h="789pt"/>
|
||||||
<medium stock="default" short="456pt" long="789pt"/>
|
<medium stock="default" short="456pt" long="789pt"/>
|
||||||
<draw y="1pt" w="11pt" h="22pt" rotate="90" x="2pt">
|
<draw y="1pt" w="11pt" h="22pt" rotate="90" x="2pt">
|
||||||
|
<assist><toolTip>A tooltip !!</toolTip></assist>
|
||||||
<font size="7pt" typeface="FooBar" baselineShift="2pt">
|
<font size="7pt" typeface="FooBar" baselineShift="2pt">
|
||||||
<fill>
|
<fill>
|
||||||
<color value="12,23,34"/>
|
<color value="12,23,34"/>
|
||||||
@ -118,6 +119,7 @@ describe("XFAFactory", function () {
|
|||||||
"xfaFont",
|
"xfaFont",
|
||||||
"xfaWrapped",
|
"xfaWrapped",
|
||||||
]);
|
]);
|
||||||
|
expect(draw.attributes.title).toEqual("A tooltip !!");
|
||||||
expect(draw.attributes.style).toEqual({
|
expect(draw.attributes.style).toEqual({
|
||||||
color: "#0c1722",
|
color: "#0c1722",
|
||||||
fontFamily: '"FooBar"',
|
fontFamily: '"FooBar"',
|
||||||
|
Loading…
Reference in New Issue
Block a user