diff --git a/packages/lexical-markdown/flow/LexicalMarkdown.js.flow b/packages/lexical-markdown/flow/LexicalMarkdown.js.flow index 7318dda1171..7f2f34483dc 100644 --- a/packages/lexical-markdown/flow/LexicalMarkdown.js.flow +++ b/packages/lexical-markdown/flow/LexicalMarkdown.js.flow @@ -17,6 +17,7 @@ import type { export type Transformer = | ElementTransformer + | MultilineElementTransformer | TextFormatTransformer | TextMatchTransformer; @@ -32,10 +33,34 @@ export type ElementTransformer = { children: Array, match: Array, isImport: boolean, - ) => void, + ) => boolean | void, type: 'element', }; +export type MultilineElementTransformer = { + dependencies: Array>; + export?: ( + node: LexicalNode, + traverseChildren: (node: ElementNode) => string, + ) => string | null; + regExpStart: RegExp; + regExpEnd?: + | RegExp + | { + optional?: true; + regExp: RegExp; + }; + replace: ( + rootNode: ElementNode, + children: Array | null, + startMatch: Array, + endMatch: Array | null, + linesInBetween: Array | null, + isImport: boolean, + ) => boolean | void; + type: 'multilineElement'; +}; + export type TextFormatTransformer = $ReadOnly<{ format: $ReadOnlyArray, tag: string, @@ -90,7 +115,7 @@ declare export var ITALIC_UNDERSCORE: TextFormatTransformer; declare export var STRIKETHROUGH: TextFormatTransformer; declare export var UNORDERED_LIST: ElementTransformer; -declare export var CODE: ElementTransformer; +declare export var CODE: MultilineElementTransformer; declare export var HEADING: ElementTransformer; declare export var ORDERED_LIST: ElementTransformer; declare export var QUOTE: ElementTransformer;