Browse Source

Merge branch 'master' of ssh://cloud.finedevelop.com:7999/~windy/fineui

# Conflicts:
#	dist/_fineui.min.js
#	dist/bundle.min.js
#	dist/fineui.min.js
es6
windy 7 years ago
parent
commit
59cfccca67
  1. 2
      dist/base.js
  2. 214
      dist/bundle.js
  3. 210
      dist/case.js
  4. 214
      dist/fineui.js
  5. 2
      dist/fix/fix.js
  6. 2
      src/base/single/input/file.js
  7. 4
      src/case/richeditor/niceditor/niceditor.js
  8. 16
      src/case/richeditor/plugins/button.bold.js
  9. 16
      src/case/richeditor/plugins/button.italic.js
  10. 16
      src/case/richeditor/plugins/button.underline.js
  11. 10
      src/case/richeditor/plugins/combo.colorchooser.js
  12. 145
      src/case/richeditor/plugins/combo.sizechooser.js

2
dist/base.js vendored

@ -19329,7 +19329,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
}); });
} }
}; };
form.setAttribute("action", handler.url); form.setAttribute("action", handler.url + "&filename=" + window.encodeURIComponent(handler.file.fileName));
form.setAttribute("target", iframe.id); form.setAttribute("target", iframe.id);
form.setAttribute("method", "post"); form.setAttribute("method", "post");
form.appendChild(handler.file); form.appendChild(handler.file);

214
dist/bundle.js vendored

