|
|
|
@ -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]); |
|
|
|
|