当前位置: 首页 > 工具软件 > HtmlEditor > 使用案例 >

extjs修改html不显示,Extjs htmleditor不会设置doctype和head标签

白浩荡
2023-12-01

Ext.define('MyHTMLEditor', {

extend:'Ext.form.HtmlEditor',

alias: 'widget.myhtmleditor',

tagsToComment: ['!DOCTYPE', 'html', 'head', 'body'],

/**

* Pushing value to wysiwyg iframe loses dtd, html, head and body tags.

* Override hack to comment them out when pushing to iframe, and then uncomment

* them on the way back (see this.cleanHtml).

*/

pushValue: function() {

var me = this,

v;

if(me.initialized){

v = me.textareaEl.dom.value || '';

if (!me.activated && v.length < 1) {

v = me.defaultValue;

}

if (me.fireEvent('beforepush', me, v) !== false) {

/ change

for (var i=0;i

v = v.replace(RegExp('', 'ig'), '');

}

/

me.getEditorBody().innerHTML = v;

if (Ext.isGecko) {

// Gecko hack, see: https://bugzilla.mozilla.org/show_bug.cgi?id=232791#c8

me.setDesignMode(false); //toggle off first

me.setDesignMode(true);

}

me.fireEvent('push', me, v);

}

}

},

/**

* Uncomment the tags mentioned in pushValue

*/

cleanHtml: function(html) {

var me = this, i,

result = me.callParent(arguments);

for (i=0;i

result = result.replace(RegExp('', 'ig'), '');

}

return result;

},

});

 类似资料: