From f01a424a4e6bdf6e4c2be18075944823f0e36b58 Mon Sep 17 00:00:00 2001 From: Yifei Date: Wed, 27 Nov 2024 17:18:33 +0800 Subject: [PATCH 1/5] fix: #3813 --- .changeset/fresh-carrots-smile.md | 5 ++ .../search/empty.spec.ts | 2 +- .../search/text.spec.ts | 49 ++++++++++++++- .../src/lib/decorateFindReplace.ts | 59 ++++++++++++++----- 4 files changed, 98 insertions(+), 17 deletions(-) create mode 100644 .changeset/fresh-carrots-smile.md diff --git a/.changeset/fresh-carrots-smile.md b/.changeset/fresh-carrots-smile.md new file mode 100644 index 0000000000..ba71c10ea5 --- /dev/null +++ b/.changeset/fresh-carrots-smile.md @@ -0,0 +1,5 @@ +--- +'@udecode/plate-find-replace': minor +--- + +fix: FindReplacePlugin supports matching consecutive text nodes diff --git a/packages/find-replace/src/lib/__tests__/decorateSearchHighlight/search/empty.spec.ts b/packages/find-replace/src/lib/__tests__/decorateSearchHighlight/search/empty.spec.ts index 97cea9079a..affcaab872 100644 --- a/packages/find-replace/src/lib/__tests__/decorateSearchHighlight/search/empty.spec.ts +++ b/packages/find-replace/src/lib/__tests__/decorateSearchHighlight/search/empty.spec.ts @@ -16,7 +16,7 @@ it('should be', () => { expect( decorateFindReplace({ ...getEditorPlugin(editor, FindReplacePlugin), - entry: [{ text: '' }, [0, 0]], + entry: [{ type: 'p', children: [{ text: '' }] }, [0]], }) ).toEqual(output); }); diff --git a/packages/find-replace/src/lib/__tests__/decorateSearchHighlight/search/text.spec.ts b/packages/find-replace/src/lib/__tests__/decorateSearchHighlight/search/text.spec.ts index 4003432bd6..40971d44d7 100644 --- a/packages/find-replace/src/lib/__tests__/decorateSearchHighlight/search/text.spec.ts +++ b/packages/find-replace/src/lib/__tests__/decorateSearchHighlight/search/text.spec.ts @@ -15,7 +15,7 @@ it('should decorate matching text', () => { expect( plugin.decorate?.({ ...getEditorPlugin(editor, plugin), - entry: [{ text: 'test' }, [0, 0]], + entry: [{ type: 'p', children: [{ text: 'test' }] }, [0]], }) ).toEqual([ { @@ -45,7 +45,7 @@ it('should decorate matching text case-insensitively', () => { expect( plugin.decorate?.({ ...getEditorPlugin(editor, plugin), - entry: [{ text: 'test' }, [0, 0]], + entry: [{ type: 'p', children: [{ text: 'test' }] }, [0]], }) ).toEqual([ { @@ -62,3 +62,48 @@ it('should decorate matching text case-insensitively', () => { }, ]); }); + +it('should decorate matching consecutive text nodes', () => { + const editor = createSlateEditor({ + plugins: [FindReplacePlugin], + }); + + const plugin = editor.getPlugin(FindReplacePlugin); + + editor.setOption(FindReplacePlugin, 'search', 'test'); + + expect( + plugin.decorate?.({ + ...getEditorPlugin(editor, plugin), + entry: [ + { type: 'p', children: [{ text: 'tes' }, { text: 't', bold: true }] }, + [0], + ], + }) + ).toEqual([ + { + [FindReplacePlugin.key]: true, + anchor: { + offset: 0, + path: [0, 0], + }, + focus: { + offset: 3, + path: [0, 0], + }, + search: 'tes', + }, + { + [FindReplacePlugin.key]: true, + anchor: { + offset: 0, + path: [0, 1], + }, + focus: { + offset: 1, + path: [0, 1], + }, + search: 't', + }, + ]); +}); diff --git a/packages/find-replace/src/lib/decorateFindReplace.ts b/packages/find-replace/src/lib/decorateFindReplace.ts index 4970078e31..7761cd43ff 100644 --- a/packages/find-replace/src/lib/decorateFindReplace.ts +++ b/packages/find-replace/src/lib/decorateFindReplace.ts @@ -1,7 +1,7 @@ import type { Decorate } from '@udecode/plate-common'; import type { Range } from 'slate'; -import { isText } from '@udecode/plate-common'; +import { isElement, isText } from '@udecode/plate-common'; import type { FindReplaceConfig } from './FindReplacePlugin'; @@ -12,27 +12,58 @@ export const decorateFindReplace: Decorate = ({ }) => { const { search } = getOptions(); - const ranges: SearchRange[] = []; + if (!(search && isElement(node) && node.children.every(isText))) { + return []; + } + + const texts = node.children.map((it) => it.text); - if (!search || !isText(node)) { - return ranges; + // Try to find a match + const matchStart = texts.join('').toLowerCase().indexOf(search.toLowerCase()); + if (matchStart === -1) { + return []; } - const { text } = node; - const parts = text.toLowerCase().split(search.toLowerCase()); - let offset = 0; - parts.forEach((part, i) => { - if (i !== 0) { + const matchEnd = matchStart + search.length; + let cumulativePosition = 0; + const ranges: SearchRange[] = []; + + for (const [i, text] of texts.entries()) { + const textStart = cumulativePosition; + const textEnd = cumulativePosition + text.length; + + // Corresponding offsets within the text string + const overlapStart = Math.max(matchStart, textStart); + const overlapEnd = Math.min(matchEnd, textEnd); + + if (overlapStart < overlapEnd) { + // Overlapping region exists + const anchorOffset = overlapStart - textStart; + const focusOffset = overlapEnd - textStart; + + // Corresponding offsets within the search string + const searchOverlapStart = overlapStart - matchStart; + const searchOverlapEnd = overlapEnd - matchStart; + + const textNodePath = [...path, i]; + ranges.push({ - anchor: { offset: offset - search.length, path }, - focus: { offset, path }, - search, + anchor: { + path: textNodePath, + offset: anchorOffset, + }, + focus: { + path: textNodePath, + offset: focusOffset, + }, + search: search.substring(searchOverlapStart, searchOverlapEnd), [type]: true, }); } - offset = offset + part.length + search.length; - }); + // Update the cumulative position for the next iteration + cumulativePosition = textEnd; + } return ranges; }; From 3de5eaaf73c4721e5d3a4c379f1e0320ede03057 Mon Sep 17 00:00:00 2001 From: Ziad Beyens Date: Wed, 27 Nov 2024 10:19:22 +0100 Subject: [PATCH 2/5] Update fresh-carrots-smile.md --- .changeset/fresh-carrots-smile.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/fresh-carrots-smile.md b/.changeset/fresh-carrots-smile.md index ba71c10ea5..325f97544c 100644 --- a/.changeset/fresh-carrots-smile.md +++ b/.changeset/fresh-carrots-smile.md @@ -1,5 +1,5 @@ --- -'@udecode/plate-find-replace': minor +'@udecode/plate-find-replace': patch --- fix: FindReplacePlugin supports matching consecutive text nodes From e4b09483ddf19ea5672e6680176129c952621d8f Mon Sep 17 00:00:00 2001 From: Yifei Date: Wed, 27 Nov 2024 18:04:28 +0800 Subject: [PATCH 3/5] fix: match multiple occurrences --- .../search/text.spec.ts | 88 +++++++++++ .../src/lib/decorateFindReplace.ts | 97 +++++++----- yarn.lock | 140 +++++++++--------- 3 files changed, 219 insertions(+), 106 deletions(-) diff --git a/packages/find-replace/src/lib/__tests__/decorateSearchHighlight/search/text.spec.ts b/packages/find-replace/src/lib/__tests__/decorateSearchHighlight/search/text.spec.ts index 40971d44d7..3eaef23505 100644 --- a/packages/find-replace/src/lib/__tests__/decorateSearchHighlight/search/text.spec.ts +++ b/packages/find-replace/src/lib/__tests__/decorateSearchHighlight/search/text.spec.ts @@ -107,3 +107,91 @@ it('should decorate matching consecutive text nodes', () => { }, ]); }); + +it('should decorate matching multiple occurrences', () => { + const editor = createSlateEditor({ + plugins: [FindReplacePlugin], + }); + + const plugin = editor.getPlugin(FindReplacePlugin); + + editor.setOption(FindReplacePlugin, 'search', 'test'); + + expect( + plugin.decorate?.({ + ...getEditorPlugin(editor, plugin), + entry: [ + { + type: 'p', + children: [ + { text: 'tes' }, + { text: 'ts and tests and t', bold: true }, + { text: 'ests' }, + ], + }, + [0], + ], + }) + ).toEqual([ + { + [FindReplacePlugin.key]: true, + anchor: { + offset: 0, + path: [0, 0], + }, + focus: { + offset: 3, + path: [0, 0], + }, + search: 'tes', + }, + { + [FindReplacePlugin.key]: true, + anchor: { + offset: 0, + path: [0, 1], + }, + focus: { + offset: 1, + path: [0, 1], + }, + search: 't', + }, + { + [FindReplacePlugin.key]: true, + anchor: { + offset: 7, + path: [0, 1], + }, + focus: { + offset: 11, + path: [0, 1], + }, + search: 'test', + }, + { + [FindReplacePlugin.key]: true, + anchor: { + offset: 17, + path: [0, 1], + }, + focus: { + offset: 18, + path: [0, 1], + }, + search: 't', + }, + { + [FindReplacePlugin.key]: true, + anchor: { + offset: 0, + path: [0, 2], + }, + focus: { + offset: 3, + path: [0, 2], + }, + search: 'est', + }, + ]); +}); diff --git a/packages/find-replace/src/lib/decorateFindReplace.ts b/packages/find-replace/src/lib/decorateFindReplace.ts index 7761cd43ff..e780cd3237 100644 --- a/packages/find-replace/src/lib/decorateFindReplace.ts +++ b/packages/find-replace/src/lib/decorateFindReplace.ts @@ -17,51 +17,76 @@ export const decorateFindReplace: Decorate = ({ } const texts = node.children.map((it) => it.text); + const str = texts.join('').toLowerCase(); + const searchLower = search.toLowerCase(); + + let start = 0; + const matches: number[] = []; + while ((start = str.indexOf(searchLower, start)) !== -1) { + matches.push(start); + start += searchLower.length; + } - // Try to find a match - const matchStart = texts.join('').toLowerCase().indexOf(search.toLowerCase()); - if (matchStart === -1) { + if (!matches.length) { return []; } - const matchEnd = matchStart + search.length; - let cumulativePosition = 0; const ranges: SearchRange[] = []; + let cumulativePosition = 0; + let matchIndex = 0; // Index in the matches array - for (const [i, text] of texts.entries()) { + for (const [textIndex, text] of texts.entries()) { const textStart = cumulativePosition; - const textEnd = cumulativePosition + text.length; - - // Corresponding offsets within the text string - const overlapStart = Math.max(matchStart, textStart); - const overlapEnd = Math.min(matchEnd, textEnd); - - if (overlapStart < overlapEnd) { - // Overlapping region exists - const anchorOffset = overlapStart - textStart; - const focusOffset = overlapEnd - textStart; - - // Corresponding offsets within the search string - const searchOverlapStart = overlapStart - matchStart; - const searchOverlapEnd = overlapEnd - matchStart; - - const textNodePath = [...path, i]; - - ranges.push({ - anchor: { - path: textNodePath, - offset: anchorOffset, - }, - focus: { - path: textNodePath, - offset: focusOffset, - }, - search: search.substring(searchOverlapStart, searchOverlapEnd), - [type]: true, - }); + const textEnd = textStart + text.length; + + // Process matches that overlap with the current text node + while (matchIndex < matches.length && matches[matchIndex] < textEnd) { + const matchStart = matches[matchIndex]; + const matchEnd = matchStart + search.length; + + // If the match ends before the start of the current text, move to the next match + if (matchEnd <= textStart) { + matchIndex++; + continue; + } + + // Calculate overlap between the text and the current match + const overlapStart = Math.max(matchStart, textStart); + const overlapEnd = Math.min(matchEnd, textEnd); + + if (overlapStart < overlapEnd) { + const anchorOffset = overlapStart - textStart; + const focusOffset = overlapEnd - textStart; + + // Corresponding offsets within the search string + const searchOverlapStart = overlapStart - matchStart; + const searchOverlapEnd = overlapEnd - matchStart; + + const textNodePath = [...path, textIndex]; + + ranges.push({ + anchor: { + path: textNodePath, + offset: anchorOffset, + }, + focus: { + path: textNodePath, + offset: focusOffset, + }, + search: search.substring(searchOverlapStart, searchOverlapEnd), + [type]: true, + }); + } + + // If the match ends within the current text, move to the next match + if (matchEnd <= textEnd) { + matchIndex++; + } else { + // The match continues in the next text node + break; + } } - // Update the cumulative position for the next iteration cumulativePosition = textEnd; } diff --git a/yarn.lock b/yarn.lock index e47c9970e7..eda421b214 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6406,7 +6406,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6424,7 +6424,7 @@ __metadata: "@udecode/plate-common": "workspace:^" lodash: "npm:^4.17.21" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6444,7 +6444,7 @@ __metadata: "@udecode/plate-common": "workspace:^" "@udecode/plate-heading": "npm:40.2.6" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6461,7 +6461,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6478,7 +6478,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6495,7 +6495,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6512,7 +6512,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6530,7 +6530,7 @@ __metadata: "@udecode/plate-common": "workspace:^" react-textarea-autosize: "npm:^8.5.3" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6550,7 +6550,7 @@ __metadata: delay: "npm:5.0.0" p-defer: "npm:^4.0.1" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6568,7 +6568,7 @@ __metadata: "@udecode/plate-common": "workspace:^" prismjs: "npm:^1.29.0" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6585,7 +6585,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6603,7 +6603,7 @@ __metadata: "@udecode/plate-common": "workspace:^" lodash: "npm:^4.17.21" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6614,17 +6614,17 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-common@npm:40.0.3, @udecode/plate-common@workspace:^, @udecode/plate-common@workspace:packages/common": +"@udecode/plate-common@npm:40.2.7, @udecode/plate-common@workspace:^, @udecode/plate-common@workspace:packages/common": version: 0.0.0-use.local resolution: "@udecode/plate-common@workspace:packages/common" dependencies: - "@udecode/plate-core": "npm:40.0.3" - "@udecode/plate-utils": "npm:40.0.3" + "@udecode/plate-core": "npm:40.2.7" + "@udecode/plate-utils": "npm:40.2.7" "@udecode/react-hotkeys": "npm:37.0.0" "@udecode/react-utils": "npm:39.0.0" "@udecode/slate": "npm:39.2.1" "@udecode/slate-react": "npm:40.0.0" - "@udecode/slate-utils": "npm:39.2.20" + "@udecode/slate-utils": "npm:40.2.7" "@udecode/utils": "npm:37.0.0" peerDependencies: react: ">=16.8.0" @@ -6637,7 +6637,7 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-core@npm:40.0.3, @udecode/plate-core@workspace:^, @udecode/plate-core@workspace:packages/core": +"@udecode/plate-core@npm:40.2.7, @udecode/plate-core@workspace:^, @udecode/plate-core@workspace:packages/core": version: 0.0.0-use.local resolution: "@udecode/plate-core@workspace:packages/core" dependencies: @@ -6645,7 +6645,7 @@ __metadata: "@udecode/react-utils": "npm:39.0.0" "@udecode/slate": "npm:39.2.1" "@udecode/slate-react": "npm:40.0.0" - "@udecode/slate-utils": "npm:39.2.20" + "@udecode/slate-utils": "npm:40.2.7" "@udecode/utils": "npm:37.0.0" clsx: "npm:^2.1.1" is-hotkey: "npm:^0.2.0" @@ -6678,7 +6678,7 @@ __metadata: "@udecode/plate-table": "npm:40.0.0" papaparse: "npm:^5.4.1" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6695,7 +6695,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6712,7 +6712,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.94.0" @@ -6730,7 +6730,7 @@ __metadata: diff-match-patch-ts: "npm:^0.6.0" lodash: "npm:^4.17.21" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6749,7 +6749,7 @@ __metadata: lodash: "npm:^4.17.21" raf: "npm:^3.4.1" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dnd: ">=14.0.0" react-dnd-html5-backend: ">=14.0.0" @@ -6762,7 +6762,7 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-docx@npm:40.2.6, @udecode/plate-docx@workspace:^, @udecode/plate-docx@workspace:packages/docx": +"@udecode/plate-docx@npm:40.2.7, @udecode/plate-docx@workspace:^, @udecode/plate-docx@workspace:packages/docx": version: 0.0.0-use.local resolution: "@udecode/plate-docx@workspace:packages/docx" dependencies: @@ -6770,11 +6770,11 @@ __metadata: "@udecode/plate-heading": "npm:40.2.6" "@udecode/plate-indent": "npm:40.0.0" "@udecode/plate-indent-list": "npm:40.0.0" - "@udecode/plate-media": "npm:40.2.4" + "@udecode/plate-media": "npm:40.2.7" "@udecode/plate-table": "npm:40.0.0" validator: "npm:^13.12.0" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6793,7 +6793,7 @@ __metadata: "@udecode/plate-combobox": "npm:40.0.0" "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6811,7 +6811,7 @@ __metadata: "@excalidraw/excalidraw": "npm:0.16.4" "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6828,7 +6828,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6847,7 +6847,7 @@ __metadata: "@floating-ui/react": "npm:^0.26.23" "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6865,7 +6865,7 @@ __metadata: "@udecode/plate-common": "workspace:^" lodash: "npm:^4.17.21" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6882,7 +6882,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6899,7 +6899,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6916,7 +6916,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6935,7 +6935,7 @@ __metadata: "@udecode/plate-common": "workspace:^" html-entities: "npm:^2.5.2" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6955,7 +6955,7 @@ __metadata: "@udecode/plate-list": "npm:40.0.0" clsx: "npm:^2.1.1" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6972,7 +6972,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6990,7 +6990,7 @@ __metadata: "@udecode/plate-common": "workspace:^" juice: "npm:^8.1.0" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7007,7 +7007,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7024,7 +7024,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7041,7 +7041,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7060,7 +7060,7 @@ __metadata: "@udecode/plate-floating": "npm:40.0.0" "@udecode/plate-normalizers": "npm:40.0.0" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7079,7 +7079,7 @@ __metadata: "@udecode/plate-reset-node": "npm:40.0.0" lodash: "npm:^4.17.21" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7100,7 +7100,7 @@ __metadata: remark-parse: "npm:^11.0.0" unified: "npm:^11.0.5" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7119,7 +7119,7 @@ __metadata: "@udecode/plate-common": "workspace:^" katex: "npm:0.16.11" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7130,14 +7130,14 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-media@npm:40.2.4, @udecode/plate-media@workspace:^, @udecode/plate-media@workspace:packages/media": +"@udecode/plate-media@npm:40.2.7, @udecode/plate-media@workspace:^, @udecode/plate-media@workspace:packages/media": version: 0.0.0-use.local resolution: "@udecode/plate-media@workspace:packages/media" dependencies: "@udecode/plate-common": "workspace:^" js-video-url-parser: "npm:^0.5.1" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7155,7 +7155,7 @@ __metadata: "@udecode/plate-combobox": "npm:40.0.0" "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7173,7 +7173,7 @@ __metadata: "@udecode/plate-common": "workspace:^" lodash: "npm:^4.17.21" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7191,7 +7191,7 @@ __metadata: "@udecode/plate-common": "workspace:^" lodash: "npm:^4.17.21" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7209,7 +7209,7 @@ __metadata: "@udecode/plate-common": "workspace:^" peerDependencies: "@playwright/test": ">=1.42.1" - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7226,7 +7226,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7243,7 +7243,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7260,7 +7260,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7278,7 +7278,7 @@ __metadata: "@udecode/plate-common": "workspace:^" copy-to-clipboard: "npm:^3.3.3" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7296,7 +7296,7 @@ __metadata: "@udecode/plate-combobox": "npm:40.0.0" "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7315,7 +7315,7 @@ __metadata: "@udecode/plate-diff": "npm:40.0.0" lodash: "npm:^4.17.21" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7333,7 +7333,7 @@ __metadata: "@udecode/plate-common": "workspace:^" tabbable: "npm:^6.2.0" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7352,7 +7352,7 @@ __metadata: "@udecode/plate-resizable": "npm:40.0.0" lodash: "npm:^4.17.21" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7368,7 +7368,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7397,7 +7397,7 @@ __metadata: "@udecode/plate-node-id": "npm:40.0.0" lodash: "npm:^4.17.21" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7414,7 +7414,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7425,15 +7425,15 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-utils@npm:40.0.3, @udecode/plate-utils@workspace:^, @udecode/plate-utils@workspace:packages/plate-utils": +"@udecode/plate-utils@npm:40.2.7, @udecode/plate-utils@workspace:^, @udecode/plate-utils@workspace:packages/plate-utils": version: 0.0.0-use.local resolution: "@udecode/plate-utils@workspace:packages/plate-utils" dependencies: - "@udecode/plate-core": "npm:40.0.3" + "@udecode/plate-core": "npm:40.2.7" "@udecode/react-utils": "npm:39.0.0" "@udecode/slate": "npm:39.2.1" "@udecode/slate-react": "npm:40.0.0" - "@udecode/slate-utils": "npm:39.2.20" + "@udecode/slate-utils": "npm:40.2.7" "@udecode/utils": "npm:37.0.0" clsx: "npm:^2.1.1" lodash: "npm:^4.17.21" @@ -7456,7 +7456,7 @@ __metadata: "@udecode/plate-common": "workspace:^" yjs: "npm:^13.6.19" peerDependencies: - "@udecode/plate-common": ">=40.0.3" + "@udecode/plate-common": ">=40.2.7" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7480,10 +7480,10 @@ __metadata: "@udecode/plate-code-block": "npm:40.0.0" "@udecode/plate-combobox": "npm:40.0.0" "@udecode/plate-comments": "npm:40.0.0" - "@udecode/plate-common": "npm:40.0.3" + "@udecode/plate-common": "npm:40.2.7" "@udecode/plate-csv": "npm:40.0.0" "@udecode/plate-diff": "npm:40.0.0" - "@udecode/plate-docx": "npm:40.2.6" + "@udecode/plate-docx": "npm:40.2.7" "@udecode/plate-find-replace": "npm:40.0.0" "@udecode/plate-floating": "npm:40.0.0" "@udecode/plate-font": "npm:40.0.0" @@ -7499,7 +7499,7 @@ __metadata: "@udecode/plate-link": "npm:40.0.0" "@udecode/plate-list": "npm:40.0.0" "@udecode/plate-markdown": "npm:40.2.2" - "@udecode/plate-media": "npm:40.2.4" + "@udecode/plate-media": "npm:40.2.7" "@udecode/plate-mention": "npm:40.0.0" "@udecode/plate-node-id": "npm:40.0.0" "@udecode/plate-normalizers": "npm:40.0.0" @@ -7562,7 +7562,7 @@ __metadata: languageName: unknown linkType: soft -"@udecode/slate-utils@npm:39.2.20, @udecode/slate-utils@workspace:^, @udecode/slate-utils@workspace:packages/slate-utils": +"@udecode/slate-utils@npm:40.2.7, @udecode/slate-utils@workspace:^, @udecode/slate-utils@workspace:packages/slate-utils": version: 0.0.0-use.local resolution: "@udecode/slate-utils@workspace:packages/slate-utils" dependencies: From e3c22b266cadc16f83cb6b02506ae63f30582beb Mon Sep 17 00:00:00 2001 From: Yifei Date: Wed, 27 Nov 2024 18:07:34 +0800 Subject: [PATCH 4/5] chore: reset yarn.lock --- yarn.lock | 140 +++++++++++++++++++++++++++--------------------------- 1 file changed, 70 insertions(+), 70 deletions(-) diff --git a/yarn.lock b/yarn.lock index eda421b214..e47c9970e7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6406,7 +6406,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6424,7 +6424,7 @@ __metadata: "@udecode/plate-common": "workspace:^" lodash: "npm:^4.17.21" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6444,7 +6444,7 @@ __metadata: "@udecode/plate-common": "workspace:^" "@udecode/plate-heading": "npm:40.2.6" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6461,7 +6461,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6478,7 +6478,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6495,7 +6495,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6512,7 +6512,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6530,7 +6530,7 @@ __metadata: "@udecode/plate-common": "workspace:^" react-textarea-autosize: "npm:^8.5.3" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6550,7 +6550,7 @@ __metadata: delay: "npm:5.0.0" p-defer: "npm:^4.0.1" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6568,7 +6568,7 @@ __metadata: "@udecode/plate-common": "workspace:^" prismjs: "npm:^1.29.0" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6585,7 +6585,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6603,7 +6603,7 @@ __metadata: "@udecode/plate-common": "workspace:^" lodash: "npm:^4.17.21" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6614,17 +6614,17 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-common@npm:40.2.7, @udecode/plate-common@workspace:^, @udecode/plate-common@workspace:packages/common": +"@udecode/plate-common@npm:40.0.3, @udecode/plate-common@workspace:^, @udecode/plate-common@workspace:packages/common": version: 0.0.0-use.local resolution: "@udecode/plate-common@workspace:packages/common" dependencies: - "@udecode/plate-core": "npm:40.2.7" - "@udecode/plate-utils": "npm:40.2.7" + "@udecode/plate-core": "npm:40.0.3" + "@udecode/plate-utils": "npm:40.0.3" "@udecode/react-hotkeys": "npm:37.0.0" "@udecode/react-utils": "npm:39.0.0" "@udecode/slate": "npm:39.2.1" "@udecode/slate-react": "npm:40.0.0" - "@udecode/slate-utils": "npm:40.2.7" + "@udecode/slate-utils": "npm:39.2.20" "@udecode/utils": "npm:37.0.0" peerDependencies: react: ">=16.8.0" @@ -6637,7 +6637,7 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-core@npm:40.2.7, @udecode/plate-core@workspace:^, @udecode/plate-core@workspace:packages/core": +"@udecode/plate-core@npm:40.0.3, @udecode/plate-core@workspace:^, @udecode/plate-core@workspace:packages/core": version: 0.0.0-use.local resolution: "@udecode/plate-core@workspace:packages/core" dependencies: @@ -6645,7 +6645,7 @@ __metadata: "@udecode/react-utils": "npm:39.0.0" "@udecode/slate": "npm:39.2.1" "@udecode/slate-react": "npm:40.0.0" - "@udecode/slate-utils": "npm:40.2.7" + "@udecode/slate-utils": "npm:39.2.20" "@udecode/utils": "npm:37.0.0" clsx: "npm:^2.1.1" is-hotkey: "npm:^0.2.0" @@ -6678,7 +6678,7 @@ __metadata: "@udecode/plate-table": "npm:40.0.0" papaparse: "npm:^5.4.1" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6695,7 +6695,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6712,7 +6712,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.94.0" @@ -6730,7 +6730,7 @@ __metadata: diff-match-patch-ts: "npm:^0.6.0" lodash: "npm:^4.17.21" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6749,7 +6749,7 @@ __metadata: lodash: "npm:^4.17.21" raf: "npm:^3.4.1" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dnd: ">=14.0.0" react-dnd-html5-backend: ">=14.0.0" @@ -6762,7 +6762,7 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-docx@npm:40.2.7, @udecode/plate-docx@workspace:^, @udecode/plate-docx@workspace:packages/docx": +"@udecode/plate-docx@npm:40.2.6, @udecode/plate-docx@workspace:^, @udecode/plate-docx@workspace:packages/docx": version: 0.0.0-use.local resolution: "@udecode/plate-docx@workspace:packages/docx" dependencies: @@ -6770,11 +6770,11 @@ __metadata: "@udecode/plate-heading": "npm:40.2.6" "@udecode/plate-indent": "npm:40.0.0" "@udecode/plate-indent-list": "npm:40.0.0" - "@udecode/plate-media": "npm:40.2.7" + "@udecode/plate-media": "npm:40.2.4" "@udecode/plate-table": "npm:40.0.0" validator: "npm:^13.12.0" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6793,7 +6793,7 @@ __metadata: "@udecode/plate-combobox": "npm:40.0.0" "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6811,7 +6811,7 @@ __metadata: "@excalidraw/excalidraw": "npm:0.16.4" "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6828,7 +6828,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6847,7 +6847,7 @@ __metadata: "@floating-ui/react": "npm:^0.26.23" "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6865,7 +6865,7 @@ __metadata: "@udecode/plate-common": "workspace:^" lodash: "npm:^4.17.21" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6882,7 +6882,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6899,7 +6899,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6916,7 +6916,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6935,7 +6935,7 @@ __metadata: "@udecode/plate-common": "workspace:^" html-entities: "npm:^2.5.2" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6955,7 +6955,7 @@ __metadata: "@udecode/plate-list": "npm:40.0.0" clsx: "npm:^2.1.1" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6972,7 +6972,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -6990,7 +6990,7 @@ __metadata: "@udecode/plate-common": "workspace:^" juice: "npm:^8.1.0" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7007,7 +7007,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7024,7 +7024,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7041,7 +7041,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7060,7 +7060,7 @@ __metadata: "@udecode/plate-floating": "npm:40.0.0" "@udecode/plate-normalizers": "npm:40.0.0" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7079,7 +7079,7 @@ __metadata: "@udecode/plate-reset-node": "npm:40.0.0" lodash: "npm:^4.17.21" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7100,7 +7100,7 @@ __metadata: remark-parse: "npm:^11.0.0" unified: "npm:^11.0.5" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7119,7 +7119,7 @@ __metadata: "@udecode/plate-common": "workspace:^" katex: "npm:0.16.11" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7130,14 +7130,14 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-media@npm:40.2.7, @udecode/plate-media@workspace:^, @udecode/plate-media@workspace:packages/media": +"@udecode/plate-media@npm:40.2.4, @udecode/plate-media@workspace:^, @udecode/plate-media@workspace:packages/media": version: 0.0.0-use.local resolution: "@udecode/plate-media@workspace:packages/media" dependencies: "@udecode/plate-common": "workspace:^" js-video-url-parser: "npm:^0.5.1" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7155,7 +7155,7 @@ __metadata: "@udecode/plate-combobox": "npm:40.0.0" "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7173,7 +7173,7 @@ __metadata: "@udecode/plate-common": "workspace:^" lodash: "npm:^4.17.21" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7191,7 +7191,7 @@ __metadata: "@udecode/plate-common": "workspace:^" lodash: "npm:^4.17.21" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7209,7 +7209,7 @@ __metadata: "@udecode/plate-common": "workspace:^" peerDependencies: "@playwright/test": ">=1.42.1" - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7226,7 +7226,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7243,7 +7243,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7260,7 +7260,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7278,7 +7278,7 @@ __metadata: "@udecode/plate-common": "workspace:^" copy-to-clipboard: "npm:^3.3.3" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7296,7 +7296,7 @@ __metadata: "@udecode/plate-combobox": "npm:40.0.0" "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7315,7 +7315,7 @@ __metadata: "@udecode/plate-diff": "npm:40.0.0" lodash: "npm:^4.17.21" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7333,7 +7333,7 @@ __metadata: "@udecode/plate-common": "workspace:^" tabbable: "npm:^6.2.0" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7352,7 +7352,7 @@ __metadata: "@udecode/plate-resizable": "npm:40.0.0" lodash: "npm:^4.17.21" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7368,7 +7368,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7397,7 +7397,7 @@ __metadata: "@udecode/plate-node-id": "npm:40.0.0" lodash: "npm:^4.17.21" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7414,7 +7414,7 @@ __metadata: dependencies: "@udecode/plate-common": "workspace:^" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7425,15 +7425,15 @@ __metadata: languageName: unknown linkType: soft -"@udecode/plate-utils@npm:40.2.7, @udecode/plate-utils@workspace:^, @udecode/plate-utils@workspace:packages/plate-utils": +"@udecode/plate-utils@npm:40.0.3, @udecode/plate-utils@workspace:^, @udecode/plate-utils@workspace:packages/plate-utils": version: 0.0.0-use.local resolution: "@udecode/plate-utils@workspace:packages/plate-utils" dependencies: - "@udecode/plate-core": "npm:40.2.7" + "@udecode/plate-core": "npm:40.0.3" "@udecode/react-utils": "npm:39.0.0" "@udecode/slate": "npm:39.2.1" "@udecode/slate-react": "npm:40.0.0" - "@udecode/slate-utils": "npm:40.2.7" + "@udecode/slate-utils": "npm:39.2.20" "@udecode/utils": "npm:37.0.0" clsx: "npm:^2.1.1" lodash: "npm:^4.17.21" @@ -7456,7 +7456,7 @@ __metadata: "@udecode/plate-common": "workspace:^" yjs: "npm:^13.6.19" peerDependencies: - "@udecode/plate-common": ">=40.2.7" + "@udecode/plate-common": ">=40.0.3" react: ">=16.8.0" react-dom: ">=16.8.0" slate: ">=0.103.0" @@ -7480,10 +7480,10 @@ __metadata: "@udecode/plate-code-block": "npm:40.0.0" "@udecode/plate-combobox": "npm:40.0.0" "@udecode/plate-comments": "npm:40.0.0" - "@udecode/plate-common": "npm:40.2.7" + "@udecode/plate-common": "npm:40.0.3" "@udecode/plate-csv": "npm:40.0.0" "@udecode/plate-diff": "npm:40.0.0" - "@udecode/plate-docx": "npm:40.2.7" + "@udecode/plate-docx": "npm:40.2.6" "@udecode/plate-find-replace": "npm:40.0.0" "@udecode/plate-floating": "npm:40.0.0" "@udecode/plate-font": "npm:40.0.0" @@ -7499,7 +7499,7 @@ __metadata: "@udecode/plate-link": "npm:40.0.0" "@udecode/plate-list": "npm:40.0.0" "@udecode/plate-markdown": "npm:40.2.2" - "@udecode/plate-media": "npm:40.2.7" + "@udecode/plate-media": "npm:40.2.4" "@udecode/plate-mention": "npm:40.0.0" "@udecode/plate-node-id": "npm:40.0.0" "@udecode/plate-normalizers": "npm:40.0.0" @@ -7562,7 +7562,7 @@ __metadata: languageName: unknown linkType: soft -"@udecode/slate-utils@npm:40.2.7, @udecode/slate-utils@workspace:^, @udecode/slate-utils@workspace:packages/slate-utils": +"@udecode/slate-utils@npm:39.2.20, @udecode/slate-utils@workspace:^, @udecode/slate-utils@workspace:packages/slate-utils": version: 0.0.0-use.local resolution: "@udecode/slate-utils@workspace:packages/slate-utils" dependencies: From 6c10766a40347137db3e33fb92df69e387b52149 Mon Sep 17 00:00:00 2001 From: Yifei Date: Wed, 27 Nov 2024 18:28:11 +0800 Subject: [PATCH 5/5] style: fix lint --- .../decorateSearchHighlight/search/empty.spec.ts | 2 +- .../decorateSearchHighlight/search/text.spec.ts | 10 +++++----- packages/find-replace/src/lib/decorateFindReplace.ts | 11 ++++++----- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/packages/find-replace/src/lib/__tests__/decorateSearchHighlight/search/empty.spec.ts b/packages/find-replace/src/lib/__tests__/decorateSearchHighlight/search/empty.spec.ts index affcaab872..6c2a2b9c2d 100644 --- a/packages/find-replace/src/lib/__tests__/decorateSearchHighlight/search/empty.spec.ts +++ b/packages/find-replace/src/lib/__tests__/decorateSearchHighlight/search/empty.spec.ts @@ -16,7 +16,7 @@ it('should be', () => { expect( decorateFindReplace({ ...getEditorPlugin(editor, FindReplacePlugin), - entry: [{ type: 'p', children: [{ text: '' }] }, [0]], + entry: [{ children: [{ text: '' }], type: 'p' }, [0]], }) ).toEqual(output); }); diff --git a/packages/find-replace/src/lib/__tests__/decorateSearchHighlight/search/text.spec.ts b/packages/find-replace/src/lib/__tests__/decorateSearchHighlight/search/text.spec.ts index 3eaef23505..98dc2525f0 100644 --- a/packages/find-replace/src/lib/__tests__/decorateSearchHighlight/search/text.spec.ts +++ b/packages/find-replace/src/lib/__tests__/decorateSearchHighlight/search/text.spec.ts @@ -15,7 +15,7 @@ it('should decorate matching text', () => { expect( plugin.decorate?.({ ...getEditorPlugin(editor, plugin), - entry: [{ type: 'p', children: [{ text: 'test' }] }, [0]], + entry: [{ children: [{ text: 'test' }], type: 'p' }, [0]], }) ).toEqual([ { @@ -45,7 +45,7 @@ it('should decorate matching text case-insensitively', () => { expect( plugin.decorate?.({ ...getEditorPlugin(editor, plugin), - entry: [{ type: 'p', children: [{ text: 'test' }] }, [0]], + entry: [{ children: [{ text: 'test' }], type: 'p' }, [0]], }) ).toEqual([ { @@ -76,7 +76,7 @@ it('should decorate matching consecutive text nodes', () => { plugin.decorate?.({ ...getEditorPlugin(editor, plugin), entry: [ - { type: 'p', children: [{ text: 'tes' }, { text: 't', bold: true }] }, + { children: [{ text: 'tes' }, { bold: true, text: 't' }], type: 'p' }, [0], ], }) @@ -122,12 +122,12 @@ it('should decorate matching multiple occurrences', () => { ...getEditorPlugin(editor, plugin), entry: [ { - type: 'p', children: [ { text: 'tes' }, - { text: 'ts and tests and t', bold: true }, + { bold: true, text: 'ts and tests and t' }, { text: 'ests' }, ], + type: 'p', }, [0], ], diff --git a/packages/find-replace/src/lib/decorateFindReplace.ts b/packages/find-replace/src/lib/decorateFindReplace.ts index e780cd3237..2b7a640a2b 100644 --- a/packages/find-replace/src/lib/decorateFindReplace.ts +++ b/packages/find-replace/src/lib/decorateFindReplace.ts @@ -22,12 +22,13 @@ export const decorateFindReplace: Decorate = ({ let start = 0; const matches: number[] = []; + while ((start = str.indexOf(searchLower, start)) !== -1) { matches.push(start); start += searchLower.length; } - if (!matches.length) { + if (matches.length === 0) { return []; } @@ -47,6 +48,7 @@ export const decorateFindReplace: Decorate = ({ // If the match ends before the start of the current text, move to the next match if (matchEnd <= textStart) { matchIndex++; + continue; } @@ -66,18 +68,17 @@ export const decorateFindReplace: Decorate = ({ ranges.push({ anchor: { - path: textNodePath, offset: anchorOffset, + path: textNodePath, }, focus: { - path: textNodePath, offset: focusOffset, + path: textNodePath, }, - search: search.substring(searchOverlapStart, searchOverlapEnd), + search: search.slice(searchOverlapStart, searchOverlapEnd), [type]: true, }); } - // If the match ends within the current text, move to the next match if (matchEnd <= textEnd) { matchIndex++;