From 605602a436edd34d5186a3cbb0484b923ccfb22c Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 20 Dec 2021 11:09:20 +0800 Subject: [PATCH] =?UTF-8?q?BI-98802=20fix:=20=E6=96=87=E6=9C=AC=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=90=8C=E6=AD=A5=E6=94=B9=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../multiselectlist/multiselectlist.insert.js | 17 +++++++++++------ .../multiselectlist.insert.nobar.js | 17 +++++++++++------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/widget/multiselectlist/multiselectlist.insert.js b/src/widget/multiselectlist/multiselectlist.insert.js index 4fbf258e2..082669692 100644 --- a/src/widget/multiselectlist/multiselectlist.insert.js +++ b/src/widget/multiselectlist/multiselectlist.insert.js @@ -101,7 +101,11 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, { }, { eventName: BI.Searcher.EVENT_PAUSE, action: function () { - var keyword = this.getKeyword(); + var keywords = self._getKeywords(); + if (keywords[keywords.length - 1] === BI.BlankSplitChar) { + keywords = keywords.slice(0, keywords.length - 1); + } + var keyword = BI.isEmptyArray(keywords) ? "" : keywords[keywords.length - 1]; self._join({ type: BI.Selection.Multi, value: [keyword] @@ -126,7 +130,7 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, { var last = BI.last(keywords); keywords = BI.initial(keywords || []); if (keywords.length > 0) { - self._joinKeywords(keywords.slice(0, last === BI.BlankSplitChar ? 1999 : 2000), function () { + self._joinKeywords(keywords, function () { if (BI.endWith(last, BI.BlankSplitChar)) { self.adapter.setValue(self.storeValue); assertShowValue(); @@ -191,16 +195,17 @@ BI.MultiSelectInsertList = BI.inherit(BI.Single, { keywords = keywords.slice(0, keywords.length - 1); } if (/\u200b\s\u200b$/.test(val)) { - return keywords.concat([BI.BlankSplitChar]); + keywords = keywords.concat([BI.BlankSplitChar]); } - return keywords; + return keywords.length > 2000 ? keywords.slice(0, 2000).concat([BI.BlankSplitChar]) : keywords.slice(0, 2000); }, _getKeywordsLength: function () { - var keywords = this._getKeywords(); + var val = this.editor.getValue(); + var keywords = val.split(/\u200b\s\u200b/); - return keywords[keywords.length - 1] === BI.BlankSplitChar ? keywords.length - 1 : keywords.length; + return keywords.length - 1; }, _showAdapter: function () { diff --git a/src/widget/multiselectlist/multiselectlist.insert.nobar.js b/src/widget/multiselectlist/multiselectlist.insert.nobar.js index 8369b2acf..e2c8f2008 100644 --- a/src/widget/multiselectlist/multiselectlist.insert.nobar.js +++ b/src/widget/multiselectlist/multiselectlist.insert.nobar.js @@ -105,7 +105,11 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, { }, { eventName: BI.Searcher.EVENT_PAUSE, action: function () { - var keyword = this.getKeyword(); + var keywords = self._getKeywords(); + if (keywords[keywords.length - 1] === BI.BlankSplitChar) { + keywords = keywords.slice(0, keywords.length - 1); + } + var keyword = BI.isEmptyArray(keywords) ? "" : keywords[keywords.length - 1]; self._join({ type: BI.Selection.Multi, value: [keyword] @@ -129,7 +133,7 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, { var last = BI.last(keywords); keywords = BI.initial(keywords || []); if (keywords.length > 0) { - self._joinKeywords(keywords.slice(0, last === BI.BlankSplitChar ? 1999 : 2000), function () { + self._joinKeywords(keywords, function () { if (BI.endWith(last, BI.BlankSplitChar)) { self.adapter.setValue(self.storeValue); assertShowValue(); @@ -197,16 +201,17 @@ BI.MultiSelectInsertNoBarList = BI.inherit(BI.Single, { keywords = keywords.slice(0, keywords.length - 1); } if (/\u200b\s\u200b$/.test(val)) { - return keywords.concat([BI.BlankSplitChar]); + keywords = keywords.concat([BI.BlankSplitChar]); } - return keywords; + return keywords.length > 2000 ? keywords.slice(0, 2000).concat([BI.BlankSplitChar]) : keywords.slice(0, 2000); }, _getKeywordsLength: function () { - var keywords = this._getKeywords(); + var val = this.editor.getValue(); + var keywords = val.split(/\u200b\s\u200b/); - return keywords[keywords.length - 1] === BI.BlankSplitChar ? keywords.length - 1 : keywords.length; + return keywords.length - 1; }, _showAdapter: function () {