feat: add draw.io block

This commit is contained in:
NGPixel committed 2026-09-05 20:43:45 -04:00
1 parent a857f96bb0
commit 7cf47610d1
9 files changed
+900 -12

No files matched your search

+5
View File
@@ -42,6 +42,11 @@ export async function registerSchemas(app: FastifyInstance): Promise<void> {
description:
'Body the editor writes between the opening and closing lines when inserting the block, for a block whose content is other blocks. Empty for a block that takes none.'
},
contentEditor: {
type: 'string',
description:
"Names an editor for the block's body, which the markdown editor offers as an \"Edit Content\" lens above the block alongside \"Edit Block Parameters\". A key the frontend resolves to a component, for a block whose body is a fenced source the props form cannot describe. Empty for a block that names none, which is most of them."
},
props: {
type: 'array',
description:
+6
View File
@@ -1673,6 +1673,11 @@
"editor.assets.uploadFailed": "File upload failed.",
"editor.backToEditor": "Back to Editor",
"editor.blockNotEnabled": "This block is not enabled for this site, and will be removed when the page is saved. Blocks are managed in the administration area.",
"editor.blockContent.drawioLoading": "Loading the draw.io editor...",
"editor.blockContent.drawioTitle": "Draw.io editor",
"editor.blockContent.drawioUnreachable": "The draw.io editor could not be loaded. Check that this address is reachable from your browser.",
"editor.blockContent.title": "Edit Block Content",
"editor.blockContent.unknownEditor": "This block asks to be edited with something this wiki does not have.",
"editor.blockParams.title": "Edit Block Parameters - {name}",
"editor.blockPicker.blockUnavailable": "This block is not available on this site. Blocks are managed in the administration area.",
"editor.blockPicker.insert": "Insert Block",
@@ -1758,6 +1763,7 @@
"editor.markup.definitionListTerm": "Term",
"editor.markup.distractionFreeMode": "Distraction Free Mode",
"editor.markup.editBlock": "Edit Block Parameters",
"editor.markup.editBlockContent": "Edit Content",
"editor.markup.editTable": "Edit in Table Editor",
"editor.markup.header": "Header",
"editor.markup.headerLevel": "Header {level}",
+16 -1
View File
@@ -31,6 +31,18 @@ export interface BlockDefinition {
isChild?: boolean
/** Body the editor writes between the opening and closing lines when inserting the block. */
template?: string
/**
* Names an editor for the block's BODY, which the markdown editor then offers as a second lens
* above the block — "Edit Content", beside "Edit Block Parameters".
*
* For a block whose body is a fenced source the props form has nothing to say about: a diagram, a
* drawing. The value is a key the frontend resolves to a component, not a component or a URL, so
* that what a block declares stays a plain literal the manifest can be read out of.
*
* Absent for every other block, and absent is the answer: a body nobody named an editor for is
* edited in the page like any other content.
*/
contentEditor?: string
}
/** A block row as exposed by the API, with what its component says it can be given. */
@@ -45,6 +57,8 @@ export interface SiteBlock {
config: Record<string, any>
props: BlockProp[]
template: string
/** Empty for a block that names no body editor, which is most of them. */
contentEditor: string
}
const blockSelection = {
@@ -278,7 +292,8 @@ class Blocks {
return {
...row,
props: definition?.props ?? [],
template: definition?.template ?? ''
template: definition?.template ?? '',
contentEditor: definition?.contentEditor ?? ''
}
})
}