Extjs HtmlEditor-编号列表和项目符号列表
我试着和HTMLEditor一起工作Extjs HtmlEditor-编号列表和项目符号列表,extjs,extjs4,extjs4.1,html-editor,Extjs,Extjs4,Extjs4.1,Html Editor,我试着和HTMLEditor一起工作 但当我选择“编号列表”或“项目符号列表”进行键入时,我会按键盘键。那样 我想是这样的 1. first 2. second 3. third 1. first 2. second third 当我在第三节集中注意力时。我按un编号。我想是这样的 1. first 2. second 3. third 1. first 2. second third 但所有的字都将被编号 如何解决这个问题。非常感谢看起来4.1.1上的
但当我选择“编号列表”或“项目符号列表”进行键入时,我会按键盘键。那样 我想是这样的
1. first
2. second
3. third
1. first
2. second
third
当我在第三节集中注意力时。我按un编号。我想是这样的
1. first
2. second
3. third
1. first
2. second
third
但所有的字都将被编号
如何解决这个问题。非常感谢看起来4.1.1上的htmleditor有一个bug。另外,您不应该使用new来创建ExtJS对象。这将导致其他ExtJS问题 升级到4.2.x将解决htmleditor的问题 你的代码应该有更好的格式。您还应该使用适当的ExtJS方法来获取项目,例如:
Ext.create('Ext.form.Panel', { // should be using Ext.create(), not new
title: 'HTML Editor',
width: 500,
bodyPadding: 10,
renderTo: Ext.getBody(),
items: [{
xtype: 'htmleditor',
name: 'editor',
enableColors: true,
enableAlignments: false,
enableLists: true,
enableSourceEdit: false,
anchor: '100%'
}],
dockedItems: [{
xtype: 'toolbar',
items: [{
xtype: 'button',
text: 'Get HTML',
handler: function(btn) {
// example of getting all form values
console.log(btn.up('form').getForm().getValues());
// proper example of getting by component
alert(btn.up('form').down('htmleditor').getValue());
}
}]
}]
});
使用
new
是完全可以接受的,甚至是性能方面的首选。从4.1开始,ExtJS类都在内部使用new
,而不是Ext.create()
,正是出于这个原因。谈论propper-Ext方法来获取组件,然后使用getCmp更糟糕……是的,你应该真正使用.up(),.down(),.prev(),etc.@sra:Per comment已修复。如果使用动态类加载,则必须使用Ext.create()。如果您使用的是new,那么您最好知道是否已经加载了任何必需的类。