diff --git a/src/uix/eidos/components/words/words-drawer.svelte b/src/uix/eidos/components/words/words-drawer.svelte index 5ec6b8321..83323be44 100644 --- a/src/uix/eidos/components/words/words-drawer.svelte +++ b/src/uix/eidos/components/words/words-drawer.svelte @@ -174,6 +174,32 @@ function toggleOpen() { open = !open; } + + /** + * Return the image block currently containing the caret, or + * undefined if the caret is not on an image. The image panel uses + * this to display block attributes (src/alt/caption/status). + */ + function imageBlockAtCaret( + s: ProviderSnippetProps + ): { readonly src: string; readonly alt?: string; readonly caption?: string; readonly status?: 'pending' | 'error' } | undefined { + const blockIndex = s.selection?.anchor.path[0]; + if (blockIndex === undefined) return undefined; + const block = s.document.children[blockIndex]; + if (!block || block.type !== 'image') return undefined; + return block; + } + + const CODE_LANGUAGES = [ + { id: '', label: 'Plain' }, + { id: 'ts', label: 'TS' }, + { id: 'js', label: 'JS' }, + { id: 'css', label: 'CSS' }, + { id: 'html', label: 'HTML' }, + { id: 'json', label: 'JSON' }, + { id: 'bash', label: 'Bash' }, + { id: 'python', label: 'Py' } + ] as const;