File tree Expand file tree Collapse file tree 2 files changed +71
-2
lines changed
Expand file tree Collapse file tree 2 files changed +71
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @dolphin/lark ' : minor
3+ ' @dolphin/chrome-extension ' : patch
4+ ---
5+
6+ Add support for Text drawing (Mermaid diagrams)
Original file line number Diff line number Diff line change @@ -313,13 +313,60 @@ interface File extends Block {
313313 }
314314}
315315
316+ enum ISVBlockTypeId {
317+ /**
318+ * Text Drawing
319+ */
320+ TextDrawing = 'blk_631fefbbae02400430b8f9f4' ,
321+ /**
322+ * Other ISV block (type inference)
323+ */
324+ _Other = '' ,
325+ }
326+
327+ interface OtherISVBlock extends Block {
328+ type : BlockType . ISV
329+ snapshot : {
330+ type : BlockType . ISV
331+ /**
332+ * ISV block type id
333+ */
334+ block_type_id : ISVBlockTypeId . _Other
335+ /**
336+ * ISV block data
337+ */
338+ data : unknown
339+ }
340+ }
341+
342+ interface TextDrawingBlock extends Block {
343+ type : BlockType . ISV
344+ snapshot : {
345+ type : BlockType . ISV
346+ /**
347+ * ISV block type id
348+ */
349+ block_type_id : ISVBlockTypeId . TextDrawing
350+ /**
351+ * ISV block data
352+ */
353+ data : {
354+ /**
355+ * Mermaid code
356+ */
357+ data : string
358+ }
359+ }
360+ }
361+
362+ type ISVBlocks = TextDrawingBlock | OtherISVBlock
363+
316364interface NotSupportedBlock extends Block {
317365 type :
318366 | BlockType . QUOTE
319367 | BlockType . BITABLE
320368 | BlockType . CHAT_CARD
321369 | BlockType . DIAGRAM
322- | BlockType . ISV
323370 | BlockType . MINDNOTE
324371 | BlockType . SHEET
325372 | BlockType . FALLBACK
@@ -347,6 +394,7 @@ type Blocks =
347394 | View
348395 | File
349396 | IframeBlock
397+ | ISVBlocks
350398 | NotSupportedBlock
351399
352400interface IframeBlock extends Block {
@@ -749,7 +797,9 @@ type Mutate<T extends Block> = T extends PageBlock
749797 ? mdast . Link
750798 : T extends IframeBlock
751799 ? mdast . Html
752- : null
800+ : T extends TextDrawingBlock
801+ ? mdast . Code
802+ : null
753803
754804interface TransformerOptions {
755805 /**
@@ -1116,6 +1166,19 @@ export class Transformer {
11161166 case BlockType . IFRAME : {
11171167 return iframeToHTML ( block )
11181168 }
1169+ case BlockType . ISV : {
1170+ if ( block . snapshot . block_type_id === ISVBlockTypeId . TextDrawing ) {
1171+ const code : mdast . Code = {
1172+ type : 'code' ,
1173+ lang : 'mermaid' ,
1174+ value : block . snapshot . data . data ,
1175+ }
1176+
1177+ return code
1178+ }
1179+
1180+ return null
1181+ }
11191182 default :
11201183 return null
11211184 }
You can’t perform that action at this time.
0 commit comments