diff --git a/src/base/single/editor/editor.textarea.js b/src/base/single/editor/editor.textarea.js index b665939ce6..8f4dea97d7 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 dff1fe7b1c..d19bac9bb9 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 () { @@ -59,12 +66,17 @@ BI.SelectPatchEditor = BI.inherit(BI.Widget, { }, { eventName: BI.Editor.EVENT_BLUR, action: function () { + self._start = false; self.fireEvent(BI.SelectPatchEditor.EVENT_BLUR, arguments); }, }], }, o.el); }, + _clearSplitValue: function () { + this.editor.setValue(""); + }, + _dealChange: function (type, v) { var value = ""; if (v !== this.editor.getValue()) {