Add version files and new GIF images for UI components
This commit is contained in:
238
themes/sources4.0/dhtmlxEditor/codebase/ext/dhtmlxeditor_ext.js
Normal file
238
themes/sources4.0/dhtmlxEditor/codebase/ext/dhtmlxeditor_ext.js
Normal file
@ -0,0 +1,238 @@
|
||||
/*
|
||||
Product Name: dhtmlxSuite
|
||||
Version: 4.0.3
|
||||
Edition: Professional
|
||||
License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact sales@dhtmlx.com
|
||||
Copyright UAB Dinamenta http://www.dhtmlx.com
|
||||
*/
|
||||
|
||||
dhtmlXEditor.prototype.attachToolbar = function(iconsPath) {
|
||||
|
||||
if (this.tb != null) return;
|
||||
|
||||
if (iconsPath != null) this.conf.iconsPath = iconsPath;
|
||||
|
||||
this.cell._stbHide();
|
||||
this.tb = this.cell.attachToolbar({
|
||||
icons_path: this.conf.iconsPath+"/dhxeditor_"+String(this.conf.skin).replace(/^dhx_/,"")+"/",
|
||||
skin: this.conf.skin
|
||||
});
|
||||
this.setSizes();
|
||||
|
||||
this._availFonts = new Array("Arial", "Arial Narrow", "Comic Sans MS", "Courier", "Georgia", "Impact", "Tahoma", "Times New Roman", "Verdana");
|
||||
this._initFont = this._availFonts[0];
|
||||
this._xmlFonts = "";
|
||||
for (var q=0; q<this._availFonts.length; q++) {
|
||||
var fnt = String(this._availFonts[q]).replace(/\s/g,"_");
|
||||
this._xmlFonts += '<item type="button" id="applyFontFamily:'+fnt+'"><itemText><![CDATA[<img src="'+this.tb.imagePath+'font_'+String(fnt).toLowerCase()+'.gif" border="0" style="/*margin-top:1px;margin-bottom:1px;*/width:110px;height:16px;">]]></itemText></item>';
|
||||
}
|
||||
//
|
||||
this._availSizes = {"1":"8pt", "2":"10pt", "3":"12pt", "4":"14pt", "5":"18pt", "6":"24pt", "7":"36pt"};
|
||||
this._xmlSizes = "";
|
||||
for (var a in this._availSizes) {
|
||||
this._xmlSizes += '<item type="button" id="applyFontSize:'+a+':'+this._availSizes[a]+'" text="'+this._availSizes[a]+'"/>';
|
||||
}
|
||||
this.tbXML = '<toolbar>'+
|
||||
// h1-h4
|
||||
'<item id="applyH1" type="buttonTwoState" img="h1.gif" imgdis="h4_dis.gif" title="H1"/>'+
|
||||
'<item id="applyH2" type="buttonTwoState" img="h2.gif" imgdis="h4_dis.gif" title="H2"/>'+
|
||||
'<item id="applyH3" type="buttonTwoState" img="h3.gif" imgdis="h4_dis.gif" title="H3"/>'+
|
||||
'<item id="applyH4" type="buttonTwoState" img="h4.gif" imgdis="h4_dis.gif" title="H4"/>'+
|
||||
'<item id="separ01" type="separator"/>'+
|
||||
// text
|
||||
'<item id="applyBold" type="buttonTwoState" img="bold.gif" imgdis="bold_dis.gif" title="Bold Text"/>'+
|
||||
'<item id="applyItalic" type="buttonTwoState" img="italic.gif" imgdis="italic_dis.gif" title="Italic Text"/>'+
|
||||
'<item id="applyUnderscore" type="buttonTwoState" img="underline.gif" imgdis="underline_dis.gif" title="Underscore Text"/>'+
|
||||
'<item id="applyStrikethrough" type="buttonTwoState" img="strike.gif" imgdis="strike_dis.gif" title="Strikethrough Text"/>'+
|
||||
'<item id="separ02" type="separator"/>'+
|
||||
// align
|
||||
'<item id="alignLeft" type="buttonTwoState" img="align_left.gif" imgdis="align_left_dis.gif" title="Left Alignment"/>'+
|
||||
'<item id="alignCenter" type="buttonTwoState" img="align_center.gif" imgdis="align_center_dis.gif" title="Center Alignment"/>'+
|
||||
'<item id="alignRight" type="buttonTwoState" img="align_right.gif" imgdis="align_right_dis.gif" title="Right Alignment"/>'+
|
||||
'<item id="alignJustify" type="buttonTwoState" img="align_justify.gif" title="Justified Alignment"/>'+
|
||||
'<item id="separ03" type="separator"/>'+
|
||||
// sub/super script
|
||||
'<item id="applySub" type="buttonTwoState" img="script_sub.gif" imgdis="script_sub.gif" title="Subscript"/>'+
|
||||
'<item id="applySuper" type="buttonTwoState" img="script_super.gif" imgdis="script_super_dis.gif" title="Superscript"/>'+
|
||||
'<item id="separ04" type="separator"/>'+
|
||||
// etc
|
||||
'<item id="createNumList" type="button" img="list_number.gif" imgdis="list_number_dis.gif" title="Number List"/>'+
|
||||
'<item id="createBulList" type="button" img="list_bullet.gif" imgdis="list_bullet_dis.gif" title="Bullet List"/>'+
|
||||
'<item id="separ05" type="separator"/>'+
|
||||
//
|
||||
'<item id="increaseIndent" type="button" img="indent_inc.gif" imgdis="indent_inc_dis.gif" title="Increase Indent"/>'+
|
||||
'<item id="decreaseIndent" type="button" img="indent_dec.gif" imgdis="indent_dec_dis.gif" title="Decrease Indent"/>'+
|
||||
'<item id="separ06" type="separator"/>'+
|
||||
'<item id="clearFormatting" type="button" img="clear.gif" title="Clear Formatting"/>'+
|
||||
'</toolbar>';
|
||||
|
||||
this.tb.loadStruct(this.tbXML);
|
||||
|
||||
this._checkAlign = function(alignSelected) {
|
||||
this.tb.setItemState("alignCenter", false);
|
||||
this.tb.setItemState("alignRight", false);
|
||||
this.tb.setItemState("alignJustify", false);
|
||||
this.tb.setItemState("alignLeft", false);
|
||||
if (alignSelected) this.tb.setItemState(alignSelected, true);
|
||||
}
|
||||
|
||||
this._checkH = function(h) {
|
||||
this.tb.setItemState("applyH1", false);
|
||||
this.tb.setItemState("applyH2", false);
|
||||
this.tb.setItemState("applyH3", false);
|
||||
this.tb.setItemState("applyH4", false);
|
||||
if (h) this.tb.setItemState(h, true);
|
||||
}
|
||||
|
||||
this._doOnFocusChanged = function(state) {
|
||||
/*bold*/
|
||||
if(!state.h1&&!state.h2&&!state.h3&&!state.h4){
|
||||
var bold = (String(state.fontWeight).search(/bold/i) != -1) || (Number(state.fontWeight) >= 700);
|
||||
this.tb.setItemState("applyBold", bold);
|
||||
} else this.tb.setItemState("applyBold", false);
|
||||
// align
|
||||
var alignId = "alignLeft";
|
||||
if (String(state.textAlign).search(/center/) != -1) { alignId = "alignCenter"; }
|
||||
if (String(state.textAlign).search(/right/) != -1) { alignId = "alignRight"; }
|
||||
if (String(state.textAlign).search(/justify/) != -1) { alignId = "alignJustify"; }
|
||||
this.tb.setItemState(alignId, true);
|
||||
this._checkAlign(alignId);
|
||||
/*heading*/
|
||||
this.tb.setItemState("applyH1", state.h1);
|
||||
this.tb.setItemState("applyH2", state.h2);
|
||||
this.tb.setItemState("applyH3", state.h3);
|
||||
this.tb.setItemState("applyH4", state.h4);
|
||||
if (window._KHTMLrv) {
|
||||
/*for Safari*/
|
||||
state.sub = (state.vAlign == "sub");
|
||||
state.sup = (state.vAlign == "super");
|
||||
}
|
||||
this.tb.setItemState("applyItalic", (state.fontStyle == "italic"));
|
||||
this.tb.setItemState("applyStrikethrough", state.del);
|
||||
this.tb.setItemState("applySub", state.sub);
|
||||
this.tb.setItemState("applySuper", state.sup);
|
||||
this.tb.setItemState("applyUnderscore", state.u);
|
||||
}
|
||||
|
||||
this._doOnToolbarClick = function(id) {
|
||||
var action = String(id).split(":");
|
||||
if (this[action[0]] != null) {
|
||||
if (typeof(this[action[0]]) == "function") {
|
||||
this[action[0]](action[1]);
|
||||
this.callEvent("onToolbarClick",[id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this._doOnStateChange = function(itemId, state) {
|
||||
this[itemId]();
|
||||
switch (itemId) {
|
||||
case "alignLeft":
|
||||
case "alignCenter":
|
||||
case "alignRight":
|
||||
case "alignJustify":
|
||||
this._checkAlign(itemId);
|
||||
break;
|
||||
case "applyH1":
|
||||
case "applyH2":
|
||||
case "applyH3":
|
||||
case "applyH4":
|
||||
this._checkH(itemId);
|
||||
break;
|
||||
}
|
||||
this.callEvent("onToolbarClick",[itemId]);
|
||||
}
|
||||
this._doOnBeforeStateChange = function(itemId, state) {
|
||||
if ((itemId == "alignLeft" || itemId == "alignCenter" || itemId == "alignRight" || itemId == "alignJustify") && state == true) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
var that = this;
|
||||
|
||||
this.tb.attachEvent("onClick", function(id){that._doOnToolbarClick(id);});
|
||||
this.tb.attachEvent("onStateChange", function(id,st){that._doOnStateChange(id,st);});
|
||||
this.tb.attachEvent("onBeforeStateChange", function(id,st){return that._doOnBeforeStateChange(id,st);});
|
||||
|
||||
this.applyBold = function(){
|
||||
this._runCommand("Bold");
|
||||
}
|
||||
|
||||
this.applyItalic = function(){
|
||||
this._runCommand("Italic");
|
||||
}
|
||||
|
||||
this.applyUnderscore = function(){
|
||||
this._runCommand("Underline");
|
||||
}
|
||||
|
||||
this.applyStrikethrough = function(){
|
||||
this._runCommand("StrikeThrough");
|
||||
}
|
||||
|
||||
this.alignLeft = function(){
|
||||
this._runCommand("JustifyLeft");
|
||||
}
|
||||
|
||||
this.alignRight = function(){
|
||||
this._runCommand("JustifyRight");
|
||||
}
|
||||
|
||||
this.alignCenter = function(){
|
||||
this._runCommand("JustifyCenter");
|
||||
}
|
||||
|
||||
this.alignJustify = function(){
|
||||
this._runCommand("JustifyFull");
|
||||
}
|
||||
|
||||
this.applySub = function(){
|
||||
this._runCommand("Subscript");
|
||||
}
|
||||
|
||||
this.applySuper = function(){
|
||||
this._runCommand("Superscript");
|
||||
}
|
||||
|
||||
this.applyH1 = function(){
|
||||
this._runCommand("FormatBlock","<H1>");
|
||||
}
|
||||
|
||||
this.applyH2 = function(){
|
||||
this._runCommand("FormatBlock","<H2>");
|
||||
}
|
||||
|
||||
this.applyH3 = function(){
|
||||
this._runCommand("FormatBlock","<H3>");
|
||||
}
|
||||
|
||||
this.applyH4 = function(){
|
||||
this._runCommand("FormatBlock","<H4>");
|
||||
}
|
||||
|
||||
this.createNumList = function(){
|
||||
this._runCommand("InsertOrderedList");
|
||||
}
|
||||
|
||||
this.createBulList = function(){
|
||||
this._runCommand("InsertUnorderedList");
|
||||
}
|
||||
|
||||
this.increaseIndent = function(){
|
||||
this._runCommand("Indent");
|
||||
}
|
||||
|
||||
this.decreaseIndent = function(){
|
||||
this._runCommand("Outdent");
|
||||
}
|
||||
this.clearFormatting = function() {
|
||||
this._runCommand("RemoveFormat");
|
||||
this.tb.setItemState("applyBold", false);
|
||||
this.tb.setItemState("applyItalic", false);
|
||||
this.tb.setItemState("applyStrikethrough", false);
|
||||
this.tb.setItemState("applySub", false);
|
||||
this.tb.setItemState("applySuper", false);
|
||||
this.tb.setItemState("applyUnderscore", false);
|
||||
}
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user