Create new EditorContent component

This commit is contained in:
Jon Staab
2025-02-03 20:57:47 -08:00
parent 7d4ba6c806
commit fedc99b0f0
7 changed files with 59 additions and 39 deletions
+5 -5
View File
@@ -1,11 +1,11 @@
<script lang="ts">
import {writable} from "svelte/store"
import {EditorContent} from "svelte-tiptap"
import {isMobile, preventDefault} from "@lib/html"
import {fly, slideAndFade} from "@lib/transition"
import Icon from "@lib/components/Icon.svelte"
import Button from "@lib/components/Button.svelte"
import ModalFooter from "@lib/components/ModalFooter.svelte"
import EditorContent from "@lib/components/EditorContent.svelte"
import {publishComment} from "@app/commands"
import {tagRoom, GENERAL, PROTECTED} from "@app/state"
import {makeEditor} from "@app/editor"
@@ -18,8 +18,8 @@
const submit = () => {
if ($uploading) return
const content = $editor.getText({blockSeparator: "\n"}).trim()
const tags = [...$editor.storage.nostr.getEditorTags(), tagRoom(GENERAL, url), PROTECTED]
const content = editor.getText({blockSeparator: "\n"}).trim()
const tags = [...editor.storage.nostr.getEditorTags(), tagRoom(GENERAL, url), PROTECTED]
if (!content) {
return pushToast({
@@ -41,12 +41,12 @@
class="card2 sticky bottom-2 z-feature mx-2 mt-4 bg-neutral">
<div class="relative">
<div class="note-editor flex-grow overflow-hidden">
<EditorContent editor={$editor} />
<EditorContent {editor} />
</div>
<Button
data-tip="Add an image"
class="tooltip tooltip-left absolute bottom-1 right-2"
onclick={$editor.commands.selectFiles}>
onclick={editor.commands.selectFiles}>
{#if $uploading}
<span class="loading loading-spinner loading-xs"></span>
{:else}