我试图在HtmlEditor的ToolBar中插入一个按钮。按钮应该通过鼠标或键盘获取选定的文本,并在所选文本的开始处添加“#”字符以将其定位为URL。Ext-JS Html编辑器获取选定文本
据我所知,最好的解决方案是创建一个插件添加按钮到HTML编辑器工具栏。我发现了创造代码,但问题在于; 我如何获得选定的文本? EXT-js版2.2
而且有提供创建HTML编辑器工具栏按钮插件代码:
Ext.ns('Ext.ux.form.HtmlEditor');
Ext.ux.form.HtmlEditor.NewLine = Ext.extend(Ext.util.Observable, {
init:function (cmp) {
this.cmp = cmp;
this.cmp.on('render', this.onRender, this);
},
onRender:function() {
this.cmp.getToolbar().addButton([
{
iconCls:'newline', //your iconCls here
handler:function() {
this.cmp.insertAtCursor('<br> ');
},
scope:this
}
]);
}
});
也许[此](http://www.sencha.com/forum/showthread.php?83407-TextField-Manipulating-the-selection-and-getting-the-selected-text-in -ExtJS-2)可以帮助...你可以添加extjs版本的问题? – VDP
不幸的是没有工作.. –