From 79a2e1542bbb3592feb31434e34182f621bfb98e Mon Sep 17 00:00:00 2001 From: Gerard Rovira Date: Thu, 14 Nov 2024 15:21:29 +0000 Subject: [PATCH] Link flow types (#6833) --- packages/lexical-link/flow/LexicalLink.js.flow | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/lexical-link/flow/LexicalLink.js.flow b/packages/lexical-link/flow/LexicalLink.js.flow index 6c9a441f7ad..cab496485ac 100644 --- a/packages/lexical-link/flow/LexicalLink.js.flow +++ b/packages/lexical-link/flow/LexicalLink.js.flow @@ -13,13 +13,22 @@ import type { NodeKey, RangeSelection, LexicalCommand, + SerializedElementNode, } from 'lexical'; import {addClassNamesToElement} from '@lexical/utils'; import {$isElementNode, ElementNode} from 'lexical'; -export type LinkAttributes = { +export type LinkAttributes = $ReadOnly<{ rel?: null | string, target?: null | string, title?: null | string, +}>; +export type SerializedLinkNode = { + ...SerializedElementNode, + rel?: null | string, + target?: null | string, + title?: null | string, + url: string, + ... }; declare export class LinkNode extends ElementNode { __url: string; @@ -36,6 +45,7 @@ declare export class LinkNode extends ElementNode { config: EditorConfig, ): boolean; static importDOM(): DOMConversionMap | null; + exportJSON(): SerializedLinkNode; getURL(): string; setURL(url: string): void; getTarget(): null | string; @@ -60,6 +70,11 @@ declare export function $createLinkNode( declare export function $isLinkNode( node: ?LexicalNode, ): node is LinkNode; +export type SerializedAutoLinkNode = { + ...SerializedLinkNode, + isUnlinked: boolean, + ... +}; declare export class AutoLinkNode extends LinkNode { static getType(): string; // $FlowFixMe clone method inheritance