I erased the HtmlEditor from getting built in my version of Ext and made my own based off it. Here is what the class/file structure looks like:
- BaseIFrameEditor.js
- HtmlEditor.js
- CodePressEditor.js
- HtmlEditorPlugin.js
- HtmlEditorPluginStandard.js
- HtmlEditorPluginLink.js
- HtmlEditorPluginImage.js
- HtmlEditorPluginSmileys.js
And i register some xtypes like this:
Code:
Ext.reg('htmleditor', Ext.extend(Ext.ux.HtmlEditor,{
tbRows:1,
tbTitles:false,
tbFloat:false,
plugins: [{
ptype:'htmlstandard'
},{
ptype:'htmllink'
},{
ptype:'htmlsmileys'
},{
ptype:'htmlimage'
}]
});
Ext.reg('floathtmleditor', Ext.extend(Ext.ux.HtmlEditor,{
tbRows:1,
tbTitles:true,
tbFloat:true,
plugins: [{
ptype:'htmlstandard'
},{
ptype:'htmllink'
},{
ptype:'htmlsmileys'
},{
ptype:'htmlimage'
}]
});
Ext.reg('basichtmleditor',Ext.extend(Ext.ux.HtmlEditor,{
tbRows:1,
tbTitles:false,
tbFloat:false,
plugins: [{
ptype:'htmlstandard',
toolbarPane: {
font: ['fontstyle']
}
}],
toolbarPanes:'font'
}));
Ext.reg('ribbonhtmleditor',Ext.extend(Ext.ux.HtmlEditor,{
tbRows:3,
tbTitles:true,
tbFloat:false,
plugins: [{
ptype:'htmlstandard'
},{
ptype:'htmllink'
},{
ptype:'htmlsmileys'
},{
ptype:'htmlimage'
}]
}));
With the concept being that there are toolbarPanes like 'font' that contain all the font related stuff. The font pane has several button groups: 'fontface','fontsize','fontstyle','fontcolor'. The 'fontstyle' group has 'bold','italic','underline', etc. So a plugin has a function that registers where its buttons go (toolbar pane and button group). The editor automatically handles merging, separators, etc.
The overflow looks nice too (works the same with the titles part off), and even slightly enhances the current justify setting, for example. We also added in the ability to float the toolbar.