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