/*!@license
* Infragistics.Web.ClientUI HTML Editor localization resources 0.0.1
*
* Copyright (c) 2011-2022 Infragistics Inc.
*
* http://www.infragistics.com/
*
*/
(function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else{return factory(jQuery)}})(function($){$.ig=$.ig||{};$.ig.locale=$.ig.locale||{};$.ig.locale.en=$.ig.locale.en||{};$.ig.HtmlEditor=$.ig.HtmlEditor||{};$.ig.locale.en.HtmlEditor={boldButtonTitle:"Bold",italicButtonTitle:"Italic",underlineButtonTitle:"Underline",strikethroughButtonTitle:"Strikethrough",increaseFontSizeButtonTitle:"Increase Font Size",decreaseFontSizeButtonTitle:"Decrease Font Size",alignTextLeftButtonTitle:"Align Text Left",alignTextRightButtonTitle:"Align Text Right",alignTextCenterButtonTitle:"Center",justifyButtonTitle:"Justify",bulletsButtonTitle:"Bullets",numberingButtonTitle:"Numbering",decreaseIndentButtonTitle:"Decrease Indent",increaseIndentButtonTitle:"Increase Indent",insertPictureButtonTitle:"Insert Picture",fontColorButtonTitle:"Font Color",textHighlightButtonTitle:"Text Highlight Color",insertLinkButtonTitle:"Insert Hyperlink",insertTableButtonTitle:"Table",addRowButtonTitle:"Add Row",removeRowButtonTitle:"Remove Row",addColumnButtonTitle:"Add Column",removeColumnButtonTitle:"Remove Column",inserHRButtonTitle:"Insert Horizontal Rule",viewSourceButtonTitle:"View Source",cutButtonTitle:"Cut",copyButtonTitle:"Copy",pasteButtonTitle:"Paste",undoButtonTitle:"Undo",redoButtonTitle:"Redo",imageUrlDialogText:"Image URL:",imageAlternativeTextDialogText:"Alternative Text:",imageWidthDialogText:"Image Width:",imageHeihgtDialogText:"Image Height:",linkNavigateToUrlDialogText:"Navigate to URL:",linkDisplayTextDialogText:"Display Text:",linkOpenInDialogText:"Open In:",linkTargetNewWindowDialogText:"New Window",linkTargetSameWindowDialogText:"Same Window",linkTargetParentWindowDialogText:"Parent Window",linkTargetTopmostWindowDialogText:"Topmost Window",applyButtonTitle:"Apply",cancelButtonTitle:"Cancel",textToolbar:"text manipulation toolbar",formattingToolbar:"text formatting toolbar",insertObjectToolbar:"objects insertion toolbar",copyPasteToolbar:"copy/paste toolbar",fontNames:{win:[{text:"Times New Roman",value:"Times New Roman"},{text:"Arial",value:"Arial"},{text:"Arial Black",value:"Arial Black"},{text:"Helvetica",value:"Helvetica"},{text:"Comic Sans MS",value:"Comic Sans MS"},{text:"Courier New",value:"Courier New"},{text:"Georgia",value:"Georgia"},{text:"Impact",value:"Impact"},{text:"Lucida Console",value:"Lucida Console"},{text:"Lucida Sans Unicode",value:"Lucida Sans Unicode"},{text:"Palatino Linotype",value:"Palatino Linotype"},{text:"Tahoma",value:"Tahoma"},{text:"Trebuchet MS",value:"Trebuchet MS"},{text:"Verdana",value:"Verdana"},{text:"Symbol",value:"Symbol"},{text:"Webdings",value:"Webdings"},{text:"Wingdings",value:"Wingdings"},{text:"MS Sans Serif",value:"MS Sans Serif"},{text:"MS Serif",value:"MS Serif"}],mac:[{text:"Times New Roman",value:"Times New Roman"},{text:"Arial",value:"Arial"},{text:"Arial Black",value:"Arial Black"},{text:"Helvetica",value:"Helvetica"},{text:"Comic Sans MS",value:"Comic Sans MS"},{text:"Courier New",value:"Courier New"},{text:"Georgia",value:"Georgia"},{text:"Impact",value:"Impact"},{text:"Monaco",value:"Monaco"},{text:"Lucida Grande",value:"Lucida Grande"},{text:"Book Antiqua",value:"Book Antiqua"},{text:"Geneva",value:"Geneva"},{text:"Trebuchet MS",value:"Trebuchet"},{text:"Verdana",value:"Verdana"},{text:"Symbol",value:"Symbol"},{text:"Webdings",value:"Webdings"},{text:"Zapf Dingbats",value:"Zapf Dingbats"},{text:"New York",value:"New York"}]},fontSizes:[{text:"1",value:"7.5 pt"},{text:"2",value:"10 pt"},{text:"3",value:"12 pt"},{text:"4",value:"13.5 pt"},{text:"5",value:"18 pt"},{text:"6",value:"24 pt"},{text:"7",value:"36 pt"}],formatsList:[{text:"h1",value:"Heading 1"},{text:"h2",value:"Heading 2"},{text:"h3",value:"Heading 3"},{text:"h4",value:"Heading 4"},{text:"h5",value:"Heading 5"},{text:"h6",value:"Heading 6"},{text:"p",value:"Normal"}]};$.ig.HtmlEditor.locale=$.ig.HtmlEditor.locale||$.ig.locale.en.HtmlEditor;return $.ig.locale.en.HtmlEditor});/*!@license
 * Infragistics.Web.ClientUI HtmlEditor 0.0.1
 *
 * Copyright (c) 2011-2022 Infragistics Inc.
 * <Licensing info>
 *
 * http://www.infragistics.com/
 *
 * Depends on:
 *   jquery.js
 *   jquery.ui.core.js
 *   jquery.ui.widget.js
 *	 infragistics.util.js
 *   infragistics.util.jquery.js
 *   infragistics.ui.widget.js
 *   infragistics.ui.toolbarbutton.js
 *   infragistics.ui.toolbar.js
 *   infragistics.ui.popover.js
 *   infragistics.ui.splitbutton.js
 *   infragistics.ui.colorpicker.js
 *   infragistics.ui.colorpickersplitbutton.js
 *   infragistics.ui.combo.js
 *   infragistics.ui.htmleditor-en.js
 *   infragistics.ui.toolbar-en.js
 */
