chore: updates

This commit is contained in:
zerosoul
2022-04-15 13:18:50 +08:00
parent 19a4861819
commit a09f95342f
5 changed files with 37 additions and 10 deletions
+20 -1
View File
@@ -13,6 +13,11 @@ import {
createSoftBreakPlugin,
createComboboxPlugin,
createMentionPlugin,
// comboboxSelectors,
// getMentionOnSelectItem,
// findMentionInput,
// removeMentionInput,
// isSelectionInMentionInput,
createPlugins,
ELEMENT_PARAGRAPH,
getPlateEditorRef,
@@ -147,6 +152,18 @@ const Plugins = ({
const handleChange = useCallback(
async (val) => {
console.log("tmps changed", val);
// const wtf = getMentionOnSelectItem();
// const plateEditor = getPlateEditorRef(`${TEXT_EDITOR_PREFIX}_${id}`);
// const currentMentionInput = findMentionInput(plateEditor);
// const items = comboboxSelectors.filteredItems();
// console.log(
// "mention check",
// items,
// isSelectionInMentionInput(plateEditor)
// );
// if (items?.length == 0 && isSelectionInMentionInput(plateEditor)) {
// removeMentionInput(plateEditor, currentMentionInput[1]);
// }
const tmps = [];
const getMixedText = (children) => {
const mentions = [];
@@ -202,7 +219,9 @@ const Plugins = ({
? {
type: "text",
content: tmp.map((t) => t.content).join("\n"),
properties: { mentions: tmp.map((t) => t.mentions).flat() },
properties: {
mentions: tmp.map((t) => t.properties?.mentions || []).flat(),
},
}
: tmp;
});