Browse Source

BI-139784 fix: 【来源内测BUG】数据编辑过滤

去掉首尾的空字符
research/test
翠屏山最速下山传说 9 months ago
parent
commit
61ea631a5e
  1. 22
      packages/fineui/src/widget/multiselect/trigger/editor.multiselect.js

22
packages/fineui/src/widget/multiselect/trigger/editor.multiselect.js

@ -1,4 +1,15 @@
import { shortcut, Widget, extend, i18nText, createWidget, Controller, isEmptyString, isEmptyArray, BlankSplitChar } from "@/core";
import {
shortcut,
Widget,
extend,
i18nText,
createWidget,
Controller,
isEmptyString,
isEmptyArray,
BlankSplitChar,
first, last, isNotEmptyString
} from "@/core";
import { StateEditor } from "@/case";
import { SelectPatchEditor } from "./editor/editor.patch";
@ -77,8 +88,13 @@ export class MultiSelectEditor extends Widget {
getKeywords() {
const val = this.editor.getValue();
let keywords = val.split(/\u200b\s\u200b/);
if (isEmptyString(keywords[keywords.length - 1])) {
keywords = keywords.slice(0, keywords.length - 1);
if (isEmptyString(first(keywords)) || isEmptyString(last(keywords))) {
keywords = keywords.filter((word, index) => {
if (index === 0 || index === keywords.length - 1) {
return isNotEmptyString(word);
}
return true;
});
}
if (/\u200b\s\u200b$/.test(val)) {
return keywords.concat([BlankSplitChar]);

Loading…
Cancel
Save