"use strict";(function(factory){if(typeof define==="function"&&define.amd){define(["./infragistics.ui.widget","./infragistics.ui.popover","./infragistics.ui.splitbutton","./infragistics.ui.colorpicker","./infragistics.ui.colorpickersplitbutton","./infragistics.ui.combo","./infragistics.ui.editors","./infragistics.ui.toolbarbutton","./infragistics.ui.toolbar"],factory)}else{return factory(jQuery)}})(function($){$.widget("ui.igHtmlEditor",$.ui.igWidget,{options:{showFormattingToolbar:true,showTextToolbar:true,showInsertObjectToolbar:true,showCopyPasteToolbar:true,width:725,height:350,toolbarSettings:[],customToolbars:[],inputName:"source",value:""},events:{rendered:"rendered",rendering:"rendering",actionExecuting:"actionExecuting",actionExecuted:"actionExecuted",toolbarCollapsing:"toolbarCollapsing",toolbarCollapsed:"toolbarCollapsed",toolbarExpanding:"toolbarExpanding",toolbarExpanded:"toolbarExpanded",cut:"cut",copy:"copy",paste:"paste",undo:"undo",redo:"redo",workspaceResized:"workspaceResized"},css:{htmlEditor:"ui-widget ui-widget-content ui-corner-all ui-ightmleditor ui-helper-clearfix",htmlEditorContent:"ui-ightmleditor-content",toolbarsContainer:"ui-igtoolbars-holder",pathFinder:"ui-igPathFinder",workspaceIframe:"ui-widget-content"},NODE:new $.ig.XmlNodeType,_toolbarsActiveState:{},_isDirty:false,_initDefaultToolbars:function(){this.defaultToolbars=[{name:"textToolbar",displayName:this._getLocaleValue("textToolbar"),isExpanded:true,language:this.options.language,allowCollapsing:true,collapseButtonIcon:"ui-igbutton-collapse",expandButtonIcon:"ui-igbutton-expand",items:[{name:"Bold",type:"button",scope:null,localeProperties:{"data-localeid":"boldButtonTitle","data-localeattr":"title"},props:{allowToggling:{value:true},isBold:{value:false,action:"_isSelectedAction"},boldButtonTooltip:{value:this._getLocaleValue("boldButtonTitle"),action:"_tooltipAction"},boldButtonIcon:{value:"ui-igbutton-bold",action:"_buttonIconAction"}}},{name:"Italic",type:"button",language:this.options.language,localeProperties:{"data-localeid":"italicButtonTitle","data-localeattr":"title"},props:{isItalic:{value:false,action:"_isSelectedAction"},italicButtonTooltip:{value:this._getLocaleValue("italicButtonTitle"),action:"_tooltipAction"},italicButtonIcon:{value:"ui-igbutton-italic",action:"_buttonIconAction"}}},{name:"Underline",type:"button",language:this.options.language,localeProperties:{"data-localeid":"underlineButtonTitle","data-localeattr":"title"},props:{isUnderline:{value:false,action:"_isSelectedAction"},underlineButtonTooltip:{value:this._getLocaleValue("underlineButtonTitle"),action:"_tooltipAction"},underlineButtonIcon:{value:"ui-igbutton-underline",action:"_buttonIconAction"}}},{name:"Strikethrough",type:"button",language:this.options.language,localeProperties:{"data-localeid":"strikethroughButtonTitle","data-localeattr":"title"},props:{isStrikethrough:{value:false,action:"_isSelectedAction"},strikethroughButtonTooltip:{value:this._getLocaleValue("strikethroughButtonTitle"),action:"_tooltipAction"},strikethroughButtonIcon:{value:"ui-igbutton-strikethrough",action:"_buttonIconAction"}}},{name:"fontFamily",type:"combo",language:this.options.language,scope:null,handler:"_fontNamePlg",props:{fontFamilyComboWidth:{value:180,action:"_comboWidthAction"},fontFamilyComboHeight:{value:"",action:"_comboHeightAction"},fontFamilies:{value:this._getFontFamilies(),action:"_comboDataSourceAction"},selectedFontFamily:{value:"Times New Roman",action:"_comboSelectedItem"}}},{type:"combo",name:"fontSize",language:this.options.language,scope:null,handler:"_fontSizePlg",props:{fontSizeComboWidth:{value:75,action:"_comboWidthAction"},fontSizeComboHeight:{value:"",action:"_comboHeightAction"},fontSizes:{value:this._getLocaleValue("fontSizes"),action:"_comboDataSourceAction"},selectedFontSize:{value:"3",action:"_comboSelectedItem"},fontSizeItemsListWidth:{value:100,action:"_comboDropDownListWidth"}}},{type:"combo",name:"formatsList",language:this.options.language,scope:null,handler:"_formatsListPlg",props:{formatsListComboWidth:{value:170,action:"_comboWidthAction"},formatsListComboHeight:{value:"",action:"_comboHeightAction"},formatsList:{value:this._getLocaleValue("formatsList"),action:"_comboDataSourceAction"},selectedFormat:{value:"p",action:"_comboSelectedItem"}}}]},{name:"formattingToolbar",displayName:this._getLocaleValue("formattingToolbar"),isExpanded:true,language:this.options.language,allowCollapsing:true,collapseButtonIcon:"ui-igbutton-collapse",expandButtonIcon:"ui-igbutton-expand",items:[{name:"justifyleft",type:"button",localeProperties:{"data-localeid":"alignTextLeftButtonTitle","data-localeattr":"title"},props:{isJustifyLeft:{value:true,action:"_isSelectedAction"},justifyLeftButtonTooltip:{value:this._getLocaleValue("alignTextLeftButtonTitle"),action:"_tooltipAction"},justifyLeftButtonIcon:{value:"ui-igbutton-justifyleft",action:"_buttonIconAction"}}},{name:"justifycenter",type:"button",localeProperties:{"data-localeid":"alignTextCenterButtonTitle","data-localeattr":"title"},props:{isJustifyCenter:{value:false,action:"_isSelectedAction"},justifyCenterButtonTooltip:{value:this._getLocaleValue("alignTextCenterButtonTitle"),action:"_tooltipAction"},justifyCenterButtonIcon:{value:"ui-igbutton-justifycenter",action:"_buttonIconAction"}}},{name:"justifyright",type:"button",localeProperties:{"data-localeid":"alignTextRightButtonTitle","data-localeattr":"title"},props:{isJustifyRight:{value:false,action:"_isSelectedAction"},justifyRightButtonTooltip:{value:this._getLocaleValue("alignTextRightButtonTitle"),action:"_tooltipAction"},justifyRightButtonIcon:{value:"ui-igbutton-justifyright",action:"_buttonIconAction"}}},{name:"justifyfull",type:"button",localeProperties:{"data-localeid":"justifyButtonTitle","data-localeattr":"title"},props:{isJustifyFull:{value:false,action:"_isSelectedAction"},justifyFullButtonTooltip:{value:this._getLocaleValue("justifyButtonTitle"),action:"_tooltipAction"},justifyFullButtonIcon:{value:"ui-igbutton-justifyfull",action:"_buttonIconAction"}}},{name:"InsertUnorderedList",type:"button",localeProperties:{"data-localeid":"bulletsButtonTitle","data-localeattr":"title"},props:{isUnorderedList:{value:false,action:"_isSelectedAction"},insertUnorderedListTooltip:{value:this._getLocaleValue("bulletsButtonTitle"),action:"_tooltipAction"},insertUnorderedListButtonIcon:{value:"ui-igbutton-unorderedlist",action:"_buttonIconAction"}}},{name:"InsertOrderedList",type:"button",localeProperties:{"data-localeid":"numberingButtonTitle","data-localeattr":"title"},props:{isOrderedList:{value:false,action:"_isSelectedAction"},insertOrderedListTooltip:{value:this._getLocaleValue("numberingButtonTitle"),action:"_tooltipAction"},insertOrderedListButtonIcon:{value:"ui-igbutton-orderedlist",action:"_buttonIconAction"}}},{name:"outdent",type:"button",localeProperties:{"data-localeid":"decreaseIndentButtonTitle","data-localeattr":"title"},props:{outdentButtonTooltip:{value:this._getLocaleValue("decreaseIndentButtonTitle"),action:"_tooltipAction"},outdentButtonIcon:{value:"ui-igbutton-removeindent",action:"_buttonIconAction"}}},{name:"indent",type:"button",localeProperties:{"data-localeid":"increaseIndentButtonTitle","data-localeattr":"title"},props:{indentTooltip:{value:this._getLocaleValue("increaseIndentButtonTitle"),action:"_tooltipAction"},indentButtonIcon:{value:"ui-igbutton-indent",action:"_buttonIconAction"}}},{name:"textColor",type:"splitButtonColor",handler:"_fontColorPlg",localeProperties:{"data-localeid":"fontColorButtonTitle","data-localeattr":"title",title:this._getLocaleValue("fontColorButtonTitle")},props:{items:{value:[{name:"textColor",iconClass:"ui-igbutton-forecolor"}]},defaultItemName:{value:"textColor"},selectedTextColor:{value:"red",action:"_spltButtonColorAction"}}},{name:"backgroundTextColor",type:"splitButtonColor",handler:"_fontBackgroundColorPlg",localeProperties:{"data-localeid":"textHighlightButtonTitle","data-localeattr":"title",title:this._getLocaleValue("textHighlightButtonTitle")},props:{items:{value:[{name:"backgroundTextColor",iconClass:"ui-igbutton-backcolor"}]},defaultItemName:{value:"backgroundTextColor"},selectedTextBackgroundColor:{value:"",action:"_spltButtonColorAction"}}}]},{name:"insertObjectToolbar",displayName:this._getLocaleValue("insertObjectToolbar"),isExpanded:true,language:this.options.language,allowCollapsing:true,collapseButtonIcon:"ui-igbutton-collapse",expandButtonIcon:"ui-igbutton-expand",items:[{name:"image",type:"button",localeProperties:{"data-localeid":"insertPictureButtonTitle","data-localeattr":"title"},handler:"_insertImageDialogPlg",props:{isImage:{value:false,action:"_isSelectedAction"},imageButtonTooltip:{value:this._getLocaleValue("insertPictureButtonTitle"),action:"_tooltipAction"},imageButtonIcon:{value:"ui-igbutton-addimage",action:"_buttonIconAction"}}},{name:"link",type:"button",handler:"_insertLinkPlg",localeProperties:{"data-localeid":"insertLinkButtonTitle","data-localeattr":"title"},props:{isLink:{value:false,action:"_isSelectedAction"},linkButtonTooltip:{value:this._getLocaleValue("insertLinkButtonTitle"),action:"_tooltipAction"},linkButtonIcon:{value:"ui-igbutton-addlink",action:"_buttonIconAction"}}},{name:"table",type:"button",handler:"_insertTablePlg",localeProperties:{"data-localeid":"insertTableButtonTitle","data-localeattr":"title"},props:{isTable:{value:false,action:"_isSelectedAction"},tableButtonTooltip:{value:this._getLocaleValue("insertTableButtonTitle"),action:"_tooltipAction"},tableButtonIcon:{value:"ui-igbutton-table",action:"_buttonIconAction"}}},{name:"addRow",type:"button",handler:"_addTableRowPlg",localeProperties:{"data-localeid":"addRowButtonTitle","data-localeattr":"title"},props:{allowToggling:{value:false},isAddRow:{value:false,action:"_isSelectedAction"},addRowButtonTooltip:{value:this._getLocaleValue("addRowButtonTitle"),action:"_tooltipAction"},addRowButtonIcon:{value:"ui-igbutton-addrow",action:"_buttonIconAction"}}},{name:"addColumn",type:"button",handler:"_addTableColumnPlg",localeProperties:{"data-localeid":"addColumnButtonTitle","data-localeattr":"title"},props:{allowToggling:{value:false},isAddColumn:{value:false,action:"_isSelectedAction"},addColumnButtonTooltip:{value:this._getLocaleValue("addColumnButtonTitle"),action:"_tooltipAction"},addColumnButtonIcon:{value:"ui-igbutton-addcolumn",action:"_buttonIconAction"}}},{name:"removeRow",type:"button",handler:"_removeTableRowPlg",localeProperties:{"data-localeid":"removeRowButtonTitle","data-localeattr":"title"},props:{allowToggling:{value:false},isRemoveRow:{value:false,action:"_isSelectedAction"},removeRowButtonTooltip:{value:this._getLocaleValue("removeRowButtonTitle"),action:"_tooltipAction"},removeRowButtonIcon:{value:"ui-igbutton-removerow",action:"_buttonIconAction"}}},{name:"removeColumn",type:"button",handler:"_removeTableColumnPlg",localeProperties:{"data-localeid":"removeColumnButtonTitle","data-localeattr":"title"},props:{allowToggling:{value:false},isRemoveColumn:{value:false,action:"_isSelectedAction"},removeColumnButtonTooltip:{value:this._getLocaleValue("removeColumnButtonTitle"),action:"_tooltipAction"},removeColumnButtonIcon:{value:"ui-igbutton-removecolumn",action:"_buttonIconAction"}}}]},{name:"copyPasteToolbar",displayName:this._getLocaleValue("copyPasteToolbar"),isExpanded:true,language:this.options.language,allowCollapsing:true,collapseButtonIcon:"ui-igbutton-collapse",expandButtonIcon:"ui-igbutton-expand",items:[{name:"copy",type:"button",scope:null,localeProperties:{"data-localeid":"copyButtonTitle","data-localeattr":"title"},props:{isCopy:{value:false,action:"_isSelectedAction"},copyButtonTooltip:{value:this._getLocaleValue("copyButtonTitle"),action:"_tooltipAction"},copyButtonIcon:{value:"ui-igbutton-copy",action:"_buttonIconAction"}}},{name:"cut",type:"button",scope:null,localeProperties:{"data-localeid":"cutButtonTitle","data-localeattr":"title"},props:{isCut:{value:false,action:"_isSelectedAction"},cutButtonTooltip:{value:this._getLocaleValue("cutButtonTitle"),action:"_tooltipAction"},cutButtonIcon:{value:"ui-igbutton-cut",action:"_buttonIconAction"}}},{name:"paste",type:"button",scope:null,localeProperties:{"data-localeid":"pasteButtonTitle","data-localeattr":"title"},props:{isPaste:{value:false,action:"_isSelectedAction"},pasteButtonTooltip:{value:this._getLocaleValue("pasteButtonTitle"),action:"_tooltipAction"},pasteButtonIcon:{value:"ui-igbutton-paste",action:"_buttonIconAction"}}},{name:"undo",type:"button",scope:null,localeProperties:{"data-localeid":"undoButtonTitle","data-localeattr":"title"},props:{allowToggling:{value:false},isUndo:{value:false,action:"_isSelectedAction"},undoButtonTooltip:{value:this._getLocaleValue("undoButtonTitle"),action:"_tooltipAction"},undoButtonIcon:{value:"ui-igbutton-undo",action:"_buttonIconAction"}}},{name:"redo",type:"button",scope:null,localeProperties:{"data-localeid":"redoButtonTitle","data-localeattr":"title"},props:{allowToggling:{value:false},isRedo:{value:false,action:"_isSelectedAction"},redoButtonTooltip:{value:this._getLocaleValue("redoButtonTitle"),action:"_tooltipAction"},redoButtonIcon:{value:"ui-igbutton-redo",action:"_buttonIconAction"}}}]}]},_createWidget:function(){this._superApply(arguments)},_id:function(id){return this.element[0].id+id},widget:function(){return this.element},_render:function(){var html="",inputName=this.options.inputName;this.element.addClass(this.css.htmlEditor);html+='<div id="'+this._id("_toolbars")+'" class="'+this.css.toolbarsContainer+'"></div>';html+='<div id="'+this._id("_content")+'" class="'+this.css.htmlEditorContent+'">';html+='<iframe class="'+this.css.workspaceIframe+'" id="'+this._id("_editor")+'"></iframe>';html+='<textarea name="'+inputName+'" id="'+this._id("_source")+'"></textarea>';html+="</div>";$(html).appendTo(this.element);$("#"+this._id("_source")).hide();this.element.height(this.options.height);this.element.width(this.options.width)},_createWorkspace:function(content){var iFrameContent="<"+"!"+"DOCTYPE html"+">"+"<html>"+"<head>"+"<title>igHtmlEditor</title>"+"</head>"+'<body contentEditable="true" spellcheck="false" style="-webkit-tap-highlight-color: rgba(255, 255, 255, 0);">'+"<p>";if(!document.all){iFrameContent+="<br />"}iFrameContent+="</p></body></html>";this.workspace=this.element.find("#"+this._id("_editor"))[0];this.workspace.contentWindow.document.open("text/html","replace");this.workspace.contentWindow.document.write(iFrameContent);this.workspace.contentWindow.document.close();if(content&&content.length>0){$(this.workspace).contents().find("body").html(content)}if($.ig.util.isWebKit){this.workspace.contentWindow.document.body.contentEditable=true}if(!document.all){var showUI=false,comandValue=true;this.workspace.contentWindow.document.execCommand("styleWithCSS",showUI,comandValue)}},_getToolbar:function(index){if(!isNaN(parseInt(index,10))){return this._toolbars.eq(index)}if(typeof index==="string"){return this._toolbars.find("#"+this._id("_toolbars_"+index))}},_getToolbarSettings:function(name){var curToolbar,result,i;for(i=0;i<this._allToolbars.length&&!result;i++){curToolbar=this._allToolbars[i];if(curToolbar.name===name){result=curToolbar}}return result},_getFirefoxVersion:function(){if($.ig.util.isFF){return parseInt(window.navigator.userAgent.match(/\bFirefox\/[ 0-9\. ]+\b/)[0].split("/").reverse()[0],10)}},_create:function(){this._allToolbars=[];this._initDefaultToolbars();var noCancel=this._trigger(this.events.rendering,null,{owner:this}),content=this.options.value||this.element.html();this.element.empty();if(noCancel){this._render();this._initToolbars();this._createWorkspace(content);this._domPathToolbar();this.resizeWorkspace();this._trigger(this.events.rendered,null,{owner:this})}},_resizeWorkspaceHandler:function(){var args={owner:this};this.resizeWorkspace();return this._trigger(this.events.workspaceResized,null,args)},_init:function(){this._comboHeight=24;this._bindToToolbarEvents();this._bindWorkspaceEvents();this.sourceWindow=this.element.find("#"+this._id("_source"));this._initFontsCombos();this._initFormatsListCombo();this._initFontSizeCombo();this._analyser=new $.ig.ToolbarHelper(this.workspace.contentWindow,this._toolbars.children());var self=this;this._onSelectionChange(function(){self._initialWorkspaceFormatting()})},_initFontsCombos:function(){var textToolbar=this._getToolbar("textToolbar"),fontFamiliesCombo=textToolbar.igToolbar("getItem","fontFamily").addClass("ui-combo-fontfamily");fontFamiliesCombo.igCombo("option",{language:this.options.language,itemTemplate:'<span style="font-family: ${value}" unselectable="on">${text}</span>',height:this._comboHeight,dropDownOrientation:"bottom"})},_initFormatsListCombo:function(){var formatsListCombo=this._getToolbar("textToolbar").igToolbar("getItem","formatsList");formatsListCombo.igCombo("option",{language:this.options.language,itemTemplate:'<${text} unselectable="on">${value}</${text}>',height:this._comboHeight,dropDownOrientation:"bottom"})},_initFontSizeCombo:function(){var fontSizesCombo=this._getToolbar("textToolbar").igToolbar("getItem","fontSize");fontSizesCombo.igCombo("option",{language:this.options.language,itemTemplate:'<span unselectable="on">${value}</span>',height:this._comboHeight,dropDownOrientation:"bottom"})},_getFontFamilies:function(){return this._getLocaleValue("fontNames")[/^win/gi.test(navigator.platform)?"win":"mac"]},_setOption:function(name,value){var self=this;if(name===undefined||value===undefined){return}if(name==="toolbarSettings"){$.each(value,function(index,toolbar){$.each(toolbar,function(tbPropName,tbPropVal){if(tbPropName!=="name"){self._getToolbar(self._allToolbars[index].name).igToolbar("option",tbPropName,tbPropVal)}})})}else if(this._toolbarsActiveState[name]){this._showToolbar(this._toolbarsActiveState[name].name,value)}else if(name==="width"){this.element.width(value)}else if(name==="height"){this.element.height(value);this.resizeWorkspace()}else if(name==="value"){this.setContent(value,"text")}this._super(name,value)},_changeLocaleForToolbars:function(){this._allToolbars.forEach(function(toolbar){this._getToolbar(toolbar.name).igToolbar("option",{displayName:this._getLocaleValue(toolbar.name),language:this.options.language})},this)},changeLocale:function(){this._superApply(arguments);this._changeLocaleForToolbars();if(this._insertLinkDialog){this._insertLinkDialog.remove();this._insertLinkDialog=null}if(this._imageDialog){this._imageDialog.remove();this._imageDialog=null}this._changeLocaleForFontFamilies();this._changeLocaleForFontSizes();this._changeLocaleForFormatsList()},_changeLocaleForFontFamilies:function(){var selectedValue,$combo=this._getToolbar("textToolbar").igToolbar("getItem","fontFamily"),comboInstance=$combo.data("igCombo");if(comboInstance){selectedValue=comboInstance.value();comboInstance._setOption("dataSource",this._getFontFamilies());comboInstance._setOption("language",this.options.language);comboInstance.value(selectedValue)}},_changeLocaleForFontSizes:function(){var selectedValue,$combo=this._getToolbar("textToolbar").igToolbar("getItem","fontSize"),comboInstance=$combo.data("igCombo");if(comboInstance){selectedValue=comboInstance.value();comboInstance._setOption("dataSource",this._getLocaleValue("fontSizes"));comboInstance._setOption("language",this.options.language);comboInstance.value(selectedValue)}},_changeLocaleForFormatsList:function(){var selectedValue,$combo=this._getToolbar("textToolbar").igToolbar("getItem","formatsList"),comboInstance=$combo.data("igCombo");if(comboInstance){selectedValue=comboInstance.value();comboInstance._setOption("dataSource",this._getLocaleValue("formatsList"));comboInstance._setOption("language",this.options.language);comboInstance.value(selectedValue)}},_showToolbar:function(name,show){if(show){this._getToolbar(name).removeClass("hidden").show()}else{this._getToolbar(name).addClass("hidden").hide()}},_initToolbars:function(){this._allToolbars=$.extend(true,[],this.defaultToolbars.concat(this.options.customToolbars));this._toolbars=this.element.find("#"+this._id("_toolbars"));this._mergeToolbarSettings();this._createToolbars()},_mergeToolbarSettings:function(){var customSettings=this.options.toolbarSettings,curSettings,curCustomSettings,curName,items,curItem,curItemProps,propFound,property,i,j;for(i=0;i<customSettings.length;i++){curCustomSettings=customSettings[i];curName=curCustomSettings.name;if(typeof curName==="string"){curSettings=this._getToolbarSettings(curName);if(curSettings){for(property in curCustomSettings){if(property!=="name"){propFound=false;if(curSettings.hasOwnProperty(property)){curSettings[property]=curCustomSettings[property]}else{items=curSettings.items;for(j=0;j<items.length&&!propFound;j++){curItem=items[j];curItemProps=curItem.props;if(curItemProps.hasOwnProperty(property)){curItemProps[property].value=curCustomSettings[property];propFound=true}}}}}}}}},_createToolbars:function(){var options=this.options,curSettings,curName,showToolbarOption,showToolbar,i;this._toolbars=this.element.find("#"+this._id("_toolbars"));for(i=0;i<this._allToolbars.length;i++){curSettings=this._allToolbars[i];curName=curSettings.name;showToolbarOption=$.camelCase("show-"+curName);showToolbar=true;$("<span>").attr("id",this._id("_toolbars")+"_"+curName).appendTo(this._toolbars).igToolbar(curSettings);if(options[showToolbarOption]!==undefined){showToolbar=options[showToolbarOption]}this._toolbarsActiveState[showToolbarOption]={name:curName,value:showToolbar};this._showToolbar(curName,showToolbar)}if($.ig.util.isIE){this._toolbars.find("*").attr("unselectable","on")}},_initialWorkspaceFormatting:function(){var i,curSettings,property,command,args,toolbarSettings=this.options.toolbarSettings,commands={isBold:"bold",isItalic:"italic",isUnderline:"underline",isStrikethrough:"strikethrough",isJustifyLeft:"justifyleft",isJustifyRight:"justifyright",isJustifyCenter:"justifycenter",isJustifyFull:"justifyfull",isUnorderedList:"InsertUnorderedList",isOrderedList:"InsertOrderedList"},argsCommands={selectedFontFamily:"fontName",selectedFontSize:"fontSize",selectedFormat:"formatBlock",selectedTextColor:"forecolor",selectedTextBackgroundColor:"backcolor"};for(i=0;i<toolbarSettings.length;i++){curSettings=toolbarSettings[i];for(property in curSettings){if(curSettings.hasOwnProperty(property)){if(commands.hasOwnProperty(property)){command=commands[property]}else if(argsCommands.hasOwnProperty(property)){command=argsCommands[property];args=curSettings[property]}else{command=null}if(command){if(command===argsCommands.selectedFormat){args="<"+args+">"}this._initialSelectionSetup();this._execCommand(command,args);this._emptyAndCollapseSelection()}}}}},_initialSelectionSetup:function(){var lastNode=$(this.contentDocument()).find(":not(br)").last(),sel=this._selectionWrapperSaved._getSelection(),range=this._selectionWrapperSaved._getRange();lastNode.html("&nbsp;");range.selectNode(lastNode[0]);sel.removeAllRanges();sel.addRange(range)},_emptyAndCollapseSelection:function(){var lastNode=$(this.contentDocument()).find(":not(br)").last(),sel=this._selectionWrapperSaved._getSelection(),range=this._selectionWrapperSaved._getRange();lastNode.html("<br>");if(lastNode.length>0){range.setStart(lastNode[0],0);range.setEnd(lastNode[0],0);range.collapse(true);sel.removeAllRanges();sel.addRange(range)}},_execCommand:function(name,args){this._selectionWrapperSaved.focus();if($.ig.util.isIE){this._selectionWrapperSaved._updateSelection(this._selectionWrapperSaved._getRange())}this._selectionWrapperSaved.execCommand(name.toLowerCase(),args);this._onSelectionChange()},_hideDialogs:function(){this.element.find(":ui-igLinkPropertiesDialog").igLinkPropertiesDialog("hide");this.element.find(":ui-igTablePropertiesDialog").igTablePropertiesDialog("hide");this.element.find(":ui-igImagePropertiesDialog").igImagePropertiesDialog("hide")},_bindToToolbarEvents:function(){var self=this,events="igtoolbartoolbarbuttonclick igtoolbartoolbarcomboselected "+"igtoolbartoolbarcustomitemclick igtoolbarcollapsing "+"igtoolbarcollapsed igtoolbarexpanding igtoolbarexpanded",splitBtnArrowSelector=".ui-splitbutton-arrow",toolbarEvents={igtoolbarcollapsing:this.events.toolbarCollapsing,igtoolbarcollapsed:this.events.toolbarCollapsed,igtoolbarexpanding:this.events.toolbarExpanding,igtoolbarexpanded:this.events.toolbarExpanded};this._toolbars.delegate(":ui-igToolbar",events,function _onToolbarItemClick(e,ui){var scope=ui.scope,handler=ui.handler,$eTarget=$(e.originalEvent.currentTarget),noCancel;delete ui.scope;delete ui.handler;self._hideDialogs();if($eTarget.is(splitBtnArrowSelector)){e.stopImmediatePropagation();return}if(toolbarEvents.hasOwnProperty(e.type)){self.resizeWorkspace();self._trigger(toolbarEvents[e.type],e,ui);return}ui.selectedItem=self._selectionWrapperSaved&&self._selectionWrapperSaved.getSelectedItem();noCancel=self._trigger(self.events.actionExecuting,e,{owner:self,toolbar:ui.toolbarName,actionName:ui.name});if(noCancel){if(!handler&&!scope){self._execCommand(ui.name,ui.value)}else if(handler&&!scope){self[handler](self.workspace.contentWindow.document,ui)}else if(handler&&scope){handler.call(ui.scope,self.workspace.contentWindow.document,ui)}self._trigger(self.events.actionExecuted,e,{owner:self,toolbar:ui.toolbarName,actionName:ui.name});e.stopImmediatePropagation()}})},_bindWorkspaceEvents:function(){var self=this,$workspaceDocument=$(this.contentDocument()),$workspaceBody=$(this.contentEditable()),KEYS={webKitIE:{CTRLZ:90,CTRLY:89},moz:{CTRLZ:90,CTRLY:89}};$workspaceDocument.find("html").bind("click",function(e){var target=$(e.target);if(target.is("html")){self.workspace.contentWindow.document.body.focus()}self._isDirty=true;self._hideDialogs();e.stopPropagation()}).bind("mouseup",function(){self._onSelectionChange()});$workspaceDocument.bind("keydown",function(e){var $children,$firstChild;self._isDirty=true;if(e.ctrlKey&&(e.which===KEYS.webKitIE.CTRLZ||e.which===KEYS.moz.CTRLZ)){self._trigger(self.events.undo,e,{owner:self})}if(e.ctrlKey&&(e.which===KEYS.webKitIE.CTRLY||e.which===KEYS.moz.CTRLY)){self._trigger(self.events.redo,e,{owner:self})}if(e.keyCode===8||e.keyCode===46){$children=$workspaceBody.children();$firstChild=$children.first();if($children.length===1&&$firstChild.html()==="<br>"){e.preventDefault()}}self._onSelectionChange()});$workspaceDocument.bind("cut copy paste",function(e){self._trigger(e.type,e,{owner:self})});this.element.bind("ightmleditoractionexecuted",function(e,ui){if(ui.actionName.toLowerCase()===self.events.undo||ui.actionName.toLowerCase()===self.events.redo){self._trigger(ui.actionName.toLowerCase(),e,{owner:self});e.stopImmediatePropagation()}});$(document).click(function(e){var $tarParents=$(e.target).parents();if(!$tarParents.is(".ui-igpopover")&&!$tarParents.is(".ui-igcombo-list")){self._hideDialogs()}});$(window).on("resize",$.proxy(this._resizeWorkspaceHandler,this))},_viewSource:function(){var workspace=$(this.workspace),workSpaceBody=workspace.contents().find("body");if(workspace.is(":visible")){workSpaceBody.attr("contentEditable",false);this.sourceWindow.val($.trim(workSpaceBody.html()));workspace.hide();this.sourceWindow.show()}else{workSpaceBody.attr("contentEditable",true);workSpaceBody.html($.trim(this.sourceWindow.val()));workspace.show();this.sourceWindow.hide();this.sourceWindow.val(encodeURIComponent(this.sourceWindow.val()))}},_viewSourcePlg:function(){this._viewSource()},_insertImageDialogPlg:function(workspace,plgUI){var image=$("<img>",this.workspace.contentWindow.document),self=this;if(plgUI.selectedItem.is("img")){image=plgUI.selectedItem}this._imageDialog=$("#"+this._id("_imageDialog"));if(!this._imageDialog.length){this._imageDialog=$('<div id="'+this._id("_imageDialog")+'"></div>').appendTo(this.element).igImagePropertiesDialog({item:image,target:plgUI.toolbarItem,language:this.options.language,locale:this.options.locale,applyform:function(e,ui){self._selectionWrapperSaved.focus();self._selectionWrapperSaved.replaceNode(ui.image)}})}else{if(this._imageDialog.igImagePropertiesDialog("option","isHidden")){this._imageDialog.igImagePropertiesDialog("show",image)}else{this._imageDialog.igImagePropertiesDialog("hide",image)}}},_insertLinkPlg:function(workspace,ui){var self=this,selectedItem=this._selectionWrapperSaved.getSelectedItem(),selectedItemNodeType=selectedItem[0].nodeType,anchor=$("<a></a>",this.workspace.contentWindow.document);if(selectedItem.parent().is("a")){anchor=selectedItem.parent()}else if(selectedItemNodeType===this.NODE._Text||selectedItemNodeType===this.NODE._Element){anchor.html(this._selectionWrapperSaved.getSelectionAsText())}if(!this._insertLinkDialog){this._insertLinkDialog=$('<div id="'+this._id("_linkDialog")+'"></div>').appendTo(this.element).igLinkPropertiesDialog({item:anchor,target:ui.toolbarItem,language:this.options.language,locale:this.options.locale,applyform:function(e,ui){self._selectionWrapperSaved.focus();self._selectionWrapperSaved.replaceNode(ui.anchor)}})}else{if(this._insertLinkDialog.igLinkPropertiesDialog("option","isHidden")){this._insertLinkDialog.igLinkPropertiesDialog("show",anchor)}else{this._insertLinkDialog.igLinkPropertiesDialog("hide",anchor)}}},_fontNamePlg:function(workspace,ui){this._execCommand("fontname",ui.value)},_fontSizePlg:function(workspace,ui){this._execCommand("fontsize",ui.value)},_formatsListPlg:function(workspace,ui){this._execCommand("formatBlock","<"+ui.value+">")},_insertTablePlg:function(workspace,plgUI){var table=$("<table></table>",this.workspace.contentWindow.document),self=this;if(plgUI.selectedItem.is("table")){table=plgUI.selectedItem}if(!this.insertTableDialog){this.insertTableDialog=$("<div id='"+this._id("_tableDialog")+"'</div>").appendTo(this.element).igTablePropertiesDialog({item:table,target:plgUI.toolbarItem,applyform:function(e,ui){self._selectionWrapperSaved.insertTable(ui.table)}});return}if(this.insertTableDialog.igTablePropertiesDialog("option","isHidden")){this.insertTableDialog.igTablePropertiesDialog("show",table);return}if(!this.insertTableDialog.igTablePropertiesDialog("option","isHidden")){this.insertTableDialog.igTablePropertiesDialog("hide")}},_addTableRowPlg:function(){var selectedItem=this._selectionWrapperSaved.getSelectedItem();if(selectedItem.is("table")){selectedItem.tableManipulator("addRow")}else if(selectedItem.is("td")){selectedItem.parents("table").first().tableManipulator("addRow",selectedItem.parent().index())}},_removeTableRowPlg:function(){var selectedItem=this._selectionWrapperSaved.getSelectedItem();if(selectedItem.is("table")){selectedItem.tableManipulator("removeRow")}else if(selectedItem.is("td")){selectedItem.parents("table").first().tableManipulator("removeRow",selectedItem.parent().index())}},_addTableColumnPlg:function(){var selectedItem=this._selectionWrapperSaved.getSelectedItem();if(selectedItem.is("table")){selectedItem.tableManipulator("addColumn")}else if(selectedItem.is("td")){selectedItem.parents("table").first().tableManipulator("addColumn",selectedItem.index())}},_removeTableColumnPlg:function(){var selectedItem=this._selectionWrapperSaved.getSelectedItem();if(selectedItem.is("table")){selectedItem.tableManipulator("removeColumn")}else if(selectedItem.is("td")){selectedItem.parents("table").first().tableManipulator("removeColumn",selectedItem.index())}},_fontColorPlg:function(workspace,ui){if(/^rgb/.test(ui.value)){ui.value=$.ig.util.rgbToHex(ui.value)}this._execCommand("forecolor",ui.value)},_fontBackgroundColorPlg:function(workspace,ui){var command=this._getFirefoxVersion()?"hilitecolor":"backcolor";this._execCommand(command,ui.value)},_domPathToolbar:function(){var self=this,tableItemPref="#"+this._id("_toolbars_insertObjectToolbar_item_"),tableItemAddRowID=tableItemPref+"addRow",tableItemAddColID=tableItemPref+"addColumn",tableItemRemRowID=tableItemPref+"removeRow",tableItemRemColID=tableItemPref+"removeColumn",doNotEnableToolbarButtonsSelector=tableItemAddRowID+", "+tableItemAddColID+", "+tableItemRemRowID+", "+tableItemRemColID;
this._viewSourceBtn=$('<div class="ui-igbutton-viewsource"></div>').appendTo(this.element).igButton({labelText:"&nbsp;",title:this._getLocaleValue("viewSourceButtonTitle"),icons:{primary:"ui-igbutton-viewsource-icon"},onlyIcons:true,click:function(){self._viewSourcePlg();if(self._domPathToolbar.igPathFinder("option","disabled")){self._domPathToolbar.igPathFinder("option","disabled",false);self._toolbars.find(":ui-igToolbarButton").not(doNotEnableToolbarButtonsSelector).igToolbarButton("option","disabled",false).end().end().find(":ui-igCombo").igCombo("enable");self._analyser._disableUnsupportedItems();self._onSelectionChange()}else{self._domPathToolbar.igPathFinder("option","disabled",true);self._toolbars.find(":ui-igToolbarButton").igToolbarButton("option","disabled",true).end().find(":ui-igCombo").igCombo("disable")}}}).attr({"data-localeid":"viewSourceButtonTitle","data-localeattr":"title"});this._domPathToolbar=$('<div id="'+this._id("_domPathToolbar")+'"></div>').appendTo(this.element).igPathFinder({click:function(e,ui){var selectionWrapper=self._selectionWrapperSaved;self.workspace.contentWindow.document.body.focus();if(self._domPathToolbar.igPathFinder("option","disabled")){return}e.preventDefault();if(ui.item.is("html")){selectionWrapper.select(ui.item.children("body"))}else if(ui.item.is("body")){selectionWrapper.select(ui.item)}else{selectionWrapper.select(ui.item)}}})},_onSelectionChange:function(callback){var self=this,selectionWrapper,workSpaceBody=$(this.workspace).contents().find("body"),selectionCallback=callback||function(){var selectedItem=this.getSelectedItem();if(selectedItem&&(selectedItem.is("p")||selectedItem.is(":header"))&&selectedItem.children("span").length>0){selectedItem=selectedItem.children("span").first()}else if(selectedItem&&(selectedItem.is("p")||selectedItem.is(":header"))&&selectedItem.children("font").length>0){selectedItem=selectedItem.children("font").first()}if(selectedItem[0].nodeType===self.NODE._Text){selectedItem=selectedItem.parent()}self._analyser.analyse(selectedItem);if(selectedItem.length){self._domPathToolbar.igPathFinder("option","items",$.merge(selectedItem,selectedItem.parents()))}};selectionWrapper=new $.ig.SelectionWrapper(this.workspace.contentWindow,function(){self._selectionWrapperSaved=this;self.sourceWindow.val(encodeURIComponent(workSpaceBody.html()));selectionCallback.call(this)})},_destroyPopovers:function(){var el=this.element[0];$(':data("igPopover")').each(function(){if($.contains(el,this)){$(this).igPopover("destroy")}})},resizeWorkspace:function(){var $clonedElement,height=this.element.height(),$editor=$("#"+this._id("_editor")),$toolbars=$("#"+this._id("_toolbars"));if(!$toolbars.is(":visible")){$clonedElement=$toolbars.clone();$clonedElement.css({display:"initial",position:"absolute",top:"-10000px",width:this.element.width()});$("body").append($clonedElement);height-=$clonedElement.height()+$toolbars.outerHeight(true);$clonedElement.remove()}else{height-=$toolbars.outerHeight(true)}height-=$(".ui-igbutton-viewsource").outerHeight(true);height-=$editor.outerHeight(true)-$editor.height();$editor.height(height);$("#"+this._id("_source")).height(height)},getContent:function(format){if(format==="text"){return $(this.workspace).contents().find("body").text()}if(format==="html"){return $(this.workspace).contents().find("body").html()}},setContent:function(content,format){if(format==="text"){$(this.workspace).contents().find("body").text(content)}else if(format==="html"){$(this.workspace).contents().find("body").html(content)}this.sourceWindow.val(encodeURIComponent(content));this.workspace.blur()},destroy:function(){this._superApply(arguments);$(this.workspace.contentWindow).undelegate();this._destroyPopovers();this._viewSourceBtn.igButton("destroy");this.element.removeClass(this.css.htmlEditor).find("#"+this._id("_content")).removeClass(this.css.htmlEditorContent).end().find("#"+this._id("_domPathToolbar")).removeClass(this.css.pathFinder).end().find("#"+this._id("_toolbars")).removeClass(this.css.toolbarsContainer).end().find(":ui-igToolbar").igToolbar("destroy").end().empty()},executeAction:function(actionName,args){this._selectionWrapperSaved.execCommand(actionName.toLowerCase(),args);this._onSelectionChange()},isDirty:function(){return this._isDirty},contentWindow:function(){return this.workspace.contentWindow},contentDocument:function(){return this.contentWindow().document},contentEditable:function(){return this.contentDocument().body},selection:function(){return this._selectionWrapperSaved._getSelection()},range:function(){return this._selectionWrapperSaved._getRange()},insertAtCaret:function(element){var el,range;if($.ig.util.isDomElement(element)){element=$(element)}if(element instanceof $){element=$("<div />").append(element).html()}else if(typeof element!=="string"){return}el=$(element,this._selectionWrapperSaved._document)[0];range=this.range();range.insertNode(el)}});$.widget("ui.igPathFinder",{options:{items:null},css:{button:"ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only "+"ui-igbutton ui-widget-content",buttonLabel:"ui-button-text",stateDefault:"ui-state-default",firstButton:"ui-first-button",overflowMarker:"ui-igpathfinder-overflowMarker"},_create:function(){var self=this,o=this.options;this._addStyles();this.element.attr("disabled",o.disabled).attr("aria-disabled",o.disabled).on("mouseover","div",function(){if(!o.disabled){$(this).addClass("ui-state-hover")}}).on("mouseleave","div",function(){if(!o.disabled){$(this).removeClass("ui-state-hover")}}).on("click","div",function(e){if(!o.disabled){$(this).siblings(".ui-state-active").removeClass("ui-state-active");$(this).addClass("ui-state-active");self._trigger("click",e,{item:self.options.__currentParents.eq(self.options.__currentButtonList.index(this))})}})},_addStyles:function(){this.element.addClass("ui-igPathFinder")},_setOption:function(name,value){$.Widget.prototype._setOption.apply(this,arguments);switch(name){case"items":this._updateToolbar();break;case"disabled":this.element.toggleClass("ui-state-disabled",!!value).attr("aria-disabled",value);break;default:break}},_addOverflowMarker:function(){var overflowMarker=$("<div>...</div>").addClass(this.css.overflowMarker).addClass(this.css.stateDefault);overflowMarker.prependTo(this.element)},_updateToolbar:function(){var i,parents,btn,buttonsList,self=this,o=this.options,path=[],html="",viewSrcBtn=$(".ui-igbutton-viewsource"),overflowMarkerWidth=20,maxWidth=viewSrcBtn.parent().width()-viewSrcBtn.outerWidth(true)-overflowMarkerWidth,maxWidthReached=false;if(o.items.length){o.items.each(function(index,element){html='<div aria-disabled="false" style="z-index:'+index+'" class="'+self.css.button+'">'+'<span class="'+self.css.buttonLabel+'">'+element.nodeName+"</span>"+"</div>";path.push(html)});this.element.empty();parents=$(o.items.toArray().reverse());buttonsList=$(path.reverse().join(""));for(i=buttonsList.length-1;i>=0&&!maxWidthReached;i--){buttonsList.removeClass(this.css.firstButton);btn=buttonsList.eq(i).addClass(this.css.firstButton).prependTo(this.element);if(i===0){maxWidth+=overflowMarkerWidth}if(this.element.outerWidth(true)>maxWidth){btn.remove();buttonsList.eq(i+1).addClass(this.css.firstButton);this._addOverflowMarker();maxWidthReached=true}}this.options.__currentButtonList=buttonsList;this.options.__currentParents=parents}}});$.widget("ui.igHtmlEditorPopover",$.ui.igWidget,{localeWidgetName:"HtmlEditor",options:{item:null,target:null,isHidden:true},css:{igHtmlEditorPropertiesDialog:"ui-ightmleditor-dialog",igHtmlEditorPropertiesDialogContainer:"ui-ightmleditor-dialog-container"},events:{apply:"applyform",cancel:"cancelform",show:"show",hide:"hide"},_id:function(id){return this.element[0].id+id},_create:function(){this.element.igPopover({closeOnBlur:false,position:"balanced",direction:"bottom",renderCloseButton:false,showOn:null,maxWidth:"90%",width:"95%",maxHeight:"300px",minWidth:"160px"});this.poContent=this.element.igPopover("container");this._createForm()},_init:function(){this._item=this.options.item;this.poContent.addClass(this.css.igHtmlEditorPropertiesDialog);this.element.addClass(this.css.igHtmlEditorPropertiesDialogContainer);this._attachFormEvents();this.show(this._item)},_createForm:function(){},_attachFormEvents:function(){},_dataBind:function(){},show:function(item){this._item=item;this._dataBind(item);this.options.isHidden=false;this.element.igPopover("show",this.options.target);this._trigger(this.events.show)},hide:function(){this.options.isHidden=true;if(this.options.target.igToolbarButton("option","isSelected")){this.options.target.igToolbarButton("toggle")}this.element.igPopover("hide");this._trigger(this.events.hide)}});$.widget("ui.igLinkPropertiesDialog",$.ui.igHtmlEditorPopover,{_txtUrl:"",_cbTarget:"",_attachFormEvents:function(){var self=this;this.poContent.find("#"+this._id("_cmbOpenIn")).igCombo({initialSelectedItems:[{index:0}],enableClearButton:false,width:"100%",mode:"dropdown"});this.poContent.find("#"+this._id("_btnCancel")).igButton({click:function(){self.hide()}});this.poContent.find("#"+this._id("_btnApply")).igButton({click:function(e){e.stopImmediatePropagation();self._item.attr({href:self._txtUrl.val(),target:self._cbTarget.igCombo("value")}).html(self._displayText.val().length>0?self._displayText.val():self._txtUrl.val());self._trigger(self.events.apply,e,{anchor:self._item});self.hide()}});this.poContent.bind("keypress",function(e){if(e.keyCode===$.ui.keyCode.ESCAPE){self.hide()}});this.element.bind("igpopovershown",function(){self.poContent.find("#"+self._id("_linkHref")).focus()})},_createForm:function(){var html="";html+="<div>"+'<ol class="layoutList">'+"<li>"+'<label for="'+this._id("_linkHref")+'" data-localeid="linkNavigateToUrlDialogText">'+this._getLocaleValue("linkNavigateToUrlDialogText")+"</label>"+'<input autocomplete="off" id="'+this._id("_linkHref")+'" name="href" type="text" value="" />'+"</li>"+"<li>"+'<label for="'+this._id("_linkDisplayText")+'" data-localeid="linkDisplayTextDialogText">'+this._getLocaleValue("linkDisplayTextDialogText")+"</label>"+'<input autocomplete="off" id="'+this._id("_linkDisplayText")+'" name="href" type="text" value="" />'+"</li>"+"<li>"+'<label for="'+this._id("_cmbOpenIn")+'" data-localeid="linkOpenInDialogText">'+this._getLocaleValue("linkOpenInDialogText")+"</label>"+'<select id="'+this._id("_cmbOpenIn")+'" name="target">'+'<option value="_blank" data-localeid="linkTargetNewWindowDialogText">'+this._getLocaleValue("linkTargetNewWindowDialogText")+"</option>"+'<option value="_self" data-localeid="linkTargetSameWindowDialogText">'+this._getLocaleValue("linkTargetSameWindowDialogText")+"</option>"+'<option value="_parent" data-localeid="linkTargetParentWindowDialogText">'+this._getLocaleValue("linkTargetParentWindowDialogText")+"</option>"+'<option value="_top" data-localeid="linkTargetTopmostWindowDialogText">'+this._getLocaleValue("linkTargetTopmostWindowDialogText")+"</option>"+"</select>"+"</li>"+'<li style="text-align:right">'+'<button aria-disabled="false" id="'+this._id("_btnApply")+'" name="insertLink" role="button" title="'+this._getLocaleValue("applyButtonTitle")+'" type="button" '+"data-localeid='applyButtonTitle' "+"data-localeattr='title'>"+this._getLocaleValue("applyButtonTitle")+"</button>"+'<button aria-disabled="false" id="'+this._id("_btnCancel")+'" role="button" title="'+this._getLocaleValue("cancelButtonTitle")+'" type="button" '+"data-localeid='cancelButtonTitle' "+"data-localeattr='title'>"+this._getLocaleValue("cancelButtonTitle")+"</button>"+"</li>"+"</ol>"+"</div>";$(html).appendTo(this.poContent)},_dataBind:function(anchor){this._txtUrl=this.poContent.find("#"+this._id("_linkHref")).val(anchor.attr("href"));this._cbTarget=this.poContent.find("#"+this._id("_cmbOpenIn")).val(anchor.attr("target"));this._displayText=this.poContent.find("#"+this._id("_linkDisplayText")).val(anchor.html())}});$.widget("ui.igTablePropertiesDialog",$.ui.igHtmlEditorPopover,{_init:function(){this.rowsNumField=this.element.find("#"+this._id("_tableRows"));this.columnsNumField=this.element.find("#"+this._id("_tableColumns"));$.ui.igHtmlEditorPopover.prototype._init.apply(this,arguments)},_createForm:function(){var html="<div>"+'<ol class="layoutList">'+"<li>"+"</li>"+"<li>"+'<div class="ui-igtablepropertiesdialog-cols-rows-num">'+'<input type="hidden" id="'+this._id("_tableRows")+'" name="tableRows" readonly="readonly" value="">'+'<input type="hidden" id="'+this._id("_tableColumns")+'" name="tableColumns" readonly="readonly" value="">'+"</div>"+"</li>"+"</ol>"+"</div>";$(html).appendTo(this.poContent);this._sampleTable=$('<table "'+this._id("_tableModel")+'" class="ui-igtablepropertiesdialog-sample-table"></table>').tableManipulator({rows:8,columns:6}).appendTo(this.poContent.find(".layoutList li:first"))},_attachFormEvents:function(){var tablePreview=this.poContent.find("table"),cells=tablePreview.find("td").addClass("ui-state-default"),rows=tablePreview.find("tr"),self=this;tablePreview.delegate("td","mouseover",function(e){var target=$(e.target),currentRowNumber=target.parent().index()+1,currentColumnNumber=$(this).index()+1,i;cells.removeClass("ui-state-hover");for(i=0;i<currentRowNumber;i++){$(rows.get(i)).find("td:lt("+currentColumnNumber+")").addClass("ui-state-hover")}self.rowsNumField.val(currentRowNumber);self.columnsNumField.val(currentColumnNumber)});tablePreview.delegate("td","click",function(e){var target=$(e.target),currentRowNumber=target.parent().index()+1,currentColumnNumber=$(this).index()+1;self._item.tableManipulator({rows:currentRowNumber,columns:currentColumnNumber,addSpacingChar:true});self._trigger(self.events.apply,e,{table:self._item.attr("border",1)});self.hide()});tablePreview.bind("mouseout",function(){cells.removeClass("ui-state-hover");self.rowsNumField.val(null);self.columnsNumField.val(null)})},_dataBind:function(){this.rowsNumField.val();this.columnsNumField.val()}});$.widget("ui.igImagePropertiesDialog",$.ui.igHtmlEditorPopover,{_init:function(){this._imgSrcFld=this.poContent.find("#"+this._id("_imgSrc"));this._imgAltFld=this.poContent.find("#"+this._id("_imgAlt"));$.ui.igHtmlEditorPopover.prototype._init.apply(this,arguments)},_createForm:function(){var html="";html+='<div class="'+this.css.igImagePropertiesDialogContent+'">';html+="   <div>";html+='       <ol class="layoutList">';html+="           <li>";html+='               <label for="'+this._id("_imgSrc")+'" data-localeid="imageUrlDialogText">'+this._getLocaleValue("imageUrlDialogText")+"</label>";html+='               <input autocomplete="off" id="'+this._id("_imgSrc")+'" name="src" type="text" value="" />';html+="           </li>";html+="           <li>";html+='               <label for="'+this._id("_imgAlt")+'" data-localeid="imageAlternativeTextDialogText">'+this._getLocaleValue("imageAlternativeTextDialogText")+"</label>";html+='               <input autocomplete="off" id="'+this._id("_imgAlt")+'" name="altText" type="text" value="" />';html+="           </li>";html+='           <li style="text-align:right">';html+='               <button aria-disabled="false" id="'+this._id("_btnApply")+'" name="insertLink" role="button" title="'+this._getLocaleValue("applyButtonTitle")+'" type="button" '+"data-localeid='applyButtonTitle' data-localeattr='title'>"+this._getLocaleValue("applyButtonTitle")+"</button>";html+='               <button aria-disabled="false" id="'+this._id("_btnCancel")+'" role="button" title="'+this._getLocaleValue("cancelButtonTitle")+'" type="button" '+"data-localeid='cancelButtonTitle' data-localeattr='title'>"+this._getLocaleValue("cancelButtonTitle")+"</button>";html+="           </li>";html+="       </ol>";html+="   </div>";html+="</div>";this.poContent.append(html)},_attachFormEvents:function(){var self=this;this.poContent.find("#"+this._id("_btnApply")).igButton({click:function(e){self._item.attr({src:self._imgSrcFld.val(),alt:self._imgAltFld.val()});self._trigger(self.events.apply,e,{image:self._item});self.hide()}}).end().find("#"+this._id("_btnCancel")).igButton({click:function(e){self._trigger(self.events.cancel,e);self.hide()}})},_dataBind:function(image){this._imgSrcFld.val(image.attr("src"));this._imgAltFld.val(image.attr("alt"))}});var table,tableNumRows=0,tableNumCols=0,settings={document:document,rows:0,columns:0,addSpacingChar:false},spacingChar="",methods={init:function(options){return this.each(function(){var tRows;$.extend(settings,options);if(this.nodeName.toLowerCase()!=="table"){return}if(settings.addSpacingChar){spacingChar="&nbsp;"}table=$(this);tRows=methods.getTableRows();if(settings.rows&&settings.rows>0){tableNumRows=settings.rows}else{tableNumRows=tRows.length}if(settings.columns&&settings.columns>0){tableNumCols=settings.columns}else if(tRows[0]){tableNumCols=tRows[0].cells.length}if(!table.children().length){methods.create()}})},create:function(){var newRow,i,j;table.empty();for(i=0;i<tableNumRows;i++){newRow=$("<tr></tr>",settings.document).appendTo(table);for(j=0;j<tableNumCols;j++){$("<td>"+spacingChar+"</td>",settings.document).appendTo(newRow)}}},addRow:function(position){var newRow=$("<tr></tr>",settings.document),j;if(position!==undefined){newRow.insertAfter(methods.getTableRows().eq(position))}else{newRow.appendTo(table)}for(j=0;j<methods.getColumnsNum();j++){$("<td>"+spacingChar+"</td>",settings.document).appendTo(newRow)}return newRow},removeRow:function(position){var rows=methods.getTableRows(),removedRow;if(position!==undefined){removedRow=rows.eq(position).remove()}else{removedRow=rows.last().remove()}return removedRow},addColumn:function(position){var columnCellsArr=[];methods.getTableRows().each(function(idx,el){var row=$(el),columns=row.children("td"),newColumn=$("<td>"+spacingChar+"</td>",settings.document);if(position!==undefined&&columns.length){columnCellsArr.push(newColumn.insertAfter(columns.eq(position))[0]);return true}columnCellsArr.push(newColumn.appendTo(row)[0])});return $([]).pushStack(columnCellsArr)},removeColumn:function(position){var removedRowsArr=[];methods.getTableRows().each(function(idx,el){var row=$(el);if(position!==undefined){removedRowsArr.push(row.children("td").eq(position).remove());return true}removedRowsArr.push(row.children("td:last").remove())});return $([]).pushStack(removedRowsArr)},getRowsNum:function(){return methods.getTableRows().length},getColumnsNum:function(){return methods.getTableCols().length},getTableRows:function(){return table.children("tbody").children("tr")},getTableCols:function(){return table.children("tbody").children("tr").first().children("td")}};$.fn.tableManipulator=function(method){if(methods[method]){if(table===undefined||this!==table[0]){table=$(this)}return methods[method].apply(this,Array.prototype.slice.call(arguments,1))}if(typeof method==="object"||!method){return methods.init.apply(this,arguments)}$.error("Method "+method+" does not exist on jQuery.tableManipulator")};$.ig.SelectionWrapper=$.ig.SelectionWrapper||Class.extend({_selection:null,_range:null,_window:null,_document:null,_commands:{insertunorderedlist:{name:"_insertList",browsers:null,args:["insertunorderedlist"]},insertorderedlist:{name:"_insertList",browsers:null,args:["insertorderedlist"]}},_css:{larger:"ui-ightmleditor-larger",smaller:"ui-ightmleditor-smaller"},NODE:new $.ig.XmlNodeType,init:function(window,callback){var self=this;this._window=window;this._document=this._window.document;this._selection=this._window.getSelection();self._range=self._getSelection().rangeCount===0?self._document.createRange():self._selection.getRangeAt(0);self._selectClosestTextNode();if($.isFunction(callback)){callback.call(self)}},_getSelection:function(){return this._selection},_getRange:function(){return this._range},_isCommandSupportedByBrowser:function(command){var supportedBrowsers,i;if(command===null||!this._commands.hasOwnProperty(command.toLowerCase())){return}if(this._commands[command].browsers===null){return}supportedBrowsers=this._commands[command].browsers;for(i=0;i<supportedBrowsers.length;i++){if($.browser&&$.browser.hasOwnProperty(supportedBrowsers[i])){return true}if(!$.browser){if($.ig.util.isIE||$.ig.util.isSafari||$.ig.util.isChrome){return true}}}},_findTextNodes:function(node,allTextNodes){var self=this,$nodeContents=$(node).contents();if($nodeContents.length>0){$nodeContents.each(function(){if(this.nodeType===3){allTextNodes.push(this)}else{self._findTextNodes(this,allTextNodes)}})}},_findAllTextNodes:function(node){var allTextNodes=[];this._findTextNodes(node,allTextNodes);return allTextNodes},_selectClosestTextNode:function(){var children,closestToCaretNode,allTextNodes,textNodeToFocus,range=this._range;if(($.ig.util.isIE||$.ig.util.isFF)&&range.collapsed&&range.startOffset>0&&range.startContainer.nodeType===this.NODE._Element){children=range.startContainer.childNodes;if(children.length>0){closestToCaretNode=children[range.startOffset-1];if(closestToCaretNode.nodeType===3){textNodeToFocus=closestToCaretNode}else{allTextNodes=this._findAllTextNodes($(closestToCaretNode));textNodeToFocus=allTextNodes[allTextNodes.length-1]}if(textNodeToFocus&&!$(textNodeToFocus).parent().is("a")){range.setStart(textNodeToFocus,textNodeToFocus.length);range.collapse(true);this._updateSelection(range)}}}},getSelectedItem:function(){var range=this._getRange(),rangeParent=$(range.commonAncestorContainer);if(range.collapsed&&range.endContainer.nodeType===this.NODE._Text){if(rangeParent.parent().is("img")||rangeParent.parent().is("td")){return rangeParent.parent()}return $(range.startContainer)}if(range.collapsed){return $(range.commonAncestorContainer)}if(range.collapsed&&range.endContainer.nodeType===this.NODE._Element){return $(range.commonAncestorContainer.childNodes[range.endOffset-range.startOffset])}return $(range.commonAncestorContainer)},getSelectionAsText:function(){if(this._getRange().text!==undefined){return this._getRange().text}return this._getRange().toString()},select:function(element){var selectedItem=element||this.getSelectedItem();this._range.selectNodeContents(selectedItem[0]);this._selection.removeAllRanges();this._selection.addRange(this._range)},insertElement:function(element){this._getRange().insertNode(element.get(0))},execCommand:function(name,args){var startEl,endEl,p,range=this._getRange(),customCommand=this._commands[name]?this[this._commands[name].name]:null,customCommandArgs=this._commands[name]?this._commands[name].args:null,browser=this._commands[name]?this._commands[name].browsers:null,isCommandSupported=this._isCommandSupportedByBrowser(name);if(this._selection.isCollapsed&&range.collapsed){if($(range.startContainer).is("body")){startEl=$(range.startContainer).find(":first");if(!startEl.length){startEl=$(range.startContainer)}range.selectNodeContents(startEl[0])}else if(range.startContainer.nodeType===this.NODE._Document){startEl=$(range.startContainer.body).find(":first");if(!startEl.length){startEl=$(range.startContainer.body)}range.selectNodeContents(startEl[0])}else if(range.startContainer.nodeType===this.NODE._Text){this._document.execCommand(name,false,args);return}else{startEl=$(range.startContainer)}if(startEl&&startEl.is("br")&&endEl&&endEl.is("br")){p=$("<p><br /></p>",this._document);startEl.replaceWith(p);range.selectNodeContents(p[0]);this._updateSelection(range)}}if($.ig.util.isIE&&$.ig.util.browserVersion>=9||$.ig.util.isOpera){if(this._selection.focusNode.nodeType!==3){this._updateSelection(range)}}if($.isFunction(customCommand)&&browser===null){customCommand.call(this,name,args)}else if($.isFunction(customCommand)&&isCommandSupported){customCommand.apply(this,customCommandArgs)}else{this._document.execCommand(name,false,args)}},_insertList:function(listType,args){var self=this,textNodes;this._document.execCommand(listType,false,args);if(!this._document.queryCommandState(listType)){if(this._selection.anchorNode&&this._selection.anchorNode.nodeType===this.NODE._Text&&$(this._selection.focusNode).is("body")){textNodes=$(this._selection.focusNode).contents().filter(function(){if($(this).is("br")){$(this).remove();return false}return this.nodeType===self.NODE._Text})}}},_getTextNodesOnlyCallback:function(){return this.nodeType===this.NODE._Text},_wrapPartialString:function(string,start,end,wrapElName){var stack=[];stack.push(this._document.createTextNode(string.slice(0,start)));stack.push(wrapElName.text(string.substring(start,end))[0]);stack.push(this._document.createTextNode(string.slice(end)));return $(stack)},_updateSelection:function(range){this._selection.removeAllRanges();this._selection.addRange(range)},replaceNode:function(newNode){var range=this._getRange(),selItem=this.getSelectedItem();if(selItem.is(newNode)){return}if(range.startOffset!==range.endOffset){range.deleteContents()}if(range.insertNode!==undefined&&!selItem.parent().is("a")){range.insertNode(newNode[0])}else if(range.pasteHTML!==undefined){range.pasteHTML(newNode[0].outerHTML)}},insertTable:function(table){var $body,$firstP,selItem=this.getSelectedItem(),br=$("<br>",this._document);if(selItem[0].nodeType===this.NODE._Document){$body=selItem.find("body");$firstP=$body.children("p").first();if($firstP.length>0){this._range.selectNodeContents($firstP[0])}else{this._range.selectNodeContents($body[0])}this._range.insertNode(table[0])}else if(selItem.is("td")){table.appendTo(selItem)}else if(selItem.is("table")){selItem.replaceWith(table)}else if(selItem.is("br")){selItem.replaceWith(table)}else{this._range.insertNode(table[0])}if(this._range.selectNodeContents!==undefined){this._range.selectNodeContents(br.insertAfter(table)[0])}},focus:function(){var focusTarget;if((this._range.startContainer.nodeType===this.NODE._Document||$(this._range.startContainer).is("body"))&&this._range.collapsed){focusTarget=$(this._document.body).find(":not(br):first");if(focusTarget.length>0){this._range.setStart(focusTarget[0],0);this._range.setEnd(focusTarget[0],0);this._document.body.focus()}}else{if($.ig.util.isIE){if(this._selection&&this._selection.focusNode&&this._selection.focusNode.nodeType!==this.NODE._Text){this._updateSelection(this._range)}}else{this._document.body.focus()}}}});$.ig.ToolbarHelper=$.ig.ToolbarHelper||Class.extend({_toolbarsItemsLocation:{textToolbar:{name:"textToolbar",bold:{name:"bold"},italic:{name:"Italic"},underline:{name:"Underline"},strikethrough:{name:"Strikethrough"},fontFamily:{name:"fontFamily"},fontSize:{name:"fontSize"},formatsList:{name:"formatsList"}},formattingToolbar:{name:"formattingToolbar",justifyleft:{name:"justifyleft"},justifycenter:{name:"justifycenter"},justifyright:{name:"justifyright"},justifyfull:{name:"justifyfull"},bullets:{name:"bullets"},indent:{name:"indent"},outdent:{name:"outdent"},textColor:{name:"textColor"},backgroundTextColor:{name:"backgroundTextColor"}},insertObjectToolbar:{name:"insertObjectToolbar",image:{name:"image"},link:{name:"link"},table:{name:"table"},addRow:{name:"addRow"},addColumn:{name:"addColumn"},removeRow:{name:"removeRow"},removeColumn:{name:"removeColumn"}},copyPasteToolbar:{name:"copyPasteToolbar",copy:{name:"copy"},cut:{name:"cut"},paste:{name:"paste"},undo:{name:"undo"},redo:{name:"redo"}}},init:function(window,toolbars){this._toolbars={};this._w=window;this._d=window.document;var self=this;toolbars.each(function(idx,el){var igToolbarName=$(el).igToolbar("option","name");self._toolbars[igToolbarName]=$(el)});this._initAlignButtons(toolbars);this._disableUnsupportedItems();this._disableTableControls(true)},_initAlignButtons:function(toolbars){var alignButtonsToolbar=this._toolbars.formattingToolbar,alignButtons={justifyleft:alignButtonsToolbar.igToolbar("getItem","justifyleft").attr({"data-localeid":"alignTextLeftButtonTitle","data-localeattr":"title"}),justifycenter:alignButtonsToolbar.igToolbar("getItem","justifycenter").attr({"data-localeid":"alignTextCenterButtonTitle","data-localeattr":"title"}),justifyright:alignButtonsToolbar.igToolbar("getItem","justifyright").attr({"data-localeid":"alignTextRightButtonTitle","data-localeattr":"title"}),justifyfull:alignButtonsToolbar.igToolbar("getItem","justifyfull").attr({"data-localeid":"justifyButtonTitle","data-localeattr":"title"})};toolbars.bind("igtoolbartoolbarbuttonclick",function(e,ui){if(alignButtons.hasOwnProperty(ui.name)){$.each(alignButtons,function(buttonName,button){if(buttonName!==ui.name&&button.igToolbarButton("option","isSelected")){button.igToolbarButton("toggle");return}})}})},_disableUnsupportedItems:function(){var copyPasteToolbar=this._toolbars.copyPasteToolbar;if(!$.ig.util.isIE){copyPasteToolbar.igToolbar("disableItem","cut",true);copyPasteToolbar.igToolbar("disableItem","copy",true);copyPasteToolbar.igToolbar("disableItem","paste",true)}},_disableTableControls:function(toDisable){var insertObjectToolbar=this._toolbars.insertObjectToolbar;if(!toDisable&&this._isTableControlsDisabled){insertObjectToolbar.igToolbar("disableItem","addColumn",false);insertObjectToolbar.igToolbar("disableItem","removeColumn",false);insertObjectToolbar.igToolbar("disableItem","addRow",false);insertObjectToolbar.igToolbar("disableItem","removeRow",false);this._isTableControlsDisabled=false}else if(toDisable&&!this._isTableControlsDisabled){insertObjectToolbar.igToolbar("disableItem","addColumn",true);insertObjectToolbar.igToolbar("disableItem","removeColumn",true);insertObjectToolbar.igToolbar("disableItem","addRow",true);insertObjectToolbar.igToolbar("disableItem","removeRow",true);this._isTableControlsDisabled=true}},_callbackMap:{_isBold:"_onBold",_isItalic:"_onItalic",_isUnderlined:"_onUnderlined",_isLineThrough:"_onLineThrough",_isJustifyCenter:"_onAlign",_isJustifyFull:"_onAlign",_isJustifyLeft:"_onAlign",_isJustifyRight:"_onAlign",_isOrderedList:"_onList",_isUnorderedList:"_onList",_hasFontName:"_onFontName",_hasFontSize:"_onFontSize",_isTable:"_onTable"},analyse:function(el){var self=this,justify;this._resetToolbars();if(el[0].nodeType===9){this._computedStyles=this._w.getComputedStyle&&this._w.getComputedStyle(this._d.body)||this._d.body.currentStyle}else{this._computedStyles=this._w.getComputedStyle&&this._w.getComputedStyle(el[0])||el[0].currentStyle}if(el.is(":header")){this._onHeader(el)}$.each(this._callbackMap,function(isTrueFunc,callback){var isTrueRes=self[isTrueFunc](el);if($.isFunction(self[isTrueFunc])&&isTrueRes&&$.isFunction(self[callback])){self[callback](el,isTrueRes);if(callback==="_onAlign"){justify=true}}});if(!justify){this._onAlign(el,"justifyleft")}if(!el.is("table")&&!el.is("td")){this._disableTableControls(true)}},_isBold:function(){return this._d.queryCommandState("bold")},_isItalic:function(){return this._d.queryCommandState("italic")},_isUnderlined:function(){return this._d.queryCommandState("underline")},_isLineThrough:function(){return this._d.queryCommandState("strikethrough")},_isJustifyCenter:function(){if(this._d.queryCommandState("justifycenter")){return"justifycenter"}},_isJustifyFull:function(){if(this._d.queryCommandState("justifyfull")){return"justifyfull"}},_isJustifyLeft:function(){if(this._d.queryCommandState("justifyleft")){return"justifyleft"}},_isJustifyRight:function(){if(this._d.queryCommandState("justifyright")){return"justifyright"}},_isOrderedList:function(){if(this._d.queryCommandState("insertorderedlist")){return"InsertOrderedList"}},_isUnorderedList:function(){if(this._d.queryCommandState("insertunorderedlist")){return"InsertUnorderedList"}},_isTable:function(el){if(el.is("table")||el.is("td")){return true}},_hasFontName:function(){var fontName=this._getFontFamily();if(fontName==="serif"){fontName="Times New Roman"}return fontName},_getFontFamily:function(){var fontName=this._d.queryCommandValue("FontName");if(fontName===""){fontName=this._computedStyles.fontFamily}return fontName},_hasFontSize:function(){return this._computedStyles.fontSize},_onBold:function(){this._toolbars.textToolbar.igToolbar("getItem","Bold").igToolbarButton("toggle")},_onItalic:function(){this._toolbars.textToolbar.igToolbar("getItem","Italic").igToolbarButton("toggle");
},_onUnderlined:function(){this._toolbars.textToolbar.igToolbar("getItem","Underline").igToolbarButton("toggle")},_onLineThrough:function(){this._toolbars.textToolbar.igToolbar("getItem","Strikethrough").igToolbarButton("toggle")},_onAlign:function(el,dir){this._toolbars.formattingToolbar.igToolbar("getItem",dir).igToolbarButton("toggle")},_onList:function(el,listType){this._toolbars.formattingToolbar.igToolbar("getItem",listType).igToolbarButton("toggle")},_onFontName:function(el,fontName){var combo=this._toolbars.textToolbar.igToolbar("getItem","fontFamily");fontName=fontName.replace(/'|"/g,"");this._setComboValue(combo,combo.igCombo("option","dataSource").data(),fontName)},_onFontSize:function(){var pxTbl={11:1,13:2,16:3,19:4,24:5,32:6},fontSizeUnits=this._d.queryCommandValue("fontsize")||pxTbl[Math.round(parseFloat(this._computedStyles.fontSize))],fontSizeUnitsStr=fontSizeUnits?fontSizeUnits.toString():"",combo=this._toolbars.textToolbar.igToolbar("getItem","fontSize");this._setComboValue(combo,$.ig.util.getLocaleValue("HtmlEditor","fontSizes"),fontSizeUnitsStr)},_onHeader:function(element){var combo=this._toolbars.textToolbar.igToolbar("getItem","formatsList");this._setComboValue(combo,$.ig.util.getLocaleValue("HtmlEditor","formatsList"),element[0].nodeName.toLowerCase())},_onTable:function(){this._disableTableControls(false)},_setComboValue:function(combo,values,newValue,valueKey){var i,dsValueKey=valueKey||valueKey===undefined?"text":valueKey,currentValue=values[combo.igCombo("index")][dsValueKey],dataSourceValue;if(newValue===currentValue){return}for(i=0;i<values.length;i++){dataSourceValue=values[i][dsValueKey];if(newValue===dataSourceValue){combo.igCombo("index",i);break}}},_resetToolbars:function(){$.each(this._toolbars,function(idx,el){$(el).igToolbar("deactivateAll")})}});$.extend($.ui.igHtmlEditor,{version:"0.0.1"});return $});