@lexical/link 0.6.1-next.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,6 +16,10 @@ import type {
16
16
  } from 'lexical';
17
17
  import {addClassNamesToElement} from '@lexical/utils';
18
18
  import {$isElementNode, ElementNode} from 'lexical';
19
+ export type LinkAttributes = {
20
+ rel?: null | string,
21
+ target?: null | string,
22
+ };
19
23
  declare export class LinkNode extends ElementNode {
20
24
  __url: string;
21
25
  __target: null | string;
@@ -51,10 +55,7 @@ declare export class LinkNode extends ElementNode {
51
55
  }
52
56
  declare export function $createLinkNode(
53
57
  url: string,
54
- attributes?: {
55
- rel?: null | string,
56
- target?: null | string,
57
- },
58
+ attributes?: LinkAttributes,
58
59
  ): LinkNode;
59
60
  declare export function $isLinkNode(
60
61
  node: ?LexicalNode,
@@ -65,22 +66,18 @@ declare export class AutoLinkNode extends LinkNode {
65
66
  static clone(node: AutoLinkNode): AutoLinkNode;
66
67
  insertNewAfter(selection: RangeSelection): null | ElementNode;
67
68
  }
68
- declare export function $createAutoLinkNode(url: string): AutoLinkNode;
69
+ declare export function $createAutoLinkNode(
70
+ url: string,
71
+ attributes?: LinkAttributes,
72
+ ): AutoLinkNode;
69
73
  declare export function $isAutoLinkNode(
70
74
  node: ?LexicalNode,
71
75
  ): boolean %checks(node instanceof AutoLinkNode);
72
76
 
73
77
  declare export var TOGGLE_LINK_COMMAND: LexicalCommand<
74
- | string
75
- | {
76
- url: string,
77
- target?: null | string,
78
- rel?: null | string,
79
- }
80
- | null,
78
+ string | {url: string, ...LinkAttributes} | null,
81
79
  >;
82
80
  declare export function toggleLink(
83
81
  url: null | string,
84
- target?: null | string,
85
- rel?: null | string,
82
+ attributes: {target?: null | string, rel?: null | string},
86
83
  ): void;
package/index.d.ts CHANGED
@@ -8,13 +8,15 @@
8
8
  */
9
9
  import type { DOMConversionMap, EditorConfig, GridSelection, LexicalCommand, LexicalNode, NodeKey, NodeSelection, RangeSelection, SerializedElementNode } from 'lexical';
10
10
  import { ElementNode, Spread } from 'lexical';
11
+ export declare type LinkAttributes = {
12
+ rel?: null | string;
13
+ target?: null | string;
14
+ };
11
15
  export declare type SerializedLinkNode = Spread<{
12
16
  type: 'link';
13
17
  url: string;
14
- target?: null | string;
15
- rel?: null | string;
16
18
  version: 1;
17
- }, SerializedElementNode>;
19
+ }, Spread<LinkAttributes, SerializedElementNode>>;
18
20
  /** @noInheritDoc */
19
21
  export declare class LinkNode extends ElementNode {
20
22
  /** @internal */
@@ -25,10 +27,7 @@ export declare class LinkNode extends ElementNode {
25
27
  __rel: null | string;
26
28
  static getType(): string;
27
29
  static clone(node: LinkNode): LinkNode;
28
- constructor(url: string, attributes?: {
29
- target?: null | string;
30
- rel?: null | string;
31
- }, key?: NodeKey);
30
+ constructor(url: string, attributes?: LinkAttributes, key?: NodeKey);
32
31
  createDOM(config: EditorConfig): HTMLAnchorElement;
33
32
  updateDOM(prevNode: LinkNode, anchor: HTMLAnchorElement, config: EditorConfig): boolean;
34
33
  static importDOM(): DOMConversionMap | null;
@@ -47,10 +46,7 @@ export declare class LinkNode extends ElementNode {
47
46
  isInline(): true;
48
47
  extractWithChild(child: LexicalNode, selection: RangeSelection | NodeSelection | GridSelection, destination: 'clone' | 'html'): boolean;
49
48
  }
50
- export declare function $createLinkNode(url: string, attributes?: {
51
- target?: null | string;
52
- rel?: null | string;
53
- }): LinkNode;
49
+ export declare function $createLinkNode(url: string, attributes?: LinkAttributes): LinkNode;
54
50
  export declare function $isLinkNode(node: LexicalNode | null | undefined): node is LinkNode;
55
51
  export declare type SerializedAutoLinkNode = Spread<{
56
52
  type: 'autolink';
@@ -64,17 +60,9 @@ export declare class AutoLinkNode extends LinkNode {
64
60
  exportJSON(): SerializedAutoLinkNode;
65
61
  insertNewAfter(selection: RangeSelection): null | ElementNode;
66
62
  }
67
- export declare function $createAutoLinkNode(url: string, attributes?: {
68
- target?: null | string;
69
- rel?: null | string;
70
- }): AutoLinkNode;
63
+ export declare function $createAutoLinkNode(url: string, attributes?: LinkAttributes): AutoLinkNode;
71
64
  export declare function $isAutoLinkNode(node: LexicalNode | null | undefined): node is AutoLinkNode;
72
- export declare const TOGGLE_LINK_COMMAND: LexicalCommand<string | {
65
+ export declare const TOGGLE_LINK_COMMAND: LexicalCommand<string | ({
73
66
  url: string;
74
- target?: string;
75
- rel?: string;
76
- } | null>;
77
- export declare function toggleLink(url: null | string, attributes?: {
78
- target?: null | string;
79
- rel?: null | string;
80
- }): void;
67
+ } & LinkAttributes) | null>;
68
+ export declare function toggleLink(url: null | string, attributes?: LinkAttributes): void;
package/package.json CHANGED
@@ -8,13 +8,13 @@
8
8
  "link"
9
9
  ],
10
10
  "license": "MIT",
11
- "version": "0.6.1-next.0",
11
+ "version": "0.6.2",
12
12
  "main": "LexicalLink.js",
13
13
  "peerDependencies": {
14
- "lexical": "0.6.1-next.0"
14
+ "lexical": "0.6.2"
15
15
  },
16
16
  "dependencies": {
17
- "@lexical/utils": "0.6.1-next.0"
17
+ "@lexical/utils": "0.6.2"
18
18
  },
19
19
  "repository": {
20
20
  "type": "git",