if(typeof(HTMLArea)=='undefined'){Ext.namespace('HTMLArea.CSS','HTMLArea.util.TYPO3','HTMLArea.util.Tips','HTMLArea.util.Color','Ext.ux.form','Ext.ux.menu','Ext.ux.Toolbar');Ext.apply(HTMLArea,{is_gecko:Ext.isGecko||Ext.isOpera||Ext.isWebKit,is_ff2:Ext.isGecko2,is_ie:Ext.isIE,is_safari:Ext.isWebKit,is_chrome:Ext.isChrome,is_opera:Ext.isOpera,RE_htmlTag:/<.[^<>]*?>/g,RE_tagName:/(<\/|<)\s*([^ \t\n>]+)/ig,RE_head:/((.|\n)*?)<\/head>/i,RE_body:/((.|\n)*?)<\/body>/i,Reg_body:new RegExp('<\/?(body)[^>]*>','gi'),reservedClassNames:/htmlarea/,RE_email:/([0-9a-z]+([a-z0-9_-]*[0-9a-z])*){1}(\.[0-9a-z]+([a-z0-9_-]*[0-9a-z])*)*@([0-9a-z]+([a-z0-9_-]*[0-9a-z])*\.)+[a-z]{2,9}/i,RE_url:/(([^:/?#]+):\/\/)?(([a-z0-9_]+:[a-z0-9_]+@)?[a-z0-9_-]{2,}(\.[a-z0-9_-]{2,})+\.[a-z]{2,5}(:[0-9]+)?(\/\S+)*\/?)/i,RE_blockTags:/^(body|p|h1|h2|h3|h4|h5|h6|ul|ol|pre|dl|dt|dd|div|noscript|blockquote|form|hr|table|caption|fieldset|address|td|tr|th|li|tbody|thead|tfoot|iframe)$/i,RE_closingTags:/^(p|blockquote|a|li|ol|ul|dl|dt|td|th|tr|tbody|thead|tfoot|caption|colgroup|table|div|b|bdo|big|cite|code|del|dfn|em|i|ins|kbd|label|q|samp|small|span|strike|strong|sub|sup|tt|u|var|abbr|acronym|font|center|object|embed|style|script|title|head)$/i,RE_noClosingTag:/^(img|br|hr|col|input|area|base|link|meta|param)$/i,RE_numberOrPunctuation:/[0-9.(),;:!¡?¿%#$'"_+=\\\/-]*/g,isIEBeforeIE9:Ext.isIE6||Ext.isIE7||Ext.isIE8||(Ext.isIE&&typeof(document.documentMode)!=='undefined'&&document.documentMode<9),_appendToLog:function(str){if(HTMLArea.enableDebugMode){var log=document.getElementById('HTMLAreaLog');if(log){log.appendChild(document.createTextNode(str));log.appendChild(document.createElement('br'));}}},appendToLog:function(editorId,objectName,functionName,text){HTMLArea._appendToLog(editorId+'['+objectName+'::'+functionName+']: '+text);},localize:function(label){return HTMLArea.I18N.dialogs[label]||HTMLArea.I18N.tooltips[label]||HTMLArea.I18N.msg[label]||'';},init:function(){Ext.apply(HTMLArea,RTEarea[0]);Ext.applyIf(HTMLArea,{editorSkin:HTMLArea.editorUrl+'skins/default/',editorCSS:HTMLArea.editorUrl+'skins/default/htmlarea.css'});if(!Ext.isString(HTMLArea.editedContentCSS)){HTMLArea.editedContentCSS=HTMLArea.editorSkin+'htmlarea-edited-content.css';} HTMLArea.isReady=true;HTMLArea._appendToLog("[HTMLArea::init]: Editor url set to: "+HTMLArea.editorUrl);HTMLArea._appendToLog("[HTMLArea::init]: Editor skin CSS set to: "+HTMLArea.editorCSS);HTMLArea._appendToLog("[HTMLArea::init]: Editor content skin CSS set to: "+HTMLArea.editedContentCSS);}});HTMLArea.Config=function(editorId){this.editorId=editorId;this.useHTTPS=false;this.useCSS=false;this.enableMozillaExtension=true;this.disableEnterParagraphs=false;this.disableObjectResizing=false;this.removeTrailingBR=true;this.editedContentStyle=HTMLArea.editedContentCSS;this.pageStyle="";this.htmlRemoveTags=/none/i;this.htmlRemoveTagsAndContents=/none/i;this.htmlRemoveComments=false;this.customTags=[];this.baseURL=document.baseURI;if(!this.baseURL){var baseTags=document.getElementsByTagName('base');if(baseTags.length>0){this.baseURL=baseTags[0].href;}else{this.baseURL=document.URL;}} if(this.baseURL&&this.baseURL.match(/(.*\:\/\/.*\/)[^\/]*/)){this.baseURL=RegExp.$1;} this.popupURL="popups/";this.documentType='\r';this.blankDocument='';this.buttonsConfig={};this.hotKeyList={};this.configDefaults={all:{xtype:'htmlareabutton',disabledClass:'buttonDisabled',textMode:false,selection:false,dialog:false,hidden:false,hideMode:'display'},htmlareabutton:{cls:'button',overCls:'buttonHover',clickEvent:(Ext.isWebKit||Ext.isIE)?'mousedown':'click'},htmlareacombo:{cls:'select',typeAhead:true,lastQuery:'',triggerAction:'all',editable:!Ext.isIE,selectOnFocus:!Ext.isIE,validationEvent:false,validateOnBlur:false,submitValue:false,forceSelection:true,mode:'local',storeRoot:'options',storeFields:[{name:'text'},{name:'value'}],valueField:'value',displayField:'text',labelSeparator:'',hideLabel:true,tpl:'
{text}
'}};};HTMLArea.Config=Ext.extend(HTMLArea.Config,{registerButton:function(config){config.itemId=config.id;if(Ext.type(this.buttonsConfig[config.id])){HTMLArea._appendToLog('[HTMLArea.Config::registerButton]: A toolbar item with the same Id: '+config.id+' already exists and will be overidden.');} config=Ext.applyIf(config,this.configDefaults['all']);config=Ext.applyIf(config,this.configDefaults[config.xtype]);switch(config.xtype){case'htmlareacombo':if(config.options){config.store=new Ext.data.ArrayStore({autoDestroy:true,fields:config.storeFields,data:config.options});}else if(config.storeUrl){config.store=new Ext.data.JsonStore({autoDestroy:true,autoLoad:true,root:config.storeRoot,fields:config.storeFields,url:config.storeUrl});} config.hideLabel=Ext.isEmpty(config.fieldLabel)||Ext.isIE6;config.helpTitle=config.tooltip;break;default:if(!config.iconCls){config.iconCls=config.id;} break;} config.cmd=config.id;config.tooltip={title:config.tooltip};this.buttonsConfig[config.id]=config;return true;},registerHotKey:function(hotKeyConfiguration){if(Ext.isDefined(this.hotKeyList[hotKeyConfiguration.id])){HTMLArea._appendToLog('[HTMLArea.Config::registerHotKey]: A hotkey with the same key '+hotKeyConfiguration.id+' already exists and will be overidden.');} if(Ext.isDefined(hotKeyConfiguration.cmd)&&!Ext.isEmpty(hotKeyConfiguration.cmd)&&Ext.isDefined(this.buttonsConfig[hotKeyConfiguration.cmd])){this.hotKeyList[hotKeyConfiguration.id]=hotKeyConfiguration;HTMLArea._appendToLog('[HTMLArea.Config::registerHotKey]: A hotkey with key '+hotKeyConfiguration.id+' was registered for toolbar item '+hotKeyConfiguration.cmd+'.');return true;}else{HTMLArea._appendToLog('[HTMLArea.Config::registerHotKey]: A hotkey with key '+hotKeyConfiguration.id+' could not be registered because toolbar item with id '+hotKeyConfiguration.cmd+' was not registered.');return false;}},getDocumentType:function(){return this.documentType;}});Ext.ux.HTMLAreaButton=Ext.extend(Ext.Button,{initComponent:function(){Ext.ux.HTMLAreaButton.superclass.initComponent.call(this);this.addEvents('HTMLAreaEventHotkey','HTMLAreaEventContextMenu');this.addListener({afterrender:{fn:this.initEventListeners,single:true}});},initEventListeners:function(){this.addListener({HTMLAreaEventHotkey:{fn:this.onHotKey},HTMLAreaEventContextMenu:{fn:this.onButtonClick}});this.setHandler(this.onButtonClick,this);this.mon(this.getToolbar(),'HTMLAreaEventToolbarUpdate',this.onUpdateToolbar,this);},getEditor:function(){return RTEarea[this.ownerCt.editorId].editor;},getToolbar:function(){return this.ownerCt;},inactive:true,activeClass:'buttonActive',setInactive:function(inactive){this.inactive=inactive;return inactive?this.removeClass(this.activeClass):this.addClass(this.activeClass);},isInContext:function(mode,selectionEmpty,ancestors){var editor=this.getEditor();var inContext=true;if(mode==='wysiwyg'&&this.context){var attributes=[],contexts=[];if(/(.*)\[(.*?)\]/.test(this.context)){contexts=RegExp.$1.split(',');attributes=RegExp.$2.split(',');}else{contexts=this.context.split(',');} contexts=new RegExp('^('+contexts.join('|')+')$','i');var matchAny=contexts.test('*');Ext.each(ancestors,function(ancestor){inContext=matchAny||contexts.test(ancestor.nodeName);if(inContext){Ext.each(attributes,function(attribute){inContext=eval("ancestor."+attribute);return inContext;});} return!inContext;});} return inContext&&(!this.selection||!selectionEmpty);},onButtonClick:function(button,event,key){if(!this.disabled){if(!this.plugins[this.action](this.getEditor(),key||this.itemId)&&event){event.stopEvent();} if(Ext.isOpera){this.getEditor().focus();} if(this.dialog){this.setDisabled(true);}else{this.getToolbar().update();}} return false;},onHotKey:function(key,event){return this.onButtonClick(this,event,key);},onUpdateToolbar:function(mode,selectionEmpty,ancestors,endPointsInSameBlock){this.setDisabled(mode==='textmode'&&!this.textMode);if(!this.disabled){if(!this.noAutoUpdate){this.setDisabled(!this.isInContext(mode,selectionEmpty,ancestors));} this.plugins['onUpdateToolbar'](this,mode,selectionEmpty,ancestors,endPointsInSameBlock);}}});Ext.reg('htmlareabutton',Ext.ux.HTMLAreaButton);Ext.ux.Toolbar.HTMLAreaToolbarText=Ext.extend(Ext.Toolbar.TextItem,{initComponent:function(){Ext.ux.Toolbar.HTMLAreaToolbarText.superclass.initComponent.call(this);this.addListener({afterrender:{fn:this.initEventListeners,single:true}});},initEventListeners:function(){this.mon(this.getToolbar(),'HTMLAreaEventToolbarUpdate',this.onUpdateToolbar,this);},getEditor:function(){return RTEarea[this.ownerCt.editorId].editor;},getToolbar:function(){return this.ownerCt;},onUpdateToolbar:function(mode,selectionEmpty,ancestors,endPointsInSameBlock){this.setDisabled(mode==='textmode'&&!this.textMode);if(!this.disabled){this.plugins['onUpdateToolbar'](this,mode,selectionEmpty,ancestors,endPointsInSameBlock);}}});Ext.reg('htmlareatoolbartext',Ext.ux.Toolbar.HTMLAreaToolbarText);Ext.ux.form.HTMLAreaCombo=Ext.extend(Ext.form.ComboBox,{initComponent:function(){Ext.ux.form.HTMLAreaCombo.superclass.initComponent.call(this);this.addEvents('HTMLAreaEventHotkey');this.addListener({afterrender:{fn:this.initEventListeners,single:true}});},initEventListeners:function(){this.addListener({select:{fn:this.onComboSelect},specialkey:{fn:this.onSpecialKey},HTMLAreaEventHotkey:{fn:this.onHotKey},beforedestroy:{fn:this.onBeforeDestroy,single:true}});this.mon(this.getToolbar(),'HTMLAreaEventToolbarUpdate',this.onUpdateToolbar,this);this.mon(this.getToolbar().ownerCt,'HTMLAreaEventFrameworkReady',this.onFrameworkReady,this);},getEditor:function(){return RTEarea[this.ownerCt.editorId].editor;},getToolbar:function(){return this.ownerCt;},onComboSelect:function(combo,record,index){if(!combo.disabled){var editor=this.getEditor();if(Ext.isIE){editor.focus();if(!Ext.isEmpty(this.savedRange)){editor.selectRange(this.savedRange);this.savedRange=null;}} this.plugins[this.action](editor,combo,record,index);if(Ext.isIE){editor.focus();this.savedRange=editor._createRange(editor._getSelection());this.triggered=true;} if(Ext.isOpera){editor.focus();} this.getToolbar().update();} return false;},onTriggerClick:function(){Ext.ux.form.HTMLAreaCombo.superclass.onTriggerClick.call(this);if(Ext.isIE){this.triggered=true;this.getEditor().focus();}},onViewClick:function(doFocus){Ext.ux.form.HTMLAreaCombo.superclass.onViewClick.call(this,false);},saveSelection:function(event){var editor=this.getEditor();if(editor.document.hasFocus()){this.savedRange=editor._createRange(editor._getSelection());}},restoreSelection:function(event){if(!Ext.isEmpty(this.savedRange)&&this.triggered){this.getEditor().selectRange(this.savedRange);this.triggered=false;}},onSpecialKey:function(combo,event){if(event.getKey()==event.ENTER){event.stopEvent();} return false;},onHotKey:function(key){if(!this.disabled){this.plugins.onHotKey(this.getEditor(),key);if(Ext.isOpera){this.getEditor().focus();} this.getToolbar().update();} return false;},onUpdateToolbar:function(mode,selectionEmpty,ancestors,endPointsInSameBlock){this.setDisabled(mode==='textmode'&&!this.textMode);if(!this.disabled){this.plugins['onUpdateToolbar'](this,mode,selectionEmpty,ancestors,endPointsInSameBlock);}},onFrameworkReady:function(){var iframe=this.getEditor().iframe;this.mon(Ext.get(iframe.document.documentElement),'click',this.collapse,this);if(Ext.isIE){this.mon(iframe.getEl(),'mouseleave',this.saveSelection,this);this.mon(iframe.getEl(),'focus',this.restoreSelection,this);}},onBeforeDestroy:function(){this.savedRange=null;this.getStore().removeAll();this.getStore().destroy();}});Ext.reg('htmlareacombo',Ext.ux.form.HTMLAreaCombo);HTMLArea.Toolbar=Ext.extend(Ext.Container,{initComponent:function(){HTMLArea.Toolbar.superclass.initComponent.call(this);this.addEvents('HTMLAreaEventToolbarUpdate');this.updateLater=new Ext.util.DelayedTask(this.update,this);this.addItems();this.addListener({afterrender:{fn:this.initEventListeners,single:true}});},initEventListeners:function(){this.addListener({beforedestroy:{fn:this.onBeforeDestroy,single:true}});this.mon(this.getEditor(),'HTMLAreaEventEditorReady',this.update,this,{single:true});},editorId:null,getEditor:function(){return RTEarea[this.editorId].editor;},addItems:function(){var editor=this.getEditor();var firstOnRow=true;var firstInGroup=true;Ext.each(editor.config.toolbar,function(row){if(!firstOnRow){this.add({xtype:'tbspacer',cls:'x-form-clear-left'});} firstOnRow=true;Ext.each(row,function(group){if(!firstOnRow&&!firstInGroup){this.add({xtype:'tbseparator',cls:'separator'});} firstInGroup=true;Ext.each(group,function(item){if(item=='space'){this.add({xtype:'tbspacer',cls:'space'});}else{var itemConfig=editor.config.buttonsConfig[item];if(!Ext.isEmpty(itemConfig)){itemConfig.id=this.editorId+'-'+itemConfig.id;this.add(itemConfig);firstInGroup=firstInGroup&&itemConfig.hidden;firstOnRow=firstOnRow&&firstInGroup;}} return true;},this);return true;},this);return true;},this);this.add({xtype:'tbspacer',cls:'x-form-clear-left'});},getButton:function(buttonId){return this.find('itemId',buttonId)[0];},update:function(){var editor=this.getEditor(),mode=editor.getMode(),selectionEmpty=true,ancestors=null,endPointsInSameBlock=true;if(editor.getMode()==='wysiwyg'){selectionEmpty=editor._selectionEmpty(editor._getSelection());ancestors=editor.getAllAncestors();endPointsInSameBlock=editor.endPointsInSameBlock();} this.fireEvent('HTMLAreaEventToolbarUpdate',mode,selectionEmpty,ancestors,endPointsInSameBlock);},onBeforeDestroy:function(){this.removeAll(true);return true;}});Ext.reg('htmlareatoolbar',HTMLArea.Toolbar);HTMLArea.Iframe=Ext.extend(Ext.BoxComponent,{initComponent:function(){HTMLArea.Iframe.superclass.initComponent.call(this);this.addEvents('HTMLAreaEventIframeReady','HTMLAreaEventWordCountChange');this.addListener({afterrender:{fn:this.initEventListeners,single:true},beforedestroy:{fn:this.onBeforeDestroy,single:true}});this.config=this.getEditor().config;this.htmlRenderer=new HTMLArea.DOM.Walker({keepComments:!this.config.htmlRemoveComments,removeTags:this.config.htmlRemoveTags,removeTagsAndContents:this.config.htmlRemoveTagsAndContents,baseUrl:this.config.baseURL});if(!this.config.showStatusBar){this.addClass('noStatusBar');}},initEventListeners:function(){this.initStyleChangeEventListener();if(Ext.isOpera){this.mon(this.getEl(),'load',this.initializeIframe,this,{single:true});}else{this.initializeIframe();}},initStyleChangeEventListener:function(){if(this.isNested&&Ext.isGecko){var options={stopEvent:true,delay:50};Ext.each(this.nestedParentElements.sorted,function(nested){this.mon(Ext.get(nested),Ext.isIE?'propertychange':'DOMAttrModified',this.onNestedShow,this,options);},this);}},editorId:null,getEditor:function(){return RTEarea[this.editorId].editor;},getToolbar:function(){return this.ownerCt.getTopToolbar();},getStatusBar:function(){return this.ownerCt.getBottomToolbar();},getButton:function(buttonId){return this.getToolbar().getButton(buttonId);},ready:false,onRender:function(ct,position){if(!this.el&&this.autoEl){if(Ext.isString(this.autoEl)){this.el=document.createElement(this.autoEl);}else{this.el=Ext.DomHelper.append(ct,this.autoEl,true);} if(!this.el.id){this.el.id=this.getId();}} if(this.resizeEl){this.resizeEl=Ext.get(this.resizeEl);} if(this.positionEl){this.positionEl=Ext.get(this.positionEl);}},initializeIframe:function(){var iframe=this.getEl().dom;if(!iframe||(!iframe.contentWindow&&!iframe.contentDocument)){this.initializeIframe.defer(50,this);}else if(iframe.contentWindow&&!Ext.isWebKit&&(!iframe.contentWindow.document||!iframe.contentWindow.document.documentElement)){this.initializeIframe.defer(50,this);}else if(Ext.isWebKit&&(!iframe.contentDocument.documentElement||!iframe.contentDocument.body)){this.initializeIframe.defer(50,this);}else{this.document=iframe.contentWindow?iframe.contentWindow.document:iframe.contentDocument;this.getEditor().document=this.document;this.getEditor()._doc=this.document;this.getEditor()._iframe=iframe;this.initializeCustomTags();this.createHead();this.getStyleSheets();}},initializeCustomTags:function(){if(HTMLArea.isIEBeforeIE9){Ext.each(this.config.customTags,function(tag){this.document.createElement(tag);},this);}},createHead:function(){var head=this.document.getElementsByTagName('head')[0];if(!head){head=this.document.createElement('head');this.document.documentElement.appendChild(head);} if(this.config.baseURL){var base=this.document.getElementsByTagName('base')[0];if(!base){base=this.document.createElement('base');base.href=this.config.baseURL;head.appendChild(base);} HTMLArea._appendToLog('[HTMLArea.Iframe::createHead]: Iframe baseURL set to: '+base.href);} var link0=this.document.getElementsByTagName('link')[0];if(!link0){link0=this.document.createElement('link');link0.rel='stylesheet';link0.type='text/css';link0.href=((Ext.isGecko&&navigator.productSub<2010072200&&!/^http(s?):\/{2}/.test(this.config.editedContentStyle))?this.config.baseURL:'')+this.config.editedContentStyle;head.appendChild(link0);HTMLArea._appendToLog('[HTMLArea.Iframe::createHead]: Skin CSS set to: '+link0.href);} if(this.config.defaultPageStyle){var link=this.document.getElementsByTagName('link')[1];if(!link){link=this.document.createElement('link');link.rel='stylesheet';link.type='text/css';link.href=((Ext.isGecko&&navigator.productSub<2010072200&&!/^https?:\/{2}/.test(this.config.defaultPageStyle))?this.config.baseURL:'')+this.config.defaultPageStyle;head.appendChild(link);} HTMLArea._appendToLog('[HTMLArea.Iframe::createHead]: Override CSS set to: '+link.href);} if(this.config.pageStyle){var link=this.document.getElementsByTagName('link')[2];if(!link){link=this.document.createElement('link');link.rel='stylesheet';link.type='text/css';link.href=((Ext.isGecko&&navigator.productSub<2010072200&&!/^https?:\/{2}/.test(this.config.pageStyle))?this.config.baseURL:'')+this.config.pageStyle;head.appendChild(link);} HTMLArea._appendToLog('[HTMLArea.Iframe::createHead]: Content CSS set to: '+link.href);} HTMLArea._appendToLog('[HTMLArea.Iframe::createHead]: Editor iframe document head successfully built.');},getStyleSheets:function(){var stylesAreLoaded=true;var errorText='';var rules;if(Ext.isOpera){if(this.document.readyState!='complete'){stylesAreLoaded=false;errorText='Document.readyState not complete';}}else{if(HTMLArea.isIEBeforeIE9){try{var rules=this.document.styleSheets[0].rules;var imports=this.document.styleSheets[0].imports;if(!rules.length&&!imports.length){stylesAreLoaded=false;errorText='Empty rules and imports arrays';}}catch(e){stylesAreLoaded=false;errorText=e;}}else{try{this.document.styleSheets&&this.document.styleSheets[0]&&this.document.styleSheets[0].rules;}catch(e){stylesAreLoaded=false;errorText=e;}} if(stylesAreLoaded){if(this.document.styleSheets.length>2){Ext.each(this.document.styleSheets,function(styleSheet,index){if(HTMLArea.isIEBeforeIE9){try{var rules=styleSheet.rules;var imports=styleSheet.imports;if(!rules.length&&!imports.length&&styleSheet.href.indexOf('defaultPageStyle')===-1){stylesAreLoaded=false;errorText='Empty rules and imports arrays of styleSheets['+index+']';return false;}}catch(e){stylesAreLoaded=false;errorText=e;return false;}}else{try{var rules=styleSheet.cssRules;}catch(e){stylesAreLoaded=false;errorText=e;return false;}}});}else{stylesAreLoaded=false;errorText='Empty stylesheets array or missing linked stylesheets';}}} if(!stylesAreLoaded){this.getStyleSheets.defer(100,this);HTMLArea._appendToLog('[HTMLArea.Iframe::getStyleSheets]: Stylesheets not yet loaded ('+errorText+'). Retrying...');if(/Security/i.test(errorText)){HTMLArea._appendToLog('ERROR [HTMLArea.Iframe::getStyleSheets]: A security error occurred. Make sure all stylesheets are accessed from the same domain/subdomain and using the same protocol as the current script.');}}else{HTMLArea._appendToLog('[HTMLArea.Iframe::getStyleSheets]: Stylesheets successfully accessed.');Ext.get(this.document.body).addClass('htmlarea-content-body');if(!Ext.isOpera){this.startListening();} this.hide();this.ready=true;this.fireEvent('HTMLAreaEventIframeReady');}},focus:function(){try{if(Ext.isWebKit){this.getEl().dom.focus();}else{this.getEl().dom.contentWindow.focus();}}catch(e){}},isNested:false,nestedParentElements:{},setDesignMode:function(on){if(on){if(!Ext.isIE){if(Ext.isGecko){if(!this.isNested||HTMLArea.util.TYPO3.allElementsAreDisplayed(this.nestedParentElements.sorted)){this.document.designMode='on';this.setOptions();}}else{this.document.designMode='on';this.setOptions();}} if(Ext.isIE||Ext.isWebKit){this.document.body.contentEditable=true;}}else{if(!Ext.isIE){this.document.designMode='off';} if(Ext.isIE||Ext.isWebKit){this.document.body.contentEditable=false;}}},setOptions:function(){if(!Ext.isIE){try{if(this.document.queryCommandEnabled('insertBrOnReturn')){this.document.execCommand('insertBrOnReturn',false,this.config.disableEnterParagraphs);} if(this.document.queryCommandEnabled('styleWithCSS')){this.document.execCommand('styleWithCSS',false,this.config.useCSS);}else if(Ext.isGecko&&this.document.queryCommandEnabled('useCSS')){this.document.execCommand('useCSS',false,!this.config.useCSS);} if(Ext.isGecko){if(this.document.queryCommandEnabled('enableObjectResizing')){this.document.execCommand('enableObjectResizing',false,!this.config.disableObjectResizing);} if(this.document.queryCommandEnabled('enableInlineTableEditing')){this.document.execCommand('enableInlineTableEditing',false,(this.config.buttons.table&&this.config.buttons.table.enableHandles)?true:false);}}}catch(e){}}},onNestedShow:function(event,target){var styleEvent=true;if((Ext.isGecko&&navigator.productSub>2007112700)||Ext.isOpera){styleEvent=(event.browserEvent.attrName=='style');}else if(Ext.isIE){styleEvent=(event.browserEvent.propertyName=='style.display');} if(styleEvent&&this.nestedParentElements.sorted.indexOf(target.id)!=-1&&(target.style.display==''||target.style.display=='block')){if(HTMLArea.util.TYPO3.allElementsAreDisplayed(this.nestedParentElements.sorted)){if(this.getEditor().getMode()==='wysiwyg'){if(Ext.isGecko){this.setDesignMode(true);} this.fireEvent('show');}else{this.ownerCt.textAreaContainer.fireEvent('show');} this.getToolbar().update();return false;}}},htmlRenderer:{},getHTML:function(){return this.htmlRenderer.render(this.document.body,false);},startListening:function(){this.keyMap=new Ext.KeyMap(Ext.get(this.document.documentElement),[],(Ext.isIE||Ext.isWebKit)?'keydown':'keypress');this.keyMap.addBinding([{key:[Ext.EventObject.DOWN,Ext.EventObject.UP,Ext.EventObject.LEFT,Ext.EventObject.RIGHT],alt:false,handler:this.onArrow,scope:this},{key:Ext.EventObject.TAB,ctrl:false,alt:false,handler:this.onTab,scope:this},{key:Ext.EventObject.SPACE,ctrl:true,shift:false,alt:false,handler:this.onCtrlSpace,scope:this}]);if(Ext.isGecko||Ext.isIE){this.keyMap.addBinding({key:[Ext.EventObject.BACKSPACE,Ext.EventObject.DELETE],alt:false,handler:this.onBackSpace,scope:this});} if(!Ext.isIE&&!this.config.disableEnterParagraphs){this.keyMap.addBinding({key:Ext.EventObject.ENTER,shift:false,handler:this.onEnter,scope:this});} if(Ext.isWebKit){this.keyMap.addBinding({key:Ext.EventObject.ENTER,alt:false,handler:this.onWebKitEnter,scope:this});} var hotKeys='';Ext.iterate(this.config.hotKeyList,function(key){if(key.length==1){hotKeys+=key.toUpperCase();}});this.hotKeyMap=new Ext.KeyMap(Ext.get(this.document.documentElement));if(!Ext.isEmpty(hotKeys)){this.hotKeyMap.addBinding({key:hotKeys,ctrl:true,shift:false,alt:false,handler:this.onHotKey,scope:this});} this.mon(Ext.get(this.document.documentElement),(Ext.isIE||Ext.isWebKit)?'keydown':'keypress',this.onAnyKey,this);this.mon(Ext.get(this.document.documentElement),'mouseup',this.onMouse,this);this.mon(Ext.get(this.document.documentElement),'click',this.onMouse,this);if(Ext.isGecko){this.mon(Ext.get(this.document.documentElement),'paste',this.onPaste,this);} this.mon(Ext.get(this.document.documentElement),'drop',this.onDrop,this);if(Ext.isWebKit){this.mon(Ext.get(this.document.body),'dragend',this.onDrop,this);}},onAnyKey:function(event){if(this.inhibitKeyboardInput(event)){return false;} if(this.getEditor().hasPluginWithOnKeyPressHandler){var letBubble=true;Ext.iterate(this.getEditor().plugins,function(pluginId){var plugin=this.getEditor().getPlugin(pluginId);if(Ext.isFunction(plugin.onKeyPress)){if(!plugin.onKeyPress(event.browserEvent)){event.stopEvent();letBubble=false;}} return letBubble;},this);if(!letBubble){return letBubble;}} this.fireEvent('HTMLAreaEventWordCountChange',100);if(!event.altKey&&!event.ctrlKey){if(!Ext.isIE&&(event.getKey()!=Ext.EventObject.ENTER||(event.shiftKey&&!Ext.isWebKit))){this.getEditor()._detectURL(event);} if(Ext.isMac&&event.browserEvent.charCode==160){return this.onOptionSpace(event.browserEvent.charCode,event);}} return true;},inhibitKeyboardInput:function(event){if(this.getEditor().inhibitKeyboardInput){event.stopEvent();return true;}else{return false;}},onMouse:function(event,target){if(Ext.isWebKit&&/^(img)$/i.test(target.nodeName)&&event.browserEvent.type=='click'){this.getEditor().selectNode(target);} this.getToolbar().updateLater.delay(100);return true;},onPaste:function(event){if(Ext.isGecko){HTMLArea.DOM.makeUrlsAbsolute.defer(50,this,[this.getEditor().document.body,this.config.baseURL,this.htmlRenderer]);}},onDrop:function(event,target){if(Ext.isWebKit){this.getEditor().cleanAppleStyleSpans.defer(50,this.getEditor(),[this.getEditor().document.body]);} if(Ext.isGecko){HTMLArea.DOM.makeUrlsAbsolute.defer(50,this,[target,this.config.baseURL,this.htmlRenderer]);} this.getToolbar().updateLater.delay(100);},onArrow:function(){this.getToolbar().updateLater.delay(100);return true;},onTab:function(key,event){if(this.inhibitKeyboardInput(event)){return false;} var keyName=(event.shiftKey?'SHIFT-':'')+'TAB';if(this.config.hotKeyList[keyName]&&this.config.hotKeyList[keyName].cmd){var button=this.getButton(this.config.hotKeyList[keyName].cmd);if(button){event.stopEvent();button.fireEvent('HTMLAreaEventHotkey',keyName,event);return false;}} event.stopEvent();return false;},onBackSpace:function(key,event){if(this.inhibitKeyboardInput(event)){return false;} if((!Ext.isIE&&!event.shiftKey)||Ext.isIE){if(this.getEditor()._checkBackspace()){event.stopEvent();}} this.getToolbar().updateLater.delay(200);return false;},onEnter:function(key,event){if(this.inhibitKeyboardInput(event)){return false;} this.getEditor()._detectURL(event);if(this.getEditor()._checkInsertP()){event.stopEvent();} this.getToolbar().updateLater.delay(200);return false;},onWebKitEnter:function(key,event){if(this.inhibitKeyboardInput(event)){return false;} if(event.shiftKey||this.config.disableEnterParagraphs){var editor=this.getEditor();editor._detectURL(event);if(Ext.isSafari){var brNode=editor.document.createElement('br');editor.insertNodeAtSelection(brNode);brNode.parentNode.normalize();if(editor._unlinkOnUndo){brNode=brNode.parentNode.parentNode.insertBefore(brNode,brNode.parentNode.nextSibling);} if(!brNode.nextSibling||!/\S+/i.test(brNode.nextSibling.textContent)){var secondBrNode=editor.document.createElement('br');secondBrNode=brNode.parentNode.appendChild(secondBrNode);} editor.selectNode(brNode,false);event.stopEvent();}} this.getToolbar().updateLater.delay(200);return false;},onCtrlSpace:function(key,event){if(this.inhibitKeyboardInput(event)){return false;} this.getEditor().insertHTML(' ');event.stopEvent();return false;},onOptionSpace:function(key,event){if(this.inhibitKeyboardInput(event)){return false;} this.getEditor().insertHTML(' ');event.stopEvent();return false;},onHotKey:function(key,event){if(this.inhibitKeyboardInput(event)){return false;} var hotKey=String.fromCharCode(key).toLowerCase();this.getButton(this.config.hotKeyList[hotKey].cmd).fireEvent('HTMLAreaEventHotkey',hotKey,event);return false;},onBeforeDestroy:function(){Ext.each(this.keyMap.bindings,function(binding,index){this.keyMap.bindings[index]=null;},this);this.keyMap.handleKeyDown=null;Ext.each(this.hotKeyMap.bindings,function(binding,index){this.hotKeyMap.bindings[index]=null;},this);this.hotKeyMap.handleKeyDown=null;this.keyMap.disable();this.hotKeyMap.disable();Ext.get(this.document.body).purgeAllListeners();Ext.get(this.document.body).dom=null;Ext.get(this.document.documentElement).purgeAllListeners();Ext.get(this.document.documentElement).dom=null;this.document=null;this.getEditor().document=null;this.getEditor()._doc=null;this.getEditor()._iframe=null;Ext.each(this.nestedParentElements.sorted,function(nested){Ext.get(nested).purgeAllListeners();Ext.get(nested).dom=null;});Ext.destroy(this.autoEl,this.el,this.resizeEl,this.positionEl);return true;}});Ext.reg('htmlareaiframe',HTMLArea.Iframe);HTMLArea.StatusBar=Ext.extend(Ext.Container,{initComponent:function(){HTMLArea.StatusBar.superclass.initComponent.call(this);this.updateWordCountLater=new Ext.util.DelayedTask(this.updateWordCount,this);this.addListener({render:{fn:this.addComponents,single:true},afterrender:{fn:this.initEventListeners,single:true}});},initEventListeners:function(){this.addListener({beforedestroy:{fn:this.onBeforeDestroy,single:true}});this.mon(this.ownerCt.toolbar,'HTMLAreaEventToolbarUpdate',this.onUpdateToolbar,this);this.mon(this.getEditor(),'HTMLAreaEventModeChange',this.onModeChange,this);this.mon(this.ownerCt.iframe,'HTMLAreaEventWordCountChange',this.onWordCountChange,this);},editorId:null,getEditor:function(){return RTEarea[this.editorId].editor;},addComponents:function(){this.statusBarWordCount=Ext.DomHelper.append(this.getEl(),{id:this.editorId+'-statusBarWordCount',tag:'span',cls:'statusBarWordCount',html:' '},true);this.statusBarTree=Ext.DomHelper.append(this.getEl(),{id:this.editorId+'-statusBarTree',tag:'span',cls:'statusBarTree',html:HTMLArea.I18N.msg['Path']+': '},true).setVisibilityMode(Ext.Element.DISPLAY).setVisible(true);this.statusBarTextMode=Ext.DomHelper.append(this.getEl(),{id:this.editorId+'-statusBarTextMode',tag:'span',cls:'statusBarTextMode',html:HTMLArea.I18N.msg['TEXT_MODE']},true).setVisibilityMode(Ext.Element.DISPLAY).setVisible(false);},clear:function(){this.statusBarTree.removeAllListeners();Ext.each(this.statusBarTree.query('a'),function(node){Ext.QuickTips.unregister(node);Ext.get(node).dom.ancestor=null;Ext.destroy(node);});this.statusBarTree.update('');this.setSelection(null);},noUpdate:false,onUpdateToolbar:function(mode,selectionEmpty,ancestors,endPointsInSameBlock){if(mode==='wysiwyg'&&!this.noUpdate){var text,language,languageObject=this.getEditor().getPlugin('Language'),classes=new Array(),classText;this.clear();var path=Ext.DomHelper.append(this.statusBarTree,{tag:'span',html:HTMLArea.I18N.msg['Path']+': '},true);Ext.each(ancestors,function(ancestor,index){if(!ancestor){return true;} text=ancestor.nodeName.toLowerCase();if(ancestor.id&&text!=='body'&&ancestor.id.substr(0,7)!=='ext-gen'){text+='#'+ancestor.id;} if(languageObject&&languageObject.getLanguageAttribute){language=languageObject.getLanguageAttribute(ancestor);if(language!='none'){text+='['+language+']';}} if(ancestor.className){classText='';classes=ancestor.className.trim().split(' ');for(var j=0,n=classes.length;j'),html:text},true);element.dom.ancestor=ancestor;element.on('click',this.onClick,this);element.on('mousedown',this.onClick,this);if(!Ext.isOpera){element.on('contextmenu',this.onContextMenu,this);} if(index){Ext.DomHelper.insertAfter(element,{tag:'span',html:String.fromCharCode(0xbb)});}},this);} this.updateWordCount();this.noUpdate=false;},onWordCountChange:function(delay){this.updateWordCountLater.delay(delay?delay:0);},updateWordCount:function(){var wordCount=0;if(this.getEditor().getMode()=='wysiwyg'){var text=this.getEditor().getHTML();if(!Ext.isEmpty(text)){text=text.replace(HTMLArea.RE_htmlTag,' ');text=text.replace(/ | /gi,' ');text=text.replace(HTMLArea.RE_numberOrPunctuation,'');wordCount=text.split(/\S\s+/g).length-1;}} this.statusBarWordCount.dom.innerHTML=wordCount?(wordCount+' '+HTMLArea.I18N.dialogs[(wordCount==1)?'word':'words']):' ';},onModeChange:function(mode){switch(mode){case'wysiwyg':this.statusBarTextMode.setVisible(false);this.statusBarTree.setVisible(true);break;case'textmode':default:this.statusBarTree.setVisible(false);this.statusBarTextMode.setVisible(true);break;}},selected:null,getSelection:function(){return this.selected;},setSelection:function(element){this.selected=element?element:null;},selectElement:function(element){var editor=this.getEditor();element.blur();if(!Ext.isIE){if(/^(img|table)$/i.test(element.ancestor.nodeName)){editor.selectNode(element.ancestor);}else{editor.selectNodeContents(element.ancestor);}}else{if(/^(img|table)$/i.test(element.ancestor.nodeName)){var range=editor.document.body.createControlRange();range.addElement(element.ancestor);range.select();}else{editor.selectNode(element.ancestor);}} this.setSelection(element.ancestor);this.noUpdate=true;editor.toolbar.update();},onClick:function(event,element){this.selectElement(element);event.stopEvent();return false;},onContextMenu:function(event,target){this.selectElement(target);return this.getEditor().getPlugin('ContextMenu')?this.getEditor().getPlugin('ContextMenu').show(event,target.ancestor):false;},onBeforeDestroy:function(){this.clear();this.removeAll(true);Ext.destroy(this.statusBarTree,this.statusBarTextMode);return true;}});Ext.reg('htmlareastatusbar',HTMLArea.StatusBar);HTMLArea.Framework=Ext.extend(Ext.Panel,{initComponent:function(){HTMLArea.Framework.superclass.initComponent.call(this);this.toolbar=this.getTopToolbar();this.statusBar=this.getBottomToolbar();this.iframe=this.getComponent('iframe');this.textAreaContainer=this.getComponent('textAreaContainer');this.addEvents('HTMLAreaEventFrameworkReady');this.addListener({beforedestroy:{fn:this.onBeforeDestroy,single:true}});this.mon(this.iframe,'HTMLAreaEventIframeReady',this.onIframeReady,this,{single:true});if(!this.isNested||HTMLArea.util.TYPO3.allElementsAreDisplayed(this.nestedParentElements.sorted)){this.render(this.textArea.parent(),this.textArea.id);}else{var parentElements=[].concat(this.nestedParentElements.sorted);HTMLArea.util.TYPO3.accessParentElements(parentElements,'args[0].render(args[0].textArea.parent(), args[0].textArea.id)',[this]);}},initEventListeners:function(){this.makeResizable();this.mon(this.textAreaContainer,'show',this.resizable?this.onTextAreaShow:this.onWindowResize,this);this.mon(this.iframe,'show',this.resizable?this.onIframeShow:this.onWindowResize,this);Ext.EventManager.onWindowResize(this.onWindowResize,this);var form=this.textArea.dom.form;if(form){if(Ext.isFunction(form.onreset)){if(typeof(form.htmlAreaPreviousOnReset)=='undefined'){form.htmlAreaPreviousOnReset=[];} form.htmlAreaPreviousOnReset.push(form.onreset);} this.mon(Ext.get(form),'reset',this.onReset,this);} this.addListener({resize:{fn:this.onFrameworkResize}});},editorId:null,getEditor:function(){return RTEarea[this.editorId].editor;},isNested:false,nestedParentElements:{},ready:false,nestedParentElements:{},resizable:false,maxHeight:2000,textAreaInitialSize:{width:0,contextWidth:0,height:0},doLayout:function(){if(!this.isNested||HTMLArea.util.TYPO3.allElementsAreDisplayed(this.nestedParentElements.sorted)){HTMLArea.Framework.superclass.doLayout.call(this);}else{var parentElements=[].concat(this.nestedParentElements.sorted);HTMLArea.util.TYPO3.accessParentElements(parentElements,'HTMLArea.Framework.superclass.doLayout.call(args[0])',[this]);}},onLayout:function(){if(!this.isNested||HTMLArea.util.TYPO3.allElementsAreDisplayed(this.nestedParentElements.sorted)){HTMLArea.Framework.superclass.onLayout.call(this);}else{var parentElements=[].concat(this.nestedParentElements.sorted);HTMLArea.util.TYPO3.accessParentElements(parentElements,'HTMLArea.Framework.superclass.onLayout.call(args[0])',[this]);}},makeResizable:function(){if(this.resizable){this.addClass('resizable');this.resizer=new Ext.Resizable(this.getEl(),{minWidth:300,maxHeight:this.maxHeight,dynamic:false});this.resizer.on('resize',this.onHtmlAreaResize,this);}},onHtmlAreaResize:function(resizer,width,height,event){this.setWidth(width);this.iframe.setHeight(this.getInnerHeight());this.textArea.setSize(this.getInnerWidth(),this.getInnerHeight());},onWindowResize:function(width,height){if(!this.isNested||HTMLArea.util.TYPO3.allElementsAreDisplayed(this.nestedParentElements.sorted)){this.resizeFramework(width,height);}else{var parentElements=[].concat(this.nestedParentElements.sorted);HTMLArea.util.TYPO3.accessParentElements(parentElements,'args[0].resizeFramework(args[1], args[2])',[this,width,height]);}},resizeFramework:function(width,height){var frameworkHeight=parseInt(this.textAreaInitialSize.height);if(this.textAreaInitialSize.width.indexOf('%')===-1){var frameworkWidth=parseInt(this.textAreaInitialSize.width)-this.getFrameWidth();}else{if(Ext.isNumber(width)){var frameworkWidth=parseInt(((width-this.textAreaInitialSize.wizardsWidth-(this.fullScreen?10:Ext.getScrollBarWidth())-this.getBox().x-15)*parseInt(this.textAreaInitialSize.width))/100);}else{var frameworkWidth=parseInt(((HTMLArea.util.TYPO3.getWindowSize().width-this.textAreaInitialSize.wizardsWidth-(this.fullScreen?10:Ext.getScrollBarWidth())-this.getBox().x-15)*parseInt(this.textAreaInitialSize.width))/100);}} if(this.resizable){this.resizer.resizeTo(frameworkWidth,frameworkHeight);}else{this.setSize(frameworkWidth,frameworkHeight);this.doLayout();}},onFrameworkResize:function(){this.iframe.setSize(this.getInnerWidth(),this.getInnerHeight());this.textArea.setSize(this.getInnerWidth(),this.getInnerHeight());},onTextAreaShow:function(){this.iframe.setHeight(this.getInnerHeight());this.textArea.setHeight(this.getInnerHeight());},onIframeShow:function(){if(this.getInnerHeight()<=0){this.onWindowResize();}else{this.iframe.setHeight(this.getInnerHeight());this.textArea.setHeight(this.getInnerHeight());}},getInnerHeight:function(){return this.getSize().height-this.toolbar.getHeight()-this.statusBar.getHeight()-5;},onIframeReady:function(){this.ready=this.rendered&&this.toolbar.rendered&&this.statusBar.rendered&&this.textAreaContainer.rendered;if(this.ready){this.initEventListeners();this.textAreaContainer.show();if(!this.getEditor().config.showStatusBar){this.statusBar.hide();} this.onWindowResize();this.fireEvent('HTMLAreaEventFrameworkReady');}else{this.onIframeReady.defer(50,this);}},onReset:function(event){this.getEditor().setHTML(this.textArea.getValue());this.toolbar.update();var htmlAreaPreviousOnReset=event.getTarget().dom.htmlAreaPreviousOnReset;if(typeof(htmlAreaPreviousOnReset)!='undefined'){Ext.each(htmlAreaPreviousOnReset,function(onReset){onReset();return true;});}},onBeforeDestroy:function(){Ext.EventManager.removeResizeListener(this.onWindowResize,this);var form=this.textArea.dom.form;if(form){form.htmlAreaPreviousOnReset=null;Ext.get(form).dom=null;} Ext.getBody().dom=null;this.toolbar.destroy();this.statusBar.destroy();this.removeAll(true);if(this.resizer){this.resizer.destroy();} return true;}});Ext.reg('htmlareaframework',HTMLArea.Framework);HTMLArea.Editor=Ext.extend(Ext.util.Observable,{constructor:function(config){HTMLArea.Editor.superclass.constructor.call(this,{});this.config=config;this.editorId=this.config.editorId;RTEarea[this.editorId].editor=this;this.textArea=Ext.get(this.config.id);this.textAreaInitialSize={width:this.config.RTEWidthOverride?this.config.RTEWidthOverride:this.textArea.getStyle('width'),height:this.config.fullScreen?HTMLArea.util.TYPO3.getWindowSize().height-20:this.textArea.getStyle('height'),wizardsWidth:0};this.nestedParentElements={all:this.config.tceformsNested,sorted:HTMLArea.util.TYPO3.simplifyNested(this.config.tceformsNested)};this.isNested=!Ext.isEmpty(this.nestedParentElements.sorted);if(Ext.get('typo3-docheader')){this.wizards=this.textArea.parent().parent().next();if(this.wizards){if(!this.isNested||HTMLArea.util.TYPO3.allElementsAreDisplayed(this.nestedParentElements.sorted)){this.textAreaInitialSize.wizardsWidth=this.wizards.getWidth();}else{var parentElements=[].concat(this.nestedParentElements.sorted);this.textAreaInitialSize.wizardsWidth=HTMLArea.util.TYPO3.accessParentElements(parentElements,'args[0].getWidth()',[this.wizards]);} this.wizards.hide();}} this.plugins={};Ext.iterate(this.config.plugin,function(plugin){if(this.config.plugin[plugin]){this.registerPlugin(plugin);}},this);this.ajax=new HTMLArea.Ajax({editor:this});this.inhibitKeyboardInput=false;this.addEvents('HTMLAreaEventEditorReady','HTMLAreaEventModeChange');},ready:false,mode:'textmode',generate:function(){this.htmlArea=new HTMLArea.Framework({id:this.editorId+'-htmlArea',layout:'anchor',baseCls:'htmlarea',editorId:this.editorId,textArea:this.textArea,textAreaInitialSize:this.textAreaInitialSize,fullScreen:this.config.fullScreen,resizable:this.config.resizable,maxHeight:this.config.maxHeight,isNested:this.isNested,nestedParentElements:this.nestedParentElements,tbar:{xtype:'htmlareatoolbar',id:this.editorId+'-toolbar',anchor:'100%',layout:'form',cls:'toolbar',editorId:this.editorId},items:[{xtype:'htmlareaiframe',itemId:'iframe',anchor:'100%',width:(this.textAreaInitialSize.width.indexOf('%')===-1)?parseInt(this.textAreaInitialSize.width):300,height:parseInt(this.textAreaInitialSize.height),autoEl:{id:this.editorId+'-iframe',tag:'iframe',cls:'editorIframe',src:Ext.isGecko?'javascript:void(0);':(Ext.isWebKit?'javascript: \''+HTMLArea.htmlEncode(this.config.documentType+this.config.blankDocument)+'\'':HTMLArea.editorUrl+'popups/blank.html')},isNested:this.isNested,nestedParentElements:this.nestedParentElements,editorId:this.editorId},{xtype:'box',itemId:'textAreaContainer',anchor:'100%',width:(this.textAreaInitialSize.width.indexOf('%')===-1)?parseInt(this.textAreaInitialSize.width):300,listeners:{afterrender:{fn:function(textAreaContainer){this.originalParent=this.textArea.parent().dom;textAreaContainer.getEl().appendChild(this.textArea);},single:true,scope:this},beforedestroy:{fn:function(textAreaContainer){this.originalParent.appendChild(this.textArea.dom);return true;},single:true,scope:this}}}],bbar:{xtype:'htmlareastatusbar',anchor:'100%',cls:'statusBar',editorId:this.editorId}});this.toolbar=this.htmlArea.getTopToolbar();this.statusBar=this.htmlArea.getBottomToolbar();this.iframe=this.htmlArea.getComponent('iframe');this.textAreaContainer=this.htmlArea.getComponent('textAreaContainer');this.relayEvents(this.htmlArea,['HTMLAreaEventFrameworkReady']);this.on('HTMLAreaEventFrameworkReady',this.onFrameworkReady,this,{single:true});},onFrameworkReady:function(){this.setMode('wysiwyg');this.initEventsListening();this.generatePlugins();this.show();if(this.wizards){this.wizards.show();} Ext.iterate(RTEarea,function(editorId,RTE){if(!Ext.isDefined(RTE.editor)||(RTE.editor.isNested&&!HTMLArea.util.TYPO3.allElementsAreDisplayed(RTE.editor.nestedParentElements.sorted))){return true;}else{RTE.editor.focus();return false;}},this);this.ready=true;this.fireEvent('HTMLAreaEventEditorReady');HTMLArea._appendToLog('[HTMLArea.Editor::onFrameworkReady]: Editor ready.');},setMode:function(mode){switch(mode){case'textmode':this.textArea.set({value:this.getHTML()},false);this.iframe.setDesignMode(false);this.iframe.hide();this.textAreaContainer.show();this.mode=mode;break;case'wysiwyg':try{this.document.body.innerHTML=this.getHTML();}catch(e){HTMLArea._appendToLog('[HTMLArea.Editor::setMode]: The HTML document is not well-formed.');TYPO3.Dialog.ErrorDialog({title:'htmlArea RTE',msg:HTMLArea.I18N.msg['HTML-document-not-well-formed']});break;} this.textAreaContainer.hide();this.iframe.show();this.iframe.setDesignMode(true);this.mode=mode;break;} this.fireEvent('HTMLAreaEventModeChange',this.mode);this.focus();Ext.iterate(this.plugins,function(pluginId){this.getPlugin(pluginId).onMode(this.mode);},this);},getMode:function(){return this.mode;},getHTML:function(){switch(this.mode){case'wysiwyg':return this.iframe.getHTML();case'textmode':return this.textArea.getValue().replace(/[\x20]+/g,'\x20').replace(/^\x20/g,' ').replace(/\x20$/g,' ');default:return'';}},getInnerHTML:function(){switch(this.mode){case'wysiwyg':return this.document.body.innerHTML;case'textmode':return this.textArea.getValue();default:return'';}},setHTML:function(html){switch(this.mode){case'wysiwyg':this.document.body.innerHTML=html;break;case'textmode':this.textArea.set({value:html},false);;break;}},registerPlugin:function(pluginName){var plugin=null;if(Ext.isString(pluginName)){try{plugin=eval(pluginName);}catch(e){try{plugin=eval('HTMLArea.'+pluginName);}catch(error){HTMLArea._appendToLog('ERROR [HTMLArea.Editor::registerPlugin]: Cannot register invalid plugin: '+error);return false;}}} if(!Ext.isFunction(plugin)){HTMLArea._appendToLog('ERROR [HTMLArea.Editor::registerPlugin]: Cannot register undefined plugin.');return false;} var pluginInstance=new plugin(this,pluginName);if(pluginInstance){var pluginInformation=pluginInstance.getPluginInformation();pluginInformation.instance=pluginInstance;this.plugins[pluginName]=pluginInformation;HTMLArea._appendToLog('[HTMLArea.Editor::registerPlugin]: Plugin '+pluginName+' was successfully registered.');return true;}else{HTMLArea._appendToLog("ERROR [HTMLArea.Editor::registerPlugin]: Can't register plugin "+pluginName+'.');return false;}},generatePlugins:function(){this.hasPluginWithOnKeyPressHandler=false;Ext.iterate(this.plugins,function(pluginId){var plugin=this.getPlugin(pluginId);plugin.onGenerate();if(Ext.isFunction(plugin.onKeyPress)){this.hasPluginWithOnKeyPressHandler=true;HTMLArea._appendToLog('[HTMLArea.Editor::generatePlugins]: Deprecated use of onKeyPress function by plugin '+pluginId+'. Use keyMap instead.');}},this);HTMLArea._appendToLog('[HTMLArea.Editor::generatePlugins]: All plugins successfully generated.');},getPlugin:function(pluginName){return(this.plugins[pluginName]?this.plugins[pluginName].instance:null);},unRegisterPlugin:function(pluginName){delete this.plugins[pluginName].instance;delete this.plugins[pluginName];},focus:function(){switch(this.getMode()){case'wysiwyg':this.iframe.focus();break;case'textmode':this.textArea.focus();break;}},initEventsListening:function(){if(Ext.isOpera){this.iframe.startListening();} var iframe=this.iframe.getEl().dom;Ext.EventManager.on(iframe.contentWindow?iframe.contentWindow:iframe.contentDocument,'unload',this.onUnload,this,{single:true});},show:function(){document.getElementById('pleasewait'+this.editorId).style.display='none';document.getElementById('editorWrap'+this.editorId).style.visibility='visible';},appendToLog:function(objectName,functionName,text){HTMLArea.appendToLog(this.editorId,objectName,functionName,text);},onUnload:function(event){if(this.ready){this.textArea.set({value:this.getHTML()},false);} Ext.TaskMgr.stopAll();this.htmlArea.destroy();Ext.iterate(this.plugins,function(pluginId){this.unRegisterPlugin(pluginId);},this);this.purgeListeners();if(this.wizards){this.wizards.dom=null;this.textArea.parent().parent().dom=null;this.textArea.parent().dom=null;} this.textArea.dom=null;RTEarea[this.editorId].editor=null;}});HTMLArea.Ajax=function(config){Ext.apply(this,config);};HTMLArea.Ajax=Ext.extend(HTMLArea.Ajax,{getJavascriptFile:function(url,callback,scope){var success=false;var self=this;this.editor.appendToLog('HTMLArea.Ajax','getJavascriptFile','Requesting script '+url);Ext.Ajax.request({method:'GET',url:url,callback:callback,success:function(response){success=true;},failure:function(response){self.editor.inhibitKeyboardInput=false;self.editor.appendToLog('HTMLArea.Ajax','getJavascriptFile','Unable to get '+url+' . Server reported '+response.status);},scope:scope});return success;},postData:function(url,data,callback,scope){var success=false;var self=this;data.charset=this.editor.config.typo3ContentCharset?this.editor.config.typo3ContentCharset:'utf-8';var params='';Ext.iterate(data,function(parameter,value){params+=(params.length?'&':'')+parameter+'='+encodeURIComponent(value);});params+=this.editor.config.RTEtsConfigParams;this.editor.appendToLog('HTMLArea.Ajax','postData','Posting to '+url+'. Data: '+params);Ext.Ajax.request({method:'POST',headers:{'Content-Type':'application/x-www-form-urlencoded; charset=UTF-8'},url:url,params:params,callback:Ext.isFunction(callback)?callback:function(options,success,response){if(success){self.editor.appendToLog('HTMLArea.Ajax','postData','Post request to '+url+' successful. Server response: '+response.responseText);}else{self.editor.appendToLog('HTMLArea.Ajax','postData','Post request to '+url+' failed. Server reported '+response.status);}},success:function(response){success=true;},failure:function(response){self.editor.appendToLog('HTMLArea.Ajax','postData','Unable to post '+url+' . Server reported '+response.status);},scope:scope});return success;}});HTMLArea.util.TYPO3=function(){return{simplifyNested:function(nested){var i,type,level,elementId,max,simplifiedNested=[],elementIdSuffix={tab:'-DIV',inline:'_fields',flex:'-content'};if(nested&&nested.length){if(nested[0][0]=='inline'){nested=inline.findContinuedNestedLevel(nested,nested[0][1]);} for(i=0,max=nested.length;i=0;){value=element.getAttribute(allowedAttributes[i]);if(value){if(allowedAttributes[i]=="style"&&element.style.cssText){return true;}else{return true;}}} return false;};HTMLArea.Editor.prototype.hasSelectedText=function(){return this.getSelectedHTML()!="";};HTMLArea.Editor.prototype.getAllAncestors=function(){var p=this.getParentElement();var a=[];while(p&&(p.nodeType===1)&&(p.nodeName.toLowerCase()!=="body")){a.push(p);p=p.parentNode;} a.push(this.document.body);return a;};HTMLArea.Editor.prototype.getBlockAncestors=function(element,withinBlock){var ancestors=new Array();var ancestor=element;while(ancestor&&(ancestor.nodeType===1)&&!/^(body)$/i.test(ancestor.nodeName)&&ancestor!=withinBlock){if(HTMLArea.isBlockElement(ancestor)){ancestors.unshift(ancestor);} ancestor=ancestor.parentNode;} ancestors.unshift(ancestor);return ancestors;};HTMLArea.Editor.prototype.getEndBlocks=function(selection){var range=this._createRange(selection);if(!Ext.isIE){var parentStart=range.startContainer;if(/^(body)$/i.test(parentStart.nodeName)){parentStart=parentStart.firstChild;} var parentEnd=range.endContainer;if(/^(body)$/i.test(parentEnd.nodeName)){parentEnd=parentEnd.lastChild;}}else{if(selection.type!=="Control"){var rangeEnd=range.duplicate();range.collapse(true);var parentStart=range.parentElement();rangeEnd.collapse(false);var parentEnd=rangeEnd.parentElement();}else{var parentStart=range.item(0);var parentEnd=parentStart;}} while(parentStart&&!HTMLArea.isBlockElement(parentStart)){parentStart=parentStart.parentNode;} while(parentEnd&&!HTMLArea.isBlockElement(parentEnd)){parentEnd=parentEnd.parentNode;} return{start:parentStart,end:parentEnd};};HTMLArea.Editor.prototype.endPointsInSameBlock=function(){var selection=this._getSelection();if(this._selectionEmpty(selection)){return true;}else{var parent=this.getParentElement(selection);var endBlocks=this.getEndBlocks(selection);return(endBlocks.start===endBlocks.end&&!/^(table|thead|tbody|tfoot|tr)$/i.test(parent.nodeName));}};HTMLArea.Editor.prototype._getFirstAncestor=function(sel,types){var prnt=this._activeElement(sel);if(prnt==null){try{prnt=(Ext.isIE?this._createRange(sel).parentElement():this._createRange(sel).commonAncestorContainer);}catch(e){return null;}} if(typeof(types)=='string')types=[types];while(prnt){if(prnt.nodeType==1){if(types==null)return prnt;for(var i=0;ih+t||e.offsetTop");str=str.replace(/ /g,"\xA0");str=str.replace(/"/g,"\x22");str=str.replace(/'/g,"'");str=str.replace(/&/g,"&");return str;};HTMLArea.htmlEncode=function(str){if(typeof(str)!='string')str=str.toString();str=str.replace(/&/g,"&");str=str.replace(//g,">");str=str.replace(/\xA0/g," ");str=str.replace(/\x22/g,""");return str;};HTMLArea.getHTML=function(root,outputRoot,editor){try{return editor.iframe.htmlRenderer.render(root,outputRoot);}catch(e){HTMLArea._appendToLog('[HTMLArea::getHTML]: The HTML document is not well-formed.');if(!HTMLArea.enableDebugMode){TYPO3.Dialog.ErrorDialog({title:'htmlArea RTE',msg:HTMLArea.I18N.msg['HTML-document-not-well-formed']});return editor.document.body.innerHTML;}else{return editor.iframe.htmlRenderer.render(root,outputRoot);}}};HTMLArea.getPrevNode=function(node){if(!node)return null;if(node.previousSibling)return node.previousSibling;if(node.parentNode)return node.parentNode;return null;};HTMLArea.getNextNode=function(node){if(!node)return null;if(node.nextSibling)return node.nextSibling;if(node.parentNode)return node.parentNode;return null;};HTMLArea.removeFromParent=function(el){if(!el.parentNode)return;var pN=el.parentNode;pN.removeChild(el);return el;};HTMLArea.DOM=function(){return{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12,getClassNames:function(node){var classNames=[];if(node){if(node.className&&/\S/.test(node.className)){classNames=node.className.trim().split(' ');} if(HTMLArea.reservedClassNames.test(node.className)){var cleanClassNames=[];var j=-1;for(var i=0;i=0;){found=((classes[i]==className)||(substring&&classes[i].indexOf(className)==0));if(found){break;}}} return found;},addClass:function(node,className){if(node){HTMLArea.DOM.removeClass(node,className);if(node.className&&HTMLArea.classesXOR&&HTMLArea.classesXOR[className]&&Ext.isFunction(HTMLArea.classesXOR[className].test)){var classNames=node.className.trim().split(' ');for(var i=classNames.length;--i>=0;){if(HTMLArea.classesXOR[className].test(classNames[i])){HTMLArea.DOM.removeClass(node,classNames[i]);}}} if(node.className){node.className+=' '+className;}else{node.className=className;}}},removeClass:function(node,className,substring){if(node&&node.className){var classes=node.className.trim().split(' ');var newClasses=[];for(var i=classes.length;--i>=0;){if((!substring&&classes[i]!=className)||(substring&&classes[i].indexOf(className)!=0)){newClasses[newClasses.length]=classes[i];}} if(newClasses.length){node.className=newClasses.join(' ');}else{if(!Ext.isOpera){node.removeAttribute('class');if(Ext.isIE){node.removeAttribute('className');}}else{node.className='';}}}},makeUrlsAbsolute:function(node,baseUrl,walker){walker.walk(node,true,'HTMLArea.DOM.makeImageSourceAbsolute(node, args[0]) || HTMLArea.DOM.makeLinkHrefAbsolute(node, args[0])','Ext.emptyFn',[baseUrl]);},makeImageSourceAbsolute:function(node,baseUrl){if(/^img$/i.test(node.nodeName)){var src=node.getAttribute('src');if(src){node.setAttribute('src',HTMLArea.DOM.addBaseUrl(src,baseUrl));} return true;} return false;},makeLinkHrefAbsolute:function(node,baseUrl){if(/^a$/i.test(node.nodeName)){var href=node.getAttribute('href');if(href){node.setAttribute('href',HTMLArea.DOM.addBaseUrl(href,baseUrl));} return true;} return false;},addBaseUrl:function(url,baseUrl){var absoluteUrl=url;if(!/^[a-z0-9_]{2,}\:/i.test(absoluteUrl)){var base=baseUrl;while(absoluteUrl.match(/^\.\.\/(.*)/)){absoluteUrl=RegExp.$1;base.match(/(.*\:\/\/.*\/)[^\/]+\/$/);base=RegExp.$1;absoluteUrl=base+absoluteUrl;} if(!/^.*\:\/\//.test(absoluteUrl)){absoluteUrl=baseUrl+absoluteUrl;}} return absoluteUrl;}};}();HTMLArea.DOM.Walker=function(config){var configDefaults={keepComments:false,keepCDATASections:false,removeTags:/none/i,removeTagsAndContents:/none/i,keepTags:/.*/i,removeAttributes:/none/i,removeTrailingBR:true,baseUrl:''};Ext.apply(this,config,configDefaults);};HTMLArea.DOM.Walker=Ext.extend(HTMLArea.DOM.Walker,{walk:function(node,includeNode,startCallback,endCallback,args){if(!this.removeTagsAndContents.test(node.nodeName)){if(includeNode){eval(startCallback);} var child=node.firstChild;while(child){this.walk(child,true,startCallback,endCallback,args);child=child.nextSibling;} if(includeNode){eval(endCallback);}}},render:function(node,includeNode){this.html='';this.walk(node,includeNode,'args[0].renderNodeStart(node)','args[0].renderNodeEnd(node)',[this]);return this.html;},renderNodeStart:function(node){var html='';switch(node.nodeType){case HTMLArea.DOM.ELEMENT_NODE:if(this.keepTags.test(node.nodeName)&&!this.removeTags.test(node.nodeName)){html+=this.setOpeningTag(node);} break;case HTMLArea.DOM.TEXT_NODE:html+=/^(script|style)$/i.test(node.parentNode.nodeName)?node.data:HTMLArea.htmlEncode(node.data);break;case HTMLArea.DOM.ENTITY_NODE:html+=node.nodeValue;break;case HTMLArea.DOM.ENTITY_REFERENCE_NODE:html+='&'+node.nodeValue+';';break;case HTMLArea.DOM.COMMENT_NODE:if(this.keepComments){html+='';} break;case HTMLArea.DOM.CDATA_SECTION_NODE:if(this.keepCDATASections){html+='';} break;default:break;} this.html+=html;},renderNodeEnd:function(node){var html='';if(node.nodeType==HTMLArea.DOM.ELEMENT_NODE){if(this.keepTags.test(node.nodeName)&&!this.removeTags.test(node.nodeName)){html+=this.setClosingTag(node);}} this.html+=html;},getAttributes:function(node){var attributes=node.attributes;var filterededAttributes=[];var attribute,attributeName,attributeValue;for(var i=attributes.length;--i>=0;){attribute=attributes.item(i);attributeName=attribute.nodeName.toLowerCase();attributeValue=attribute.nodeValue;if(/_moz|contenteditable|complete/.test(attributeName)||this.removeAttributes.test(attributeName)){continue;} if(!attribute.specified&&attributeName!=='value'){continue;} if(Ext.isIE){if(attributeName==='style'){attributeValue=node.style.cssText;}else if(attributeName==='href'||attributeName==='src'){attributeValue=this.stripBaseURL(attributeValue);}else if(attributeName==='value'&&/^li$/i.test(node.nodeName)&&attributeValue==0){continue;}}else if(Ext.isGecko){if(/(_moz|^$)/.test(attributeValue)){continue;}else if(attributeName==='href'||attributeName==='src'){attributeValue=HTMLArea.DOM.addBaseUrl(attributeValue,this.baseUrl);}} if(attributeName==='id'&&/^ext-gen/.test(attributeValue)){continue;} filterededAttributes.push({attributeName:attributeName,attributeValue:attributeValue});} return(Ext.isWebKit||Ext.isOpera)?filterededAttributes.reverse():filterededAttributes;},setOpeningTag:function(node){var html='';if(/^br$/i.test(node.nodeName)){if(Ext.isGecko&&node.hasAttribute('_moz_editor_bogus_node')){return html;}else if(this.removeTrailingBR&&!node.nextSibling&&HTMLArea.isBlockElement(node.parentNode)&&(!node.previousSibling||!/^br$/i.test(node.previousSibling.nodeName))){if(!node.previousSibling&&node.parentNode&&/^p$/i.test(node.parentNode.nodeName)&&node.parentNode.className){html+=" ";} return html;}} var attributes=this.getAttributes(node);for(var i=0,n=attributes.length;i':'>');if(/^li$/i.test(node.nodeName)&&!/^[ou]l$/i.test(node.parentNode.nodeName)){html='
    '+html;} return html;},setClosingTag:function(node){var html=HTMLArea.RE_noClosingTag.test(node.nodeName)?'':'';if(/^li$/i.test(node.nodeName)&&!/^[ou]l$/i.test(node.parentNode.nodeName)){html+='
';} return html;},stripBaseURL:function(value){return value;}});HTMLArea.CSS.Parser=Ext.extend(Ext.util.Observable,{constructor:function(config){HTMLArea.CSS.Parser.superclass.constructor.call(this,{});var configDefaults={parseAttemptsMaximumNumber:17,prefixLabelWithClassName:false,postfixLabelWithClassName:false,showTagFreeClasses:false,tags:null,editor:null};Ext.apply(this,config,configDefaults);this.addEvents('HTMLAreaEventCssParsingComplete');},parsedClasses:{},isReady:false,cssLoaded:false,parseAttemptsCounter:0,attemptTimeout:null,error:null,getClasses:function(){return this.parsedClasses;},initiateParsing:function(){if(this.editor.config.classesUrl&&(typeof(HTMLArea.classesLabels)==='undefined')){this.editor.ajax.getJavascriptFile(this.editor.config.classesUrl,function(options,success,response){if(success){try{if(typeof(HTMLArea.classesLabels)==='undefined'){eval(response.responseText);this.editor.appendToLog('HTMLArea.CSS.Parser','initiateParsing','Javascript file successfully evaluated: '+this.editor.config.classesUrl);}}catch(e){this.editor.appendToLog('HTMLArea.CSS.Parser','initiateParsing','Error evaluating contents of Javascript file: '+this.editor.config.classesUrl);}} this.parse();},this);}else{this.parse();}},parse:function(){if(this.editor.document){this.parseStyleSheets();if(!this.cssLoaded){if(this.parseAttemptsCounter-1){var match=pattern.exec(s.substring(index));s=s.substring(index+match[0].length);nodeName=(match[1]&&(match[1]!='*'))?match[1].toLowerCase().trim():'all';className=match[2];if(className&&!HTMLArea.reservedClassNames.test(className)){if(((nodeName!='all')&&(!this.tags||!this.tags[nodeName]))||((nodeName=='all')&&(!this.tags||!this.tags[nodeName])&&this.showTagFreeClasses)||(this.tags&&this.tags[nodeName]&&this.tags[nodeName].allowedClasses&&this.tags[nodeName].allowedClasses.test(className))){if(!this.parsedClasses[nodeName]){this.parsedClasses[nodeName]={};} cssName=className;if(HTMLArea.classesLabels&&HTMLArea.classesLabels[className]){cssName=this.prefixLabelWithClassName?(className+' - '+HTMLArea.classesLabels[className]):HTMLArea.classesLabels[className];cssName=this.postfixLabelWithClassName?(cssName+' - '+className):cssName;} this.parsedClasses[nodeName][className]=cssName;}}}}}},filterAllowedClasses:function(){Ext.iterate(this.tags,function(nodeName){var allowedClasses={};if(nodeName!=='all'&&Ext.isDefined(this.parsedClasses['all'])){if(this.tags&&this.tags[nodeName]&&this.tags[nodeName].allowedClasses){var allowed=this.tags[nodeName].allowedClasses;Ext.iterate(this.parsedClasses['all'],function(cssClass,value){if(allowed.test(cssClass)){allowedClasses[cssClass]=value;}});}else{allowedClasses=this.parsedClasses['all'];}} if(Ext.isDefined(this.parsedClasses[nodeName])){if(this.tags&&this.tags[nodeName]&&this.tags[nodeName].allowedClasses){var allowed=this.tags[nodeName].allowedClasses;Ext.iterate(this.parsedClasses[nodeName],function(cssClass,value){if(allowed.test(cssClass)){allowedClasses[cssClass]=value;}});}else{Ext.iterate(this.parsedClasses[nodeName],function(cssClass,value){allowedClasses[cssClass]=value;});}} this.parsedClasses[nodeName]=allowedClasses;},this);if(this.showTagFreeClasses&&Ext.isDefined(this.parsedClasses['all'])){Ext.iterate(this.parsedClasses,function(nodeName){if(nodeName!=='all'&&!this.tags[nodeName]){Ext.iterate(this.parsedClasses['all'],function(cssClass,value){this.parsedClasses[nodeName][cssClass]=value;},this);}},this);}},sort:function(){Ext.iterate(this.parsedClasses,function(nodeName,value){var classes=[];var sortedClasses={};Ext.iterate(value,function(cssClass){classes.push(cssClass);});function compare(a,b){x=value[a];y=value[b];return((xy)?1:0));} classes=classes.sort(compare);for(var i=0;i>8)&0xFF;var b=(v>>16)&0xFF;return'rgb('+r+','+g+','+b+')';},colorToHex:function(v){if(typeof(v)==='undefined'||v==null){return'';} function hex(d){return(d<16)?('0'+d.toString(16)):d.toString(16);};if(typeof(v)=='number'){var b=v&0xFF;var g=(v>>8)&0xFF;var r=(v>>16)&0xFF;return'#'+hex(r)+hex(g)+hex(b);} if(v.substr(0,3)==='rgb'){var re=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/;if(v.match(re)){var r=parseInt(RegExp.$1);var g=parseInt(RegExp.$2);var b=parseInt(RegExp.$3);return('#'+hex(r)+hex(g)+hex(b)).toUpperCase();} return null;} if(v.substr(0,1)==='#'){return v;} return'';},checkIfColorInPalette:function(color){if(this.el&&!this.el.child('a.color-'+color)){this.deSelect();return false;}}}}();HTMLArea._makeColor=HTMLArea.util.Color.colorToRgb;HTMLArea._colorToRgb=HTMLArea.util.Color.colorToHex;Ext.ColorPalette.prototype.select=Ext.ColorPalette.prototype.select.createInterceptor(HTMLArea.util.Color.checkIfColorInPalette);Ext.override(Ext.ColorPalette,{deSelect:function(){if(this.el&&this.value){this.el.child('a.color-'+this.value).removeClass('x-color-palette-sel');this.value=null;}}});Ext.ux.menu.HTMLAreaColorMenu=Ext.extend(Ext.menu.Menu,{enableScrolling:false,hideOnClick:true,cls:'x-color-menu',colorPaletteValue:'',customColorsValue:'',plain:true,showSeparator:false,initComponent:function(){var paletteItems=[];var width='auto';if(this.colorsConfiguration){paletteItems.push({xtype:'container',layout:'anchor',width:160,style:{float:'right'},items:{xtype:'colorpalette',itemId:'custom-colors',cls:'htmlarea-custom-colors',colors:this.colorsConfiguration,value:this.value,allowReselect:true,tpl:new Ext.XTemplate(' {0}')}});} if(this.colors.length){paletteItems.push({xtype:'container',layout:'anchor',items:{xtype:'colorpalette',itemId:'color-palette',cls:'color-palette',colors:this.colors,value:this.value,allowReselect:true}});} if(this.colorsConfiguration&&this.colors.length){width=350;} Ext.apply(this,{layout:'menu',width:width,items:paletteItems});Ext.ux.menu.HTMLAreaColorMenu.superclass.initComponent.call(this);this.standardPalette=this.find('itemId','color-palette')[0];this.customPalette=this.find('itemId','custom-colors')[0];if(this.standardPalette){this.standardPalette.purgeListeners();this.relayEvents(this.standardPalette,['select']);} if(this.customPalette){this.customPalette.purgeListeners();this.relayEvents(this.customPalette,['select']);} this.on('select',this.menuHide,this);if(this.handler){this.on('select',this.handler,this.scope||this);}},menuHide:function(){if(this.hideOnClick){this.hide(true);}}});Ext.reg('htmlareacolormenu',Ext.ux.menu.HTMLAreaColorMenu);Ext.ux.form.ColorPaletteField=Ext.extend(Ext.form.TriggerField,{triggerClass:'x-form-color-trigger',defaultColors:['000000','222222','444444','666666','999999','BBBBBB','DDDDDD','FFFFFF','660000','663300','996633','003300','003399','000066','330066','660066','990000','993300','CC9900','006600','0033FF','000099','660099','990066','CC0000','CC3300','FFCC00','009900','0066FF','0000CC','663399','CC0099','FF0000','FF3300','FFFF00','00CC00','0099FF','0000FF','9900CC','FF0099','CC3333','FF6600','FFFF33','00FF00','00CCFF','3366FF','9933FF','FF00FF','FF6666','FF6633','FFFF66','66FF66','00FFFF','3399FF','9966FF','FF66FF','FF9999','FF9966','FFFF99','99FF99','99FFFF','66CCFF','9999FF','FF99FF','FFCCCC','FFCC99','FFFFCC','CCFFCC','CCFFFF','99CCFF','CCCCFF','FFCCFF'],colorizeFieldBackgroud:true,colorizeFieldText:true,colorizeTrigger:false,editable:true,initComponent:function(){Ext.ux.form.ColorPaletteField.superclass.initComponent.call(this);if(!this.colors){this.colors=this.defaultColors;} this.addEvents('select');},validateBlur:function(){return!this.menu||!this.menu.isVisible();},setValue:function(color){if(color){if(this.colorizeFieldBackgroud){this.el.applyStyles('background: #'+color+';');} if(this.colorizeFieldText){this.el.applyStyles('color: #'+this.rgbToHex(this.invert(this.hexToRgb(color)))+';');} if(this.colorizeTrigger){this.trigger.applyStyles('background-color: #'+color+';');}} return Ext.ux.form.ColorPaletteField.superclass.setValue.call(this,color);},onDestroy:function(){Ext.destroy(this.menu);Ext.ux.form.ColorPaletteField.superclass.onDestroy.call(this);},onTriggerClick:function(){if(this.disabled){return;} if(this.menu==null){this.menu=new Ext.ux.menu.HTMLAreaColorMenu({cls:'htmlarea-color-menu',hideOnClick:false,colors:this.colors,colorsConfiguration:this.colorsConfiguration,value:this.getValue()});} this.onFocus();this.menu.show(this.el,"tl-bl?");this.menuEvents('on');},menuEvents:function(method){this.menu[method]('select',this.onSelect,this);this.menu[method]('hide',this.onMenuHide,this);this.menu[method]('show',this.onFocus,this);},onSelect:function(m,d){this.setValue(d);this.fireEvent('select',this,d);this.menu.hide();},onMenuHide:function(){this.focus(false,60);this.menuEvents('un');},invert:function(r,g,b){if(r instanceof Array){return this.invert.call(this,r[0],r[1],r[2]);} return[255-r,255-g,255-b];},hexToRgb:function(hex){return[this.hexToDec(hex.substr(0,2)),this.hexToDec(hex.substr(2,2)),this.hexToDec(hex.substr(4,2))];},hexToDec:function(hex){var s=hex.split('');return((this.getHCharPos(s[0])*16)+this.getHCharPos(s[1]));},getHCharPos:function(c){var HCHARS='0123456789ABCDEF';return HCHARS.indexOf(c.toUpperCase());},rgbToHex:function(r,g,b){if(r instanceof Array){return this.rgbToHex.call(this,r[0],r[1],r[2]);} return this.decToHex(r)+this.decToHex(g)+this.decToHex(b);},decToHex:function(n){var HCHARS='0123456789ABCDEF';n=parseInt(n,10);n=(!isNaN(n))?n:0;n=(n>255||n<0)?0:n;return HCHARS.charAt((n-n%16)/16)+HCHARS.charAt(n%16);}});Ext.reg('colorpalettefield',Ext.ux.form.ColorPaletteField);HTMLArea.getElementById=function(tag,id){var el,i,objs=document.getElementsByTagName(tag);for(i=objs.length;--i>=0&&(el=objs[i]);){if(el.id==id)return el;} return null;};var lorem_ipsum=function(element,text){if(element.tagName.toLowerCase()=="textarea"&&element.id&&element.id.substr(0,7)=="RTEarea"){var editor=RTEarea[element.id.substr(7,element.id.length)]["editor"];editor.insertHTML(text);editor.toolbar.update();}};HTMLArea.initEditor=function(editorNumber){if(document.getElementById('pleasewait'+editorNumber)){if(HTMLArea.checkSupportedBrowser()){document.getElementById('pleasewait'+editorNumber).style.display='block';document.getElementById('editorWrap'+editorNumber).style.visibility='hidden';if(!HTMLArea.isReady){HTMLArea.initEditor.defer(150,null,[editorNumber]);}else{HTMLArea._appendToLog("[HTMLArea::initEditor]: Initializing editor with editor Id: "+editorNumber+".");var editor=new HTMLArea.Editor(Ext.apply(new HTMLArea.Config(editorNumber),RTEarea[editorNumber]));editor.generate();return false;}}else{document.getElementById('pleasewait'+editorNumber).style.display='none';document.getElementById('editorWrap'+editorNumber).style.visibility='visible';}}};HTMLArea.Base=function(){if(arguments.length){if(this==window){HTMLArea.Base.prototype.extend.call(arguments[0],arguments.callee.prototype);}else{this.extend(arguments[0]);}}};HTMLArea.Base.version="1.0.2";HTMLArea.Base.prototype={extend:function(source,value){var extend=HTMLArea.Base.prototype.extend;if(arguments.length==2){var ancestor=this[source];if((ancestor instanceof Function)&&(value instanceof Function)&&ancestor.valueOf()!=value.valueOf()&&/\bbase\b/.test(value)){var method=value;value=function(){var previous=this.base;this.base=ancestor;var returnValue=method.apply(this,arguments);this.base=previous;return returnValue;};value.valueOf=function(){return method;};value.toString=function(){return String(method);};} return this[source]=value;}else if(source){var _prototype={toSource:null};var _protected=["toString","valueOf"];if(HTMLArea.Base._prototyping)_protected[2]="constructor";for(var i=0;(name=_protected[i]);i++){if(source[name]!=_prototype[name]){extend.call(this,name,source[name]);}} for(var name in source){if(!_prototype[name]){extend.call(this,name,source[name]);}}} return this;},base:function(){}};HTMLArea.Base.extend=function(_instance,_static){var extend=HTMLArea.Base.prototype.extend;if(!_instance)_instance={};HTMLArea.Base._prototyping=true;var _prototype=new this;extend.call(_prototype,_instance);var constructor=_prototype.constructor;_prototype.constructor=this;delete HTMLArea.Base._prototyping;var klass=function(){if(!HTMLArea.Base._prototyping)constructor.apply(this,arguments);this.constructor=klass;};klass.prototype=_prototype;klass.extend=this.extend;klass.implement=this.implement;klass.toString=function(){return String(constructor);};extend.call(klass,_static);var object=constructor?klass:_prototype;return object;};HTMLArea.Base.implement=function(_interface){if(_interface instanceof Function)_interface=_interface.prototype;this.prototype.extend(_interface);};HTMLArea.Plugin=HTMLArea.Base.extend({constructor:function(editor,pluginName){this.editor=editor;this.editorNumber=editor.editorId;this.editorId=editor.editorId;this.editorConfiguration=editor.config;this.name=pluginName;try{this.I18N=HTMLArea.I18N[this.name];}catch(e){this.I18N=new Object();} return this.configurePlugin(editor);},configurePlugin:function(editor){return false;},registerPluginInformation:function(pluginInformation){if(typeof(pluginInformation)!=="object"){this.appendToLog("registerPluginInformation","Plugin information was not provided");return false;}else{this.pluginInformation=pluginInformation;this.pluginInformation.name=this.name;this.pluginInformation.developer_url=this.pluginInformation.developerUrl;this.pluginInformation.c_owner=this.pluginInformation.copyrightOwner;this.pluginInformation.sponsor_url=this.pluginInformation.sponsorUrl;return true;}},getPluginInformation:function(){return this.pluginInformation;},getPluginInstance:function(pluginName){return this.editor.getPlugin(pluginName);},getEditorMode:function(){return this.editor.getMode();},isButtonInToolbar:function(buttonId){var index=-1;Ext.each(this.editorConfiguration.toolbar,function(row){Ext.each(row,function(group){index=group.indexOf(buttonId);return index===-1;});return index===-1;});return index!==-1;},getButton:function(buttonId){return this.editor.toolbar.getButton(buttonId);},registerButton:function(buttonConfiguration){if(this.isButtonInToolbar(buttonConfiguration.id)){if(Ext.isString(buttonConfiguration.action)&&Ext.isFunction(this[buttonConfiguration.action])){buttonConfiguration.plugins=this;if(buttonConfiguration.dialog){if(!buttonConfiguration.dimensions){buttonConfiguration.dimensions={width:250,height:250};} buttonConfiguration.dimensions.top=buttonConfiguration.dimensions.top?buttonConfiguration.dimensions.top:this.editorConfiguration.dialogueWindows.defaultPositionFromTop;buttonConfiguration.dimensions.left=buttonConfiguration.dimensions.left?buttonConfiguration.dimensions.left:this.editorConfiguration.dialogueWindows.defaultPositionFromLeft;} buttonConfiguration.hidden=buttonConfiguration.hide;if(this.editorConfiguration.buttons[this.editorConfiguration.convertButtonId[buttonConfiguration.id]]){Ext.applyIf(buttonConfiguration,this.editorConfiguration.buttons[this.editorConfiguration.convertButtonId[buttonConfiguration.id]]);} if(this.editorConfiguration.registerButton(buttonConfiguration)){var hotKey=buttonConfiguration.hotKey?buttonConfiguration.hotKey:((this.editorConfiguration.buttons[this.editorConfiguration.convertButtonId[buttonConfiguration.id]]&&this.editorConfiguration.buttons[this.editorConfiguration.convertButtonId[buttonConfiguration.id]].hotKey)?this.editorConfiguration.buttons[this.editorConfiguration.convertButtonId[buttonConfiguration.id]].hotKey:null);if(!hotKey&&buttonConfiguration.hotKey=="0"){hotKey="0";} if(!hotKey&&this.editorConfiguration.buttons[this.editorConfiguration.convertButtonId[buttonConfiguration.id]]&&this.editorConfiguration.buttons[this.editorConfiguration.convertButtonId[buttonConfiguration.id]].hotKey=="0"){hotKey="0";} if(hotKey||hotKey=="0"){var hotKeyConfiguration={id:hotKey,cmd:buttonConfiguration.id};return this.registerHotKey(hotKeyConfiguration);} return true;}}else{this.appendToLog("registerButton","Function "+buttonConfiguration.action+" was not defined when registering button "+buttonConfiguration.id);}} return false;},registerDropDown:function(dropDownConfiguration){if(this.isButtonInToolbar(dropDownConfiguration.id)){if(Ext.isString(dropDownConfiguration.action)&&Ext.isFunction(this[dropDownConfiguration.action])){dropDownConfiguration.plugins=this;dropDownConfiguration.hidden=dropDownConfiguration.hide;dropDownConfiguration.xtype='htmlareacombo';if(this.editorConfiguration.buttons[this.editorConfiguration.convertButtonId[dropDownConfiguration.id]]){Ext.applyIf(dropDownConfiguration,this.editorConfiguration.buttons[this.editorConfiguration.convertButtonId[dropDownConfiguration.id]]);} return this.editorConfiguration.registerButton(dropDownConfiguration);}else{this.appendToLog('registerDropDown','Function '+dropDownConfiguration.action+' was not defined when registering drop-down '+dropDownConfiguration.id);}} return false;},registerText:function(textConfiguration){if(this.isButtonInToolbar(textConfiguration.id)){textConfiguration.plugins=this;textConfiguration.xtype='htmlareatoolbartext';return this.editorConfiguration.registerButton(textConfiguration);} return false;},getDropDownConfiguration:function(dropDownId){return this.editorConfiguration.buttonsConfig[dropDownId];},registerHotKey:function(hotKeyConfiguration){return this.editorConfiguration.registerHotKey(hotKeyConfiguration);},translateHotKey:function(key){if(typeof(this.editorConfiguration.hotKeyList[key])!=="undefined"){var buttonId=this.editorConfiguration.hotKeyList[key].cmd;if(typeof(buttonId)!=="undefined"){return buttonId;}else{return"";}} return"";},getHotKeyConfiguration:function(key){if(Ext.isDefined(this.editorConfiguration.hotKeyList[key])){return this.editorConfiguration.hotKeyList[key];}else{return null;}},init:Ext.emptyFn,onUpdateToolbar:Ext.emptyFn,onKeyPress:null,onMode:function(mode){if(mode==="textmode"&&this.dialog&&HTMLArea.Dialog[this.name]==this.dialog&&!(this.dialog.buttonId&&this.editorConfiguration.buttons[this.dialog.buttonId]&&this.editorConfiguration.buttons[this.dialog.buttonId].textMode)){this.dialog.close();}},onGenerate:Ext.emptyFn,makeFunctionReference:function(functionName){var self=this;return(function(arg1,arg2,arg3){return(self[functionName](arg1,arg2,arg3));});},localize:function(label){return this.I18N[label]||HTMLArea.localize(label);},getHelpTip:function(fieldName,label,pluginName){if(Ext.isDefined(TYPO3.ContextHelp)){var pluginName=Ext.isDefined(pluginName)?pluginName:this.name;return''+(this.localize(label)||label)+'';}else{return this.localize(label)||label;}},getJavascriptFile:function(url,callback){this.appendToLog('getJavascriptFile','Requesting script '+url);return this.editor.ajax.getJavascriptFile(url,callback,this);},postData:function(url,data,callback){this.appendToLog('postData','Posting to '+url+'.');return this.editor.ajax.postData(url,data,callback,this);},openDialog:function(buttonId,url,action,arguments,dimensions,showScrollbars,dialogOpener){if(this.dialog&&this.dialog.hasOpenedWindow()&&this.dialog.buttonId===buttonId){this.dialog.focus();return this.dialog;}else{var actionFunctionReference=action;if(typeof(action)==="string"){if(typeof(this[action])==="function"){var actionFunctionReference=this.makeFunctionReference(action);}else{this.appendToLog("openDialog","Function "+action+" was not defined when opening dialog for "+buttonId);}} return new HTMLArea.Dialog(this,buttonId,url,actionFunctionReference,arguments,this.getWindowDimensions(dimensions,buttonId),(showScrollbars?showScrollbars:"no"),dialogOpener);}},openContainerWindow:function(buttonId,title,dimensions,url){this.dialog=new Ext.Window({id:this.editor.editorId+buttonId,title:this.localize(title)||title,cls:'htmlarea-window',width:dimensions.width,border:false,resizable:true,iconCls:this.getButton(buttonId).iconCls,listeners:{afterrender:{fn:this.onContainerResize},resize:{fn:this.onContainerResize},close:{fn:this.onClose,scope:this}},items:{xtype:'box',height:dimensions.height-20,itemId:'content-iframe',autoEl:{tag:'iframe',cls:'content-iframe',src:url}}});this.show();},onContainerResize:function(panel){var iframe=panel.getComponent('content-iframe');if(iframe.rendered){iframe.getEl().setSize(panel.getInnerWidth(),panel.getInnerHeight());}},getWindowDimensions:function(dimensions,buttonId){this.dialogueWindowDimensions={width:250,height:250};if(this.editorConfiguration.dialogueWindows){Ext.apply(this.dialogueWindowDimensions,this.editorConfiguration.dialogueWindows);} if(this.editorConfiguration.buttonsConfig[buttonId]){Ext.apply(this.dialogueWindowDimensions,this.editorConfiguration.buttonsConfig[buttonId].dimensions);} Ext.apply(this.dialogueWindowDimensions,dimensions);var buttonConfiguration=this.editorConfiguration.buttons[this.editorConfiguration.convertButtonId[buttonId]];if(buttonConfiguration&&buttonConfiguration.dialogueWindow){Ext.apply(this.dialogueWindowDimensions,buttonConfiguration.dialogueWindow);} return this.dialogueWindowDimensions;},makeUrlFromPopupName:function(popupName){return(popupName?this.editor.popupURL("plugin://"+this.name+"/"+popupName):this.editor.popupURL("blank.html"));},makeUrlFromModulePath:function(modulePath,parameters){return modulePath+'?'+this.editorConfiguration.RTEtsConfigParams+'&editorNo='+this.editor.editorId+'&sys_language_content='+this.editorConfiguration.sys_language_content+'&contentTypo3Language='+this.editorConfiguration.typo3ContentLanguage+'&contentTypo3Charset='+encodeURIComponent(this.editorConfiguration.typo3ContentCharset)+(parameters?parameters:'');},appendToLog:function(functionName,text){this.editor.appendToLog(this.name,functionName,text);},addConfigElement:function(configElement,configArray){if(!Ext.isEmpty(configElement)){configArray.push(configElement);}},syncHeight:function(tabPanel,tab){var position=this.dialog.getPosition();if(position[0]>0){this.dialog.setPosition(position);}},show:function(){this.dialog.mon(this.editor,'HTMLAreaEventModeChange',this.close,this,{single:true});this.saveSelection();if(typeof(this.dialogueWindowDimensions)!=='undefined'){this.dialog.setPosition(this.dialogueWindowDimensions.positionFromLeft,this.dialogueWindowDimensions.positionFromTop);} this.dialog.show();this.restoreSelection();},close:function(){this.saveSelection();this.dialog.close();},onClose:function(){this.editor.focus();this.restoreSelection();this.editor.updateToolbar();},onCancel:function(){this.dialog.close();this.editor.focus();},saveSelection:function(){if(Ext.isIE){this.savedRange=this.editor._createRange(this.editor._getSelection());}},restoreSelection:function(){if(Ext.isIE&&this.savedRange){try{this.editor.selectRange(this.savedRange);}catch(e){}}},buildButtonConfig:function(button,handler){return{xtype:'button',text:this.localize(button),listeners:{click:{fn:handler,scope:this}}};}});HTMLArea.Dialog=HTMLArea.Base.extend({constructor:function(plugin,buttonId,url,action,arguments,dimensions,showScrollbars,dialogOpener){this.window=window.window?window.window:window.self;this.plugin=plugin;this.buttonId=buttonId;this.action=action;if(typeof(arguments)!=="undefined"){this.arguments=arguments;} this.plugin.dialog=this;if(HTMLArea.Dialog[this.plugin.name]&&HTMLArea.Dialog[this.plugin.name].hasOpenedWindow()&&HTMLArea.Dialog[this.plugin.name].plugin!=this.plugin){HTMLArea.Dialog[this.plugin.name].close();} HTMLArea.Dialog[this.plugin.name]=this;this.dialogWindow=window.open(url,this.plugin.name+"Dialog","toolbar=no,location=no,directories=no,menubar=no,resizable=yes,top="+dimensions.top+",left="+dimensions.left+",dependent=yes,dialog=yes,chrome=no,width="+dimensions.width+",height="+dimensions.height+",scrollbars="+showScrollbars);if(!this.dialogWindow){this.plugin.appendToLog("openDialog","Dialog window could not be opened with url "+url);return false;} if(typeof(dialogOpener)!=="undefined"){this.dialogWindow.opener=dialogOpener;this.dialogWindow.opener.openedDialog=this;} if(!this.dialogWindow.opener){this.dialogWindow.opener=this.window;} return true;},addButtons:function(){var self=this;var div=this.document.createElement("div");this.content.appendChild(div);div.className="buttons";for(var i=0;i=0;){var tag=tags[ti];var els=this.content.getElementsByTagName(tag);for(var j=0;j=0;){var element=elements[i];if(element.firstChild&&element.firstChild.data){label=this.plugin.localize(element.firstChild.data);if(label)element.firstChild.data=label;} if(element.title){label=this.plugin.localize(element.title);if(label)element.title=label;} if(types[type]=="option"&&element.selected){element.selected=false;element.selected=true;}}} label=this.plugin.localize(this.dialogWindow.document.title);if(label)this.dialogWindow.document.title=label;},resize:function(noResize){var buttonConfiguration=this.plugin.editorConfiguration.buttons[this.plugin.editorConfiguration.convertButtonId[this.buttonId]];if(!this.plugin.editorConfiguration.dialogueWindows.doNotResize&&(!buttonConfiguration||!buttonConfiguration.dialogueWindow||!buttonConfiguration.dialogueWindow.doNotResize)){var dialogWindow=this.dialogWindow;var doc=dialogWindow.document;var content=doc.getElementById("content");if(Ext.isGecko||((Ext.isIE||Ext.isOpera||(Ext.isWebKit&&!Ext.isChrome))&&content)){var self=this;setTimeout(function(){if(!noResize){if(content){self.resizeToContent(content);}else if(dialogWindow.sizeToContent){dialogWindow.sizeToContent();}} self.centerOnParent();},75);}else if(!noResize){var body=doc.body;if(Ext.isIE){var innerX=(doc.documentElement&&doc.documentElement.clientWidth)?doc.documentElement.clientWidth:body.clientWidth;var innerY=(doc.documentElement&&doc.documentElement.clientHeight)?doc.documentElement.clientHeight:body.clientHeight;var pageY=Math.max(body.scrollHeight,body.offsetHeight);if(innerY==pageY){dialogWindow.resizeTo(body.scrollWidth,body.scrollHeight+80);}else{dialogWindow.resizeBy((innerX=0;){ranges.push(selection.getRangeAt(i));}} return ranges;};HTMLArea.Editor.prototype.setSelectionRanges=function(ranges,selection){if(!selection){var selection=this._getSelection();} if(selection.getRangeAt){this.emptySelection(selection);for(var i=ranges.length;--i>=0;){this.addRangeToSelection(selection,ranges[i]);}}};HTMLArea.Editor.prototype.getSelectedElement=function(selection){var selectedElement=null;if(!selection){var selection=this._getSelection();} if(selection&&selection.anchorNode&&selection.anchorNode.nodeType==1){if(this.getSelectionType(selection)=="Control"){selectedElement=selection.anchorNode.childNodes[selection.anchorOffset];if(!selectedElement){selectedElement=selection.anchorNode;}else if(selectedElement.nodeType!=1){return null;}}} return selectedElement;};HTMLArea.Editor.prototype.getSelectedHTML=function(){var range=this._createRange(this._getSelection());if(range.collapsed)return"";var cloneContents=range.cloneContents();if(!cloneContents){cloneContents=this._doc.createDocumentFragment();} return HTMLArea.getHTML(cloneContents,false,this);};HTMLArea.Editor.prototype.getSelectedHTMLContents=function(){return this.getSelectedHTML();};HTMLArea.Editor.prototype.getParentElement=function(selection,range){if(!selection){var selection=this._getSelection();} if(this.getSelectionType(selection)==="Control"){return this.getSelectedElement(selection);} if(typeof(range)==="undefined"){var range=this._createRange(selection);} var parentElement=range.commonAncestorContainer;if(parentElement.nodeType==9)return this._doc.body;while(parentElement&&parentElement.nodeType==3){parentElement=parentElement.parentNode;} return parentElement;};HTMLArea.Editor.prototype._activeElement=function(selection){if(this._selectionEmpty(selection)){return null;} if(selection.anchorNode.nodeType==1){return selection.anchorNode;}else{return null;}};HTMLArea.Editor.prototype._selectionEmpty=function(sel){if(!sel)return true;return sel.isCollapsed;};HTMLArea.Editor.prototype.getBookmark=function(range){var bookmark={startId:(new Date()).valueOf()+Math.floor(Math.random()*1000)+'S',endId:(new Date()).valueOf()+Math.floor(Math.random()*1000)+'E'};var startSpan;var endSpan;var rangeClone=range.cloneRange();if(!range.collapsed){endSpan=this._doc.createElement("span");endSpan.style.display="none";endSpan.id=bookmark.endId;endSpan.setAttribute("HTMLArea_bookmark",true);endSpan.innerHTML=" ";rangeClone.collapse(false);rangeClone.insertNode(endSpan);} startSpan=this._doc.createElement("span");startSpan.style.display="none";startSpan.id=bookmark.startId;startSpan.setAttribute("HTMLArea_bookmark",true);startSpan.innerHTML=" ";var rangeClone=range.cloneRange();rangeClone.collapse(true);rangeClone.insertNode(startSpan);bookmark.startNode=startSpan;bookmark.endNode=endSpan;if(endSpan){range.setEndBefore(endSpan);range.setStartAfter(startSpan);}else{range.setEndAfter(startSpan);range.collapse(false);} return bookmark;};HTMLArea.Editor.prototype.getBookmarkNode=function(bookmark,endPoint){if(endPoint){return this._doc.getElementById(bookmark.startId);}else{return this._doc.getElementById(bookmark.endId);}};HTMLArea.Editor.prototype.moveToBookmark=function(bookmark){var startSpan=this.getBookmarkNode(bookmark,true);var endSpan=this.getBookmarkNode(bookmark,false);var parent;var range=this._createRange();if(startSpan){if(startSpan.previousSibling&&startSpan.previousSibling.nodeType==3){range.setStart(startSpan.previousSibling,startSpan.previousSibling.data.length);}else{range.setStartBefore(startSpan);} HTMLArea.removeFromParent(startSpan);}else{range.setStart(this._doc.body,0);} if(endSpan){if(endSpan.nextSibling&&endSpan.nextSibling.nodeType==3){range.setEnd(endSpan.nextSibling,0);}else{range.setEndBefore(endSpan);} HTMLArea.removeFromParent(endSpan);}else{range.collapse(true);} return range;};HTMLArea.Editor.prototype.selectRange=function(range){var selection=this._getSelection();this.emptySelection(selection);this.addRangeToSelection(selection,range);};HTMLArea.Editor.prototype.insertNodeAtSelection=function(toBeInserted){this.focus();var range=this._createRange(this._getSelection());range.deleteContents();var toBeSelected=(toBeInserted.nodeType===11)?toBeInserted.lastChild:toBeInserted;range.insertNode(toBeInserted);this.selectNodeContents(toBeSelected,false);};HTMLArea.Editor.prototype.insertHTML=function(html){this.focus();var fragment=this._doc.createDocumentFragment();var div=this._doc.createElement("div");div.innerHTML=html;while(div.firstChild){fragment.appendChild(div.firstChild);} this.insertNodeAtSelection(fragment);};HTMLArea.Editor.prototype.wrapWithInlineElement=function(element,selection,range){element.appendChild(range.extractContents());range.insertNode(element);element.normalize();var neighbour=element.previousSibling;if(neighbour&&(neighbour.nodeType!=3)&&!/\S/.test(neighbour.textContent)){HTMLArea.removeFromParent(neighbour);} neighbour=element.nextSibling;if(neighbour&&(neighbour.nodeType!=3)&&!/\S/.test(neighbour.textContent)){HTMLArea.removeFromParent(neighbour);} this.selectNodeContents(element,false);};HTMLArea.Editor.prototype.cleanAppleStyleSpans=function(node){if(Ext.isWebKit){if(node.getElementsByClassName){var spans=node.getElementsByClassName("Apple-style-span");for(var i=spans.length;--i>=0;){this.removeMarkup(spans[i]);}}else{var spans=node.getElementsByTagName("span");for(var i=spans.length;--i>=0;){if(HTMLArea.DOM.hasClass(spans[i],"Apple-style-span")){this.removeMarkup(spans[i]);}} var fonts=node.getElementsByTagName("font");for(i=fonts.length;--i>=0;){if(HTMLArea.DOM.hasClass(fonts[i],"Apple-style-span")){this.removeMarkup(fonts[i]);}}}}};HTMLArea.Editor.prototype._checkBackspace=function(){var self=this;window.setTimeout(function(){var selection=self._getSelection();var range=self._createRange(selection);var startContainer=range.startContainer;var startOffset=range.startOffset;if(self._selectionEmpty()){if(/^(body)$/i.test(startContainer.nodeName)){var node=startContainer.childNodes[startOffset];}else if(/^(body)$/i.test(startContainer.parentNode.nodeName)){var node=startContainer;}else{return false;} if(/^(br|#text)$/i.test(node.nodeName)&&!/\S/.test(node.textContent)){var previousSibling=node.previousSibling;while(previousSibling&&/^(br|#text)$/i.test(previousSibling.nodeName)&&!/\S/.test(previousSibling.textContent)){previousSibling=previousSibling.previousSibling;} if(previousSibling){HTMLArea.removeFromParent(node);if(/^(ol|ul|dl)$/i.test(previousSibling.nodeName)){self.selectNodeContents(previousSibling.lastChild,false);}else if(/^(table)$/i.test(previousSibling.nodeName)){self.selectNodeContents(previousSibling.rows[previousSibling.rows.length-1].cells[previousSibling.rows[previousSibling.rows.length-1].cells.length-1],false);}else if(!/\S/.test(previousSibling.textContent)&&previousSibling.firstChild){self.selectNode(previousSibling.firstChild,true);}else{self.selectNodeContents(previousSibling,false);}}}}},10);return false;};HTMLArea.Editor.prototype._checkInsertP=function(){var editor=this;this.focus();var i,left,right,rangeClone,sel=this._getSelection(),range=this._createRange(sel),p=this.getAllAncestors(),block=null,a=null,doc=this._doc;for(i=0;i=0;){if(HTMLArea.isBlockElement(block.childNodes[i])){blockOnLeft=block.childNodes[i];break;}else{rangeClone.setStartBefore(block.childNodes[i]);}}}else{var inlineContainer=range.startContainer;while(inlineContainer.parentNode!=block){inlineContainer=inlineContainer.parentNode;} var leftSibling=inlineContainer;while(leftSibling.previousSibling&&!HTMLArea.isBlockElement(leftSibling.previousSibling)){leftSibling=leftSibling.previousSibling;} rangeClone.setStartBefore(leftSibling);var blockOnLeft=leftSibling.previousSibling;} left=doc.createElement('p');left.appendChild(rangeClone.extractContents());if(!left.textContent&&!left.getElementsByTagName('img').length&&!left.getElementsByTagName('table').length){left.innerHTML='
';} if(block.hasChildNodes()){if(blockOnLeft){left=block.insertBefore(left,blockOnLeft.nextSibling);}else{left=block.insertBefore(left,block.firstChild);}}else{left=block.appendChild(left);} block.normalize();var rightSibling=left;while(rightSibling.nextSibling&&!HTMLArea.isBlockElement(rightSibling.nextSibling)){rightSibling=rightSibling.nextSibling;} var blockOnRight=rightSibling.nextSibling;range.setEndAfter(rightSibling);range.setStartAfter(left);right=doc.createElement('p');right.appendChild(range.extractContents());if(!right.textContent&&!right.getElementsByTagName('img').length&&!right.getElementsByTagName('table').length){right.innerHTML='
';} if(!(left.childNodes.length==1&&right.childNodes.length==1&&left.firstChild.nodeName.toLowerCase()=='br'&&right.firstChild.nodeName.toLowerCase()=='br')){if(blockOnRight){right=block.insertBefore(right,blockOnRight);}else{right=block.appendChild(right);} this.selectNodeContents(right,true);}else{this.selectNodeContents(left,true);} block.normalize();}else{var first=block.firstChild;if(first){block.removeChild(first);} right=doc.createElement("p");if(Ext.isWebKit||Ext.isOpera){right.innerHTML="
";} right=block.appendChild(right);this.selectNodeContents(right,true);}}else{range.setEndAfter(block);var df=range.extractContents(),left_empty=false;if(!/\S/.test(block.innerHTML)||(!/\S/.test(block.textContent)&&!/<(img|hr|table)/i.test(block.innerHTML))){if(!Ext.isOpera){block.innerHTML="
";} left_empty=true;} p=df.firstChild;if(p){if(!/\S/.test(p.innerHTML)||(!/\S/.test(p.textContent)&&!/<(img|hr|table)/i.test(p.innerHTML))){if(/^h[1-6]$/i.test(p.nodeName)){p=this.convertNode(p,"p");} if(/^(dt|dd)$/i.test(p.nodeName)){p=this.convertNode(p,(p.nodeName.toLowerCase()==="dt")?"dd":"dt");} if(!Ext.isOpera){p.innerHTML="
";} if(/^li$/i.test(p.nodeName)&&left_empty&&(!block.nextSibling||!/^li$/i.test(block.nextSibling.nodeName))){left=block.parentNode;left.removeChild(block);range.setEndAfter(left);range.collapse(false);p=this.convertNode(p,/^(li|dd|td|th|p|h[1-6])$/i.test(left.parentNode.nodeName)?"br":"p");}} range.insertNode(df);if(p.previousSibling){var a=p.previousSibling.lastChild;if(a&&/^a$/i.test(a.nodeName)&&!/\S/.test(a.innerHTML)){this.convertNode(a,'br');}} var a=p.lastChild;if(a&&/^a$/i.test(a.nodeName)&&!/\S/.test(a.innerHTML)){this.convertNode(a,'br');} while(p.firstChild&&p.firstChild.nodeType==1&&!/^(br|img|hr|table)$/i.test(p.firstChild.nodeName)){p=p.firstChild;} if(/^br$/i.test(p.nodeName)){p=p.parentNode.insertBefore(doc.createTextNode('\x20'),p);}else if(!/\S/.test(p.innerHTML)){p.appendChild(doc.createElement('br'));} this.selectNodeContents(p,true);}else{if(/^(li|dt|dd)$/i.test(block.nodeName)){p=doc.createElement(block.nodeName);}else{p=doc.createElement("p");} if(!Ext.isOpera){p.innerHTML="
";} if(block.nextSibling){p=block.parentNode.insertBefore(p,block.nextSibling);}else{p=block.parentNode.appendChild(p);} this.selectNodeContents(p,true);}} this.scrollToCaret();return true;};HTMLArea.Editor.prototype._detectURL=function(event){var ev=event.browserEvent;var editor=this;var s=this._getSelection();if(this.getParentElement(s).nodeName.toLowerCase()!='a'){var autoWrap=function(textNode,tag){var rightText=textNode.nextSibling;if(typeof(tag)=='string')tag=editor._doc.createElement(tag);var a=textNode.parentNode.insertBefore(tag,rightText);HTMLArea.removeFromParent(textNode);a.appendChild(textNode);s.collapse(rightText,0);rightText.parentNode.normalize();editor._unLink=function(){var t=a.firstChild;a.removeChild(t);a.parentNode.insertBefore(t,a);HTMLArea.removeFromParent(a);t.parentNode.normalize();editor._unLink=null;editor._unlinkOnUndo=false;};editor._unlinkOnUndo=true;return a;};switch(ev.which){case 13:case 32:if(s&&s.isCollapsed&&s.anchorNode.nodeType==3&&s.anchorNode.data.length>3&&s.anchorNode.data.indexOf('.')>=0){var midStart=s.anchorNode.data.substring(0,s.anchorOffset).search(/[a-zA-Z0-9]+\S{3,}$/);if(midStart==-1)break;if(this._getFirstAncestor(s,'a'))break;var matchData=s.anchorNode.data.substring(0,s.anchorOffset).replace(/^.*?(\S*)$/,'$1');if(matchData.indexOf('@')!=-1){var m=matchData.match(HTMLArea.RE_email);if(m){var leftText=s.anchorNode;var rightText=leftText.splitText(s.anchorOffset);var midText=leftText.splitText(midStart);var midEnd=midText.data.search(/[^a-zA-Z0-9\.@_\-]/);if(midEnd!=-1)var endText=midText.splitText(midEnd);autoWrap(midText,'a').href='mailto:'+m[0];break;}} var m=matchData.match(HTMLArea.RE_url);if(m){var leftText=s.anchorNode;var rightText=leftText.splitText(s.anchorOffset);var midText=leftText.splitText(midStart);var midEnd=midText.data.search(/[^a-zA-Z0-9\._\-\/\&\?=:@]/);if(midEnd!=-1)var endText=midText.splitText(midEnd);autoWrap(midText,'a').href=(m[1]?m[1]:'http://')+m[3];break;}} break;default:if(ev.keyCode==27||(editor._unlinkOnUndo&&ev.ctrlKey&&ev.which==122)){if(this._unLink){this._unLink();event.stopEvent();} break;}else if(ev.which||ev.keyCode==8||ev.keyCode==46){this._unlinkOnUndo=false;if(s.anchorNode&&s.anchorNode.nodeType==3){var a=this._getFirstAncestor(s,'a');if(!a)break;if(!a._updateAnchTimeout){if(s.anchorNode.data.match(HTMLArea.RE_email)&&(a.href.match('mailto:'+s.anchorNode.data.trim()))){var textNode=s.anchorNode;var fn=function(){a.href='mailto:'+textNode.data.trim();a._updateAnchTimeout=setTimeout(fn,250);};a._updateAnchTimeout=setTimeout(fn,250);break;} var m=s.anchorNode.data.match(HTMLArea.RE_url);if(m&&a.href.match(s.anchorNode.data.trim())){var textNode=s.anchorNode;var fn=function(){var m=textNode.data.match(HTMLArea.RE_url);a.href=(m[1]?m[1]:'http://')+m[3];a._updateAnchTimeout=setTimeout(fn,250);} a._updateAnchTimeout=setTimeout(fn,250);}}}} break;}}};HTMLArea.EditorMode=HTMLArea.Plugin.extend({constructor:function(editor,pluginName){this.base(editor,pluginName);},configurePlugin:function(editor){var pluginInformation={version:"2.0",developer:"Stanislas Rolland",developerUrl:"http://www.sjbr.ca/",copyrightOwner:"Stanislas Rolland",sponsor:"SJBR",sponsorUrl:"http://www.sjbr.ca/",license:"GPL"};this.registerPluginInformation(pluginInformation);var buttonList=this.buttonList,buttonId;for(var i=0,n=buttonList.length;i";var tagclose="";if(fullNodeSelected){if(!statusBarSelection){parent.innerHTML=tagopen+parent.innerHTML+tagclose;if(element==="bdo"){parent.firstChild.setAttribute("dir","rtl");} editor.selectNodeContents(parent,false);}else{var content=parent.outerHTML;var newElement=this.remapMarkup(parent,element);newElement.innerHTML=content;editor.selectNodeContents(newElement,false);}}else{editor.wrapWithInlineElement(newElement,selection,range);}}}else{if(fullNodeSelected){if(elementIsAncestor){parent=ancestors[elementAncestorIndex];} var parentElement=parent.parentNode;editor.removeMarkup(parent);if(Ext.isWebKit&&this.isInlineElement(parentElement)){editor.selectNodeContents(parentElement,false);}}}}else{if(parent&&!HTMLArea.isBlockElement(parent)){if((element==="none")||elementIsAncestor){if(elementIsAncestor){parent=ancestors[elementAncestorIndex];} editor.removeMarkup(parent);}else{var bookmark=this.editor.getBookmark(range);var newElement=this.remapMarkup(parent,element);this.editor.selectRange(this.editor.moveToBookmark(bookmark));}}}},remapMarkup:function(element,tagName){var attributeValue;var newElement=this.editor.convertNode(element,tagName);if(tagName==="bdo"){newElement.setAttribute("dir","ltr");} for(var i=0;i1)||disabled);}});HTMLArea.BlockElements=HTMLArea.Plugin.extend({constructor:function(editor,pluginName){this.base(editor,pluginName);},configurePlugin:function(editor){this.buttonsConfiguration=this.editorConfiguration.buttons;if(this.buttonsConfiguration.blockstyle){this.tags=this.editorConfiguration.buttons.blockstyle.tags;} this.useClass={Indent:"indent",JustifyLeft:"align-left",JustifyCenter:"align-center",JustifyRight:"align-right",JustifyFull:"align-justify"};this.useAlignAttribute=false;for(var buttonId in this.useClass){if(this.useClass.hasOwnProperty(buttonId)){if(this.editorConfiguration.buttons[this.buttonList[buttonId][2]]){this.useClass[buttonId]=this.editorConfiguration.buttons[this.buttonList[buttonId][2]].useClass?this.editorConfiguration.buttons[this.buttonList[buttonId][2]].useClass:this.useClass[buttonId];if(buttonId==="Indent"){this.useBlockquote=this.editorConfiguration.buttons.indent.useBlockquote?this.editorConfiguration.buttons.indent.useBlockquote:false;}else{if(this.editorConfiguration.buttons[this.buttonList[buttonId][2]].useAlignAttribute){this.useAlignAttribute=true;}}}}} this.allowedAttributes=new Array("id","title","lang","xml:lang","dir","class");if(Ext.isIE){this.addAllowedAttribute("className");} this.indentedList=null;var standardElements=new Array("address","blockquote","div","h1","h2","h3","h4","h5","h6","p","pre");this.standardBlockElements=new RegExp("^("+standardElements.join("|")+")$","i");this.formatBlockItems={};if(this.buttonsConfiguration&&this.buttonsConfiguration.formatblock&&this.buttonsConfiguration.formatblock.items){this.formatBlockItems=this.buttonsConfiguration.formatblock.items;} for(var tagName in this.formatBlockItems){if(this.formatBlockItems.hasOwnProperty(tagName)&&this.formatBlockItems[tagName].tagName&&this.formatBlockItems[tagName].addClass){if(!this.formatBlockItems[this.formatBlockItems[tagName].tagName]){this.formatBlockItems[this.formatBlockItems[tagName].tagName]={};} if(!this.formatBlockItems[this.formatBlockItems[tagName].tagName].classList){this.formatBlockItems[this.formatBlockItems[tagName].tagName].classList=new Array();} this.formatBlockItems[this.formatBlockItems[tagName].tagName].classList.push(this.formatBlockItems[tagName].addClass);}} for(var tagName in this.formatBlockItems){if(this.formatBlockItems.hasOwnProperty(tagName)&&this.formatBlockItems[tagName].classList){this.formatBlockItems[tagName].classList=new RegExp("^("+this.formatBlockItems[tagName].classList.join("|")+")$");}} var pluginInformation={version:'1.5',developer:'Stanislas Rolland',developerUrl:'http://www.sjbr.ca/',copyrightOwner:'Stanislas Rolland',sponsor:this.localize('Technische Universitat Ilmenau'),sponsorUrl:'http://www.tu-ilmenau.de/',license:'GPL'};this.registerPluginInformation(pluginInformation);var buttonId="FormatBlock";var dropDownConfiguration={id:buttonId,tooltip:this.localize(buttonId+"-Tooltip"),options:this.buttonsConfiguration.formatblock?this.buttonsConfiguration.formatblock.options:[],action:"onChange"};if(this.buttonsConfiguration.formatblock){dropDownConfiguration.width=this.buttonsConfiguration.formatblock.width?parseInt(this.buttonsConfiguration.formatblock.width,10):200;if(this.buttonsConfiguration.formatblock.listWidth){dropDownConfiguration.listWidth=parseInt(this.buttonsConfiguration.formatblock.listWidth,10);} if(this.buttonsConfiguration.formatblock.maxHeight){dropDownConfiguration.maxHeight=parseInt(this.buttonsConfiguration.formatblock.maxHeight,10);}} this.registerDropDown(dropDownConfiguration);var blockElements=new Array();Ext.each(dropDownConfiguration.options,function(option){if(option[1]!='none'){blockElements.push(option[1]);}});this.allowedBlockElements=new RegExp("^("+blockElements.join("|")+")$","i");if(blockElements.length){this.allowedBlockElements=new RegExp("^("+blockElements.join("|")+")$","i");}else{this.allowedBlockElements=this.standardBlockElements;} Ext.each(blockElements,function(blockElement){var configuredHotKey=this.defaultHotKeys[blockElement];if(this.editorConfiguration.buttons.formatblock&&this.editorConfiguration.buttons.formatblock.items&&this.editorConfiguration.buttons.formatblock.items[blockElement]&&this.editorConfiguration.buttons.formatblock.items[blockElement].hotKey){configuredHotKey=this.editorConfiguration.buttons.formatblock.items[blockElement].hotKey;} if(configuredHotKey){var hotKeyConfiguration={id:configuredHotKey,cmd:buttonId,element:blockElement};this.registerHotKey(hotKeyConfiguration);}},this);for(var buttonId in this.buttonList){if(this.buttonList.hasOwnProperty(buttonId)){var button=this.buttonList[buttonId];var buttonConfiguration={id:buttonId,tooltip:this.localize(buttonId+'-Tooltip'),iconCls:'htmlarea-action-'+button[3],contextMenuTitle:this.localize(buttonId+'-contextMenuTitle'),helpText:this.localize(buttonId+'-helpText'),action:'onButtonPress',hotKey:((this.buttonsConfiguration[button[2]]&&this.buttonsConfiguration[button[2]].hotKey)?this.buttonsConfiguration[button[2]].hotKey:(button[1]?button[1]:null))};this.registerButton(buttonConfiguration);}} return true;},buttonList:{Indent:[null,'TAB','indent','indent'],Outdent:[null,'SHIFT-TAB','outdent','outdent'],Blockquote:[null,null,'blockquote','blockquote'],InsertParagraphBefore:[null,null,'insertparagraphbefore','paragraph-insert-before'],InsertParagraphAfter:[null,null,'insertparagraphafter','paragraph-insert-after'],JustifyLeft:[null,'l','left','justify-left'],JustifyCenter:[null,'e','center','justify-center'],JustifyRight:[null,'r','right','justify-right'],JustifyFull:[null,'j','justifyfull','justify-full'],InsertOrderedList:[null,null,'orderedlist','ordered-list'],InsertUnorderedList:[null,null,'unorderedlist','unordered-list'],InsertHorizontalRule:[null,null,'inserthorizontalrule','horizontal-rule-insert']},defaultHotKeys:{'p':'n','h1':'1','h2':'2','h3':'3','h4':'4','h5':'5','h6':'6'},isAllowedBlockElement:function(blockName){return this.allowedBlockElements.test(blockName);},addAllowedAttribute:function(attribute){this.allowedAttributes.push(attribute);},onChange:function(editor,combo,record,index){this.applyBlockElement(combo.itemId,combo.getValue());},applyBlockElement:function(buttonId,blockElement){var tagName=blockElement;var className=null;if(this.formatBlockItems[tagName]){if(this.formatBlockItems[tagName].addClass){className=this.formatBlockItems[tagName].addClass;} if(this.formatBlockItems[tagName].tagName){tagName=this.formatBlockItems[tagName].tagName;}} if(this.standardBlockElements.test(tagName)||tagName=="none"){switch(tagName){case"blockquote":this.onButtonPress(this.editor,"Blockquote",null,className);break;case"div":case"address":case"none":this.onButtonPress(this.editor,tagName,null,className);break;default:var element=tagName;if(Ext.isIE){element="<"+element+">";} this.editor.focus();if(Ext.isWebKit){if(!this.editor._doc.body.hasChildNodes()){this.editor._doc.body.appendChild((this.editor._doc.createElement("br")));} this.editor._doc.body.normalize();} try{this.editor._doc.execCommand(buttonId,false,element);}catch(e){this.appendToLog("applyBlockElement",e+"\n\nby execCommand("+buttonId+");");} this.addClassOnBlockElements(tagName,className);}}},onButtonPress:function(editor,id,target,className){var buttonId=this.translateHotKey(id);buttonId=buttonId?buttonId:id;this.editor.focus();var selection=editor._getSelection();var range=editor._createRange(selection);var statusBarSelection=this.editor.statusBar?this.editor.statusBar.getSelection():null;var parentElement=statusBarSelection?statusBarSelection:this.editor.getParentElement(selection,range);if(target){parentElement=target;} while(parentElement&&(!HTMLArea.isBlockElement(parentElement)||/^li$/i.test(parentElement.nodeName))){parentElement=parentElement.parentNode;} var blockAncestors=this.getBlockAncestors(parentElement);var tableCell=null;if(id==="TAB"||id==="SHIFT-TAB"){for(var i=blockAncestors.length;--i>=0;){if(/^(td|th)$/i.test(blockAncestors[i].nodeName)){tableCell=blockAncestors[i];break;}}} var fullNodeTextSelected=(!Ext.isIE&&parentElement.textContent===range.toString())||(Ext.isIE&&parentElement.innerText===range.text);switch(buttonId){case"Indent":if(/^(ol|ul)$/i.test(parentElement.nodeName)&&!(fullNodeTextSelected&&!/^(li)$/i.test(parentElement.parentNode.nodeName))){if(Ext.isOpera){try{this.editor._doc.execCommand(buttonId,false,null);}catch(e){this.appendToLog("onButtonPress",e+"\n\nby execCommand("+buttonId+");");} this.indentedList=parentElement;this.makeNestedList(parentElement);this.editor.selectNodeContents(this.indentedList.lastChild,false);}else{this.indentSelectedListElements(parentElement,range);}}else if(tableCell){var tablePart=tableCell.parentNode.parentNode;var nextCell=tableCell.nextSibling?tableCell.nextSibling:(tableCell.parentNode.nextSibling?tableCell.parentNode.nextSibling.cells[0]:null);if(!nextCell){switch(tablePart.nodeName.toLowerCase()){case"thead":nextCell=tablePart.parentNode.tBodies[0].rows[0].cells[0];break;case"tbody":nextCell=tablePart.nextSibling?tablePart.nextSibling.rows[0].cells[0]:null;break;case"tfoot":this.editor.selectNodeContents(tablePart.parentNode.lastChild.lastChild.lastChild,true);}} if(!nextCell){if(this.editor.plugins.TableOperations){this.editor.plugins.TableOperations.instance.onButtonPress(this.editor,"TO-row-insert-under");}else{nextCell=tablePart.parentNode.rows[0].cells[0];}} if(nextCell){if(Ext.isOpera&&!nextCell.hasChildNodes()){nextCell.appendChild(this.editor.document.createElement('br'));} this.editor.selectNodeContents(nextCell,true);}}else if(this.useBlockquote){try{this.editor._doc.execCommand(buttonId,false,null);}catch(e){this.appendToLog("onButtonPress",e+"\n\nby execCommand("+buttonId+");");}}else if(this.isAllowedBlockElement("div")){if(/^div$/i.test(parentElement.nodeName)&&!HTMLArea.DOM.hasClass(parentElement,this.useClass[buttonId])){HTMLArea.DOM.addClass(parentElement,this.useClass[buttonId]);}else if(!/^div$/i.test(parentElement.nodeName)&&/^div$/i.test(parentElement.parentNode.nodeName)&&!HTMLArea.DOM.hasClass(parentElement.parentNode,this.useClass[buttonId])){HTMLArea.DOM.addClass(parentElement.parentNode,this.useClass[buttonId]);}else{var bookmark=this.editor.getBookmark(range);var newBlock=this.wrapSelectionInBlockElement("div",this.useClass[buttonId],null,true);this.editor.selectRange(this.editor.moveToBookmark(bookmark));}}else{this.addClassOnBlockElements(buttonId);} break;case"Outdent":if(/^(ol|ul)$/i.test(parentElement.nodeName)&&!HTMLArea.DOM.hasClass(parentElement,this.useClass.Indent)){if(/^(li)$/i.test(parentElement.parentNode.nodeName)){if(Ext.isOpera){try{this.editor._doc.execCommand(buttonId,false,null);}catch(e){this.appendToLog("onButtonPress",e+"\n\nby execCommand("+buttonId+");");}}else{this.outdentSelectedListElements(parentElement,range);}}}else if(tableCell){var previousCell=tableCell.previousSibling?tableCell.previousSibling:(tableCell.parentNode.previousSibling?tableCell.parentNode.previousSibling.lastChild:null);if(!previousCell){var table=tableCell.parentNode.parentNode.parentNode;var tablePart=tableCell.parentNode.parentNode.nodeName.toLowerCase();switch(tablePart){case"tbody":if(table.tHead){previousCell=table.tHead.rows[table.tHead.rows.length-1].cells[table.tHead.rows[table.tHead.rows.length-1].cells.length-1];break;} case"thead":if(table.tFoot){previousCell=table.tFoot.rows[table.tFoot.rows.length-1].cells[table.tFoot.rows[table.tFoot.rows.length-1].cells.length-1];break;} case"tfoot":previousCell=table.tBodies[table.tBodies.length-1].rows[table.tBodies[table.tBodies.length-1].rows.length-1].cells[table.tBodies[table.tBodies.length-1].rows[table.tBodies[table.tBodies.length-1].rows.length-1].cells.length-1];}} if(previousCell){if(Ext.isOpera&&!previousCell.hasChildNodes()){previousCell.appendChild(this.editor.document.createElement('br'));} this.editor.selectNodeContents(previousCell,true);}}else if(this.useBlockquote){try{this.editor._doc.execCommand(buttonId,false,null);}catch(e){this.appendToLog("onButtonPress",e+"\n\nby execCommand("+buttonId+");");}}else if(this.isAllowedBlockElement("div")){for(var i=blockAncestors.length;--i>=0;){if(HTMLArea.DOM.hasClass(blockAncestors[i],this.useClass.Indent)){var bookmark=this.editor.getBookmark(range);var newBlock=this.wrapSelectionInBlockElement("div",false,blockAncestors[i]);if(newBlock.parentNode!==blockAncestors[i]){var parent=newBlock.parentNode;this.removeElement(newBlock);while(parent.parentNode!==blockAncestors[i]){parent=parent.parentNode;} blockAncestors[i].insertBefore(newBlock,parent);newBlock.appendChild(parent);} newBlock.className=blockAncestors[i].className;HTMLArea.DOM.removeClass(newBlock,this.useClass.Indent);if(!newBlock.previousSibling){while(newBlock.hasChildNodes()){if(newBlock.firstChild.nodeType==1){newBlock.firstChild.className=newBlock.className;} blockAncestors[i].parentNode.insertBefore(newBlock.firstChild,blockAncestors[i]);}}else if(!newBlock.nextSibling){if(blockAncestors[i].nextSibling){while(newBlock.hasChildNodes()){if(newBlock.firstChild.nodeType==1){newBlock.lastChild.className=newBlock.className;} blockAncestors[i].parentNode.insertBefore(newBlock.lastChild,blockAncestors[i].nextSibling);}}else{while(newBlock.hasChildNodes()){if(newBlock.firstChild.nodeType==1){newBlock.firstChild.className=newBlock.className;} blockAncestors[i].parentNode.appendChild(newBlock.firstChild);}}}else{var clone=blockAncestors[i].cloneNode(false);if(blockAncestors[i].nextSibling){blockAncestors[i].parentNode.insertBefore(clone,blockAncestors[i].nextSibling);}else{blockAncestors[i].parentNode.appendChild(clone);} while(newBlock.nextSibling){clone.appendChild(newBlock.nextSibling);} while(newBlock.hasChildNodes()){if(newBlock.firstChild.nodeType==1){newBlock.firstChild.className=newBlock.className;} blockAncestors[i].parentNode.insertBefore(newBlock.firstChild,clone);}} blockAncestors[i].removeChild(newBlock);if(!blockAncestors[i].hasChildNodes()){blockAncestors[i].parentNode.removeChild(blockAncestors[i]);} this.editor.selectRange(this.editor.moveToBookmark(bookmark));break;}}}else{this.addClassOnBlockElements(buttonId);} break;case"InsertParagraphBefore":case"InsertParagraphAfter":this.insertParagraph(buttonId==="InsertParagraphAfter");break;case"Blockquote":var commandState=false;for(var i=blockAncestors.length;--i>=0;){if(/^blockquote$/i.test(blockAncestors[i].nodeName)){commandState=true;this.removeElement(blockAncestors[i]);break;}} if(!commandState){var bookmark=this.editor.getBookmark(range);var newBlock=this.wrapSelectionInBlockElement("blockquote",className,null,true);this.editor.selectRange(this.editor.moveToBookmark(bookmark));} break;case"address":case"div":var bookmark=this.editor.getBookmark(range);var newBlock=this.wrapSelectionInBlockElement(buttonId,className,null,true);this.editor.selectRange(this.editor.moveToBookmark(bookmark));break;case"JustifyLeft":case"JustifyCenter":case"JustifyRight":case"JustifyFull":if(this.useAlignAttribute){try{this.editor._doc.execCommand(buttonId,false,null);}catch(e){this.appendToLog("onButtonPress",e+"\n\nby execCommand("+buttonId+");");}}else{this.addClassOnBlockElements(buttonId);} break;case"InsertOrderedList":case"InsertUnorderedList":this.insertList(buttonId,parentElement);break;case"InsertHorizontalRule":this.insertHorizontalRule();break;case"none":if(this.isAllowedBlockElement(parentElement.nodeName)){this.removeElement(parentElement);} break;default:break;} return false;},getBlockAncestors:function(element,withinBlock){var ancestors=new Array();var ancestor=element;while(ancestor&&(ancestor.nodeType===1)&&!/^(body)$/i.test(ancestor.nodeName)&&ancestor!=withinBlock){if(HTMLArea.isBlockElement(ancestor)){ancestors.unshift(ancestor);} ancestor=ancestor.parentNode;} ancestors.unshift(ancestor);return ancestors;},wrapSelectionInBlockElement:function(blockName,useClass,withinBlock,keepValid){var endBlocks=this.editor.getEndBlocks(this.editor._getSelection());var startAncestors=this.getBlockAncestors(endBlocks.start,withinBlock);var endAncestors=this.getBlockAncestors(endBlocks.end,withinBlock);var i=0;while(i";this.editor.selectNodeContents(first,true);}else{var parentNode=parentElement.parentNode;try{this.editor._doc.execCommand(buttonId,false,null);}catch(e){this.appendToLog("onButtonPress",e+"\n\nby execCommand("+buttonId+");");} if(Ext.isWebKit){this.editor.cleanAppleStyleSpans(parentNode);}}},indentSelectedListElements:function(list,range){var bookmark=this.editor.getBookmark(range);var indentedList=this.wrapSelectionInBlockElement(list.nodeName.toLowerCase(),null,list);var range=this.editor.moveToBookmark(bookmark);bookmark=this.editor.getBookmark(range);var last=indentedList.lastChild.lastChild;if(last&&/^(ol|ul)$/i.test(last.nodeName)){var child=last.firstChild,next;while(child){next=child.nextSibling;if(!this.editor.rangeIntersectsNode(range,child)){indentedList.appendChild(child);} child=next;} if(!last.hasChildNodes()){HTMLArea.removeFromParent(last);}} if(indentedList.previousSibling&&indentedList.previousSibling.hasChildNodes()){if(/^(ol|ul)$/i.test(indentedList.previousSibling.lastChild.nodeName)){while(indentedList.hasChildNodes()){indentedList.previousSibling.lastChild.appendChild(indentedList.firstChild);} list.removeChild(indentedList);}else{indentedList=indentedList.previousSibling.appendChild(indentedList);}}else{var first=this.editor._doc.createElement("li");first.innerHTML=" ";list.insertBefore(first,indentedList);indentedList=first.appendChild(indentedList);} this.editor.selectRange(this.editor.moveToBookmark(bookmark));},outdentSelectedListElements:function(list,range){var bookmark=this.editor.getBookmark(range);var wrappedList=this.wrapSelectionInBlockElement(list.nodeName.toLowerCase(),null,list);var range=this.editor.moveToBookmark(bookmark);bookmark=this.editor.getBookmark(range);if(!wrappedList.previousSibling){var next=list.parentNode.nextSibling;var last=wrappedList.lastChild;while(wrappedList.hasChildNodes()){if(next){list.parentNode.parentNode.insertBefore(wrappedList.firstChild,next);}else{list.parentNode.parentNode.appendChild(wrappedList.firstChild);}} list.removeChild(wrappedList);last.appendChild(list);}else if(!wrappedList.nextSibling){this.editor.moveToBookmark(bookmark);while(wrappedList.hasChildNodes()){if(list.parentNode.nextSibling){list.parentNode.parentNode.insertBefore(wrappedList.firstChild,list.parentNode.nextSibling);}else{list.parentNode.parentNode.appendChild(wrappedList.firstChild);}} list.removeChild(wrappedList);this.editor.selectNodeContents(list.parentNode.nextSibling,true);bookmark=this.editor.getBookmark(this.editor._createRange(this.editor._getSelection()));}else{var next=list.parentNode.nextSibling;var last=wrappedList.lastChild;var sibling=wrappedList.nextSibling;while(wrappedList.hasChildNodes()){if(next){list.parentNode.parentNode.insertBefore(wrappedList.firstChild,next);}else{list.parentNode.parentNode.appendChild(wrappedList.firstChild);}} while(sibling){wrappedList.appendChild(sibling);sibling=sibling.nextSibling;} last.appendChild(wrappedList);} if(!list.hasChildNodes()){list.parentNode.removeChild(list);} this.editor.selectRange(this.editor.moveToBookmark(bookmark));},makeNestedList:function(el){var previous;for(var i=el.firstChild;i;i=i.nextSibling){if(/^li$/i.test(i.nodeName)){for(var j=i.firstChild;j;j=j.nextSibling){if(/^(ol|ul)$/i.test(j.nodeName)){this.makeNestedList(j);}}}else if(/^(ol|ul)$/i.test(i.nodeName)){previous=i.previousSibling;this.indentedList=i.cloneNode(true);if(!previous){previous=el.insertBefore(this.editor._doc.createElement("li"),i);this.indentedList=previous.appendChild(this.indentedList);}else{this.indentedList=previous.appendChild(this.indentedList);} HTMLArea.removeFromParent(i);this.makeNestedList(el);break;}}},insertParagraph:function(after){var endBlocks=this.editor.getEndBlocks(this.editor._getSelection());var ancestors=after?this.getBlockAncestors(endBlocks.end):this.getBlockAncestors(endBlocks.start);var endElement=ancestors[ancestors.length-1];for(var i=ancestors.length;--i>=0;){if(/^(table|div|ul|ol|dl|blockquote|address|pre)$/i.test(ancestors[i].nodeName)&&!/^(li)$/i.test(ancestors[i].parentNode.nodeName)){endElement=ancestors[i];break;}} if(endElement){var parent=endElement.parentNode;var paragraph=this.editor._doc.createElement("p");if(Ext.isIE){paragraph.innerHTML=" ";}else{paragraph.appendChild(this.editor._doc.createElement("br"));} if(after&&!endElement.nextSibling){parent.appendChild(paragraph);}else{parent.insertBefore(paragraph,after?endElement.nextSibling:endElement);} this.editor.selectNodeContents(paragraph,true);}},insertHorizontalRule:function(){this.editor.execCommand('InsertHorizontalRule');if(!Ext.isIE&&!Ext.isOpera&&!this.editor.config.disableEnterParagraphs){var range=this.editor._createRange(this.editor._getSelection());var startContainer=range.startContainer;if(/^body$/i.test(startContainer.nodeName)){startContainer.normalize();var ruler=startContainer.childNodes[range.startOffset-1];if(ruler.nextSibling){if(ruler.nextSibling.nodeType==HTMLArea.DOM.TEXT_NODE){if(/\S/.test(ruler.nextSibling.textContent)){var paragraph=this.editor.document.createElement('p');paragraph=startContainer.appendChild(paragraph);paragraph=startContainer.insertBefore(paragraph,ruler.nextSibling);paragraph.appendChild(ruler.nextSibling);}else{HTMLArea.removeFromParent(ruler.nextSibling);var paragraph=ruler.nextSibling;}}else{var paragraph=ruler.nextSibling;} if(/^hr$/i.test(paragraph.nodeName)){var inBetweenParagraph=this.editor.document.createElement('p');inBetweenParagraph.innerHTML='
';paragraph=startContainer.insertBefore(inBetweenParagraph,paragraph);}}else{var paragraph=this.editor.document.createElement('p');if(Ext.isWebKit){paragraph.innerHTML='
';} paragraph=startContainer.appendChild(paragraph);} this.editor.selectNodeContents(paragraph,true);}}},onGenerate:function(){if(Ext.isIE){this.editor.iframe.keyMap.addBinding({key:Ext.EventObject.ENTER,shift:false,handler:this.onKey,scope:this});}},onKey:function(key,event){var selection=this.editor._getSelection();if(this.editor._selectionEmpty(selection)){var range=this.editor._createRange(selection);var parentElement=this.editor.getParentElement(selection,range);while(parentElement&&!HTMLArea.isBlockElement(parentElement)){parentElement=parentElement.parentNode;} if(/^(dt|dd)$/i.test(parentElement.nodeName)){var nodeRange=this.editor._createRange();nodeRange.moveToElementText(parentElement);range.setEndPoint("EndToEnd",nodeRange);if(!range.text||range.text=="\x20"){var item=parentElement.parentNode.insertBefore(this.editor._doc.createElement((parentElement.nodeName.toLowerCase()==="dt")?"dd":"dt"),parentElement.nextSibling);item.innerHTML="\x20";this.editor.selectNodeContents(item,true);event.stopEvent();return false;}}else if(/^(li)$/i.test(parentElement.nodeName)&&!parentElement.innerText&&parentElement.parentNode.parentNode&&/^(dd|td|th)$/i.test(parentElement.parentNode.parentNode.nodeName)){var item=parentElement.parentNode.parentNode.insertBefore(this.editor._doc.createTextNode("\x20"),parentElement.parentNode.nextSibling);this.editor.selectNodeContents(parentElement.parentNode.parentNode,false);parentElement.parentNode.removeChild(parentElement);event.stopEvent();return false;}} return true;},cleanClasses:function(node){var classNames=node.className.trim().split(" ");var nodeName=node.nodeName.toLowerCase();for(var i=classNames.length;--i>=0;){if(!HTMLArea.reservedClassNames.test(classNames[i])){if(this.tags&&this.tags[nodeName]&&this.tags[nodeName].allowedClasses){if(!this.tags[nodeName].allowedClasses.test(classNames[i])){HTMLArea.DOM.removeClass(node,classNames[i]);}}else if(this.tags&&this.tags.all&&this.tags.all.allowedClasses){if(!this.tags.all.allowedClasses.test(classNames[i])){HTMLArea.DOM.removeClass(node,classNames[i]);}} if(this.formatBlockItems[nodeName]&&this.formatBlockItems[nodeName].classList&&this.formatBlockItems[nodeName].classList.test(classNames[i])){HTMLArea.DOM.removeClass(node,classNames[i]);}}}},onUpdateToolbar:function(button,mode,selectionEmpty,ancestors,endPointsInSameBlock){if(mode==='wysiwyg'&&this.editor.isEditable()){var statusBarSelection=this.editor.statusBar?this.editor.statusBar.getSelection():null;var parentElement=statusBarSelection?statusBarSelection:this.editor.getParentElement();if(!/^body$/i.test(parentElement.nodeName)){while(parentElement&&!HTMLArea.isBlockElement(parentElement)||/^li$/i.test(parentElement.nodeName)){parentElement=parentElement.parentNode;} var blockAncestors=this.getBlockAncestors(parentElement);var endBlocks=this.editor.getEndBlocks(this.editor._getSelection());var startAncestors=this.getBlockAncestors(endBlocks.start);var endAncestors=this.getBlockAncestors(endBlocks.end);var index=0;while(index=0;){if(/^blockquote$/i.test(blockAncestors[j].nodeName)){commandState=true;break;}}}else if(/^(ol|ul)$/i.test(parentElement.nodeName)){commandState=true;}else{for(var j=blockAncestors.length;--j>=0;){if(HTMLArea.DOM.hasClass(blockAncestors[j],this.useClass.Indent)||/^(td|th)$/i.test(blockAncestors[j].nodeName)){commandState=true;break;}}} button.setDisabled(!commandState);break;case"Indent":break;case"InsertParagraphBefore":case"InsertParagraphAfter":button.setDisabled(/^(body)$/i.test(startAncestors[index].nodeName));break;case"Blockquote":for(var j=blockAncestors.length;--j>=0;){if(/^blockquote$/i.test(blockAncestors[j].nodeName)){commandState=true;break;}} button.setInactive(!commandState);break;case"JustifyLeft":case"JustifyCenter":case"JustifyRight":case"JustifyFull":if(this.useAlignAttribute){try{commandState=this.editor._doc.queryCommandState(button.itemId);}catch(e){commandState=false;}}else{if(/^(body)$/i.test(startAncestors[index].nodeName)){button.setDisabled(true);}else{button.setDisabled(false);commandState=true;for(var block=startAncestors[index];block;block=block.nextSibling){commandState=commandState&&HTMLArea.DOM.hasClass(block,this.useClass[button.itemId]);if(block==endAncestors[index]){break;}}}} button.setInactive(!commandState);break;case"InsertOrderedList":case"InsertUnorderedList":try{commandState=this.editor._doc.queryCommandState(button.itemId);}catch(e){commandState=false;} button.setInactive(!commandState);break;default:break;}}else{switch(button.itemId){case'FormatBlock':this.updateDropDown(button);break;case'Outdent':button.setDisabled(true);break;case'Indent':break;case'InsertParagraphBefore':case'InsertParagraphAfter':button.setDisabled(true);break;case'Blockquote':button.setInactive(true);break;case'JustifyLeft':case'JustifyCenter':case'JustifyRight':case'JustifyFull':button.setInactive(true);button.setDisabled(true);break;case'InsertOrderedList':case'InsertUnorderedList':button.setInactive(true);break;default:break;}}}},updateDropDown:function(select,deepestBlockAncestor,startAncestor){var store=select.getStore();store.removeAt(0);var index=-1;if(deepestBlockAncestor){var nodeName=deepestBlockAncestor.nodeName.toLowerCase();index=store.findBy(function(record,id){var item=this.formatBlockItems[record.get('value')];return item&&item.tagName==nodeName&&item.addClass&&HTMLArea.DOM.hasClass(deepestBlockAncestor,item.addClass);},this);if(index==-1){index=store.findExact('value',nodeName);}} if(index==-1){store.insert(0,new store.recordType({text:this.localize('No block'),value:'none'}));select.setValue('none');}else{store.insert(0,new store.recordType({text:this.localize('Remove block'),value:'none'}));select.setValue(store.getAt(index+1).get('value'));}},onHotKey:function(editor,key){var blockElement;var hotKeyConfiguration=this.getHotKeyConfiguration(key);if(hotKeyConfiguration){var blockElement=hotKeyConfiguration.element;} if(blockElement&&this.isAllowedBlockElement(blockElement)){this.applyBlockElement(this.translateHotKey(key),blockElement);return false;} return true;}});HTMLArea.BlockStyle=HTMLArea.Plugin.extend({constructor:function(editor,pluginName){this.base(editor,pluginName);},configurePlugin:function(editor){this.cssArray={};this.classesUrl=this.editorConfiguration.classesUrl;this.pageTSconfiguration=this.editorConfiguration.buttons.blockstyle;this.tags=(this.pageTSconfiguration&&this.pageTSconfiguration.tags)?this.pageTSconfiguration.tags:{};if(typeof(this.editorConfiguration.classesTag)!=="undefined"){if(this.editorConfiguration.classesTag.div){if(!this.tags.div){this.tags.div=new Object();} if(!this.tags.div.allowedClasses){this.tags.div.allowedClasses=this.editorConfiguration.classesTag.div;}} if(this.editorConfiguration.classesTag.td){if(!this.tags.td){this.tags.td=new Object();} if(!this.tags.td.allowedClasses){this.tags.td.allowedClasses=this.editorConfiguration.classesTag.td;}} if(this.editorConfiguration.classesTag.table){if(!this.tags.table){this.tags.table=new Object();} if(!this.tags.table.allowedClasses){this.tags.table.allowedClasses=this.editorConfiguration.classesTag.table;}}} var allowedClasses;for(var tagName in this.tags){if(this.tags.hasOwnProperty(tagName)){if(this.tags[tagName].allowedClasses){allowedClasses=this.tags[tagName].allowedClasses.trim().split(",");for(var cssClass in allowedClasses){if(allowedClasses.hasOwnProperty(cssClass)){allowedClasses[cssClass]=allowedClasses[cssClass].trim().replace(/\*/g,".*");}} this.tags[tagName].allowedClasses=new RegExp("^("+allowedClasses.join("|")+")$","i");}}} this.showTagFreeClasses=(this.pageTSconfiguration?this.pageTSconfiguration.showTagFreeClasses:false)||this.editorConfiguration.showTagFreeClasses;this.prefixLabelWithClassName=this.pageTSconfiguration?this.pageTSconfiguration.prefixLabelWithClassName:false;this.postfixLabelWithClassName=this.pageTSconfiguration?this.pageTSconfiguration.postfixLabelWithClassName:false;var pluginInformation={version:'2.0',developer:'Stanislas Rolland',developerUrl:'http://www.sjbr.ca/',copyrightOwner:'Stanislas Rolland',sponsor:this.localize('Technische Universitat Ilmenau'),sponsorUrl:'http://www.tu-ilmenau.de/',license:'GPL'};this.registerPluginInformation(pluginInformation);var dropDownId='BlockStyle';var fieldLabel=this.pageTSconfiguration?this.pageTSconfiguration.fieldLabel:'';if(Ext.isEmpty(fieldLabel)&&this.isButtonInToolbar('I[Block style label]')){fieldLabel=this.localize('Block style label');} var dropDownConfiguration={id:dropDownId,tooltip:this.localize(dropDownId+'-Tooltip'),fieldLabel:fieldLabel,options:[[this.localize('No style'),'none']],action:'onChange',storeFields:[{name:'text'},{name:'value'},{name:'style'}],tpl:'
{text}
'};if(this.pageTSconfiguration){if(this.pageTSconfiguration.width){dropDownConfiguration.width=parseInt(this.pageTSconfiguration.width,10);} if(this.pageTSconfiguration.listWidth){dropDownConfiguration.listWidth=parseInt(this.pageTSconfiguration.listWidth,10);} if(this.pageTSconfiguration.maxHeight){dropDownConfiguration.maxHeight=parseInt(this.pageTSconfiguration.maxHeight,10);}} this.registerDropDown(dropDownConfiguration);return true;},onChange:function(editor,combo,record,index){var className=combo.getValue();this.editor.focus();var blocks=this.getSelectedBlocks();for(var k=0;k=0;){if(!HTMLArea.reservedClassNames.test(classNames[i])){HTMLArea.DOM.removeClass(node,classNames[i]);if(node.nodeName.toLowerCase()==="table"&&this.getPluginInstance('TableOperations')){this.getPluginInstance('TableOperations').removeAlternatingClasses(node,classNames[i]);this.getPluginInstance('TableOperations').removeCountingClasses(node,classNames[i]);} break;}}}else{var nodeName=node.nodeName.toLowerCase();if(this.tags&&this.tags[nodeName]&&this.tags[nodeName].allowedClasses){if(this.tags[nodeName].allowedClasses.test(className)){HTMLArea.DOM.addClass(node,className);}}else if(this.tags&&this.tags.all&&this.tags.all.allowedClasses){if(this.tags.all.allowedClasses.test(className)){HTMLArea.DOM.addClass(node,className);}}else{HTMLArea.DOM.addClass(node,className);} if(nodeName==="table"&&this.getPluginInstance('TableOperations')){this.getPluginInstance('TableOperations').reStyleTable(node);}}},getSelectedBlocks:function(){var block,range,i=0,blocks=[];var statusBarSelection=this.editor.statusBar?this.editor.statusBar.getSelection():null;if(Ext.isGecko){var selection=this.editor._getSelection();try{while((range=selection.getRangeAt(i++))){block=this.editor.getParentElement(selection,range);blocks.push(statusBarSelection?statusBarSelection:block);}}catch(e){}}else{blocks.push(statusBarSelection?statusBarSelection:this.editor.getParentElement());} return blocks;},onGenerate:function(){this.editor.iframe.mon(this.editor,'HTMLAreaEventModeChange',this.onModeChange,this);this.blockStyles=new HTMLArea.CSS.Parser({prefixLabelWithClassName:this.prefixLabelWithClassName,postfixLabelWithClassName:this.postfixLabelWithClassName,showTagFreeClasses:this.showTagFreeClasses,tags:this.tags,editor:this.editor});this.editor.iframe.mon(this.blockStyles,'HTMLAreaEventCssParsingComplete',this.onCssParsingComplete,this);this.blockStyles.initiateParsing();},onCssParsingComplete:function(){if(this.blockStyles.isReady){this.cssArray=this.blockStyles.getClasses();} if(this.getEditorMode()==='wysiwyg'&&this.editor.isEditable()){this.updateValue('BlockStyle');}},onUpdateToolbar:function(button,mode,selectionEmpty,ancestors){if(mode==='wysiwyg'&&this.editor.isEditable()){this.updateValue(button.itemId);}},onModeChange:function(mode){if(mode==='wysiwyg'&&this.editor.isEditable()){this.updateValue('BlockStyle');}},updateValue:function(dropDownId){var dropDown=this.getButton(dropDownId);if(dropDown){var classNames=new Array();var tagName=null;var statusBarSelection=this.editor.statusBar?this.editor.statusBar.getSelection():null;var parent=statusBarSelection?statusBarSelection:this.editor.getParentElement();while(parent&&!HTMLArea.isBlockElement(parent)&&parent.nodeName.toLowerCase()!="img"){parent=parent.parentNode;} if(parent){tagName=parent.nodeName.toLowerCase();classNames=HTMLArea.DOM.getClassNames(parent);} if(tagName&&tagName!=="body"){this.buildDropDownOptions(dropDown,tagName);this.setSelectedOption(dropDown,classNames);}else{this.initializeDropDown(dropDown);dropDown.setDisabled(true);}}},initializeDropDown:function(dropDown){var store=dropDown.getStore();store.removeAll(false);store.insert(0,new store.recordType({text:this.localize('No style'),value:'none'}));dropDown.setValue('none');},buildDropDownOptions:function(dropDown,nodeName){var store=dropDown.getStore();this.initializeDropDown(dropDown);if(this.blockStyles.isReady){var allowedClasses={};if(Ext.isDefined(this.cssArray[nodeName])){allowedClasses=this.cssArray[nodeName];}else if(this.showTagFreeClasses&&Ext.isDefined(this.cssArray['all'])){allowedClasses=this.cssArray['all'];} Ext.iterate(allowedClasses,function(cssClass,value){var style=null;if(!this.editor.config.disablePCexamples){if(HTMLArea.classesValues[cssClass]&&!HTMLArea.classesNoShow[cssClass]){style=HTMLArea.classesValues[cssClass];}else if(/-[0-9]+$/.test(cssClass)&&HTMLArea.classesValues[RegExp.leftContext+'-']){style=HTMLArea.classesValues[RegExp.leftContext+'-'];}} store.add(new store.recordType({text:value,value:cssClass,style:style}));},this);}},setSelectedOption:function(dropDown,classNames,noUnknown,defaultClass){var store=dropDown.getStore();dropDown.setValue('none');if(classNames.length){var index=store.findExact('value',classNames[classNames.length-1]);if(index!=-1){dropDown.setValue(classNames[classNames.length-1]);if(!defaultClass){store.getAt(0).set('text',this.localize('Remove style'));}} if(index==-1&&!noUnknown){store.add(new store.recordType({text:this.localize('Unknown style'),value:classNames[classNames.length-1]}));index=store.getCount()-1;dropDown.setValue(classNames[classNames.length-1]);if(!defaultClass){store.getAt(0).set('text',this.localize('Remove style'));}} var classNamesString=','+classNames.join(',')+',';store.each(function(option){if(classNamesString.indexOf(','+option.get('value')+',')!=-1){store.removeAt(store.indexOf(option));} return true;});} dropDown.setDisabled(!store.getCount()||(store.getCount()==1&&dropDown.getValue()=='none'));}});HTMLArea.CharacterMap=HTMLArea.Plugin.extend({constructor:function(editor,pluginName){this.base(editor,pluginName);},configurePlugin:function(editor){var pluginInformation={version:'2.0',developer:'Holger Hees, Bernhard Pfeifer, Stanislas Rolland',developerUrl:'http://www.sjbr.ca/',copyrightOwner:'Holger Hees, Bernhard Pfeifer, Stanislas Rolland',sponsor:'System Concept GmbH, Bernhard Pfeifer, SJBR',sponsorUrl:'http://www.sjbr.ca/',license:'GPL'};this.registerPluginInformation(pluginInformation);var buttonId='InsertCharacter';var buttonConfiguration={id:buttonId,tooltip:this.localize(buttonId+'-Tooltip'),action:'onButtonPress',dialog:true,iconCls:'htmlarea-action-character-insert-from-map'};this.registerButton(buttonConfiguration);Ext.iterate(this.maps,function(key,map,maps){for(var i=map.length;--i>=0;){maps[key][i].push(this.localize(map[i][1]));}},this);return true;},maps:{general:[[' ','nbsp'],['À','Agrave'],['à','agrave'],['Á','Aacute'],['á','aacute'],['Â','Acirc'],['â','acirc'],['Ã','Atilde'],['ã','atilde'],['Ä','Auml'],['ä','auml'],['Å','Aring'],['å','aring'],['Æ','AElig'],['æ','aelig'],['ª','ordf'],['Ç','Ccedil'],['ç','ccedil'],['Ð','ETH'],['ð','eth'],['È','Egrave'],['è','egrave'],['É','Eacute'],['é','eacute'],['Ê','Ecirc'],['ê','ecirc'],['Ë','Euml'],['ë','euml'],['Ì','Igrave'],['ì','igrave'],['Í','Iacute'],['í','iacute'],['Î','Icirc'],['î','icirc'],['Ï','Iuml'],['ï','iuml'],['Ñ','Ntilde'],['ñ','ntilde'],['Ò','Ograve'],['ò','ograve'],['Ó','Oacute'],['ó','oacute'],['Ô','Ocirc'],['ô','ocirc'],['Õ','Otilde'],['õ','otilde'],['Ö','Ouml'],['ö','ouml'],['Ø','Oslash'],['ø','oslash'],['Œ','OElig'],['œ','oelig'],['º','ordm'],['Š','Scaron'],['š','scaron'],['ß','szlig'],['Þ','THORN'],['þ','thorn'],['Ù','Ugrave'],['ù','ugrave'],['Ú','Uacute'],['ú','uacute'],['Û','Ucirc'],['û','ucirc'],['Ü','Uuml'],['ü','uuml'],['Ý','Yacute'],['ý','yacute'],['Ÿ','Yuml'],['ÿ','yuml'],['´','acute'],['ˆ','circ'],['˜','tilde'],['¨','uml'],['¸','cedil'],['­','shy'],['–','ndash'],['—','mdash'],['‘','lsquo'],['’','rsquo'],['‚','sbquo'],['“','ldquo'],['”','rdquo'],['„','bdquo'],['‹','lsaquo'],['›','rsaquo'],['«','laquo'],['»','raquo'],['"','quot'],['…','hellip'],['¿','iquest'],['¡','iexcl'],['•','bull'],['†','dagger'],['‡','Dagger'],['¦','brvbar'],['¶','para'],['§','sect'],['◊','loz'],['@','#064'],['©','copy'],['®','reg'],['™','trade'],['¤','curren'],['¢','cent'],['€','euro'],['£','pound'],['¥','yen'],[' ','emsp'],[' ','ensp'],[' ','thinsp'],['‍','zwj'],['‌','zwnj']],mathematical:[['−','minus'],['±','plusmn'],['×','times'],['÷','divide'],['√','radic'],['⋅','sdot'],['⊗','otimes'],['∗','lowast'],['≥','ge'],['≤','le'],['≠','ne'],['≈','asymp'],['∼','sim'],['∝','prop'],['°','deg'],['′','prime'],['″','Prime'],['µ','micro'],['∠','ang'],['⊥','perp'],['‰','permil'],['⁄','frasl'],['¼','frac14'],['½','frac12'],['¾','frac34'],['¹','sup1'],['²','sup2'],['³','sup3'],['¬','not'],['∧','and'],['∨','or'],['∴','there4'],['≅','cong'],['∈','isin'],['∋','ni'],['∉','notin'],['⊂','sub'],['⊆','sube'],['⊄','nsub'],['⊃','sup'],['⊇','supe'],['∩','cap'],['∪','cup'],['⊕','oplus'],['∇','nabla'],['∅','empty'],['≡','equiv'],['∑','sum'],['∏','prod'],['℘','weierp'],['∃','exist'],['∀','forall'],['∞','infin'],['ℵ','alefsym'],['ℜ','real'],['ℑ','image'],['ƒ','fnof'],['∫','int'],['∂','part'],['Α','Alpha'],['α','alpha'],['Β','Beta'],['β','beta'],['Γ','Gamma'],['γ','gamma'],['Δ','Delta'],['δ','delta'],['Ε','Epsilon'],['ε','epsilon'],['Ζ','Zeta'],['ζ','zeta'],['Η','Eta'],['η','eta'],['Θ','Theta'],['θ','theta'],['ϑ','thetasym'],['Ι','Iota'],['ι','iota'],['Κ','Kappa'],['κ','kappa'],['Λ','Lambda'],['λ','lambda'],['Μ','Mu'],['μ','mu'],['Ν','Nu'],['ν','nu'],['Ξ','Xi'],['ξ','xi'],['Ο','Omicron'],['ο','omicron'],['Π','Pi'],['π','pi'],['ϖ','piv'],['Ρ','Rho'],['ρ','rho'],['Σ','Sigma'],['σ','sigma'],['ς','sigmaf'],['Τ','Tau'],['τ','tau'],['Υ','Upsilon'],['ϒ','upsih'],['υ','upsilon'],['Φ','Phi'],['φ','phi'],['Χ','Chi'],['χ','chi'],['Ψ','Psi'],['ψ','psi'],['Ω','Omega'],['ω','omega']],graphical:[['↵','crarr'],['↑','uarr'],['↓','darr'],['←','larr'],['→','rarr'],['↔','harr'],['⇑','uArr'],['⇓','dArr'],['⇐','lArr'],['⇒','rArr'],['⇔','hArr'],[' ','nbsp'],[' ','nbsp'],[' ','nbsp'],[' ','nbsp'],['♣','clubs'],['♦','diams'],['♥','hearts'],['♠','spades']]},onButtonPress:function(editor,id){var buttonId=this.translateHotKey(id);buttonId=buttonId?buttonId:id;this.openDialogue(buttonId,'Insert special character',this.getWindowDimensions({width:434,height:360},buttonId),this.buildTabItems());return false;},openDialogue:function(buttonId,title,dimensions,tabItems,handler){this.dialog=new Ext.Window({title:this.localize(title),cls:'htmlarea-window',border:false,width:dimensions.width,height:'auto',resizable:!Ext.isIE,iconCls:this.getButton(buttonId).iconCls,listeners:{close:{fn:this.onClose,scope:this}},items:{xtype:'tabpanel',activeTab:0,listeners:{activate:{fn:this.resetFocus,scope:this},tabchange:{fn:this.syncHeight,scope:this}},items:tabItems},buttons:[this.buildButtonConfig('Cancel',this.onCancel)]});this.show();},buildTabItems:function(){var tabItems=[];Ext.iterate(this.maps,function(id,map){tabItems.push({xtype:'box',cls:'character-map',title:this.localize(id),itemId:id,tpl:new Ext.XTemplate('{0}'),listeners:{render:{fn:this.renderMap,scope:this}}});},this);return tabItems;},renderMap:function(component){component.tpl.overwrite(component.el,this.maps[component.itemId]);component.mon(component.el,'click',this.insertCharacter,this,{delegate:'a'});},insertCharacter:function(event,target){event.stopEvent();this.editor.focus();this.restoreSelection();var entity=Ext.get(target).dom.innerHTML;if(Ext.isIE){this.editor.insertHTML(entity);this.saveSelection();}else{this.editor.insertNodeAtSelection(this.editor.document.createTextNode(((Ext.isGecko||Ext.isWebKit)&&entity==' ')?'\xA0':entity));} return false;},resetFocus:function(){this.editor.focus();this.restoreSelection();}});HTMLArea.TextStyle=HTMLArea.Plugin.extend({constructor:function(editor,pluginName){this.base(editor,pluginName);},configurePlugin:function(editor){this.cssArray={};this.classesUrl=this.editorConfiguration.classesUrl;this.pageTSconfiguration=this.editorConfiguration.buttons.textstyle;this.tags=(this.pageTSconfiguration&&this.pageTSconfiguration.tags)?this.pageTSconfiguration.tags:{};if(typeof(this.editorConfiguration.classesTag)!=="undefined"){if(this.editorConfiguration.classesTag.span){if(!this.tags.span){this.tags.span=new Object();} if(!this.tags.span.allowedClasses){this.tags.span.allowedClasses=this.editorConfiguration.classesTag.span;}}} var allowedClasses;for(var tagName in this.tags){if(this.tags.hasOwnProperty(tagName)){if(this.tags[tagName].allowedClasses){allowedClasses=this.tags[tagName].allowedClasses.trim().split(",");for(var cssClass in allowedClasses){if(allowedClasses.hasOwnProperty(cssClass)){allowedClasses[cssClass]=allowedClasses[cssClass].trim().replace(/\*/g,".*");}} this.tags[tagName].allowedClasses=new RegExp("^("+allowedClasses.join("|")+")$","i");}}} this.showTagFreeClasses=(this.pageTSconfiguration?this.pageTSconfiguration.showTagFreeClasses:false)||this.editorConfiguration.showTagFreeClasses;this.prefixLabelWithClassName=this.pageTSconfiguration?this.pageTSconfiguration.prefixLabelWithClassName:false;this.postfixLabelWithClassName=this.pageTSconfiguration?this.pageTSconfiguration.postfixLabelWithClassName:false;this.REInlineTags=/^(a|abbr|acronym|b|bdo|big|cite|code|del|dfn|em|i|img|ins|kbd|q|samp|small|span|strike|strong|sub|sup|tt|u|var)$/;this.allowedAttributes=new Array("id","title","lang","xml:lang","dir","class");if(Ext.isIE){this.addAllowedAttribute("className");} var pluginInformation={version:'2.1',developer:'Stanislas Rolland',developerUrl:'http://www.sjbr.ca/',copyrightOwner:'Stanislas Rolland',sponsor:this.localize('Technische Universitat Ilmenau'),sponsorUrl:'http://www.tu-ilmenau.de/',license:'GPL'};this.registerPluginInformation(pluginInformation);var buttonId='TextStyle';var fieldLabel=this.pageTSconfiguration?this.pageTSconfiguration.fieldLabel:'';if(Ext.isEmpty(fieldLabel)&&this.isButtonInToolbar('I[text_style]')){fieldLabel=this.localize('text_style');} var dropDownConfiguration={id:buttonId,tooltip:this.localize(buttonId+'-Tooltip'),fieldLabel:fieldLabel,options:[[this.localize('No style'),'none']],action:'onChange',storeFields:[{name:'text'},{name:'value'},{name:'style'}],tpl:'
{text}
'};if(this.pageTSconfiguration){if(this.pageTSconfiguration.width){dropDownConfiguration.width=parseInt(this.pageTSconfiguration.width,10);} if(this.pageTSconfiguration.listWidth){dropDownConfiguration.listWidth=parseInt(this.pageTSconfiguration.listWidth,10);} if(this.pageTSconfiguration.maxHeight){dropDownConfiguration.maxHeight=parseInt(this.pageTSconfiguration.maxHeight,10);}} this.registerDropDown(dropDownConfiguration);return true;},isInlineElement:function(el){return el&&(el.nodeType===1)&&this.REInlineTags.test(el.nodeName.toLowerCase());},addAllowedAttribute:function(attribute){this.allowedAttributes.push(attribute);},onChange:function(editor,combo,record,index){var className=combo.getValue();var classNames=null;var fullNodeSelected=false;this.editor.focus();var selection=this.editor._getSelection();var statusBarSelection=this.editor.statusBar?this.editor.statusBar.getSelection():null;var range=this.editor._createRange(selection);var parent=this.editor.getParentElement();var selectionEmpty=this.editor._selectionEmpty(selection);var ancestors=this.editor.getAllAncestors();if(Ext.isIE){var bookmark=range.getBookmark();} if(!selectionEmpty){for(var i=0;i=0;){if((node.hasAttribute&&node.hasAttribute(additionalAttributes[i]))||node.getAttribute(additionalAttributes[i])!=null){additionalParameter+="&curUrl["+additionalAttributes[i]+"]="+encodeURIComponent(node.getAttribute(additionalAttributes[i]));}}}}else if(this.editor.hasSelectedText()){var text=this.editor.getSelectedHTML();if(text&&text!=null){var offset=text.toLowerCase().indexOf("");ATagContent=ATagContent.substring(0,offset);additionalParameter="&curUrl[all]="+encodeURIComponent(ATagContent);}}} this.openContainerWindow(buttonId,this.getButton(buttonId).tooltip.title,this.getWindowDimensions({width:550,height:500},buttonId),this.makeUrlFromModulePath(this.modulePath,additionalParameter));} return false;},createLink:function(theLink,cur_target,cur_class,cur_title,additionalValues){var selection,range,anchorClass,imageNode=null,addIconAfterLink;this.editor.focus();this.restoreSelection();var node=this.editor.getParentElement();var el=HTMLArea.getElementObject(node,'a');if(el!=null&&/^a$/i.test(el.nodeName)){node=el;} if(HTMLArea.classesAnchorSetup&&cur_class){for(var i=HTMLArea.classesAnchorSetup.length;--i>=0;){anchorClass=HTMLArea.classesAnchorSetup[i];if(anchorClass.name==cur_class&&anchorClass.image){imageNode=this.editor.document.createElement('img');imageNode.src=anchorClass.image;imageNode.alt=anchorClass.altText;addIconAfterLink=anchorClass.addIconAfterLink;break;}}} if(node!=null&&/^a$/i.test(node.nodeName)){this.editor.selectNode(node);selection=this.editor._getSelection();range=this.editor._createRange(selection);if(HTMLArea.classesAnchorSetup){this.cleanAllLinks(node,range,true);} if(Ext.isIE){var content=node.innerHTML;} node.href=Ext.isGecko?encodeURI(theLink):theLink;if(Ext.isIE){node.innerHTML=content;} this.setLinkAttributes(node,range,cur_target,cur_class,cur_title,imageNode,addIconAfterLink,additionalValues);}else{selection=this.editor._getSelection();range=this.editor._createRange(selection);if(Ext.isIE){this.cleanAllLinks(node,range);}else{var bookmark=this.editor.getBookmark(range);this.cleanAllLinks(node,range);var range=this.editor.moveToBookmark(bookmark);this.editor.selectRange(range);} if(Ext.isGecko){this.editor.document.execCommand('CreateLink',false,encodeURI(theLink));}else{this.editor.document.execCommand('CreateLink',false,theLink);} selection=this.editor._getSelection();range=this.editor._createRange(selection);node=this.editor.getParentElement();var el=HTMLArea.getElementObject(node,'a');if(el!=null&&/^a$/i.test(el.nodeName)){node=el;} if(node){if(Ext.isIE){if(node.lastChild&&/^br$/i.test(node.lastChild.nodeName)){HTMLArea.removeFromParent(node.lastChild);node.parentNode.insertBefore(this.editor.document.createElement('br'),node.nextSibling);}} this.setLinkAttributes(node,range,cur_target,cur_class,cur_title,imageNode,addIconAfterLink,additionalValues);}} this.close();},unLink:function(buttonPressed){this.editor.focus();if(!buttonPressed){this.restoreSelection();} var node=this.editor.getParentElement();var el=HTMLArea.getElementObject(node,"a");if(el!=null&&/^a$/i.test(el.nodeName))node=el;if(node!=null&&/^a$/i.test(node.nodeName))this.editor.selectNode(node);if(HTMLArea.classesAnchorSetup){var selection=this.editor._getSelection();var range=this.editor._createRange(selection);if(!Ext.isIE){this.cleanAllLinks(node,range,false);}else{this.cleanAllLinks(node,range,true);this.editor._doc.execCommand("Unlink",false,"");}}else{this.editor._doc.execCommand("Unlink",false,"");} if(this.dialog){this.close();}},setLinkAttributes:function(node,range,cur_target,cur_class,cur_title,imageNode,addIconAfterLink,additionalValues){if(/^a$/i.test(node.nodeName)){var nodeInRange=false;if(!Ext.isIE){nodeInRange=this.editor.rangeIntersectsNode(range,node);}else{if(this.editor._getSelection().type.toLowerCase()=="control"){nodeInRange=true;}else{var nodeRange=this.editor._doc.body.createTextRange();nodeRange.moveToElementText(node);nodeInRange=nodeRange.inRange(range)||range.inRange(nodeRange)||(range.compareEndPoints("StartToStart",nodeRange)==0)||(range.compareEndPoints("EndToEnd",nodeRange)==0);}} if(nodeInRange){if(imageNode!=null){if(addIconAfterLink){node.appendChild(imageNode.cloneNode(false));}else{node.insertBefore(imageNode.cloneNode(false),node.firstChild);}} if(Ext.isGecko){node.href=decodeURI(node.href);} if(cur_target.trim())node.target=cur_target.trim();else node.removeAttribute("target");if(cur_class.trim()){node.className=cur_class.trim();}else{if(!Ext.isOpera){node.removeAttribute('class');if(Ext.isIE){node.removeAttribute('className');}}else{node.className='';}} if(cur_title.trim()){node.title=cur_title.trim();}else{node.removeAttribute("title");node.removeAttribute("rtekeep");} if(this.pageTSConfiguration&&this.pageTSConfiguration.additionalAttributes&&typeof(additionalValues)=="object"){for(additionalAttribute in additionalValues){if(additionalValues.hasOwnProperty(additionalAttribute)){if(additionalValues[additionalAttribute].toString().trim()){node.setAttribute(additionalAttribute,additionalValues[additionalAttribute]);}else{node.removeAttribute(additionalAttribute);}}}}}}else{for(var i=node.firstChild;i;i=i.nextSibling){if(i.nodeType==1||i.nodeType==11){this.setLinkAttributes(i,range,cur_target,cur_class,cur_title,imageNode,addIconAfterLink,additionalValues);}}}},cleanClassesAnchorImages:function(node){var nodeArray=[],splitArray1=[],splitArray2=[];for(var childNode=node.firstChild;childNode;childNode=childNode.nextSibling){if(/^img$/i.test(childNode.nodeName)){splitArray1=childNode.src.split("/");for(var i=HTMLArea.classesAnchorSetup.length;--i>=0;){if(HTMLArea.classesAnchorSetup[i]["image"]){splitArray2=HTMLArea.classesAnchorSetup[i]["image"].split("/");if(splitArray1[splitArray1.length-1]==splitArray2[splitArray2.length-1]){nodeArray.push(childNode);break;}}}}} for(i=nodeArray.length;--i>=0;){node.removeChild(nodeArray[i]);}},cleanAllLinks:function(node,range,keepLinks){if(/^a$/i.test(node.nodeName)){var intersection=false;if(!Ext.isIE){intersection=this.editor.rangeIntersectsNode(range,node);}else{if(this.editor._getSelection().type.toLowerCase()=="control"){intersection=true;}else{var nodeRange=this.editor._doc.body.createTextRange();nodeRange.moveToElementText(node);intersection=range.inRange(nodeRange)||((range.compareEndPoints("StartToStart",nodeRange)>0)&&(range.compareEndPoints("StartToEnd",nodeRange)<0))||((range.compareEndPoints("EndToStart",nodeRange)>0)&&(range.compareEndPoints("EndToEnd",nodeRange)<0));}} if(intersection){this.cleanClassesAnchorImages(node);if(!keepLinks){while(node.firstChild)node.parentNode.insertBefore(node.firstChild,node);node.parentNode.removeChild(node);}}}else{for(var i=node.firstChild;i;i=i.nextSibling){if(i.nodeType==1||i.nodeType==11)this.cleanAllLinks(i,range,keepLinks);}}},onUpdateToolbar:function(button,mode,selectionEmpty,ancestors){if(mode==='wysiwyg'&&this.editor.isEditable()){switch(button.itemId){case'CreateLink':button.setDisabled(selectionEmpty&&!button.isInContext(mode,selectionEmpty,ancestors));if(!button.disabled){var node=this.editor.getParentElement();var el=HTMLArea.getElementObject(node,'a');if(el!=null&&/^a$/i.test(el.nodeName)){node=el;} if(node!=null&&/^a$/i.test(node.nodeName)){button.setTooltip({title:this.localize('Modify link')});}else{button.setTooltip({title:this.localize('Insert link')});}} break;case'UnLink':var link=false;if(Ext.isGecko&&!selectionEmpty){var range=this.editor._createRange(this.editor._getSelection());if(range.startContainer.nodeType==1&&range.startContainer==range.endContainer&&(range.endOffset-range.startOffset==1)){var node=range.startContainer.childNodes[range.startOffset];if(node&&/^a$/i.test(node.nodeName)&&node.textContent==range.toString()){link=true;}}} button.setDisabled(!link&&!button.isInContext(mode,selectionEmpty,ancestors));break;}}}});HTMLArea.FindReplace=HTMLArea.Plugin.extend({constructor:function(editor,pluginName){this.base(editor,pluginName);},configurePlugin:function(editor){var pluginInformation={version:'2.0',developer:'Cau Guanabara & Stanislas Rolland',developerUrl:'http://www.sjbr.ca',copyrightOwner:'Cau Guanabara & Stanislas Rolland',sponsor:'Independent production & SJBR',sponsorUrl:'http://www.sjbr.ca',license:'GPL'};this.registerPluginInformation(pluginInformation);var buttonId='FindReplace';var buttonConfiguration={id:buttonId,tooltip:this.localize('Find and Replace'),iconCls:'htmlarea-action-find-replace',action:'onButtonPress',dialog:true};this.registerButton(buttonConfiguration);this.marksCleaningRE=/(]*id="?htmlarea-frmark[^>]*"?>)([^<>]*)(<\/span>)/gi;return true;},onButtonPress:function(editor,id,target){var buttonId=this.translateHotKey(id);buttonId=buttonId?buttonId:id;this.buffer=null;this.initVariables();var plugin=this.getPluginInstance('UndoRedo');if(plugin){plugin.stop();var undo=this.getButton('Undo');if(undo){undo.setDisabled(true);} var redo=this.getButton('Redo');if(redo){redo.setDisabled(true);}} this.openDialogue(buttonId,'Find and Replace',this.getWindowDimensions({width:410,height:360},buttonId));return false;},openDialogue:function(buttonId,title,dimensions){this.dialog=new Ext.Window({title:this.localize(title),cls:'htmlarea-window',border:false,width:dimensions.width,height:'auto',resizable:!Ext.isIE,iconCls:this.getButton(buttonId).iconCls,listeners:{close:{fn:this.onClose,scope:this}},items:[{xtype:'fieldset',defaultType:'textfield',labelWidth:100,defaults:{labelSeparator:'',width:250,listeners:{change:{fn:this.clearDoc,scope:this}}},listeners:{render:{fn:this.initPattern,scope:this}},items:[{itemId:'pattern',fieldLabel:this.localize('Search for:')},{itemId:'replacement',fieldLabel:this.localize('Replace with:')}]},{xtype:'fieldset',defaultType:'checkbox',title:this.localize('Options'),labelWidth:150,items:[{itemId:'words',fieldLabel:this.localize('Whole words only'),listeners:{check:{fn:this.clearDoc,scope:this}}},{itemId:'matchCase',fieldLabel:this.localize('Case sensitive search'),listeners:{check:{fn:this.clearDoc,scope:this}}},{itemId:'replaceAll',fieldLabel:this.localize('Substitute all occurrences'),listeners:{check:{fn:this.requestReplacement,scope:this}}}]},{xtype:'fieldset',defaultType:'button',title:this.localize('Actions'),defaults:{minWidth:150,disabled:true,style:{marginBottom:'5px'}},items:[{text:this.localize('Clear'),itemId:'clear',listeners:{click:{fn:this.clearMarks,scope:this}}},{text:this.localize('Highlight'),itemId:'hiliteall',listeners:{click:{fn:this.hiliteAll,scope:this}}},{text:this.localize('Undo'),itemId:'undo',listeners:{click:{fn:this.resetContents,scope:this}}}]}],buttons:[this.buildButtonConfig('Next',this.onNext),this.buildButtonConfig('Done',this.onCancel)]});this.show();},initPattern:function(fieldset){var selection=this.editor.getSelectedHTML();if(/\S/.test(selection)){selection=selection.replace(/<[^>]*>/g,'');selection=selection.replace(/ /g,'');} if(/\S/.test(selection)){fieldset.getComponent('pattern').setValue(selection);fieldset.getComponent('replacement').focus();}else{fieldset.getComponent('pattern').focus();}},requestReplacement:function(){if(!this.dialog.find('itemId','replacement')[0].getValue()&&this.dialog.find('itemId','replaceAll')[0].getValue()){TYPO3.Dialog.InformationDialog({title:this.getButton('FindReplace').tooltip.title,msg:this.localize('Inform a replacement word'),fn:function(){this.dialog.find('itemId','replacement')[0].focus();},scope:this});} this.clearDoc();},onNext:function(){if(!this.dialog.find('itemId','pattern')[0].getValue()){TYPO3.Dialog.InformationDialog({title:this.getButton('FindReplace').tooltip.title,msg:this.localize('Enter the text you want to find'),fn:function(){this.dialog.find('itemId','pattern')[0].focus();},scope:this});return false;} var fields=['pattern','replacement','words','matchCase','replaceAll'];var params={};Ext.each(fields,function(field){params[field]=this.dialog.find('itemId',field)[0].getValue();},this);this.search(params);return false;},search:function(params){var html=this.editor.getInnerHTML();if(this.buffer==null){this.buffer=html;} if(this.matches==0){var pattern=new RegExp(params.words?'(?!<[^>]*)(\\b'+params.pattern+'\\b)(?![^<]*>)':'(?!<[^>]*)('+params.pattern+')(?![^<]*>)','g'+(params.matchCase?'':'i'));this.editor.setHTML(html.replace(pattern,''+"$1"+''));Ext.each(this.editor.document.body.getElementsByTagName('span'),function(mark){if(/^htmlarea-frmark/.test(mark.id)){this.spans.push(mark);}},this);} this.spanWalker(params.pattern,params.replacement,params.replaceAll);},spanWalker:function(pattern,replacement,replaceAll){this.clearMarks();if(this.spans.length){Ext.each(this.spans,function(mark,i){if(i>=this.matches&&!/[0-9]$/.test(mark.id)){this.matches++;this.disableActions('clear',false);mark.id='htmlarea-frmark_'+this.matches;mark.style.color='white';mark.style.backgroundColor='highlight';mark.style.fontWeight='bold';mark.scrollIntoView(false);var self=this;function replace(button){if(button=='yes'){mark.firstChild.replaceData(0,mark.firstChild.data.length,replacement);self.replaces++;self.disableActions('undo',false);} self.endWalk(pattern,i);} if(replaceAll){replace('yes');return true;}else{TYPO3.Dialog.QuestionDialog({title:this.getButton('FindReplace').tooltip.title,msg:this.localize('Substitute this occurrence?'),fn:replace,scope:this});return false;}}},this);}else{this.endWalk(pattern,0);}},endWalk:function(pattern,index){if(index>=this.spans.length-1||!this.spans.length){var message=this.localize('Done')+':

';if(this.matches>0){if(this.matches==1){message+=this.matches+' '+this.localize('found item');}else{message+=this.matches+' '+this.localize('found items');} if(this.replaces>0){if(this.replaces==1){message+=',
'+this.replaces+' '+this.localize('replaced item');}else{message+=',
'+this.replaces+' '+this.localize('replaced items');}} this.hiliteAll();}else{message+='"'+pattern+'" '+this.localize('not found');this.disableActions('hiliteall,clear',true);} TYPO3.Dialog.InformationDialog({title:this.getButton('FindReplace').tooltip.title,msg:message+'.',minWidth:300});}},clearDoc:function(){this.editor.setHTML(this.editor.getInnerHTML().replace(this.marksCleaningRE,"$2"));this.initVariables();this.disableActions('hiliteall,clear',true);},clearMarks:function(){Ext.each(this.editor.document.body.getElementsByTagName('span'),function(mark){if(/^htmlarea-frmark/.test(mark.id)){mark.style.backgroundColor='';mark.style.color='';mark.style.fontWeight='';}},this);this.disableActions('hiliteall',false);this.disableActions('clear',true);},hiliteAll:function(){Ext.each(this.editor.document.body.getElementsByTagName('span'),function(mark){if(/^htmlarea-frmark/.test(mark.id)){mark.style.backgroundColor='highlight';mark.style.color='white';mark.style.fontWeight='bold';}},this);this.disableActions('clear',false);this.disableActions('hiliteall',true);},resetContents:function(){if(this.buffer!=null){var transp=this.editor.getInnerHTML();this.editor.setHTML(this.buffer);this.buffer=transp;this.disableActions('clear',true);}},disableActions:function(actions,disabled){Ext.each(actions.split(/[,; ]+/),function(action){this.dialog.find('itemId',action)[0].setDisabled(disabled);},this);},initVariables:function(){this.matches=0;this.replaces=0;this.spans=new Array();},onCancel:function(){this.clearDoc();var plugin=this.getPluginInstance('UndoRedo');if(plugin){plugin.start();} this.base();},onClose:function(){this.clearDoc();var plugin=this.getPluginInstance('UndoRedo');if(plugin){plugin.start();} this.base();}});HTMLArea.RemoveFormat=HTMLArea.Plugin.extend({constructor:function(editor,pluginName){this.base(editor,pluginName);},configurePlugin:function(editor){var pluginInformation={version:'2.1',developer:'Stanislas Rolland',developerUrl:'http://www.sjbr.ca/',copyrightOwner:'Stanislas Rolland',sponsor:'SJBR',sponsorUrl:'http://www.sjbr.ca/',license:'GPL',hasHelp:true};this.registerPluginInformation(pluginInformation);var buttonId='RemoveFormat';var buttonConfiguration={id:buttonId,tooltip:this.localize(buttonId+'Tooltip'),iconCls:'htmlarea-action-remove-format',action:'onButtonPress',dialog:true};this.registerButton(buttonConfiguration);return true;},onButtonPress:function(editor,id,target){var buttonId=this.translateHotKey(id);buttonId=buttonId?buttonId:id;this.openDialogue(buttonId,'Remove formatting',this.getWindowDimensions({width:260,height:260},buttonId));return false;},openDialogue:function(buttonId,title,dimensions){this.dialog=new Ext.Window({title:this.getHelpTip('',title),cls:'htmlarea-window',border:false,width:dimensions.width,height:'auto',resizable:!Ext.isIE,iconCls:this.getButton(buttonId).iconCls,listeners:{close:{fn:this.onClose,scope:this}},items:[{xtype:'fieldset',title:this.getHelpTip('area','Cleaning Area'),defaultType:'radio',labelWidth:140,defaults:{labelSeparator:''},items:[{itemId:'selection',fieldLabel:this.getHelpTip('selection','Selection'),name:'htmlarea-removeFormat-area'},{itemId:'allContent',fieldLabel:this.getHelpTip('all','All'),checked:true,name:'htmlarea-removeFormat-area'}]},{xtype:'fieldset',defaultType:'checkbox',title:this.getHelpTip('options','Cleaning options'),labelWidth:170,defaults:{labelSeparator:''},items:[{itemId:'formatting',fieldLabel:this.getHelpTip('htmlFormat','Formatting:')},{itemId:'msWordFormatting',fieldLabel:this.getHelpTip('msWordFormat','MS Word Formatting:'),checked:true},{itemId:'typographical',fieldLabel:this.getHelpTip('typographicalPunctuation','Typographical punctuation:')},{itemId:'spaces',fieldLabel:this.getHelpTip('nonBreakingSpace','Spaces')},{itemId:'images',fieldLabel:this.getHelpTip('images','Images:')},{itemId:'allHtml',fieldLabel:this.getHelpTip('allHtml','All HTML:')}]}],buttons:[this.buildButtonConfig('OK',this.onOK),this.buildButtonConfig('Cancel',this.onCancel)]});this.show();},onOK:function(){var fields=['selection','allContent','formatting','msWordFormatting','typographical','spaces','images','allHtml'];var params={};Ext.each(fields,function(field){params[field]=this.dialog.find('itemId',field)[0].getValue();},this);if(params['allHtml']||params['formatting']||params['spaces']||params['images']||params['msWordFormatting']||params['typographical']){this.applyRequest(params);this.close();}else{TYPO3.Dialog.InformationDialog({title:this.getButton('RemoveFormat').tooltip.title,msg:this.localize('Select the type of formatting you wish to remove.')});} return false;},applyRequest:function(params){var editor=this.editor;editor.focus();this.restoreSelection();if(params['allContent']){var html=editor.getInnerHTML();}else{var html=editor.getSelectedHTML();} if(html){if(params['allHtml']){html=html.replace(/<[\!]*?[^<>]*?>/g,"");} if(params['formatting']){html=html.replace(/<\/?(abbr|acronym|b|big|cite|code|em|font|i|q|s|samp|small|span|strike|strong|sub|sup|tt|u|var)(>|[^>a-zA-Z][^>]*>)/gi,'');html=html.replace(/[ \t\n\r]+(style|class|align|cellpadding|cellspacing|frame|bgcolor)=\"[^>\"]*\"/gi,"");} if(params['spaces']){html=html.replace(/ /g," ");} if(params['images']){html=html.replace(/<\/?img[^>]*>/gi,"");} if(params['msWordFormatting']){html=html.replace(/[ \r\n\t]+/g," ");html=html.replace(/<(b|strong|i|em|p|li|ul) [^>]*>/gi,"<$1>");html=html.replace(/ (style|class|align)=\"[^>\"]*\"/gi,"");html=html.replace(/<\/?span[^>]*>/gi,"").replace(/<\/?div[^>]*>/gi,"").replace(/<\?xml:[^>]*>/gi,"").replace(/<\/?st1:[^>]*>/gi,"").replace(/<\/?[a-z]:[^>]*>/g,"").replace(/<\/?meta[^>]*>/g,"").replace(/<\/?link[^>]*>/g,"");html=html.replace(/]*>.*<\/style[^>]*>/gi,"").replace(/]*>.*<\/title[^>]*>/gi,"");html=html.replace(/0){splitRow(cells[index++]);}};function selectNextNode(el){var node=el.nextSibling;while(node&&node.nodeType!=1){node=node.nextSibling;} if(!node){node=el.previousSibling;while(node&&node.nodeType!=1){node=node.previousSibling;}} if(!node)node=el.parentNode;editor.selectNodeContents(node);};function getSelectedCells(sel){var cell,range,i=0,cells=[];try{while(range=sel.getRangeAt(i++)){cell=range.startContainer.childNodes[range.startOffset];while(!/^(td|th|body)$/.test(cell.nodeName.toLowerCase()))cell=cell.parentNode;if(/^(td|th)$/.test(cell.nodeName.toLowerCase()))cells.push(cell);}}catch(e){} return cells;};function deleteEmptyTable(table){var lastPart=true;for(var j=tableParts.length;--j>=0;){var tablePart=table.getElementsByTagName(tableParts[j])[0];if(tablePart)lastPart=false;} if(lastPart){selectNextNode(table);table.parentNode.removeChild(table);}};function computeCellIndexes(table){var matrix=[];var lookup={};for(var m=tableParts.length;--m>=0;){var tablePart=table.getElementsByTagName(tableParts[m])[0];if(tablePart){var rows=tablePart.rows;for(var i=0,n=rows.length;i=0;){var tablePart=table.getElementsByTagName(tableParts[j])[0];if(tablePart){var rows=tablePart.rows;for(var i=rows.length;--i>=0;){var tr=rows[i];var ref=tr.cells[index+(/after/.test(buttonId)?1:0)];if(!ref){var otd=editor._doc.createElement(tr.lastChild.nodeName.toLowerCase());otd.innerHTML=mozbr;tr.appendChild(otd);}else{var otd=editor._doc.createElement(ref.nodeName.toLowerCase());otd.innerHTML=mozbr;tr.insertBefore(otd,ref);}}}} this.reStyleTable(table);break;case"TO-col-split":var cell=this.getClosest("td");if(!cell)var cell=this.getClosest("th");if(!cell)break;var sel=editor._getSelection();if(Ext.isGecko&&!sel.isCollapsed){var cells=getSelectedCells(sel);for(i=0;i=0;){var tablePart=table.getElementsByTagName(tableParts[j])[0];if(tablePart){var rows=tablePart.rows;var lastColumn=true;for(var i=rows.length;--i>=0;){if(rows[i].cells.length>1)lastColumn=false;} if(lastColumn){selectNextNode(tablePart);table.removeChild(tablePart);}else{if(part==tablePart)selectNextNode(cell);for(var i=rows.length;--i>=0;){if(rows[i].cells[index])rows[i].removeChild(rows[i].cells[index]);} lastPart=false;}}} if(lastPart){selectNextNode(table);table.parentNode.removeChild(table);} this.reStyleTable(table);break;case"TO-cell-split":var cell=this.getClosest("td");if(!cell)var cell=this.getClosest("th");if(!cell)break;var sel=editor._getSelection();if(Ext.isGecko&&!sel.isCollapsed){var cells=getSelectedCells(sel);for(i=0;i=0;)rows[k]=[];var row=null;var cells=null;if(Ext.isGecko){try{while(range=sel.getRangeAt(i++)){var td=range.startContainer.childNodes[range.startOffset];if(td.parentNode!=row){(cells)&&rows[tablePartsIndex[row.parentNode.nodeName.toLowerCase()]].push(cells);row=td.parentNode;cells=[];} cells.push(td);}}catch(e){} try{rows[tablePartsIndex[row.parentNode.nodeName.toLowerCase()]].push(cells);}catch(e){}}else{var cell=this.getClosest("td");if(!cell)var cell=this.getClosest("th");if(!cell){TYPO3.Dialog.InformationDialog({title:this.getButton('TO-cell-merge').tooltip.title,msg:this.localize('Please click into some cell')});break;} var tr=cell.parentNode;var no_cols=parseInt(prompt(this.localize("How many columns would you like to merge?"),2));if(!no_cols)break;var no_rows=parseInt(prompt(this.localize("How many rows would you like to merge?"),2));if(!no_rows)break;var lookup=computeCellIndexes(cell.parentNode.parentNode.parentNode);var first_index=getActualCellIndex(cell,lookup);var td=cell,colspan=0;cells=[];for(var i=no_cols;--i>=0;){if(!td)break;cells.push(td);var last_index=getActualCellIndex(td,lookup);td=td.nextSibling;} rows[tablePartsIndex[tr.parentNode.nodeName.toLowerCase()]].push(cells);var index,first_index_found,last_index_found;for(var j=1;jlast_index)break;if(index==first_index)first_index_found=true;if(index>=first_index)cells.push(td);} if(!first_index_found)break;rows[tablePartsIndex[tr.parentNode.nodeName.toLowerCase()]].push(cells);}} for(var k=tableParts.length;--k>=0;){var cell,row;var cellHTML="";var cellRowSpan=0;var cellColSpan,maxCellColSpan=0;if(rows[k]&&rows[k][0]){for(var i=0;i=0;){var tablePart=table.getElementsByTagName(this.tableParts[j])[0];if(tablePart){var rows=tablePart.rows;for(var i=rows.length;--i>=0;){if(rows[i].cells.length>index){cells.push(rows[i].cells[index]);}}}} return cells;},toggleBorders:function(forceBorders){var body=this.editor._doc.body;if(!HTMLArea.DOM.hasClass(body,'htmlarea-showtableborders')){HTMLArea.DOM.addClass(body,'htmlarea-showtableborders');}else if(!forceBorders){HTMLArea.DOM.removeClass(body,'htmlarea-showtableborders');}},reStyleTable:function(table){if(table){if(this.classesUrl&&(typeof(HTMLArea.classesAlternating)==='undefined'||typeof(HTMLArea.classesCounting)==='undefined')){this.getJavascriptFile(this.classesUrl,function(options,success,response){if(success){try{if(typeof(HTMLArea.classesAlternating)==='undefined'||typeof(HTMLArea.classesCounting)==='undefined'){eval(response.responseText);this.appendToLog('reStyleTable','Javascript file successfully evaluated: '+this.classesUrl);} this.reStyleTable(table);}catch(e){this.appendToLog('reStyleTable','Error evaluating contents of Javascript file: '+this.classesUrl);}}});}else{var classNames=table.className.trim().split(' ');for(var i=classNames.length;--i>=0;){var classConfiguration=HTMLArea.classesAlternating[classNames[i]];if(classConfiguration&&classConfiguration.rows){if(classConfiguration.rows.oddClass&&classConfiguration.rows.evenClass){this.alternateRows(table,classConfiguration);}} if(classConfiguration&&classConfiguration.columns){if(classConfiguration.columns.oddClass&&classConfiguration.columns.evenClass){this.alternateColumns(table,classConfiguration);}} classConfiguration=HTMLArea.classesCounting[classNames[i]];if(classConfiguration&&classConfiguration.rows){if(classConfiguration.rows.rowClass){this.countRows(table,classConfiguration);}} if(classConfiguration&&classConfiguration.columns){if(classConfiguration.columns.columnClass){this.countColumns(table,classConfiguration);}}}}}},removeAlternatingClasses:function(table,removeClass){if(table){if(this.classesUrl&&typeof(HTMLArea.classesAlternating)==='undefined'){this.getJavascriptFile(this.classesUrl,function(options,success,response){if(success){try{if(typeof(HTMLArea.classesAlternating)==='undefined'){eval(response.responseText);this.appendToLog('removeAlternatingClasses','Javascript file successfully evaluated: '+this.classesUrl);} this.removeAlternatingClasses(table,removeClass);}catch(e){this.appendToLog('removeAlternatingClasses','Error evaluating contents of Javascript file: '+this.classesUrl);}}});}else{var classConfiguration=HTMLArea.classesAlternating[removeClass];if(classConfiguration){if(classConfiguration.rows&&classConfiguration.rows.oddClass&&classConfiguration.rows.evenClass){this.alternateRows(table,classConfiguration,true);} if(classConfiguration.columns&&classConfiguration.columns.oddClass&&classConfiguration.columns.evenClass){this.alternateColumns(table,classConfiguration,true);}}}}},alternateRows:function(table,classConfiguration,remove){var oddClass={tbody:classConfiguration.rows.oddClass,thead:classConfiguration.rows.oddHeaderClass};var evenClass={tbody:classConfiguration.rows.evenClass,thead:classConfiguration.rows.evenHeaderClass};var startAt=parseInt(classConfiguration.rows.startAt);startAt=remove?1:(startAt?startAt:1);var rows=table.rows,type,odd,even;for(var i=startAt-1,n=rows.length;i=0;){var cells=rows[i].cells;for(var j=startAt-1,n=cells.length;j=0;){var cells=rows[i].cells;for(var j=startAt-1,n=cells.length;j=0;){this.remapRowCells(rows[i],"td");if(tbody.rows.length){tbody.insertBefore(rows[i],tbody.rows[0]);}else{tbody.appendChild(rows[i]);}}} table.removeChild(thead);}} if(headers=="both"){var firstRow=tbody.rows[0];HTMLArea.DOM.addClass(firstRow,this.useHeaderClass);}else if(headers!="top"){var firstRow=tbody.rows[0];HTMLArea.DOM.removeClass(firstRow,this.useHeaderClass);this.remapRowCells(firstRow,"td");} if(headers=="top"||headers=="both"){this.remapRowCells(firstRow,"th");} if(headers=="left"){var firstRow=tbody.rows[0];} if(headers=="left"||headers=="both"){var rows=tbody.rows;for(var i=rows.length;--i>=0;){if(i||rows[i]==firstRow){if(rows[i].cells[0].nodeName.toLowerCase()!="th"){var th=this.remapCell(rows[i].cells[0],"th");th.scope="row";}}}}else{var rows=tbody.rows;for(var i=rows.length;--i>=0;){if(rows[i].cells[0].nodeName.toLowerCase()!="td"){rows[i].cells[0].scope="";var td=this.remapCell(rows[i].cells[0],"td");}}} this.reStyleTable(table);},remapCell:function(element,nodeName){var newCell=this.editor.convertNode(element,nodeName);var attributes=element.attributes,attributeName,attributeValue;for(var i=attributes.length;--i>=0;){attributeName=attributes.item(i).nodeName;if(nodeName!='td'||(attributeName!='scope'&&attributeName!='abbr')){attributeValue=element.getAttribute(attributeName);if(attributeValue){newCell.setAttribute(attributeName,attributeValue);}}} if(Ext.isIE){if(element.style.cssText){newCell.style.cssText=element.style.cssText;} if(element.className){newCell.setAttribute("class",element.className);if(!newCell.className){newCell.setAttribute("className",element.className);}}else{newCell.removeAttribute("class");newCell.removeAttribute("className");}} if(this.tags&&this.tags[nodeName]&&this.tags[nodeName].allowedClasses){if(newCell.className&&/\S/.test(newCell.className)){var allowedClasses=this.tags[nodeName].allowedClasses;var classNames=newCell.className.trim().split(" ");for(var i=classNames.length;--i>=0;){if(!allowedClasses.test(classNames[i])){HTMLArea.DOM.removeClass(newCell,classNames[i]);}}}} return newCell;},remapRowCells:function(row,toType){var cells=row.cells;if(toType==="th"){for(var i=cells.length;--i>=0;){if(cells[i].nodeName.toLowerCase()!="th"){var th=this.remapCell(cells[i],"th");th.scope="col";}}}else{for(var i=cells.length;--i>=0;){if(cells[i].nodeName.toLowerCase()!="td"){var td=this.remapCell(cells[i],"td");td.scope="";}}}},processStyle:function(element,params){var style=element.style;if(Ext.isIE){style.styleFloat="";}else{style.cssFloat="";} style.textAlign="";for(var i in params){if(params.hasOwnProperty(i)){var val=params[i];switch(i){case"f_st_backgroundColor":if(/\S/.test(val)){style.backgroundColor=((val.charAt(0)==='#')?'':'#')+val;}else{style.backgroundColor='';} break;case"f_st_color":if(/\S/.test(val)){style.color=((val.charAt(0)==='#')?'':'#')+val;}else{style.color='';} break;case"f_st_backgroundImage":if(/\S/.test(val)){style.backgroundImage="url("+val+")";}else{style.backgroundImage="";} break;case"f_st_borderWidth":if(/\S/.test(val)){style.borderWidth=val+"px";}else{style.borderWidth="";} if(params.f_st_borderStyle=="none")style.borderWidth="0px";if(params.f_st_borderStyle=="not set")style.borderWidth="";break;case"f_st_borderStyle":style.borderStyle=(val!="not set")?val:"";break;case"f_st_borderColor":if(/\S/.test(val)){style.borderColor=((val.charAt(0)==='#')?'':'#')+val;}else{style.borderColor='';} if(params.f_st_borderStyle==='none'){style.borderColor='';} break;case"f_st_borderCollapse":style.borderCollapse=(val!=='not set')?val:'';if(params.f_st_borderStyle==='none'){style.borderCollapse='';} break;case"f_st_width":if(/\S/.test(val)){style.width=val+params.f_st_widthUnit;}else{style.width="";} break;case"f_st_height":if(/\S/.test(val)){style.height=val+params.f_st_heightUnit;}else{style.height="";} break;case"f_st_textAlign":style.textAlign=(val!="not set")?val:"";break;case"f_st_vertAlign":style.verticalAlign=(val!="not set")?val:"";break;}}}},buildDescriptionFieldsetConfig:function(table){if(!Ext.isEmpty(table)){var caption=table.getElementsByTagName('caption')[0];} return{xtype:'fieldset',title:this.localize('Description'),defaultType:'textfield',defaults:{labelSeparator:'',helpIcon:true},items:[{fieldLabel:this.localize('Caption:'),itemId:'f_caption',value:Ext.isDefined(caption)?caption.innerHTML:'',width:300,helpTitle:this.localize('Description of the nature of the table')},{fieldLabel:this.localize('Summary:'),itemId:'f_summary',value:!Ext.isEmpty(table)?table.summary:'',width:300,helpTitle:this.localize('Summary of the table purpose and structure')}]};},buildSizeAndHeadersFieldsetConfig:function(table){var itemsConfig=[];if(Ext.isEmpty(table)){itemsConfig.push({fieldLabel:this.localize('Rows:'),labelSeparator:'',itemId:'f_rows',value:(this.properties.numberOfRows&&this.properties.numberOfRows.defaultValue)?this.properties.numberOfRows.defaultValue:'2',width:30,minValue:1,helpTitle:this.localize('Number of rows')});itemsConfig.push({fieldLabel:this.localize('Cols:'),labelSeparator:'',itemId:'f_cols',value:(this.properties.numberOfColumns&&this.properties.numberOfColumns.defaultValue)?this.properties.numberOfColumns.defaultValue:'4',width:30,minValue:1,helpTitle:this.localize('Number of columns')});} if(this.removedProperties.indexOf('headers')==-1){var store=new Ext.data.ArrayStore({autoDestroy:true,fields:[{name:'text'},{name:'value'}],data:[[this.localize('No header cells'),'none'],[this.localize('Header cells on top'),'top'],[this.localize('Header cells on left'),'left'],[this.localize('Header cells on top and left'),'both']]});this.removeOptions(store,'headers');if(Ext.isEmpty(table)){var selected=(this.properties.headers&&this.properties.headers.defaultValue)?this.properties.headers.defaultValue:'top';}else{var selected='none';var thead=table.getElementsByTagName('thead');var tbody=table.getElementsByTagName('tbody');if(thead.length&&thead[0].rows.length){selected='top';}else if(tbody.length&&tbody[0].rows.length){if(HTMLArea.DOM.hasClass(tbody[0].rows[0],this.useHeaderClass)){selected='both';}else if(tbody[0].rows[0].cells.length&&tbody[0].rows[0].cells[0].nodeName.toLowerCase()=='th'){selected='left';}}} itemsConfig.push(Ext.apply({xtype:'combo',fieldLabel:this.localize('Headers:'),labelSeparator:'',itemId:'f_headers',helpTitle:this.localize('Table headers'),store:store,width:(this.properties['headers']&&this.properties['headers'].width)?this.properties['headers'].width:200,value:selected},this.configDefaults['combo']));} return{xtype:'fieldset',title:this.localize(Ext.isEmpty(table)?'Size and Headers':'Headers'),defaultType:'numberfield',defaults:{helpIcon:true},items:itemsConfig};},buildStylingFieldsetConfig:function(element,buttonId){var itemsConfig=[];var nodeName=element?element.nodeName.toLowerCase():'table';var table=(nodeName=='table');var select=this.buildStylingFieldConfig('f_class',(table?'Table class:':'Class:'),(table?'Table class selector':'Class selector'));this.setStyleOptions(select,element,nodeName,(buttonId==='InsertTable')?this.defaultClass:null);itemsConfig.push(select);if(element&&table){var tbody=element.getElementsByTagName('tbody')[0];if(tbody){var tbodyStyleSelect=this.buildStylingFieldConfig('f_class_tbody','Table body class:','Table body class selector');this.setStyleOptions(tbodyStyleSelect,tbody,'tbody');itemsConfig.push(tbodyStyleSelect);} var thead=element.getElementsByTagName('thead')[0];if(thead){var theadStyleSelect=this.buildStylingFieldConfig('f_class_thead','Table header class:','Table header class selector');this.setStyleOptions(theadStyleSelect,thead,'thead');itemsConfig.push(theadStyleSelect);} var tfoot=element.getElementsByTagName('tfoot')[0];if(tfoot){var tfootStyleSelect=this.buildStylingFieldConfig('f_class_tfoot','Table footer class:','Table footer class selector');this.setStyleOptions(tfootStyleSelect,tfoot,'tfoot');itemsConfig.push(tfootStyleSelect);}} return{xtype:'fieldset',defaults:{labelSeparator:''},title:this.localize('CSS Style'),items:itemsConfig};},buildStylingFieldConfig:function(fieldName,fieldLabel,fieldTitle){return new Ext.form.ComboBox(Ext.apply({xtype:'combo',itemId:fieldName,fieldLabel:this.localize(fieldLabel),helpTitle:this.localize(fieldTitle),width:(this.properties['style']&&this.properties['style'].width)?this.properties['style'].width:300,store:new Ext.data.ArrayStore({autoDestroy:true,fields:[{name:'text'},{name:'value'},{name:'style'}],data:[[this.localize('No block style'),'none']]})},{tpl:'
{text}
'},this.configDefaults['combo']));},setStyleOptions:function(dropDown,element,nodeName,defaultClass){var blockStyle=this.getPluginInstance('BlockStyle');if(dropDown&&blockStyle){if(defaultClass){var classNames=new Array();classNames.push(defaultClass);}else{var classNames=HTMLArea.DOM.getClassNames(element);} blockStyle.buildDropDownOptions(dropDown,nodeName);blockStyle.setSelectedOption(dropDown,classNames,'noUnknown',defaultClass);}},buildLanguageFieldsetConfig:function(element){var itemsConfig=[];var languageObject=this.getPluginInstance('Language');if(this.removedProperties.indexOf('language')==-1&&this.getButton('Language')){var selectedLanguage=!Ext.isEmpty(element)?languageObject.getLanguageAttribute(element):'none';function initLanguageStore(store){if(selectedLanguage!=='none'){store.removeAt(0);store.insert(0,new store.recordType({text:languageObject.localize('Remove language mark'),value:'none'}));}} var languageStore=new Ext.data.JsonStore({autoDestroy:true,autoLoad:true,root:'options',fields:[{name:'text'},{name:'value'}],url:this.getDropDownConfiguration('Language').dataUrl,listeners:{load:initLanguageStore}});itemsConfig.push(Ext.apply({xtype:'combo',fieldLabel:this.localize('Language'),itemId:'f_lang',helpTitle:this.localize('Language'),store:languageStore,width:(this.properties['language']&&this.properties['language'].width)?this.properties['language'].width:200,value:selectedLanguage},this.configDefaults['combo']));} if(this.removedProperties.indexOf('direction')==-1&&(this.getButton('LeftToRight')||this.getButton('RightToLeft'))){itemsConfig.push(Ext.apply({xtype:'combo',fieldLabel:this.localize('Text direction'),itemId:'f_dir',helpTitle:this.localize('Text direction'),store:new Ext.data.ArrayStore({autoDestroy:true,fields:[{name:'text'},{name:'value'}],data:[[this.localize('Not set'),'not set'],[this.localize('RightToLeft'),'rtl'],[this.localize('LeftToRight'),'ltr']]}),width:(this.properties['direction']&&this.properties['dirrection'].width)?this.properties['direction'].width:200,value:!Ext.isEmpty(element)&&element.dir?element.dir:'not set'},this.configDefaults['combo']));} return{xtype:'fieldset',title:this.localize('Language'),items:itemsConfig};},buildSpacingFieldsetConfig:function(table){return{xtype:'fieldset',title:this.localize('Spacing and padding'),defaultType:'numberfield',defaults:{labelSeparator:'',helpIcon:true},items:[{fieldLabel:this.localize('Cell spacing:'),itemId:'f_spacing',value:!Ext.isEmpty(table)?table.cellSpacing:'',width:30,minValue:0,helpTitle:this.localize('Space between adjacent cells')},{fieldLabel:this.localize('Cell padding:'),itemId:'f_padding',value:!Ext.isEmpty(table)?table.cellPadding:'',width:30,minValue:0,helpTitle:this.localize('Space between content and border in cell')}]};},buildLayoutFieldsetConfig:function(element){var itemsConfig=[];var nodeName=element?element.nodeName.toLowerCase():'table';switch(nodeName){case'table':var widthTitle='Table width';var heightTitle='Table height';break;case'tr':var widthTitle='Row width';var heightTitle='Row height';break;case'td':case'th':var widthTitle='Cell width';var heightTitle='Cell height';} if(this.removedProperties.indexOf('width')===-1){var widthUnitStore=new Ext.data.ArrayStore({autoDestroy:true,fields:[{name:'text'},{name:'value'}],data:[[this.localize('percent'),'%'],[this.localize('pixels'),'px'],[this.localize('em'),'em']]});this.removeOptions(widthUnitStore,'widthUnit');itemsConfig.push({fieldLabel:this.localize('Width:'),labelSeparator:'',itemId:'f_st_width',value:element?this.getLength(element.style.width):((this.properties.width&&this.properties.width.defaultValue)?this.properties.width.defaultValue:''),width:30,helpTitle:this.localize(widthTitle)});itemsConfig.push(Ext.apply({xtype:'combo',fieldLabel:this.localize('Width unit'),itemId:'f_st_widthUnit',helpTitle:this.localize('Width unit'),store:widthUnitStore,width:(this.properties['widthUnit']&&this.properties['widthUnit'].width)?this.properties['widthUnit'].width:60,value:element?(/%/.test(element.style.width)?'%':(/px/.test(element.style.width)?'px':'em')):((this.properties.widthUnit&&this.properties.widthUnit.defaultValue)?this.properties.widthUnit.defaultValue:'%')},this.configDefaults['combo']));} if(this.removedProperties.indexOf('height')===-1){var heightUnitStore=new Ext.data.ArrayStore({autoDestroy:true,fields:[{name:'text'},{name:'value'}],data:[[this.localize('percent'),'%'],[this.localize('pixels'),'px'],[this.localize('em'),'em']]});this.removeOptions(heightUnitStore,'heightUnit');itemsConfig.push({fieldLabel:this.localize('Height:'),labelSeparator:'',itemId:'f_st_height',value:element?this.getLength(element.style.height):((this.properties.height&&this.properties.height.defaultValue)?this.properties.height.defaultValue:''),width:30,helpTitle:this.localize(heightTitle)});itemsConfig.push(Ext.apply({xtype:'combo',fieldLabel:this.localize('Height unit'),itemId:'f_st_heightUnit',helpTitle:this.localize('Height unit'),store:heightUnitStore,width:(this.properties['heightUnit']&&this.properties['heightUnit'].width)?this.properties['heightUnit'].width:60,value:element?(/%/.test(element.style.height)?'%':(/px/.test(element.style.height)?'px':'em')):((this.properties.heightUnit&&this.properties.heightUnit.defaultValue)?this.properties.heightUnit.defaultValue:'%')},this.configDefaults['combo']));} if(nodeName=='table'&&this.removedProperties.indexOf('float')===-1){var floatStore=new Ext.data.ArrayStore({autoDestroy:true,fields:[{name:'text'},{name:'value'}],data:[[this.localize('Not set'),'not set'],[this.localize('Left'),'left'],[this.localize('Right'),'right']]});this.removeOptions(floatStore,'float');itemsConfig.push(Ext.apply({xtype:'combo',fieldLabel:this.localize('Float:'),labelSeparator:'',itemId:'f_st_float',helpTitle:this.localize('Specifies where the table should float'),store:floatStore,width:(this.properties['float']&&this.properties['float'].width)?this.properties['float'].width:120,value:element?(Ext.get(element).hasClass(this.floatLeft)?'left':(Ext.get(element).hasClass(this.floatRight)?'right':'not set')):this.floatDefault},this.configDefaults['combo']));} return{xtype:'fieldset',title:this.localize('Layout'),defaultType:'numberfield',defaults:{helpIcon:true},items:itemsConfig};},buildAlignmentFieldsetConfig:function(element){var itemsConfig=[];var selectedTextAlign='not set';var blockElements=this.getPluginInstance('BlockElements');if(element&&blockElements){Ext.iterate(this.convertAlignment,function(value){if(Ext.get(element).hasClass(blockElements.useClass[this.convertAlignment[value]])){selectedTextAlign=value;return false;} return true;},this);}else{selectedTextAlign=(element&&element.style.textAlign)?element.style.textAlign:'not set';} itemsConfig.push(Ext.apply({xtype:'combo',fieldLabel:this.localize('Text alignment:'),itemId:'f_st_textAlign',helpTitle:this.localize('Horizontal alignment of text within cell'),store:new Ext.data.ArrayStore({autoDestroy:true,fields:[{name:'text'},{name:'value'}],data:[[this.localize('Not set'),'not set'],[this.localize('Left'),'left'],[this.localize('Center'),'center'],[this.localize('Right'),'right'],[this.localize('Justify'),'justify']]}),width:(this.properties['textAlign']&&this.properties['textAlign'].width)?this.properties['textAlign'].width:100,value:selectedTextAlign},this.configDefaults['combo']));itemsConfig.push(Ext.apply({xtype:'combo',fieldLabel:this.localize('Vertical alignment:'),itemId:'f_st_vertAlign',helpTitle:this.localize('Vertical alignment of content within cell'),store:new Ext.data.ArrayStore({autoDestroy:true,fields:[{name:'text'},{name:'value'}],data:[[this.localize('Not set'),'not set'],[this.localize('Top'),'top'],[this.localize('Middle'),'middle'],[this.localize('Bottom'),'bottom'],[this.localize('Baseline'),'baseline']]}),width:(this.properties['verticalAlign']&&this.properties['verticalAlign'].width)?this.properties['verticalAlign'].width:100,value:(element&&element.style.verticalAlign)?element.style.verticalAlign:'not set'},this.configDefaults['combo']));return{xtype:'fieldset',title:this.localize('Alignment'),defaults:{labelSeparator:''},items:itemsConfig};},buildBordersFieldsetConfig:function(element){var itemsConfig=[];var nodeName=element?element.nodeName.toLowerCase():'table';var borderStyleStore=new Ext.data.ArrayStore({autoDestroy:true,fields:[{name:'text'},{name:'value'}],data:[[this.localize('Not set'),'not set'],[this.localize('No border'),'none'],[this.localize('Dotted'),'dotted'],[this.localize('Dashed'),'dashed'],[this.localize('Solid'),'solid'],[this.localize('Double'),'double'],[this.localize('Groove'),'groove'],[this.localize('Ridge'),'ridge'],[this.localize('Inset'),'inset'],[this.localize('Outset'),'outset']]});this.removeOptions(borderStyleStore,'borderStyle');var selectedBorderStyle=element&&element.style.borderStyle?element.style.borderStyle:((this.properties.borderWidth)?((this.properties.borderStyle&&this.properties.borderStyle.defaultValue)?this.properties.borderStyle.defaultValue:'solid'):'not set');itemsConfig.push(Ext.apply({xtype:'combo',fieldLabel:this.localize('Border style:'),itemId:'f_st_borderStyle',helpTitle:this.localize('Border style'),store:borderStyleStore,width:(this.properties.borderStyle&&this.properties.borderStyle.width)?this.properties.borderStyle.width:150,value:selectedBorderStyle,listeners:{change:{fn:this.setBorderFieldsDisabled}}},this.configDefaults['combo']));itemsConfig.push({fieldLabel:this.localize('Border width:'),itemId:'f_st_borderWidth',value:element?this.getLength(element.style.borderWidth):((this.properties.borderWidth&&this.properties.borderWidth.defaultValue)?this.properties.borderWidth.defaultValue:''),width:30,minValue:0,helpTitle:this.localize('Border width'),helpText:this.localize('pixels'),disabled:(selectedBorderStyle==='none')});itemsConfig.push({xtype:'colorpalettefield',fieldLabel:this.localize('Color:'),itemId:'f_st_borderColor',colors:this.editorConfiguration.disableColorPicker?[]:null,colorsConfiguration:this.editorConfiguration.colors,value:HTMLArea.util.Color.colorToHex(element&&element.style.borderColor?element.style.borderColor:((this.properties.borderColor&&this.properties.borderColor.defaultValue)?this.properties.borderColor.defaultValue:'')).substr(1,6),helpTitle:this.localize('Border color'),disabled:(selectedBorderStyle==='none')});if(nodeName==='table'){itemsConfig.push(Ext.apply({xtype:'combo',fieldLabel:this.localize('Collapsed borders'),labelSeparator:':',itemId:'f_st_borderCollapse',helpTitle:this.localize('Collapsed borders'),store:new Ext.data.ArrayStore({autoDestroy:true,fields:[{name:'text'},{name:'value'}],data:[[this.localize('Not set'),'not set'],[this.localize('Collapsed borders'),'collapse'],[this.localize('Detached borders'),'separate']]}),width:(this.properties.borderCollapse&&this.properties.borderCollapse.width)?this.properties.borderCollapse.width:150,value:element&&element.style.borderCollapse?element.style.borderCollapse:'not set',disabled:(selectedBorderStyle==='none')},this.configDefaults['combo']));itemsConfig.push(Ext.apply({xtype:'combo',fieldLabel:this.localize('Frames:'),itemId:'f_frames',helpTitle:this.localize('Specifies which sides should have a border'),store:new Ext.data.ArrayStore({autoDestroy:true,fields:[{name:'text'},{name:'value'}],data:[[this.localize('Not set'),'not set'],[this.localize('No sides'),'void'],[this.localize('The top side only'),'above'],[this.localize('The bottom side only'),'below'],[this.localize('The top and bottom sides only'),'hsides'],[this.localize('The right and left sides only'),'vsides'],[this.localize('The left-hand side only'),'lhs'],[this.localize('The right-hand side only'),'rhs'],[this.localize('All four sides'),'box']]}),width:(this.properties.frame&&this.properties.frame.width)?this.properties.frame.width:250,value:(element&&element.frame)?element.frame:'not set',disabled:(selectedBorderStyle==='none')},this.configDefaults['combo']));itemsConfig.push(Ext.apply({xtype:'combo',fieldLabel:this.localize('Rules:'),itemId:'f_rules',helpTitle:this.localize('Specifies where rules should be displayed'),store:new Ext.data.ArrayStore({autoDestroy:true,fields:[{name:'text'},{name:'value'}],data:[[this.localize('Not set'),'not set'],[this.localize('No rules'),'none'],[this.localize('Rules will appear between rows only'),'rows'],[this.localize('Rules will appear between columns only'),'cols'],[this.localize('Rules will appear between all rows and columns'),'all']]}),width:(this.properties.rules&&this.properties.rules.width)?this.properties.rules.width:360,value:(element&&element.rules)?element.rules:'not set'},this.configDefaults['combo']));} return{xtype:'fieldset',title:this.localize('Frame and borders'),defaultType:'numberfield',defaults:{labelSeparator:'',helpIcon:true},items:itemsConfig};},setBorderFieldsDisabled:function(field,value){field.ownerCt.findBy(function(item){var itemId=item.getItemId();if(itemId=='f_st_borderStyle'||itemId=='f_rules'){return false;}else if(value==='none'){switch(item.getXType()){case'numberfield':item.setValue(0);break;case'colorpalettefield':item.setValue('');break;default:item.setValue('not set');break;} item.setDisabled(true);}else{item.setDisabled(false);} return true;});},buildColorsFieldsetConfig:function(element){var itemsConfig=[];itemsConfig.push({xtype:'colorpalettefield',fieldLabel:this.localize('FG Color:'),itemId:'f_st_color',colors:this.editorConfiguration.disableColorPicker?[]:null,colorsConfiguration:this.editorConfiguration.colors,value:HTMLArea.util.Color.colorToHex(element&&element.style.color?element.style.color:((this.properties.color&&this.properties.color.defaultValue)?this.properties.color.defaultValue:'')).substr(1,6)});itemsConfig.push({xtype:'colorpalettefield',fieldLabel:this.localize('Background:'),itemId:'f_st_backgroundColor',colors:this.editorConfiguration.disableColorPicker?[]:null,colorsConfiguration:this.editorConfiguration.colors,value:HTMLArea.util.Color.colorToHex(element&&element.style.backgroundColor?element.style.backgroundColor:((this.properties.backgroundColor&&this.properties.backgroundColor.defaultValue)?this.properties.backgroundColor.defaultValue:'')).substr(1,6)});itemsConfig.push({fieldLabel:this.localize('Image URL:'),itemId:'f_st_backgroundImage',value:element&&element.style.backgroundImage.match(/url\(\s*(.*?)\s*\)/)?RegExp.$1:'',width:(this.properties.backgroundImage&&this.properties.backgroundImage.width)?this.properties.backgroundImage.width:300,helpTitle:this.localize('URL of the background image'),helpIcon:true});return{xtype:'fieldset',title:this.localize('Background and colors'),defaultType:'textfield',defaults:{labelSeparator:''},items:itemsConfig};},buildCellTypeFieldsetConfig:function(element,column){var itemsConfig=[];if(column){var data=[[this.localize('Data cells'),'td'],[this.localize('Headers for rows'),'throw'],[this.localize('Headers for row groups'),'throwgroup']];}else{var data=[[this.localize('Normal'),'td'],[this.localize('Header for column'),'thcol'],[this.localize('Header for row'),'throw'],[this.localize('Header for row group'),'throwgroup']];} var self=this;function cellTypeChange(cellTypeField,record){var value=record.get('value');var styleCombo=self.dialog.find('itemId','f_class')[0];if(styleCombo){self.setStyleOptions(styleCombo,element,value.substring(0,2));} var abbrField=self.dialog.find('itemId','f_cell_abbr')[0];if(abbrField){abbrField.setVisible(value!='td');abbrField.label.setVisible(value!='td');}} var selected=element.nodeName.toLowerCase()+element.scope.toLowerCase();itemsConfig.push(Ext.apply({xtype:'combo',fieldLabel:this.localize(column?'Type of cells of the column':'Type of cell'),itemId:'f_cell_type',helpTitle:this.localize(column?'Specifies the type of cells':'Specifies the type of cell'),store:new Ext.data.ArrayStore({autoDestroy:true,fields:[{name:'text'},{name:'value'}],data:data}),width:(this.properties.cellType&&this.properties.cellType.width)?this.properties.cellType.width:250,value:(column&&selected=='thcol')?'td':selected,listeners:{select:{fn:cellTypeChange,scope:this}}},this.configDefaults['combo']));if(!column){itemsConfig.push({xtype:'textfield',fieldLabel:this.localize('Abbreviation'),labelSeparator:':',itemId:'f_cell_abbr',helpTitle:this.localize('Header abbreviation'),width:300,value:element.abbr,hideMode:'visibility',hidden:(selected=='td'),hideLabel:(selected=='td')});} return{xtype:'fieldset',title:this.localize(column?'Type of cells':'Cell Type and Scope'),defaults:{labelSeparator:'',helpIcon:true},items:itemsConfig};},buildRowGroupFieldsetConfig:function(element){var itemsConfig=[];var current=element.parentNode.nodeName.toLowerCase();function displayCheckbox(field,record,index){var checkBox=field.ownerCt.getComponent('f_convertCells');var value=record.get('value');if(current!==value&&(current==='thead'||value==='thead')){checkBox.label.dom.innerHTML=(value==='thead')?this.localize('Make cells header cells'):this.localize('Make cells data cells');checkBox.show();checkBox.label.show();checkBox.setValue(true);}else{checkBox.setValue(false);checkBox.hide();checkBox.label.hide();}} itemsConfig.push(Ext.apply({xtype:'combo',fieldLabel:this.localize('Row group:'),itemId:'f_rowgroup',helpTitle:this.localize('Table section'),store:new Ext.data.ArrayStore({autoDestroy:true,fields:[{name:'text'},{name:'value'}],data:[[this.localize('Table body'),'tbody'],[this.localize('Table header'),'thead'],[this.localize('Table footer'),'tfoot']]}),width:(this.properties.rowGroup&&this.properties.rowGroup.width)?this.properties.rowGroup.width:150,value:current,labelSeparator:'',listeners:{select:{fn:displayCheckbox,scope:this}}},this.configDefaults['combo']));itemsConfig.push({xtype:'checkbox',fieldLabel:this.localize('Make cells header cells'),labelSeparator:':',itemId:'f_convertCells',helpTitle:this.localize('Make cells header cells'),value:false,hideMode:'visibility',hidden:true,hideLabel:true});return{xtype:'fieldset',title:this.localize('Row group'),defaults:{helpIcon:true},items:itemsConfig};},removeOptions:function(store,property){if(this.properties[property]&&this.properties[property].removeItems){var items=this.properties[property].removeItems.split(',');var index=-1;Ext.each(items,function(item){index=store.findExact('value',item.trim());if(index!==-1){store.removeAt(index);} return true;});}},onKey:function(key,event){var selection=this.editor._getSelection();var range=this.editor._createRange(selection);var parentElement=this.editor.getParentElement(selection,range);while(parentElement&&!HTMLArea.isBlockElement(parentElement)){parentElement=parentElement.parentNode;} if(/^(td|th)$/i.test(parentElement.nodeName)){if(Ext.isIE){range.pasteHTML('
');range.select();}else{var brNode=this.editor._doc.createElement('br');this.editor.insertNodeAtSelection(brNode);if(brNode.nextSibling){this.editor.selectNodeContents(brNode.nextSibling,true);}else{this.editor.selectNodeContents(brNode,false);}} event.stopEvent();return false;} return true;}});HTMLArea.ContextMenu=HTMLArea.Plugin.extend({constructor:function(editor,pluginName){this.base(editor,pluginName);},configurePlugin:function(editor){this.pageTSConfiguration=this.editorConfiguration.contextMenu;if(!this.pageTSConfiguration){this.pageTSConfiguration={};} if(this.pageTSConfiguration.showButtons){this.showButtons=this.pageTSConfiguration.showButtons;} if(this.pageTSConfiguration.hideButtons){this.hideButtons=this.pageTSConfiguration.hideButtons;} var pluginInformation={version:'3.1',developer:'Mihai Bazon & Stanislas Rolland',developerUrl:'http://www.sjbr.ca/',copyrightOwner:'dynarch.com & Stanislas Rolland',sponsor:'American Bible Society & SJBR',sponsorUrl:'http://www.sjbr.ca/',license:'GPL'};this.registerPluginInformation(pluginInformation);return true;},onGenerate:function(){this.menu=new Ext.menu.Menu(Ext.applyIf({cls:'htmlarea-context-menu',defaultType:'menuitem',listeners:{itemClick:{fn:this.onItemClick,scope:this},show:{fn:this.onShow,scope:this},hide:{fn:this.onHide,scope:this}},items:this.buildItemsConfig()},this.pageTSConfiguration));this.menu.mon(Ext.get(this.editor.document.documentElement),'contextmenu',this.show,this);this.menu.mon(this.editor,'beforedestroy',this.onBeforeDestroy,this,{single:true});},buildItemsConfig:function(){var itemsConfig=[];var firstInGroup=true,convertedItemId;Ext.each(this.editor.config.toolbar,function(row){firstInGroup=true;Ext.each(row,function(group){if(!firstInGroup){itemsConfig.push({xtype:'menuseparator',cls:'separator'});} firstInGroup=true;Ext.each(group,function(itemId){convertedItemId=this.editorConfiguration.convertButtonId[itemId];if((!this.showButtons||this.showButtons.indexOf(convertedItemId)!==-1)&&(!this.hideButtons||this.hideButtons.indexOf(convertedItemId)===-1)){var button=this.getButton(itemId);if(button&&button.getXType()==='htmlareabutton'&&!button.hideInContextMenu){var itemId=button.getItemId();itemsConfig.push({itemId:itemId,cls:'button',overCls:'hover',text:(button.contextMenuTitle?button.contextMenuTitle:button.tooltip.title),iconCls:button.iconCls,helpText:(button.helpText?button.helpText:this.localize(itemId+'-tooltip')),hidden:true});firstInGroup=false;}} return true;},this);return true;},this);return true;},this);if(!firstInGroup){itemsConfig.push({xtype:'menuseparator',cls:'separator'});} var itemId='DeleteTarget';itemsConfig.push({itemId:itemId,cls:'button',overCls:'hover',iconCls:'htmlarea-action-delete-item',helpText:this.localize('Remove this node from the document')});return itemsConfig;},onShow:function(){this.menu.mon(Ext.get(this.editor.document.documentElement),'mousedown',this.menu.hide,this.menu,{single:true});},onHide:function(){this.menu.mun(Ext.get(this.editor.document.documentElement),'mousedown',this.menu.hide,this.menu);},show:function(event,target){event.stopEvent();this.showMenu.defer(150,this,[target]);},showMenu:function(target){this.showContextItems(target);if(!Ext.isIE){this.ranges=this.editor.getSelectionRanges();} var iframeEl=this.editor.iframe.getEl();this.menu.showAt([Ext.fly(target).getX()+iframeEl.getX(),Ext.fly(target).getY()+iframeEl.getY()]);},showContextItems:function(target){var lastIsSeparator=false,lastIsButton=false,xtype,lastVisible;this.menu.cascade(function(menuItem){xtype=menuItem.getXType();if(xtype==='menuseparator'){menuItem.setVisible(lastIsButton);lastIsButton=false;}else if(xtype==='menuitem'){var button=this.getButton(menuItem.getItemId());if(button){var text=button.contextMenuTitle?button.contextMenuTitle:button.tooltip.title;if(menuItem.text!=text){menuItem.setText(text);} menuItem.helpText=button.helpText?button.helpText:menuItem.helpText;menuItem.setVisible(!button.disabled);lastIsButton=lastIsButton||!button.disabled;}else{this.deleteTarget=target;if(/^(html|body)$/i.test(target.nodeName)){this.deleteTarget=null;}else if(/^(table|thead|tbody|tr|td|th|tfoot)$/i.test(target.nodeName)){this.deleteTarget=Ext.fly(target).findParent('table');}else if(/^(ul|ol|dl|li|dd|dt)$/i.test(target.nodeName)){this.deleteTarget=Ext.fly(target).findParent('ul')||Ext.fly(target).findParent('ol')||Ext.fly(target).findParent('dl');} if(this.deleteTarget){menuItem.setVisible(true);menuItem.setText(this.localize('Remove the')+' <'+this.deleteTarget.nodeName.toLowerCase()+'> ');lastIsButton=true;}else{menuItem.setVisible(false);}}} if(!menuItem.hidden){lastVisible=menuItem;}},this);if(!lastIsButton){lastVisible.setVisible(false);}},onItemClick:function(item,event){if(!Ext.isIE){this.editor.setSelectionRanges(this.ranges);} var button=this.getButton(item.getItemId());if(button){button.fireEvent('HTMLAreaEventContextMenu',button,event);}else if(item.getItemId()==='DeleteTarget'){var parent=this.deleteTarget.parentNode;parent.normalize();if(!Ext.isIE&&/^(td|th)$/i.test(parent.nodeName)&&parent.childNodes.length==1){parent.appendChild(this.editor.document.createElement('br'));} var nextSibling=this.deleteTarget.nextSibling;var previousSibling=this.deleteTarget.previousSibling;if(nextSibling){this.editor.selectNode(nextSibling,true);}else if(previousSibling){this.editor.selectNode(previousSibling,false);} HTMLArea.removeFromParent(this.deleteTarget);this.editor.updateToolbar();}},onBeforeDestroy:function(){this.menu.items.each(function(menuItem){Ext.QuickTips.unregister(menuItem);});this.menu.removeAll(true);this.menu.destroy();}});HTMLArea.UndoRedo=HTMLArea.Plugin.extend({constructor:function(editor,pluginName){this.base(editor,pluginName);},configurePlugin:function(editor){this.pageTSconfiguration=this.editorConfiguration.buttons.undo;this.customUndo=true;this.undoQueue=new Array();this.undoPosition=-1;this.undoSteps=25;this.undoTimeout=500;var pluginInformation={version:'2.0',developer:'Stanislas Rolland',developerUrl:'http://www.sjbr.ca',copyrightOwner:'Stanislas Rolland',sponsor:'SJBR',sponsorUrl:'http://www.sjbr.ca',license:'GPL'};this.registerPluginInformation(pluginInformation);var buttonList=this.buttonList,buttonId;for(var i=0;i=this.undoSteps){this.undoQueue.shift();--this.undoPosition;} if(this.undoPosition<0||this.undoQueue[this.undoPosition].time0){this.takeSnapshot();this.setContent(--this.undoPosition);this.updateButtonsState();}},redo:function(){if(this.undoPosition=this.undoQueue.length-1);break;}}else{try{button.setDisabled(!this.editor._doc.queryCommandEnabled(button.itemId));}catch(e){button.setDisabled(true);}}}else{button.setDisabled(!button.textMode);}},updateButtonsState:function(){var mode=this.getEditorMode(),selectionEmpty=true,ancestors=null;if(mode==='wysiwyg'){selectionEmpty=this.editor._selectionEmpty(this.editor._getSelection());ancestors=this.editor.getAllAncestors();} var button=this.getButton('Undo');if(button){this.onUpdateToolbar(button,mode,selectionEmpty,ancestors)} var button=this.getButton('Redo');if(button){this.onUpdateToolbar(button,mode,selectionEmpty,ancestors)}},onButtonPress:function(editor,id){var buttonId=this.translateHotKey(id);buttonId=buttonId?buttonId:id;if(this.getButton(buttonId)&&!this.getButton(buttonId).disabled){if(this.customUndo){this[buttonId.toLowerCase()]();}else{this.editor._doc.execCommand(buttonId,false,null);}} return false;}});HTMLArea.CopyPaste=HTMLArea.Plugin.extend({constructor:function(editor,pluginName){this.base(editor,pluginName);},configurePlugin:function(editor){this.buttonsConfiguration=this.editorConfiguration.buttons;var pluginInformation={version:'2.2',developer:'Stanislas Rolland',developerUrl:'http://www.sjbr.ca/',copyrightOwner:'Stanislas Rolland',sponsor:this.localize('Technische Universitat Ilmenau'),sponsorUrl:'http://www.tu-ilmenau.de/',license:'GPL'};this.registerPluginInformation(pluginInformation);Ext.iterate(this.buttonList,function(buttonId,button){var buttonConfiguration={id:buttonId,tooltip:this.localize(buttonId.toLowerCase()),iconCls:'htmlarea-action-'+button[2],action:'onButtonPress',context:button[0],selection:button[3],hotKey:button[1]};this.registerButton(buttonConfiguration);},this);return true;},buttonList:{Copy:[null,'c','copy',true],Cut:[null,'x','cut',true],Paste:[null,'v','paste',false]},onGenerate:function(){this.editor.iframe.mon(Ext.get(Ext.isIE?this.editor.document.body:this.editor.document.documentElement),'cut',this.cutHandler,this);Ext.iterate(this.buttonList,function(buttonId,button){if(!Ext.isGecko&&!this.editor.document.queryCommandSupported(buttonId)){this.editor.toolbar.remove(buttonId);} if(!this.getButton(buttonId)){this.editor.iframe.hotKeyMap.addBinding({key:button[1].toUpperCase(),ctrl:true,shift:false,alt:false,handler:this.onHotKey,scope:this});this.editorConfiguration.hotKeyList[button[1]]={id:button[1],cmd:buttonId};}},this);},onButtonPress:function(editor,id){var buttonId=this.translateHotKey(id);buttonId=buttonId?buttonId:id;this.editor.focus();if(!this.applyToTable(buttonId)){switch(buttonId){case'Copy':if(buttonId==id){this.applyBrowserCommand(buttonId);} break;case'Cut':if(buttonId==id){this.applyBrowserCommand(buttonId);} if(Ext.isOpera){this.cutHandler();} break;case'Paste':if(buttonId==id){this.applyBrowserCommand(buttonId);} if(Ext.isOpera||Ext.isGecko2){var cleaner=this.getButton('CleanWord');if(cleaner){cleaner.fireEvent.defer(250,cleaner,['click',cleaner]);}} break;default:break;} return(buttonId!=id);}else{if(Ext.isOpera){this.editor.inhibitKeyboardInput=true;var bookmark=this.editor.getBookmark(this.editor._createRange(this.editor._getSelection()));var html=this.editor.getInnerHTML();this.revertPaste.defer(200,this,[html,bookmark]);} return false;}},revertPaste:function(html,bookmark){this.editor.setHTML(html);this.editor.selectRange(this.editor.moveToBookmark(bookmark));this.editor.inhibitKeyboardInput=false;},applyBrowserCommand:function(buttonId){try{this.editor.document.execCommand(buttonId,false,null);}catch(e){if(Ext.isGecko){this.mozillaClipboardAccessException();}}},onHotKey:function(key,event){var hotKey=String.fromCharCode(key).toLowerCase();if(!this.onButtonPress(this,hotKey)){event.stopEvent();}},cutHandler:function(event){this.removeEmptyLink.defer(50,this);},removeEmptyLink:function(){var selection=this.editor._getSelection();var range=this.editor._createRange(selection);var parent=this.editor.getParentElement(selection,range);if(parent.firstChild&&/^(a)$/i.test(parent.firstChild.nodeName)){parent=parent.firstChild;} if(/^(a)$/i.test(parent.nodeName)){parent.normalize();if(!parent.innerHTML||(parent.childNodes.length==1&&/^(br)$/i.test(parent.firstChild.nodeName))){if(!Ext.isIE){var container=parent.parentNode;this.editor.removeMarkup(parent);if(Ext.isOpera&&/^(li)$/i.test(container.nodeName)&&!container.firstChild){container.innerHTML='
';this.editor.selectNodeContents(container,true);}}else{HTMLArea.removeFromParent(parent);}}} if(Ext.isWebKit){this.editor.cleanAppleStyleSpans(this.editor.document.body);var bookmark=this.editor.getBookmark(this.editor._createRange(this.editor._getSelection()));this.editor.selectRange(this.editor.moveToBookmark(bookmark));} this.editor.updateToolbar();},applyToTable:function(buttonId){var selection=this.editor._getSelection();var range=this.editor._createRange(selection);var parent=this.editor.getParentElement(selection,range);var endBlocks=this.editor.getEndBlocks(selection);switch(buttonId){case'Copy':case'Cut':HTMLArea.copiedCells=null;var endBlocks=this.editor.getEndBlocks(selection);if((/^(tr)$/i.test(parent.nodeName)&&!Ext.isIE)||(/^(td|th)$/i.test(endBlocks.start.nodeName)&&/^(td|th)$/i.test(endBlocks.end.nodeName)&&!Ext.isGecko&&endBlocks.start!=endBlocks.end)){HTMLArea.copiedCells=this.collectCells(buttonId,selection,endBlocks);} break;case'Paste':if(/^(tr|td|th)$/i.test(parent.nodeName)&&HTMLArea.copiedCells){return this.pasteCells(selection,endBlocks);} break;default:break;} return false;},pasteCells:function(selection,endBlocks){var cell=null;if(Ext.isGecko){range=selection.getRangeAt(0);cell=range.startContainer.childNodes[range.startOffset];while(cell&&!HTMLArea.isBlockElement(cell)){cell=cell.parentNode;}} if(!cell&&/^(td|th)$/i.test(endBlocks.start.nodeName)){cell=endBlocks.start;} if(!cell){return false;} var tableParts=['thead','tbody','tfoot'];var tablePartsIndex={thead:0,tbody:1,tfoot:2};var tablePart=cell.parentNode.parentNode;var tablePartIndex=tablePartsIndex[tablePart.nodeName.toLowerCase()] var rows=HTMLArea.copiedCells[tablePartIndex];if(rows&&rows[0]){for(var i=0,rowIndex=cell.parentNode.sectionRowIndex-1;i=0;){rows[k]=[];} var row=null;var cutRows=[];if(Ext.isGecko){if(selection.rangeCount==1){cells=[];for(var i=0,n=endBlocks.start.cells.length;i';} if(operation==='Cut'){cutRows.push(endBlocks.start);}} rows[tablePartsIndex[endBlocks.start.parentNode.nodeName.toLowerCase()]].push(cells);}else{try{var firstCellOfRow=false;var lastCellOfRow=false;while(range=selection.getRangeAt(i++)){cell=range.startContainer.childNodes[range.startOffset];if(cell.parentNode!=row){(cells)&&rows[tablePartsIndex[row.parentNode.nodeName.toLowerCase()]].push(cells);if(operation==='Cut'&&firstCellOfRow&&lastCellOfRow)cutRows.push(row);row=cell.parentNode;cells=[];firstCellOfRow=false;lastCellOfRow=false;} cells.push(cell.innerHTML);if(operation==='Cut'){cell.innerHTML='
';} if(!cell.previousSibling)firstCellOfRow=true;if(!cell.nextSibling)lastCellOfRow=true;}}catch(e){} try{rows[tablePartsIndex[row.parentNode.nodeName.toLowerCase()]].push(cells);}catch(e){} if(row&&operation==='Cut'&&firstCellOfRow&&lastCellOfRow){cutRows.push(row);}}}else{var firstRow=endBlocks.start.parentNode;var lastRow=endBlocks.end.parentNode;cells=[];var firstCellOfRow=false;var lastCellOfRow=false;if(firstRow==lastRow){cell=endBlocks.start;while(cell){cells.push(cell.innerHTML);if(operation==='Cut'){cell.innerHTML='';} if(!cell.previousSibling)firstCellOfRow=true;if(!cell.nextSibling)lastCellOfRow=true;if(cell==endBlocks.end)break;cell=cell.nextSibling;} rows[tablePartsIndex[firstRow.parentNode.nodeName.toLowerCase()]].push(cells);if(operation==='Cut'&&firstCellOfRow&&lastCellOfRow)cutRows.push(firstRow);}else{row=firstRow;while(row){cells=[];for(var i=0,n=row.cells.length;i {0}'),allowReselect:true,listeners:{select:{fn:this.onSelect,scope:this}}}});} itemsConfig.push({xtype:'container',layout:'hbox',items:paletteItems});itemsConfig.push({xtype:'displayfield',itemId:'show-color',cls:'show-color',width:60,height:22,helpTitle:this.localize(buttonId)});itemsConfig.push({itemId:'color',cls:'color',width:60,minValue:0,value:(element&&element.style[this.styleProperty[buttonId]])?HTMLArea.util.Color.colorToHex(element.style[this.styleProperty[buttonId]]).substr(1,6):'',enableKeyEvents:true,fieldLabel:this.localize(buttonId),helpTitle:this.localize(buttonId),listeners:{change:{fn:this.onChange,scope:this},afterrender:{fn:this.onAfterRender,scope:this}}});return{xtype:'fieldset',title:this.localize('color_title'),defaultType:'textfield',labelWidth:175,defaults:{helpIcon:false},items:itemsConfig};},onSelect:function(palette,color){this.dialog.find('itemId','color')[0].setValue(color);this.showColor(color);if(palette.getItemId()=='color-palette'){var customPalette=this.dialog.find('itemId','custom-colors')[0];if(customPalette){customPalette.deSelect();}}else{var standardPalette=this.dialog.find('itemId','color-palette')[0];if(standardPalette){standardPalette.deSelect();}}},showColor:function(color){if(color){var newColor=color;if(newColor.indexOf('#')==0){newColor=newColor.substr(1);} this.dialog.find('itemId','show-color')[0].el.setStyle('backgroundColor',HTMLArea.util.Color.colorToHex(parseInt(newColor,16)));}},onChange:function(field,value){if(value){var color=value.toUpperCase();this.showColor(color);var standardPalette=this.dialog.find('itemId','color-palette')[0];if(standardPalette){standardPalette.select(color);} var customPalette=this.dialog.find('itemId','custom-colors')[0];if(customPalette){customPalette.select(color);}}},onAfterRender:function(field){if(!Ext.isEmpty(field.getValue())){this.showColor(field.getValue());}},openDialogue:function(title,arguments,dimensions,items,handler){if(this.dialog){this.dialog.close();} this.dialog=new Ext.Window({title:this.localize(title),arguments:arguments,cls:'htmlarea-window',border:false,width:dimensions.width,height:dimensions.height,autoScroll:true,resizable:!Ext.isIE,iconCls:this.getButton(arguments.buttonId).iconCls,listeners:{close:{fn:this.onClose,scope:this}},items:{xtype:'container',layout:'form',style:{width:'95%'},defaults:{labelWidth:150},items:items},buttons:[this.buildButtonConfig('OK',handler),this.buildButtonConfig('Cancel',this.onCancel)]});this.show();},setColor:function(button,event){this.restoreSelection();var buttonId=this.dialog.arguments.buttonId;var color=this.dialog.find('itemId','color')[0].getValue();if(color){if(color.indexOf('#')==0){color=color.substr(1);} color=HTMLArea.util.Color.colorToHex(parseInt(color,16));} this.editor.focus();var element,fullNodeSelected=false;var selection=this.editor._getSelection();var range=this.editor._createRange(selection);var parent=this.editor.getParentElement(selection,range);var selectionEmpty=this.editor._selectionEmpty(selection);var statusBarSelection=this.editor.statusBar?this.editor.statusBar.getSelection():null;if(!selectionEmpty){var ancestors=this.editor.getAllAncestors();var fullySelectedNode=this.editor.getFullySelectedNode(selection,range,ancestors);if(fullySelectedNode){fullNodeSelected=true;parent=fullySelectedNode;}} if(selectionEmpty||fullNodeSelected){element=parent;element.style[this.styleProperty[buttonId]]=color;if((element.nodeName.toLowerCase()==='span')&&!HTMLArea.hasAllowedAttributes(element,this.allowedAttributes)){this.editor.removeMarkup(element);}}else if(statusBarSelection){var element=statusBarSelection;element.style[this.styleProperty[buttonId]]=color;if((element.nodeName.toLowerCase()==='span')&&!HTMLArea.hasAllowedAttributes(element,this.allowedAttributes)){this.editor.removeMarkup(element);}}else if(color&&this.editor.endPointsInSameBlock()){var element=this.editor._doc.createElement('span');element.style[this.styleProperty[buttonId]]=color;this.editor.wrapWithInlineElement(element,selection,range);} this.close();event.stopEvent();},onUpdateToolbar:function(button,mode,selectionEmpty,ancestors,endPointsInSameBlock){if(mode==='wysiwyg'&&this.editor.isEditable()){var statusBarSelection=this.editor.statusBar?this.editor.statusBar.getSelection():null,parentElement=statusBarSelection?statusBarSelection:this.editor.getParentElement(),disabled=!endPointsInSameBlock||(selectionEmpty&&/^body$/i.test(parentElement.nodeName));button.setInactive(!parentElement.style[this.styleProperty[button.itemId]]);button.setDisabled(disabled);}}});HTMLArea.I18N=new Object();HTMLArea.I18N={"tooltips":{"bold":"Fett","italic":"Kursiv","underline":"Unterstrichen","strikethrough":"Durchgestrichen","subscript":"Tiefgestellt","superscript":"Hochgestellt","justifyleft":"Linksb\u00fcndig","justifycenter":"Zentrieren","justifyright":"Rechtsb\u00fcndig","justifyfull":"Blocksatz","insertorderedlist":"Nummerierung","insertunorderedlist":"Aufz\u00e4hlung","outdent":"Einzug verkleinern","indent":"Einzug vergr\u00f6\u00dfern","forecolor":"Zeichenfarbe","hilitecolor":"Hintergrundfarbe","inserthorizontalrule":"Horizontale Linie","createlink":"Link einf\u00fcgen","unlink":"Link entfernen","insertimage":"Bild einf\u00fcgen\/ver\u00e4ndern","inserttable":"Tabelle einf\u00fcgen","htmlmode":"Zur HTML-Ansicht wechseln","popupeditor":"Editor-Fenster vergr\u00f6\u00dfern","about":"\u00dcber diesen Editor","showhelp":"Hilfe","textindicator":"Momentaner Stil","undo":"Letzte Aktion r\u00fcckg\u00e4ngig machen","redo":"Letzte Aktion wiederholen","cut":"Auswahl ausschneiden","copy":"Auswahl kopieren","paste":"Aus der Zwischenablage einf\u00fcgen","lefttoright":"Schreibrichtung von links nach rechts","righttoleft":"Schreibrichtung von rechts nach links","removeformat":"Formatierung entfernen","print":"Das Dokument drucken","killword":"MSOffice entfernen","fontname":"Schriftart","fontsize":"Schriftgr\u00f6\u00dfe","formatblock":"Absatzart"},"msg":{"Path":"Pfad","TEXT_MODE":"Sie befinden sich im TEXT-MODUS. Benutzen Sie die Schaltfl\u00e4che [<>], um zur\u00fcck in den WYSIWYG-Modus zu wechseln.","ActiveX-required":"Wenn Sie den Editor innerhalb des Internet Explorers verwenden wollen, m\u00fcssen Sie ActiveX-Controls zulassen.","HTML-document-not-well-formed":"Das HTML-Dokument ist nicht wohlgeformt.","Moz-Clipboard":"Unprivilegierte Skripte k\u00f6nnen aus Sicherheitsgr\u00fcnden Ausschneiden\/Kopieren\/Einf\u00fcgen nicht nutzen. Klicken Sie auf Ja, um einen technischen Hinweis von mozilla.org (auf englisch) zu lesen, der Ihnen zeigt, wie Sie Skripten den Zugriff auf die Zwischenablage erm\u00f6glichen.","Moz-Extension":"Aus Sicherheitsgr\u00fcnden d\u00fcrfen unprivilegierte Applikationen nicht auf die Zwischenablage zugreifen. Klicken Sie auf Ja, um eine Komponente zu installieren, die Programmen dieser TYPO3-Site erlaubt, auf die Zwischenablage zuzugreifen und Kopieren, Ausschneiden und Einf\u00fcgen zu verwenden.","Moz-Extension-Success":"Die Installation war erfolgreich. Sie m\u00fcssen Ihren Browser verlassen und erneut starten, damit die \u00c4nderungen wirksam werden.","Moz-Extension-Failure":"Das Firefox Add-on \"AllowClipboard Helper\" konnte nicht installiert werden.","Moz-Extension-Install-Not-Enabled":"Die Installation kann nicht durchgef\u00fchrt werden. Bitte \u00e4ndern Sie Ihre Browser-Einstellungen so, dass eine Software-Installation von dieser TYPO3-Site zugelassen wird.","Allow-Clipboard-Helper-Extension":"Aus Sicherheitsgr\u00fcnden d\u00fcrfen unprivilegierte Applikationen nicht auf die Zwischenablage zugreifen. Klicken Sie auf OK, um eine Komponente zu installieren, mit der Sie die Websites angeben k\u00f6nnen, die Zugriff auf die Zwischenablage erhalten sollen und Inhalte kopieren, ausschneiden und einf\u00fcgen d\u00fcrfen.","Mozilla-Org-Install-Not-Enabled":"Die Installation kann nicht durchgef\u00fchrt werden. Bitte \u00e4ndern Sie Ihre Browser-Einstellungen so, dass eine Software-Installation von der Site https:\/\/addons.mozilla.org zugelassen wird.","Allow-Clipboard-Helper-Extension-Success":"Die Installation war erfolgreich. Sie m\u00fcssen Ihren Browser verlassen und erneut starten, damit die \u00c4nderungen wirksam werden. W\u00e4hlen Sie dann in Ihrem Browser unter [Extras | AllowClipboard Helper] diejenigen Sites aus, denen der Zugriff auf die Zwischenablage gew\u00e4hrt werden soll."},"dialogs":{"OK":"OK","Cancel":"Abbrechen","Delete":"L\u00f6schen","Close":"Schlie\u00dfen","Not set":"Nicht gesetzt","General":"Allgemein","Alignment:":"Ausrichtung:","Alignment not set":"Nicht gew\u00e4hlt","Left":"Links","Center":"Zentriert","Right":"Rechts","Texttop":"Text Oben","Absmiddle":"Absolut zentriert","Baseline":"Grundlinie","Absbottom":"Absolut unten","Bottom":"Unten","Middle":"Mitte","Top":"Oben","Justify":"Blocksatz","Float:":"Umflie\u00dfen:","Non-floating":"Nicht umflie\u00dfen","Layout":"Layout","Spacing and padding":"Zwischenraum","Horizontal:":"Horizontal:","Horizontal padding":"Horizontaler Abstand","Vertical:":"Vertikal:","Vertical padding":"Vertikaler Abstand","Border":"Rahmen","Border thickness:":"Rahmenst\u00e4rke:","Leave empty for no border":"Geben Sie keinen Wert ein, wenn Sie keinen Rahmen w\u00fcnschen","Insert\/Modify Link":"Link einf\u00fcgen\/ver\u00e4ndern","Insert link":"Link einf\u00fcgen","Modify link":"Link ver\u00e4ndern","URL:":"URL:","link_href_tooltip":"Geben Sie die Link-URL hier ein","link_url_required":"Bitte geben Sie die URL ein, auf die dieser Link zeigt","Title (tooltip):":"Titel (Kurzinfo):","link_title_tooltip":"Geben Sie die Link-Kurzinfo hier ein","Target:":"Ziel:","link_target_tooltip":"W\u00e4hlen Sie den Namen des Ziel-Frames","target_none":"Keines (benutze impliziertes Ziel)","target_blank":"Neues Fenster (_blank)","target_self":"Gleicher Frame (_self)","target_top":"Top-Frame (_top)","target_other":"Anderer Frame","Insert Custom Element":"Benutzerdefiniertes Element einf\u00fcgen","Insert Table":"Tabelle einf\u00fcgen","Dimension":"Gr\u00f6\u00dfe","Rows:":"Zeilen:","Number of rows":"Anzahl Zeilen","You must enter a number of rows":"Sie m\u00fcssen eine Anzahl Zeilen angeben","Cols:":"Spalten:","Number of columns":"Anzahl Spalten","You must enter a number of columns":"Sie m\u00fcssen eine Anzahl Spalten eingeben","Width:":"Breite:","Width of the table":"Breite der Tabelle","Percent":"Prozent","Pixels":"Pixel","Em":"Em","Width unit":"Einheit","Text alignment":"Textausrichtung","Where the table should float":"Wo soll die Tabelle schweben","Cell spacing:":"Zellenabstand:","Space between adjacent cells":"Der Abstand zwischen benachbarten Zellen","Cell padding:":"Textabstand:","Space between content and border in cell":"Der Abstand zwischen dem Inhalt und dem Rand einer Zelle","Insert Image":"Bild einf\u00fcgen","Insert image":"Bild einf\u00fcgen","Modify image":"Bild ver\u00e4ndern","Image URL:":"Bild-URL:","Enter the image URL here":"Geben Sie die URL des Bildes hier ein","Preview":"Vorschau","Preview the image in a new window":"Betrachten Sie eine Vorschau des Bildes in einem neuen Fenster","Alternate text:":"Alternativer Text:","For browsers that dont support images":"F\u00fcr Browser, die keine Bildanzeige unterst\u00fctzen","Where the image should float":"Legt fest, wo das Bild schweben soll","Image alignment:":"Bildausrichtung:","Positioning of this image":"Position dieses Bildes","Image Preview":"Bildvorschau","image_url_first":"Sie m\u00fcssen zuerst die Bild-URL eingeben","image_url_required":"Sie m\u00fcssen die Bild-URL eingeben","Select Color":"W\u00e4hlen Sie eine Farbe","Insert\/Modify Acronym":"Akronym oder Abk\u00fcrzung einf\u00fcgen\/bearbeiten","About HTMLArea":"\u00dcber htmlArea RTE","About":"\u00dcber","free_editor":"Ein in TYPO3 integrierter, freier WYSIWYG-Editor f\u00fcr