From 9e70dc825e743a65bddc05ca67c25ab5b8e034ff Mon Sep 17 00:00:00 2001 From: umaranis Date: Mon, 16 Jan 2023 23:03:18 +1100 Subject: [PATCH] refactor: more control to user library user in composing the editor with plugins and controls --- demos/plaintext-editor/src/App.svelte | 21 ++--- .../src/PlainTextComposer.svelte | 34 ++++++++ demos/playground/src/App.svelte | 5 +- demos/playground/src/RichTextComposer.svelte | 61 +++++++++++++++ demos/richtext-editor-basic/src/App.svelte | 10 +-- .../src/RichTextBasicComposer.svelte | 39 ++++++++++ demos/richtext-editor/src/App.svelte | 10 +-- .../src/RichTextComposer.svelte | 59 ++++++++++++++ demos/sveltekit/src/RichTextComposer.svelte | 59 ++++++++++++++ demos/sveltekit/src/routes/+page.js | 2 + demos/sveltekit/src/routes/+page.svelte | 13 ++-- .../sveltekit/src/themes/StickyEditorTheme.js | 4 +- .../RichTextBasicComposer.svelte | 12 --- .../richtext-basic/RichTextBasicEditor.svelte | 25 ------ .../richtext/RichTextComposer.svelte | 12 --- .../components/richtext/RichTextEditor.svelte | 44 ----------- .../svelte-lexical/src/core/Composer.svelte | 13 ++++ .../src/core/ContentEditable.svelte | 78 +++++++++++++++++++ .../svelte-lexical/src/core/TextEditor.svelte | 58 -------------- packages/svelte-lexical/src/index.ts | 19 +++-- 20 files changed, 384 insertions(+), 194 deletions(-) create mode 100644 demos/plaintext-editor/src/PlainTextComposer.svelte create mode 100644 demos/playground/src/RichTextComposer.svelte create mode 100644 demos/richtext-editor-basic/src/RichTextBasicComposer.svelte create mode 100644 demos/richtext-editor/src/RichTextComposer.svelte create mode 100644 demos/sveltekit/src/RichTextComposer.svelte create mode 100644 demos/sveltekit/src/routes/+page.js delete mode 100644 packages/svelte-lexical/src/components/richtext-basic/RichTextBasicComposer.svelte delete mode 100644 packages/svelte-lexical/src/components/richtext-basic/RichTextBasicEditor.svelte delete mode 100644 packages/svelte-lexical/src/components/richtext/RichTextComposer.svelte delete mode 100644 packages/svelte-lexical/src/components/richtext/RichTextEditor.svelte create mode 100644 packages/svelte-lexical/src/core/Composer.svelte create mode 100644 packages/svelte-lexical/src/core/ContentEditable.svelte delete mode 100644 packages/svelte-lexical/src/core/TextEditor.svelte diff --git a/demos/plaintext-editor/src/App.svelte b/demos/plaintext-editor/src/App.svelte index e26be28..ac5d479 100644 --- a/demos/plaintext-editor/src/App.svelte +++ b/demos/plaintext-editor/src/App.svelte @@ -1,28 +1,17 @@

Svelte Lexical!

This Plain Text Editor is build with svelte-lexical + href="https://github.com/umaranis/svelte-lexical/"> + svelte-lexical +

- - - - +
diff --git a/packages/svelte-lexical/src/core/TextEditor.svelte b/packages/svelte-lexical/src/core/TextEditor.svelte deleted file mode 100644 index 86f77c2..0000000 --- a/packages/svelte-lexical/src/core/TextEditor.svelte +++ /dev/null @@ -1,58 +0,0 @@ - - -
- -
-
-
-
-
-
- - - -
-
- - diff --git a/packages/svelte-lexical/src/index.ts b/packages/svelte-lexical/src/index.ts index 9223efc..9ba59e5 100644 --- a/packages/svelte-lexical/src/index.ts +++ b/packages/svelte-lexical/src/index.ts @@ -1,15 +1,22 @@ -export {default as TextEditor} from './core/TextEditor.svelte'; export {default as PlainTextPlugin} from './core/plugins/PlainTextPlugin.svelte'; export {default as RichTextPlugin} from './core/plugins/RichTextPlugin.svelte'; export {default as HistoryPlugin} from './core/plugins/HistoryPlugin.svelte'; export {default as ListPlugin} from './core/plugins/ListPlugin.svelte'; +export {default as CheckListPlugin} from './core/plugins/CheckListPlugin.svelte'; +export {default as HorizontalRulePlugin} from './core/plugins/HorizontalRulePlugin.svelte'; +export {default as ImagePlugin} from './core/plugins/ImagePlugin.svelte'; -export {default as RichTextEditor} from './components/richtext/RichTextEditor.svelte'; -export {default as RichTextComposer} from './components/richtext/RichTextComposer.svelte'; - -export {default as RichTextBasicEditor} from './components/richtext-basic/RichTextBasicEditor.svelte'; -export {default as RichTextBasicComposer} from './components/richtext-basic/RichTextBasicComposer.svelte'; +export {HeadingNode, QuoteNode} from '@lexical/rich-text'; +export {ListNode, ListItemNode} from '@lexical/list'; +export {HorizontalRuleNode} from './core/plugins/HorizontalRuleNode'; +export {ImageNode} from './core/plugins/ImageNode'; export {default as ToolbarBasic} from './components/richtext-basic/ToolbarBasic.svelte'; +export {default as ToolbarRichText} from './components/richtext/ToolbarRichText.svelte'; +export {default as ActionBar} from './components/actionbar/ActionBar.svelte'; +export {default as TreeViewPlugin} from './core/plugins/TreeViewPlugin.svelte'; + +export {default as ContentEditable} from './core/ContentEditable.svelte'; +export {default as Composer} from './core/Composer.svelte'; export {type EditorThemeClasses} from 'lexical';