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();
});
},
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 () {
this.bold.setSelected(true);
},

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

@ -30,6 +30,22 @@ BI.RichEditorItalicButton = BI.inherit(BI.RichEditorAction, {
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 () {
this.italic.setSelected(true);
},

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

@ -30,6 +30,22 @@ BI.RichEditorUnderlineButton = BI.inherit(BI.RichEditorAction, {
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 () {
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 () {
var value = this.getValue();
// 用span代替font
document.execCommand('styleWithCSS', null, true);
self.doCommand(this.getValue() || "inherit");
document.execCommand('styleWithCSS', null, false);
if(BI.isIE() && BI.getIEVersion() < 11) {
self.doCommand(this.getValue());
} else {
document.execCommand('styleWithCSS', null, true);
self.doCommand(this.getValue() || "inherit");
document.execCommand('styleWithCSS', null, false);
}
});
},

Loading…
Cancel
Save