@ -35356,7 +35356,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
// Deep watchers and watchers on Object/Arrays should fire even // Deep watchers and watchers on Object/Arrays should fire even
// when the value is the same, because the value may // when the value is the same, because the value may
// have mutated. // have mutated.
_.isObject(value) || this.deep) { this.deep) {
// set new value // set new value
var oldValue = this.value; var oldValue = this.value;
this.value = value; this.value = value;
@ -55242,7 +55242,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
}); });
} }
}; };
form.setAttribute("action", handler.url); form.setAttribute("action", handler.url + "&filename=" + window.encodeURIComponent(handler.file.fileName));
form.setAttribute("target", iframe.id); form.setAttribute("target", iframe.id);
form.setAttribute("method", "post"); form.setAttribute("method", "post");
form.appendChild(handler.file); form.appendChild(handler.file);
@ -83886,9 +83886,7 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
} }
} }
return false; return false;
}, }
}); });
}()); }());
/** /**
@ -84087,6 +84085,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);
}, },
@ -84127,6 +84141,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);
}, },
@ -84203,6 +84233,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);
}, },
@ -84342,9 +84388,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);
}
}); });
}, },
@ -84437,37 +84487,99 @@ BI.shortcut("bi.rich_editor_font_chooser", BI.RichEditorFontChooser);/**
*/ */
BI.RichEditorSizeChooser = BI.inherit(BI.RichEditorAction, { BI.RichEditorSizeChooser = BI.inherit(BI.RichEditorAction, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.RichEditorSizeChooser.superclass._defaultConfig.apply(this, arguments), { return BI.extend(
baseCls: "bi-rich-editor-size-chooser bi-border bi-card", BI.RichEditorSizeChooser.superclass._defaultConfig.apply(
command: "FontSize", this,
width: 50, arguments
height: 24 ),
}); {
baseCls: "bi-rich-editor-size-chooser bi-border bi-card",
command: "FontSize",
width: 50,
height: 24
}
);
}, },
_items: [{ _items: [
value: 1, {
text: "1(8pt)" value: 12,
}, { text: 12
value: 2, },
text: "2(10pt)" {
}, { value: 13,
value: 3, text: 13
text: "3(12pt)" },
}, { {
value: 4, value: 14,
text: "4(14pt)" text: 14
}, { },
value: 5, {
text: "5(18pt)" value: 16,
}, { text: 16
value: 6, },
text: "6(24pt)" {
}], value: 18,
text: 18
},
{
value: 20,
text: 20
},
{
value: 22,
text: 22
},
{
value: 24,
text: 24
},
{
value: 26,
text: 26
},
{
value: 28,
text: 28
},
{
value: 30,
text: 30
},
{
value: 32,
text: 32
},
{
value: 34,
text: 34
},
{
value: 36,
text: 36
},
{
value: 38,
text: 38
},
{
value: 40,
text: 40
},
{
value: 64,
text: 64
},
{
value: 128,
text: 128
}
],
_init: function () { _init: function () {
BI.RichEditorSizeChooser.superclass._init.apply(this, arguments); BI.RichEditorSizeChooser.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this,
o = this.options;
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.text_trigger", type: "bi.text_trigger",
readonly: true, readonly: true,
@ -84489,27 +84601,49 @@ BI.RichEditorSizeChooser = BI.inherit(BI.RichEditorAction, {
items: BI.createItems(this._items, { items: BI.createItems(this._items, {
type: "bi.single_select_item" type: "bi.single_select_item"
}), }),
layouts: [{ layouts: [
type: "bi.vertical" {
}] type: "bi.vertical"
}
]
} }
} }
}); });
this.combo.on(BI.Combo.EVENT_CHANGE, function () { this.combo.on(BI.Combo.EVENT_CHANGE, function () {
var val = this.getValue()[0]; var val = this.getValue()[0];
self.doCommand(val); self.doAction(val);
this.hideView(); this.hideView();
this.setValue([]); this.setValue([]);
}); });
}, },
hideIf: function (e) { hideIf: function (e) {
if(!this.combo.element.find(e.target).length > 0) { if (!this.combo.element.find(e.target).length > 0) {
this.combo.hideView(); this.combo.hideView();
} }
},
doAction: function (fontSize) {
var editor = this.options.editor.instance;
var range = editor.getRng();
var commonSize = 7;
if (!range.collapsed) {
this.doCommand(commonSize);
BI.each(document.getElementsByTagName("font"), function (idx, el) {
if (
BI.contains($(el).parents(), editor.element[0]) &&
el["size"] == commonSize
) {
$(el)
.removeAttr("size")
.css("font-size", fontSize + "px");
}
});
}
} }
}); });
BI.shortcut("bi.rich_editor_size_chooser", BI.RichEditorSizeChooser);/** BI.shortcut("bi.rich_editor_size_chooser", BI.RichEditorSizeChooser);
/**
* 富文本编辑器 * 富文本编辑器
* *
* Created by GUY on 2017/9/15. * Created by GUY on 2017/9/15.

210
dist/case.js vendored

@ -11201,9 +11201,7 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
} }
} }
return false; return false;
}, }
}); });
}()); }());
/** /**
@ -11402,6 +11400,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);
}, },
@ -11442,6 +11456,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);
}, },
@ -11518,6 +11548,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);
}, },
@ -11657,9 +11703,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);
}
}); });
}, },
@ -11752,37 +11802,99 @@ BI.shortcut("bi.rich_editor_font_chooser", BI.RichEditorFontChooser);/**
*/ */
BI.RichEditorSizeChooser = BI.inherit(BI.RichEditorAction, { BI.RichEditorSizeChooser = BI.inherit(BI.RichEditorAction, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.RichEditorSizeChooser.superclass._defaultConfig.apply(this, arguments), { return BI.extend(
baseCls: "bi-rich-editor-size-chooser bi-border bi-card", BI.RichEditorSizeChooser.superclass._defaultConfig.apply(
command: "FontSize", this,
width: 50, arguments
height: 24 ),
}); {
baseCls: "bi-rich-editor-size-chooser bi-border bi-card",
command: "FontSize",
width: 50,
height: 24
}
);
}, },
_items: [{ _items: [
value: 1, {
text: "1(8pt)" value: 12,
}, { text: 12
value: 2, },
text: "2(10pt)" {
}, { value: 13,
value: 3, text: 13
text: "3(12pt)" },
}, { {
value: 4, value: 14,
text: "4(14pt)" text: 14
}, { },
value: 5, {
text: "5(18pt)" value: 16,
}, { text: 16
value: 6, },
text: "6(24pt)" {
}], value: 18,
text: 18
},
{
value: 20,
text: 20
},
{
value: 22,
text: 22
},
{
value: 24,
text: 24
},
{
value: 26,
text: 26
},
{
value: 28,
text: 28
},
{
value: 30,
text: 30
},
{
value: 32,
text: 32
},
{
value: 34,
text: 34
},
{
value: 36,
text: 36
},
{
value: 38,
text: 38
},
{
value: 40,
text: 40
},
{
value: 64,
text: 64
},
{
value: 128,
text: 128
}
],
_init: function () { _init: function () {
BI.RichEditorSizeChooser.superclass._init.apply(this, arguments); BI.RichEditorSizeChooser.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this,
o = this.options;
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.text_trigger", type: "bi.text_trigger",
readonly: true, readonly: true,
@ -11804,27 +11916,49 @@ BI.RichEditorSizeChooser = BI.inherit(BI.RichEditorAction, {
items: BI.createItems(this._items, { items: BI.createItems(this._items, {
type: "bi.single_select_item" type: "bi.single_select_item"
}), }),
layouts: [{ layouts: [
type: "bi.vertical" {
}] type: "bi.vertical"
}
]
} }
} }
}); });
this.combo.on(BI.Combo.EVENT_CHANGE, function () { this.combo.on(BI.Combo.EVENT_CHANGE, function () {
var val = this.getValue()[0]; var val = this.getValue()[0];
self.doCommand(val); self.doAction(val);
this.hideView(); this.hideView();
this.setValue([]); this.setValue([]);
}); });
}, },
hideIf: function (e) { hideIf: function (e) {
if(!this.combo.element.find(e.target).length > 0) { if (!this.combo.element.find(e.target).length > 0) {
this.combo.hideView(); this.combo.hideView();
} }
},
doAction: function (fontSize) {
var editor = this.options.editor.instance;
var range = editor.getRng();
var commonSize = 7;
if (!range.collapsed) {
this.doCommand(commonSize);
BI.each(document.getElementsByTagName("font"), function (idx, el) {
if (
BI.contains($(el).parents(), editor.element[0]) &&
el["size"] == commonSize
) {
$(el)
.removeAttr("size")
.css("font-size", fontSize + "px");
}
});
}
} }
}); });
BI.shortcut("bi.rich_editor_size_chooser", BI.RichEditorSizeChooser);/** BI.shortcut("bi.rich_editor_size_chooser", BI.RichEditorSizeChooser);
/**
* 富文本编辑器 * 富文本编辑器
* *
* Created by GUY on 2017/9/15. * Created by GUY on 2017/9/15.

214
dist/fineui.js vendored

@ -35605,7 +35605,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
// Deep watchers and watchers on Object/Arrays should fire even // Deep watchers and watchers on Object/Arrays should fire even
// when the value is the same, because the value may // when the value is the same, because the value may
// have mutated. // have mutated.
_.isObject(value) || this.deep) { this.deep) {
// set new value // set new value
var oldValue = this.value; var oldValue = this.value;
this.value = value; this.value = value;
@ -55491,7 +55491,7 @@ BI.shortcut("bi.checkbox", BI.Checkbox);/**
}); });
} }
}; };
form.setAttribute("action", handler.url); form.setAttribute("action", handler.url + "&filename=" + window.encodeURIComponent(handler.file.fileName));
form.setAttribute("target", iframe.id); form.setAttribute("target", iframe.id);
form.setAttribute("method", "post"); form.setAttribute("method", "post");
form.appendChild(handler.file); form.appendChild(handler.file);
@ -84135,9 +84135,7 @@ BI.shortcut("bi.rich_editor_text_toolbar", BI.RichEditorTextToolbar);/**
} }
} }
return false; return false;
}, }
}); });
}()); }());
/** /**
@ -84336,6 +84334,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);
}, },
@ -84376,6 +84390,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);
}, },
@ -84452,6 +84482,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);
}, },
@ -84591,9 +84637,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);
}
}); });
}, },
@ -84686,37 +84736,99 @@ BI.shortcut("bi.rich_editor_font_chooser", BI.RichEditorFontChooser);/**
*/ */
BI.RichEditorSizeChooser = BI.inherit(BI.RichEditorAction, { BI.RichEditorSizeChooser = BI.inherit(BI.RichEditorAction, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.RichEditorSizeChooser.superclass._defaultConfig.apply(this, arguments), { return BI.extend(
baseCls: "bi-rich-editor-size-chooser bi-border bi-card", BI.RichEditorSizeChooser.superclass._defaultConfig.apply(
command: "FontSize", this,
width: 50, arguments
height: 24 ),
}); {
baseCls: "bi-rich-editor-size-chooser bi-border bi-card",
command: "FontSize",
width: 50,
height: 24
}
);
}, },
_items: [{ _items: [
value: 1, {
text: "1(8pt)" value: 12,
}, { text: 12
value: 2, },
text: "2(10pt)" {
}, { value: 13,
value: 3, text: 13
text: "3(12pt)" },
}, { {
value: 4, value: 14,
text: "4(14pt)" text: 14
}, { },
value: 5, {
text: "5(18pt)" value: 16,
}, { text: 16
value: 6, },
text: "6(24pt)" {
}], value: 18,
text: 18
},
{
value: 20,
text: 20
},
{
value: 22,
text: 22
},
{
value: 24,
text: 24
},
{
value: 26,
text: 26
},
{
value: 28,
text: 28
},
{
value: 30,
text: 30
},
{
value: 32,
text: 32
},
{
value: 34,
text: 34
},
{
value: 36,
text: 36
},
{
value: 38,
text: 38
},
{
value: 40,
text: 40
},
{
value: 64,
text: 64
},
{
value: 128,
text: 128
}
],
_init: function () { _init: function () {
BI.RichEditorSizeChooser.superclass._init.apply(this, arguments); BI.RichEditorSizeChooser.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this,
o = this.options;
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.text_trigger", type: "bi.text_trigger",
readonly: true, readonly: true,
@ -84738,27 +84850,49 @@ BI.RichEditorSizeChooser = BI.inherit(BI.RichEditorAction, {
items: BI.createItems(this._items, { items: BI.createItems(this._items, {
type: "bi.single_select_item" type: "bi.single_select_item"
}), }),
layouts: [{ layouts: [
type: "bi.vertical" {
}] type: "bi.vertical"
}
]
} }
} }
}); });
this.combo.on(BI.Combo.EVENT_CHANGE, function () { this.combo.on(BI.Combo.EVENT_CHANGE, function () {
var val = this.getValue()[0]; var val = this.getValue()[0];
self.doCommand(val); self.doAction(val);
this.hideView(); this.hideView();
this.setValue([]); this.setValue([]);
}); });
}, },
hideIf: function (e) { hideIf: function (e) {
if(!this.combo.element.find(e.target).length > 0) { if (!this.combo.element.find(e.target).length > 0) {
this.combo.hideView(); this.combo.hideView();
} }
},
doAction: function (fontSize) {
var editor = this.options.editor.instance;
var range = editor.getRng();
var commonSize = 7;
if (!range.collapsed) {
this.doCommand(commonSize);
BI.each(document.getElementsByTagName("font"), function (idx, el) {
if (
BI.contains($(el).parents(), editor.element[0]) &&
el["size"] == commonSize
) {
$(el)
.removeAttr("size")
.css("font-size", fontSize + "px");
}
});
}
} }
}); });
BI.shortcut("bi.rich_editor_size_chooser", BI.RichEditorSizeChooser);/** BI.shortcut("bi.rich_editor_size_chooser", BI.RichEditorSizeChooser);
/**
* 富文本编辑器 * 富文本编辑器
* *
* Created by GUY on 2017/9/15. * Created by GUY on 2017/9/15.

2
dist/fix/fix.js vendored

@ -814,7 +814,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
// Deep watchers and watchers on Object/Arrays should fire even // Deep watchers and watchers on Object/Arrays should fire even
// when the value is the same, because the value may // when the value is the same, because the value may
// have mutated. // have mutated.
_.isObject(value) || this.deep) { this.deep) {
// set new value // set new value
var oldValue = this.value; var oldValue = this.value;
this.value = value; this.value = value;

2
src/base/single/input/file.js

@ -306,7 +306,7 @@
}); });
} }
}; };
form.setAttribute("action", handler.url); form.setAttribute("action", handler.url + "&filename=" + window.encodeURIComponent(handler.file.fileName));
form.setAttribute("target", iframe.id); form.setAttribute("target", iframe.id);
form.setAttribute("method", "post"); form.setAttribute("method", "post");
form.appendChild(handler.file); form.appendChild(handler.file);

4
src/case/richeditor/niceditor/niceditor.js

@ -456,8 +456,6 @@
} }
} }
return false; return false;
}, }
}); });
}()); }());

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);
}
}); });
}, },

145
src/case/richeditor/plugins/combo.sizechooser.js

@ -7,37 +7,99 @@
*/ */
BI.RichEditorSizeChooser = BI.inherit(BI.RichEditorAction, { BI.RichEditorSizeChooser = BI.inherit(BI.RichEditorAction, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.RichEditorSizeChooser.superclass._defaultConfig.apply(this, arguments), { return BI.extend(
baseCls: "bi-rich-editor-size-chooser bi-border bi-card", BI.RichEditorSizeChooser.superclass._defaultConfig.apply(
command: "FontSize", this,
width: 50, arguments
height: 24 ),
}); {
baseCls: "bi-rich-editor-size-chooser bi-border bi-card",
command: "FontSize",
width: 50,
height: 24
}
);
}, },
_items: [{ _items: [
value: 1, {
text: "1(8pt)" value: 12,
}, { text: 12
value: 2, },
text: "2(10pt)" {
}, { value: 13,
value: 3, text: 13
text: "3(12pt)" },
}, { {
value: 4, value: 14,
text: "4(14pt)" text: 14
}, { },
value: 5, {
text: "5(18pt)" value: 16,
}, { text: 16
value: 6, },
text: "6(24pt)" {
}], value: 18,
text: 18
},
{
value: 20,
text: 20
},
{
value: 22,
text: 22
},
{
value: 24,
text: 24
},
{
value: 26,
text: 26
},
{
value: 28,
text: 28
},
{
value: 30,
text: 30
},
{
value: 32,
text: 32
},
{
value: 34,
text: 34
},
{
value: 36,
text: 36
},
{
value: 38,
text: 38
},
{
value: 40,
text: 40
},
{
value: 64,
text: 64
},
{
value: 128,
text: 128
}
],
_init: function () { _init: function () {
BI.RichEditorSizeChooser.superclass._init.apply(this, arguments); BI.RichEditorSizeChooser.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this,
o = this.options;
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.text_trigger", type: "bi.text_trigger",
readonly: true, readonly: true,
@ -59,24 +121,45 @@ BI.RichEditorSizeChooser = BI.inherit(BI.RichEditorAction, {
items: BI.createItems(this._items, { items: BI.createItems(this._items, {
type: "bi.single_select_item" type: "bi.single_select_item"
}), }),
layouts: [{ layouts: [
type: "bi.vertical" {
}] type: "bi.vertical"
}
]
} }
} }
}); });
this.combo.on(BI.Combo.EVENT_CHANGE, function () { this.combo.on(BI.Combo.EVENT_CHANGE, function () {
var val = this.getValue()[0]; var val = this.getValue()[0];
self.doCommand(val); self.doAction(val);
this.hideView(); this.hideView();
this.setValue([]); this.setValue([]);
}); });
}, },
hideIf: function (e) { hideIf: function (e) {
if(!this.combo.element.find(e.target).length > 0) { if (!this.combo.element.find(e.target).length > 0) {
this.combo.hideView(); this.combo.hideView();
} }
},
doAction: function (fontSize) {
var editor = this.options.editor.instance;
var range = editor.getRng();
var commonSize = 7;
if (!range.collapsed) {
this.doCommand(commonSize);
BI.each(document.getElementsByTagName("font"), function (idx, el) {
if (
BI.contains($(el).parents(), editor.element[0]) &&
el["size"] == commonSize
) {
$(el)
.removeAttr("size")
.css("font-size", fontSize + "px");
}
});
}
} }
}); });
BI.shortcut("bi.rich_editor_size_chooser", BI.RichEditorSizeChooser); BI.shortcut("bi.rich_editor_size_chooser", BI.RichEditorSizeChooser);
Loading…
Cancel
Save