ignite-ui
Version:
Ignite UI for jQuery by Infragistics
1 lines • 70 kB
JavaScript
(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});"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(" ");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.on(events,":ui-igToolbar",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").on("click",function(e){var target=$(e.target);if(target.is("html")){self.workspace.contentWindow.document.body.focus()}self._isDirty=true;self._hideDialogs();e.stopPropagation()}).on("mouseup",function(){self._onSelectionChange()});$workspaceDocument.on("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.on("cut copy paste",function(e){self._trigger(e.type,e,{owner:self})});this.element.on("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).on("click",function(e){var $tarParents=$(e.target).parents();if(!$tarParents.is(".ui-igpopover")&&!$tarParents.is(".ui-igcombo-list")){self._hideDialogs()}});$(window).on("resize",this._resizeWorkspaceHandler.bind(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:" ",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).off();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.on("keypress",function(e){if(e.keyCode===$.ui.keyCode.ESCAPE){self.hide()}});this.element.on("igpopovershown",function(){self.poContent.find("#"+self._id("_linkHref")).trigger("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.on("mouseover","td",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.on("click","td",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.on("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