X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6e39d509471fe9b4e2660e0d1631b350d0c66f40..2e847cf21b8ab9d15fa167b315ca5b2fa92638fc:/docs/source/HtmlEditor.html diff --git a/docs/source/HtmlEditor.html b/docs/source/HtmlEditor.html index 963b9d24..04d0c950 100644 --- a/docs/source/HtmlEditor.html +++ b/docs/source/HtmlEditor.html @@ -203,7 +203,7 @@ Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, { createToolbar : function(editor){ var items = []; var tipsEnabled = Ext.QuickTips && Ext.QuickTips.isEnabled(); - + function btn(id, toggle, handler){ return { @@ -229,7 +229,7 @@ Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, { html: this.createFontOptions() } }); - + items.push( fontSelectItem, '-' @@ -340,16 +340,16 @@ Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, { ); } } - + // build the toolbar var tb = new Ext.Toolbar({ renderTo: this.wrap.dom.firstChild, items: items }); - + if (fontSelectItem) { this.fontSelect = fontSelectItem.el; - + this.mon(this.fontSelect, 'change', function(){ var font = this.fontSelect.dom.value; this.relayCmd('fontname', font); @@ -362,9 +362,7 @@ Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, { this.mon(tb.el, 'click', function(e){ e.preventDefault(); }); - - - + this.tb = tb; }, @@ -379,24 +377,27 @@ Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, { }, setReadOnly: function(readOnly){ - if(this.initialized){ - var newDM = readOnly ? 'off' : 'on', - doc = this.getDoc(); - if(String(doc.designMode).toLowerCase() != newDM){ - doc.designMode = newDM; - } - this.disableItems(!readOnly); - } + Ext.form.HtmlEditor.superclass.setReadOnly.call(this, readOnly); + if(this.initialized){ + this.setDesignMode(!readOnly); + var bd = this.getEditorBody(); + if(bd){ + bd.style.cursor = this.readOnly ? 'default' : 'text'; + } + this.disableItems(readOnly); + } },
/** * Protected method that will not generally be called directly. It * is called when the editor initializes the iframe with HTML contents. Override this method if you * want to change the initialization markup of the iframe (e.g. to add stylesheets). + * + * Note: IE8-Standards has unwanted scroller behavior, so the default meta tag forces IE7 compatibility */ getDocMarkup : function(){ - return ''; + return ''; }, // private @@ -431,8 +432,8 @@ Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, { this.createToolbar(this); this.disableItems(true); - // is this needed? - // this.tb.doLayout(); + + this.tb.doLayout(); this.createIFrame(); @@ -447,9 +448,9 @@ Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, { var iframe = document.createElement('iframe'); iframe.name = Ext.id(); iframe.frameBorder = '0'; - iframe.src = Ext.SSL_SECURE_URL; - this.wrap.dom.appendChild(iframe); + iframe.style.overflow = 'auto'; + this.wrap.dom.appendChild(iframe); this.iframe = iframe; this.monitorTask = Ext.TaskMgr.start({ @@ -473,7 +474,7 @@ Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, { var doc = this.getDoc(); if(doc.body || doc.readyState == 'complete'){ Ext.TaskMgr.stop(task); - doc.designMode="on"; + this.setDesignMode(true); this.initEditor.defer(10, this); } }, @@ -491,12 +492,34 @@ Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, { if(!doc){ return; } - if(!doc.editorInitialized || String(doc.designMode).toLowerCase() != 'on'){ + if(!doc.editorInitialized || this.getDesignMode() != 'on'){ this.initFrame(); } } }, - + + /* private + * set current design mode. To enable, mode can be true or 'on', off otherwise + */ + setDesignMode : function(mode){ + var doc ; + if(doc = this.getDoc()){ + if(this.readOnly){ + mode = false; + } + doc.designMode = (/on|true/i).test(String(mode).toLowerCase()) ?'on':'off'; + } + + }, + + // private + getDesignMode : function(){ + var doc = this.getDoc(); + if(!doc){ return ''; } + return String(doc.designMode).toLowerCase(); + + }, + disableItems: function(disabled){ if(this.fontSelect){ this.fontSelect.dom.disabled = disabled; @@ -540,7 +563,7 @@ Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, { } this.sourceEditMode = sourceEditMode === true; var btn = this.tb.getComponent('sourceedit'); - + if(btn.pressed !== this.sourceEditMode){ btn.toggle(this.sourceEditMode); if(!btn.xtbHidden){ @@ -555,8 +578,8 @@ Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, { this.el.dom.removeAttribute('tabIndex'); this.el.focus(); }else{ - if(this.initialized && !this.readOnly){ - this.disableItems(false); + if(this.initialized){ + this.disableItems(this.readOnly); } this.pushValue(); this.iframe.className = ''; @@ -670,14 +693,13 @@ Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, { this.getEditorBody().innerHTML = v; if(Ext.isGecko){ // Gecko hack, see: https://bugzilla.mozilla.org/show_bug.cgi?id=232791#c8 - var d = this.getDoc(), - mode = d.designMode.toLowerCase(); - - d.designMode = mode.toggle('on', 'off'); - d.designMode = mode; + this.setDesignMode(false); //toggle off first + } + this.setDesignMode(true); this.fireEvent('push', this, v); } + } }, @@ -703,12 +725,12 @@ Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, { ss = this.el.getStyles('font-size', 'font-family', 'background-image', 'background-repeat'), doc, fn; - + ss['background-attachment'] = 'fixed'; // w3c dbody.bgProperties = 'fixed'; // ie Ext.DomHelper.applyStyles(dbody, ss); - + doc = this.getDoc(); if(doc){ @@ -767,7 +789,7 @@ Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, { this.wrap.remove(); } } - + if(this.el){ this.el.removeAllListeners(); this.el.remove(); @@ -778,7 +800,7 @@ Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, { // private onFirstFocus : function(){ this.activated = true; - this.disableItems(false); + this.disableItems(this.readOnly); if(Ext.isGecko){ // prevent silly gecko errors this.win.focus(); var s = this.win.getSelection(); @@ -848,7 +870,7 @@ Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, { return; } - var btns = this.tb.items.map, + var btns = this.tb.items.map, doc = this.getDoc(); if(this.enableFont && !Ext.isSafari2){ @@ -965,7 +987,7 @@ Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, { fixKeys : function(){ // load time branching for fastest keydown performance if(Ext.isIE){ return function(e){ - var k = e.getKey(), + var k = e.getKey(), doc = this.getDoc(), r; if(k == e.TAB){