|
613 | 613 | <tab label="&highlight.tab7.label;" value="Selected" observes="b.highlightSelected"/>
|
614 | 614 | </tabs>
|
615 | 615 | <tabpanels>
|
616 |
| - <tabpanel orient="vertical"> |
| 616 | + <tabpanel orient="vertical" oncommand="doHighlightStyle();" |
| 617 | + oninput="doHighlightStyle();" |
| 618 | + onchange="doHighlightStyle();"> |
617 | 619 | <checkbox id="c.highlightEnabled" label="&highlightEnabled.label;"/>
|
618 | 620 | <separator class="groove"/>
|
619 | 621 | <hbox>
|
620 |
| - <checkbox id="c.highlightBold" label="&highlightBold.label;" style="font-weight: bold;" observes="b.highlightEnabled" |
621 |
| - oncommand="doHighlightStyle();"/> |
622 |
| - <checkbox id="c.highlightItalic" label="&highlightItalic.label;" style="font-style: italic;" observes="b.highlightEnabled" |
623 |
| - oncommand="doHighlightStyle();"/> |
| 622 | + <checkbox id="c.highlightBold" label="&highlightBold.label;" style="font-weight: bold;" observes="b.highlightEnabled"/> |
| 623 | + <checkbox id="c.highlightItalic" label="&highlightItalic.label;" style="font-style: italic;" observes="b.highlightEnabled"/> |
624 | 624 | <checkbox id="c.highlightUnderline" label="&highlightUnderline.label;" style="text-decoration: underline;" observes="b.highlightEnabled"
|
625 |
| - oncommand="if (this.checked) this.nextSibling.checked = false;doHighlightStyle();"/> |
| 625 | + oncommand="if (this.checked) this.nextSibling.checked = false;"/> |
626 | 626 | <checkbox id="c.highlightStrikethrough" label="&highlightStrikethrough.label;" style="text-decoration: line-through;" observes="b.highlightEnabled"
|
627 |
| - oncommand="if (this.checked) this.previousSibling.checked = false;doHighlightStyle();"/> |
| 627 | + oncommand="if (this.checked) this.previousSibling.checked = false;"/> |
628 | 628 | </hbox>
|
629 | 629 | <grid>
|
630 | 630 | <rows>
|
631 | 631 | <row align="center">
|
632 |
| - <checkbox id="c.highlightColor" label="&highlightColor.label;" oncommand="doHighlightStyle();"> |
| 632 | + <checkbox id="c.highlightColor" label="&highlightColor.label;"> |
633 | 633 | <observes element="b.highlightEnabled" attribute="disabled" onbroadcast="onHighlightColor();"/>
|
634 | 634 | </checkbox>
|
635 |
| - <textbox id="c.highlightColorCode" observes="b.highlightColor" oninput="doHighlightStyle();"/> |
| 635 | + <textbox id="c.highlightColorCode" observes="b.highlightColor"/> |
636 | 636 | <colorpicker id="c.highlightColorPicker" type="button"
|
637 |
| - onchange="this.previousSibling.value = this.color;doHighlightStyle();" |
| 637 | + onchange="this.previousSibling.value = this.color;" |
638 | 638 | onbroadcast="this.style.opacity = this.disabled ? 0.3 : 1;">
|
639 | 639 | <observes element="b.highlightColor" attribute="disabled"/>
|
640 | 640 | </colorpicker>
|
641 | 641 | </row>
|
642 | 642 | <row align="center">
|
643 |
| - <checkbox id="c.highlightBgColor" label="&highlightBgColor.label;" oncommand="doHighlightStyle();"> |
| 643 | + <checkbox id="c.highlightBgColor" label="&highlightBgColor.label;"> |
644 | 644 | <observes element="b.highlightEnabled" attribute="disabled" onbroadcast="onHighlightBgColor();"/>
|
645 | 645 | </checkbox>
|
646 |
| - <textbox id="c.highlightBgColorCode" observes="b.highlightBgColor" oninput="doHighlightStyle();"/> |
| 646 | + <textbox id="c.highlightBgColorCode" observes="b.highlightBgColor"/> |
647 | 647 | <colorpicker id="c.highlightBgColorPicker" type="button"
|
648 |
| - onchange="this.previousSibling.value = this.color;doHighlightStyle();" |
| 648 | + onchange="this.previousSibling.value = this.color;" |
649 | 649 | onbroadcast="this.style.opacity = this.disabled ? 0.3 : 1;">
|
650 | 650 | <observes element="b.highlightBgColor" attribute="disabled"/>
|
651 | 651 | </colorpicker>
|
652 | 652 | </row>
|
653 | 653 | <row align="center">
|
654 |
| - <checkbox id="c.highlightOutline" label="&highlightOutline.label;" oncommand="doHighlightStyle();"> |
| 654 | + <checkbox id="c.highlightOutline" label="&highlightOutline.label;"> |
655 | 655 | <observes element="b.highlightEnabled" attribute="disabled" onbroadcast="onHighlightOutline();"/>
|
656 | 656 | </checkbox>
|
657 |
| - <textbox id="c.highlightOutlineColorCode" observes="b.highlightOutline" oninput="doHighlightStyle();"/> |
| 657 | + <textbox id="c.highlightOutlineColorCode" observes="b.highlightOutline"/> |
658 | 658 | <colorpicker id="c.highlightOutlineColorPicker" type="button"
|
659 |
| - onchange="this.previousSibling.value = this.color;doHighlightStyle();" |
| 659 | + onchange="this.previousSibling.value = this.color;" |
660 | 660 | onbroadcast="this.style.opacity = this.disabled ? 0.3 : 1;">
|
661 | 661 | <observes element="b.highlightOutline" attribute="disabled"/>
|
662 | 662 | </colorpicker>
|
663 | 663 | </row>
|
664 | 664 | <row align="center">
|
665 |
| - <checkbox id="c.highlightOpacity" label="Opacity:" oncommand="doHighlightStyle();"> |
| 665 | + <checkbox id="c.highlightOpacity" label="Opacity:"> |
666 | 666 | <observes element="b.highlightEnabled" attribute="disabled" onbroadcast="onHighlightOpacity();"/>
|
667 | 667 | </checkbox>
|
668 | 668 | <textbox id="c.highlightOpacityCode" type="number" min="0" max="100" increment="10" size="3" maxlength="3"
|
669 |
| - observes="b.highlightOpacity" oninput="doHighlightStyle();" onchange="doHighlightStyle();"/> |
| 669 | + observes="b.highlightOpacity"/> |
670 | 670 | </row>
|
671 | 671 | </rows>
|
672 | 672 | </grid>
|
|
1246 | 1246 | $("c.highlightOutlineColorCode").value = style.outlineColorCode;
|
1247 | 1247 | $("c.highlightOutlineColorPicker").color = style.outlineColorCode;
|
1248 | 1248 | $("c.highlightOpacity").checked = style.opacity;
|
1249 |
| - $("c.highlightOpacityCode").value = style.opacityCode * 100; |
| 1249 | + $("c.highlightOpacityCode").value = ("opacityCode" in style ? style.opacityCode : 1) * 100; |
1250 | 1250 |
|
1251 | 1251 | onHighlightColor();
|
1252 | 1252 | onHighlightBgColor();
|
|
1271 | 1271 | opacityCode: $("c.highlightOpacityCode").value / 100
|
1272 | 1272 | };
|
1273 | 1273 |
|
| 1274 | + for (let prop in style) { |
| 1275 | + if (style[prop] === false || style[prop] === "undefined" || style[prop] === 1) |
| 1276 | + delete style[prop]; |
| 1277 | + } |
| 1278 | +
|
1274 | 1279 | $("style" + $("highlight").selectedItem.value).value = JSON.stringify(style);
|
1275 | 1280 | }
|
1276 | 1281 |
|
|
0 commit comments