|
|
@ -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); |