diff --git a/src/base/single/editor/editor.textarea.js b/src/base/single/editor/editor.textarea.js index b665939ce..8f4dea97d 100644 --- a/src/base/single/editor/editor.textarea.js +++ b/src/base/single/editor/editor.textarea.js @@ -82,6 +82,9 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { // 水印快速消失 self.watermark && self.watermark.setVisible(false); }); + this.content.element.keyup(function (e) { + self.fireEvent(BI.TextAreaEditor.EVENT_KEY_DOWN, e.keyCode); + }); this.content.element.click(function (e) { e.stopPropagation(); }); @@ -246,4 +249,5 @@ BI.TextAreaEditor.EVENT_BLUR = "EVENT_BLUR"; BI.TextAreaEditor.EVENT_FOCUS = "EVENT_FOCUS"; BI.TextAreaEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; BI.TextAreaEditor.EVENT_EMPTY = "EVENT_EMPTY"; +BI.TextAreaEditor.EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; BI.shortcut("bi.textarea_editor", BI.TextAreaEditor); diff --git a/src/widget/multiselect/trigger/editor/editor.patch.js b/src/widget/multiselect/trigger/editor/editor.patch.js index dff1fe7b1..baf630dc2 100644 --- a/src/widget/multiselect/trigger/editor/editor.patch.js +++ b/src/widget/multiselect/trigger/editor/editor.patch.js @@ -51,6 +51,13 @@ BI.SelectPatchEditor = BI.inherit(BI.Widget, { debounceInputChange(type, v); } }, + }, { + eventName: BI.Editor.EVENT_KEY_DOWN, + action: function (keyCode) { + if (keyCode === BI.KeyCode.ENTER) { + self._clearSplitValue(); + } + }, }, { eventName: BI.Editor.EVENT_FOCUS, action: function () { @@ -65,7 +72,13 @@ BI.SelectPatchEditor = BI.inherit(BI.Widget, { }, o.el); }, + _clearSplitValue: function () { + console.log(6); + this.editor.setValue(""); + }, + _dealChange: function (type, v) { + console.log(5); var value = ""; if (v !== this.editor.getValue()) { return;