Browse Source

BI-24520

es6
fay 6 years ago
parent
commit
331c4d44e9
  1. 16
      src/case/richeditor/plugins/button.bold.js
  2. 16
      src/case/richeditor/plugins/button.italic.js
  3. 16
      src/case/richeditor/plugins/button.underline.js
  4. 10
      src/case/richeditor/plugins/combo.colorchooser.js

16
src/case/richeditor/plugins/button.bold.js

@ -30,6 +30,22 @@ BI.RichEditorBoldButton = BI.inherit(BI.RichEditorAction, {
self.doCommand(); self.doCommand();
}); });
}, },
checkNodes: function (e) {
var self = this;
try {
BI.defer(function() {
if(document.queryCommandState("bold") ) {
self.activate();
} else {
self.deactivate();
}
});
} catch (error) {
BI.RichEditorBoldButton.superclass.checkNodes(e);
}
},
activate: function () { activate: function () {
this.bold.setSelected(true); this.bold.setSelected(true);
}, },

16
src/case/richeditor/plugins/button.italic.js

@ -30,6 +30,22 @@ BI.RichEditorItalicButton = BI.inherit(BI.RichEditorAction, {
self.doCommand(); self.doCommand();
}); });
}, },
checkNodes: function (e) {
var self = this;
try {
BI.defer(function() {
if(document.queryCommandState("italic") ) {
self.activate();
} else {
self.deactivate();
}
});
} catch (error) {
BI.RichEditorBoldButton.superclass.checkNodes(e);
}
},
activate: function () { activate: function () {
this.italic.setSelected(true); this.italic.setSelected(true);
}, },

16
src/case/richeditor/plugins/button.underline.js

@ -30,6 +30,22 @@ BI.RichEditorUnderlineButton = BI.inherit(BI.RichEditorAction, {
self.doCommand(); self.doCommand();
}); });
}, },
checkNodes: function (e) {
var self = this;
try {
BI.defer(function() {
if(document.queryCommandState("underline") ) {
self.activate();
} else {
self.deactivate();
}
});
} catch (error) {
BI.RichEditorBoldButton.superclass.checkNodes(e);
}
},
activate: function () { activate: function () {
this.underline.setSelected(true); this.underline.setSelected(true);
}, },

10
src/case/richeditor/plugins/combo.colorchooser.js

@ -32,9 +32,13 @@ BI.RichEditorColorChooser = BI.inherit(BI.RichEditorAction, {
this.colorchooser.on(BI.ColorChooser.EVENT_CHANGE, function () { this.colorchooser.on(BI.ColorChooser.EVENT_CHANGE, function () {
var value = this.getValue(); var value = this.getValue();
// 用span代替font // 用span代替font
document.execCommand('styleWithCSS', null, true); if(BI.isIE() && BI.getIEVersion() < 11) {
self.doCommand(this.getValue() || "inherit"); self.doCommand(this.getValue());
document.execCommand('styleWithCSS', null, false); } else {
document.execCommand('styleWithCSS', null, true);
self.doCommand(this.getValue() || "inherit");
document.execCommand('styleWithCSS', null, false);
}
}); });
}, },

Loading…
Cancel
Save