Fix doc panel images (#10673)

Transformers from our custom plugins were ignored because of misconfiguration of lexical markdown plugin.

Part of #10435


https://github.com/user-attachments/assets/48b22546-9893-42f8-9a3b-5ed6070c4eaf
This commit is contained in:
Ilya Bogdanov 2024-07-25 18:31:33 +03:00 committed by GitHub
parent 8a3180eb89
commit 5366dd384f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 19 deletions

View File

@ -30,6 +30,8 @@ const title = computed(() =>
: '', : '',
) )
const alt = props.alt ? props.alt : DEFAULT_ALT_TEXT
onUnmounted(() => { onUnmounted(() => {
if (data.value?.ok) data.value.value.dispose?.() if (data.value?.ok) data.value.value.dispose?.()
}) })

View File

@ -28,10 +28,11 @@ export function markdownPlugin(
if (extension?.transformers) transformers.push(...extension.transformers) if (extension?.transformers) transformers.push(...extension.transformers)
} }
transformers.push(...TRANSFORMERS) transformers.push(...TRANSFORMERS)
return [...extensions, baseMarkdownPlugin, markdownSyncPlugin(model, transformers)] return [...extensions, baseMarkdownPlugin(transformers), markdownSyncPlugin(model, transformers)]
} }
const baseMarkdownPlugin: LexicalPlugin = { function baseMarkdownPlugin(transformers: Transformer[]): LexicalPlugin {
return {
nodes: [ nodes: [
HeadingNode, HeadingNode,
QuoteNode, QuoteNode,
@ -47,8 +48,9 @@ const baseMarkdownPlugin: LexicalPlugin = {
], ],
register: (editor) => { register: (editor) => {
registerRichText(editor) registerRichText(editor)
registerMarkdownShortcuts(editor, TRANSFORMERS) registerMarkdownShortcuts(editor, transformers)
}, },
}
} }
const markdownSyncPlugin = (model: Ref<string>, transformers: Transformer[]): LexicalPlugin => ({ const markdownSyncPlugin = (model: Ref<string>, transformers: Transformer[]): LexicalPlugin => ({