0
`我已经添加在HTML编辑自定义按钮,这将改变预览area.I的背景颜色已经尝试了一切,但似乎无法得到它EXTJS如何改变HTML编辑的背景色动态
Ext.onReady(function() {
Ext.tip.QuickTipManager.init(); // enable tooltips
new Ext.panel.Panel({
title: 'HTML Editor',
renderTo: Ext.getBody(),
width: 550,
height: 250,
frame: true,
layout: 'fit',
items: {
xtype: 'htmleditor',
enableColors: false,
enableAlignments: false,
listeners:{
render:function(){
this.getToolbar().add({
xtype:'button',
scope: this,
tooltip:'Set background color',
iconCls : 'btn-charttheme',
menu : {
xtype : 'colormenu',
listeners : {
select :function(picker,selColor) {
}
}
}
});
}
}
}
});`
`
这是正确的方法,因为据我所知,这是唯一的方法。你可以通过在iframe中注入CSS样式表或规则来获得幻想,但它归结为相同的想法。唯一的是:为什么不使用['iframeEl'](http://docs.sencha.com/extjs/4.2.2/source/HtmlEditor.html#Ext-form-field-HtmlEditor-method-afterRender )直接? – rixo
因为我是一个白痴,并没有意识到那是在那里。感谢rixo,更新了代码。 – incutonez
感谢@incutonez,解决方法运作良好! – AngryLeo