0
扩展Base的领域这是我如何尽量延长Ext.form.field.Base
:无法在ExtJS的4
Ext.define('Ext.form.field.CKEditorInline', {
extend: 'Ext.form.field.Base',
alias: 'widget.ckeditorinline',
requires: [
'Ext.XTemplate'
],
constructor: function(config) {
Ext.applyIf(config, {
fieldSubTpl: [
'<div id="{id}-editor" contenteditable="true" class="ckeditorinline"></div><input id="{id}" name="{name}" type="text" value="{value}" style="display:none"/>',
{ compiled: true }]
});
this.callParent([config]);
},
getValue: function() {
var el = document.getElementById(this.id + "-inputEl-editor");
if (!!el) {
return el.innerHTML;
}
return null;
},
setValue: function (value) {
var el = document.getElementById(this.id + "-inputEl-editor");
if (value === "") value = "<p><br/></p>";
if (!!el) {
el.innerHTML = !!value ? value : "<p><br/></p>";
}
},
reset: function() {
var el = document.getElementById(this.id + "-inputEl-editor");
if (!!el) {
el.innerHTML = '<p><br/></p>';
}
}
});
所以,基本上我想要的是使用,而不是输入字段编辑股利。但是,当我尝试在此字段中键入(打印)某些内容时,我发现我无法打印空格字符或使用Enter中断(因此,无法使用“one two”或“one \ ntwo”等值相反,我得到了“一二”)。这有什么问题,我该如何解决?
你是什么意思?你是否收到任何错误或编译成功,但没有工作? – Tejas
编译成功,但正如我所说的,当我尝试在我的contenteditable div元素中打印一些值时,使用模板创建时遇到问题。 – Jacobian