diff --git a/src/lib/components/shad-editor/editor-toolbar.svelte b/src/lib/components/shad-editor/editor-toolbar.svelte index bc294e0b..4388aaf2 100644 --- a/src/lib/components/shad-editor/editor-toolbar.svelte +++ b/src/lib/components/shad-editor/editor-toolbar.svelte @@ -20,7 +20,7 @@ import Align from './icons/textalign.svelte'; import Quickcolor from './icons/quickcolor.svelte'; import Table from './icons/table.svelte'; - import Image from './icons/image.svelte'; + // import Image from './icons/image.svelte'; import Text from './icons/text.svelte'; import SearchReplace from './icons/search-replace.svelte'; @@ -35,15 +35,15 @@ let { editor, show_button_kv }: Props = $props(); let show_button_kv_defaults: any = { undo: true, - redo: false, + redo: true, text: true, bold: true, italic: true, underline: true, - strikethrough: true, - align: true, + strikethrough: false, + align: false, link: true, code: false, blockquote: false, @@ -57,7 +57,7 @@ let show_button_kv_defaults: any = { text_color: true, highlighter: true, quick_color: true, - search_replace: true, + search_replace: false, }; if (show_button_kv) { show_button_kv = {...show_button_kv_defaults, ...show_button_kv}; @@ -116,9 +116,9 @@ if (show_button_kv) { {#if show_button_kv.task_list} {/if} - {#if show_button_kv.image} + {#if show_button_kv.table} {/if} diff --git a/src/lib/components/shad-editor/shad-editor.svelte b/src/lib/components/shad-editor/shad-editor.svelte index ba8ee0ee..d3774ad8 100644 --- a/src/lib/components/shad-editor/shad-editor.svelte +++ b/src/lib/components/shad-editor/shad-editor.svelte @@ -44,6 +44,7 @@ showToolbar?: boolean; // html_text?: string; new_html?: string; + placeholder?: string; } let { class: @@ -52,6 +53,7 @@ showToolbar = true, // html_text = '', new_html = $bindable(''), + placeholder = $bindable('Start typing...') }: Props = $props(); let editor = $state(); @@ -141,11 +143,12 @@ editor = transaction.editor; console.log(editor.isActive('bold')); content = editor.getHTML(); - console.log(content); - if (content == '

') { + // console.log(content); + let html = editor.getHTML(); + if (html == '

') { new_html = ''; } else { - new_html = content ?? ''; + new_html = html ?? ''; } } }); @@ -160,5 +163,14 @@ {#if editor && showToolbar} {/if} -
+
+ +
diff --git a/src/lib/element_tiptap_editor.svelte b/src/lib/element_tiptap_editor.svelte index 56265959..4bf22dbd 100644 --- a/src/lib/element_tiptap_editor.svelte +++ b/src/lib/element_tiptap_editor.svelte @@ -286,7 +286,7 @@ let mouse_leave_wait: number = 2000; // show_menu = true; // } }} - class="editor textarea p-1 transition-all duration-1000" + class="xxxeditor textarea p-1 transition-all duration-1000" class:hidden={true} > @@ -308,304 +308,7 @@ let mouse_leave_wait: number = 2000; items-center justify-between " > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + {/if} @@ -630,6 +333,7 @@ let mouse_leave_wait: number = 2000; class="editor textarea p-1 transition-all duration-1000" bind:content={html_text} bind:new_html={new_html} + placeholder={placeholder} />