Browse Source

BI-87945: 新交互:输入回车清空当前搜索框

es6
windy 3 years ago
parent
commit
82a8f20589
  1. 4
      src/base/single/editor/editor.textarea.js
  2. 13
      src/widget/multiselect/trigger/editor/editor.patch.js

4
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);

13
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;

Loading…
Cancel
Save