diff --git a/demos/playground/src/RichTextComposer.svelte b/demos/playground/src/RichTextComposer.svelte index 3fe325e..49b331f 100644 --- a/demos/playground/src/RichTextComposer.svelte +++ b/demos/playground/src/RichTextComposer.svelte @@ -10,7 +10,7 @@ CheckListPlugin, HorizontalRulePlugin, ImagePlugin, - //TreeViewPlugin, + TreeViewPlugin, } from 'svelte-lexical'; import { HeadingNode, @@ -56,6 +56,6 @@ - + diff --git a/packages/svelte-lexical/package.json b/packages/svelte-lexical/package.json index e56fcf0..152a536 100644 --- a/packages/svelte-lexical/package.json +++ b/packages/svelte-lexical/package.json @@ -65,6 +65,7 @@ "@lexical/history": "^0.7.6", "@lexical/link": "^0.7.6", "@lexical/list": "^0.7.6", + "@lexical/mark": "^0.7.6", "@lexical/overflow": "^0.7.6", "@lexical/plain-text": "^0.7.6", "@lexical/rich-text": "^0.7.6", diff --git a/packages/svelte-lexical/src/core/plugins/TreeView.svelte b/packages/svelte-lexical/src/core/plugins/TreeView.svelte new file mode 100644 index 0000000..1dfebba --- /dev/null +++ b/packages/svelte-lexical/src/core/plugins/TreeView.svelte @@ -0,0 +1,632 @@ + + +
+ {#if !showLimited && isLimited} +
+ + Detected large EditorState, this can impact debugging performance. + + +
+ {/if} + {#if !timeTravelEnabled && (showLimited || !isLimited) && totalEditorStates > 2} + + {/if} + {#if showLimited || !isLimited} +
{content}
+ {/if} + {#if timeTravelEnabled && (showLimited || !isLimited)} +
+ + { + const editorStateIndex = Number(event.target.value); + const timeStampedEditorState = + timeStampedEditorStates[editorStateIndex]; + + if (timeStampedEditorState) { + playingIndexRef = editorStateIndex; + editor.setEditorState(timeStampedEditorState[1]); + } + }} + type="range" + min="1" + max={totalEditorStates - 1} /> + +
+ {/if} +
diff --git a/packages/svelte-lexical/src/core/plugins/TreeViewPlugin.svelte b/packages/svelte-lexical/src/core/plugins/TreeViewPlugin.svelte new file mode 100644 index 0000000..fcb253f --- /dev/null +++ b/packages/svelte-lexical/src/core/plugins/TreeViewPlugin.svelte @@ -0,0 +1,10 @@ + + + diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5b29d23..720faaa 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -176,6 +176,7 @@ importers: '@lexical/history': ^0.7.6 '@lexical/link': ^0.7.6 '@lexical/list': ^0.7.6 + '@lexical/mark': ^0.7.6 '@lexical/overflow': ^0.7.6 '@lexical/plain-text': ^0.7.6 '@lexical/rich-text': ^0.7.6 @@ -215,6 +216,7 @@ importers: '@lexical/history': 0.7.6_lexical@0.7.6 '@lexical/link': 0.7.6_lexical@0.7.6 '@lexical/list': 0.7.6_lexical@0.7.6 + '@lexical/mark': 0.7.6_lexical@0.7.6 '@lexical/overflow': 0.7.6_lexical@0.7.6 '@lexical/plain-text': 0.7.6_eioik75cyzoruwd4hvum3yfzge '@lexical/rich-text': 0.7.6_eioik75cyzoruwd4hvum3yfzge @@ -2070,6 +2072,15 @@ packages: lexical: 0.7.6 dev: false + /@lexical/mark/0.7.6_lexical@0.7.6: + resolution: {integrity: sha512-eADaPXoCeiNa0Tr0Ep92V2Ns5uU3W5DgllFPboWG3hn0C0y63MxswDFvV6eYSRHlBETqpo6Bf05xlOgIPH3h7Q==} + peerDependencies: + lexical: 0.7.6 + dependencies: + '@lexical/utils': 0.7.6_lexical@0.7.6 + lexical: 0.7.6 + dev: false + /@lexical/overflow/0.7.6_lexical@0.7.6: resolution: {integrity: sha512-3sdZRhP/tWUilWylfDE3iLUzHNLfVscKwj0sxLv8v9Hm1uHn84ixIX/15djR7pcT2eUaygLiP2Yb3ia+elVIeQ==} peerDependencies: