1818 AtlasObjectNode ,
1919 PlayerObjectNode ,
2020 } from " $lib/tiptap/extensions/index" ;
21+
2122 // Components
2223 import Modal from " $lib/components/Modal.svelte" ;
2324 import MiniEditor from " $lib/components/text/MiniEditor.svelte" ;
2425 import MiniRenderer from " $lib/components/text/MiniRenderer.svelte" ;
2526 import ColorPicker from " svelte-awesome-color-picker" ;
27+ import TextStyleButtons from " $lib/components/text/TextStyleButtons.svelte" ;
28+ import ToolbarButton from " $lib/components/text/ToolbarButton.svelte" ;
29+ import ContextMenu from " $lib/components/text/ContextMenu.svelte" ;
2630
31+ // Important functions things
2732 import { convertToTextOrEmpty , snbtToDocument } from " $lib/text/nbt" ;
2833 import { Editor , type JSONContent } from " @tiptap/core" ;
2934 import Color from " @tiptap/extension-color" ;
3035 import Placeholder from " @tiptap/extension-placeholder" ;
3136 import StarterKit from " @tiptap/starter-kit" ;
3237 import { onDestroy , onMount } from " svelte" ;
38+
3339 // Icons
3440 import IconUndo from " ~icons/tabler/arrow-back-up" ;
3541 import IconRedo from " ~icons/tabler/arrow-forward-up" ;
4854 import IconSquare from " ~icons/tabler/square-filled" ;
4955 import IconHollow from " ~icons/tabler/square-x" ;
5056
57+ // Random variables
5158 import { page } from " $app/state" ;
52-
53- import TextStyleButtons from " $lib/components/text/TextStyleButtons.svelte" ;
5459 import { colorMap } from " $lib/text/general" ;
55-
56- import ToolbarButton from " $lib/components/text/ToolbarButton.svelte" ;
5760 import { openDataStore } from " $lib/db" ;
5861 import { fontLUT } from " $lib/tiptap/extensions/fonts" ;
5962 import { tooltip } from " $lib/tooltip" ;
7376 let doesContentExist: boolean = $state (false );
7477 let shouldOptimise = $state (true );
7578
79+ let editorCtxMenu: ContextMenu | undefined = $state ()! ;
80+
7681 // Import
7782 let importDialog: Modal = $state ()! ;
7883 let importText: string = $state (" " );
541546 </div >
542547
543548 <div
549+ role =" none"
544550 class =" font-minecraft w-full grow overflow-auto bg-zinc-800 first:focus:outline-none"
545551 spellcheck =" false"
552+ oncontextmenu ={editorCtxMenu ! .onOpen }
546553 bind:this ={element }>
547554 </div >
548555
567574 recentlyCopied = true ;
568575 setTimeout (() => (recentlyCopied = false ), 2000 );
569576 }}
570- aria-label =" Copy" >
577+ aria-label =" Copy output " >
571578 {#if recentlyCopied }
572579 <IconTick />
573580 {:else }
825832 <modal .default editor ={editor ! } bind:unicodeSelectorDialog />
826833 {/await }
827834</div >
835+
836+ <ContextMenu bind:this ={editorCtxMenu } />
0 commit comments