@payloadcms/richtext-lexical 3.61.0-canary.4 → 3.61.0-canary.5
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.
- package/dist/exports/client/chunk-RPFDD27K.js +2 -0
- package/dist/exports/client/chunk-RPFDD27K.js.map +7 -0
- package/dist/exports/client/componentInline-BVC77WQC.js +2 -0
- package/dist/exports/client/index.js +12 -12
- package/dist/exports/client/index.js.map +3 -3
- package/dist/features/blocks/client/nodes/BlocksNode.d.ts +1 -1
- package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/client/nodes/BlocksNode.js +3 -2
- package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
- package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts +1 -1
- package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/client/nodes/InlineBlocksNode.js +3 -2
- package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
- package/dist/features/blocks/server/nodes/BlocksNode.d.ts +1 -1
- package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/server/nodes/BlocksNode.js +3 -2
- package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
- package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/server/nodes/InlineBlocksNode.js +3 -3
- package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
- package/dist/features/link/nodes/AutoLinkNode.js +1 -1
- package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
- package/dist/features/link/nodes/LinkNode.js +1 -1
- package/dist/features/link/nodes/LinkNode.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +4 -4
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +4 -4
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
- package/dist/features/relationship/client/nodes/RelationshipNode.d.ts +1 -1
- package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
- package/dist/features/relationship/client/nodes/RelationshipNode.js +3 -2
- package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
- package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +1 -1
- package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
- package/dist/features/relationship/server/nodes/RelationshipNode.js +3 -2
- package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
- package/dist/features/upload/client/plugin/index.js +2 -2
- package/dist/features/upload/client/plugin/index.js.map +1 -1
- package/package.json +6 -6
- package/dist/exports/client/chunk-ADWHGDDR.js +0 -2
- package/dist/exports/client/chunk-ADWHGDDR.js.map +0 -7
- package/dist/exports/client/componentInline-MIPTDFRK.js +0 -2
- /package/dist/exports/client/{componentInline-MIPTDFRK.js.map → componentInline-BVC77WQC.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type EditorConfig, type LexicalEditor, type LexicalNode } from 'lexical';
|
|
2
2
|
import { type JSX } from 'react';
|
|
3
3
|
import type { BlockFieldsOptionalID, SerializedBlockNode } from '../../server/nodes/BlocksNode.js';
|
|
4
4
|
import { ServerBlockNode } from '../../server/nodes/BlocksNode.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlocksNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/nodes/BlocksNode.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BlocksNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/nodes/BlocksNode.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,SAAS,CAAA;AAChB,OAAc,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAA;AAEvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAA;AAElG,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAGlE,qBAAa,SAAU,SAAQ,eAAe;WAC5B,KAAK,CAAC,IAAI,EAAE,eAAe,GAAG,eAAe;WAI7C,OAAO,IAAI,MAAM;WAIjB,UAAU,CAAC,cAAc,EAAE,mBAAmB,GAAG,SAAS;IAgBjE,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO;IAUlE,UAAU,IAAI,mBAAmB;CAG3C;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,qBAAqB,GAAG,SAAS,CASzE;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,IAAI,SAAS,CAEhG"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
4
|
import ObjectID from 'bson-objectid';
|
|
5
|
+
import { $applyNodeReplacement } from 'lexical';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
import { ServerBlockNode } from '../../server/nodes/BlocksNode.js';
|
|
7
8
|
import { BlockComponent } from '../component/index.js';
|
|
@@ -39,12 +40,12 @@ export class BlockNode extends ServerBlockNode {
|
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
export function $createBlockNode(fields) {
|
|
42
|
-
return new BlockNode({
|
|
43
|
+
return $applyNodeReplacement(new BlockNode({
|
|
43
44
|
fields: {
|
|
44
45
|
...fields,
|
|
45
46
|
id: fields?.id || new ObjectID.default().toHexString()
|
|
46
47
|
}
|
|
47
|
-
});
|
|
48
|
+
}));
|
|
48
49
|
}
|
|
49
50
|
export function $isBlockNode(node) {
|
|
50
51
|
return node instanceof BlockNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlocksNode.js","names":["ObjectID","React","ServerBlockNode","BlockComponent","BlockNode","clone","node","getType","importJSON","serializedNode","version","fields","data","$createBlockNode","setFormat","format","decorate","editor","config","_jsx","cacheBuster","getCacheBuster","formData","getFields","nodeKey","getKey","exportJSON","id","default","toHexString","$isBlockNode"],"sources":["../../../../../src/features/blocks/client/nodes/BlocksNode.tsx"],"sourcesContent":["'use client'\nimport
|
|
1
|
+
{"version":3,"file":"BlocksNode.js","names":["ObjectID","$applyNodeReplacement","React","ServerBlockNode","BlockComponent","BlockNode","clone","node","getType","importJSON","serializedNode","version","fields","data","$createBlockNode","setFormat","format","decorate","editor","config","_jsx","cacheBuster","getCacheBuster","formData","getFields","nodeKey","getKey","exportJSON","id","default","toHexString","$isBlockNode"],"sources":["../../../../../src/features/blocks/client/nodes/BlocksNode.tsx"],"sourcesContent":["'use client'\nimport ObjectID from 'bson-objectid'\nimport {\n $applyNodeReplacement,\n type EditorConfig,\n type LexicalEditor,\n type LexicalNode,\n} from 'lexical'\nimport React, { type JSX } from 'react'\n\nimport type { BlockFieldsOptionalID, SerializedBlockNode } from '../../server/nodes/BlocksNode.js'\n\nimport { ServerBlockNode } from '../../server/nodes/BlocksNode.js'\nimport { BlockComponent } from '../component/index.js'\n\nexport class BlockNode extends ServerBlockNode {\n static override clone(node: ServerBlockNode): ServerBlockNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n static override importJSON(serializedNode: SerializedBlockNode): BlockNode {\n if (serializedNode.version === 1) {\n // Convert (version 1 had the fields wrapped in another, unnecessary data property)\n serializedNode = {\n ...serializedNode,\n fields: {\n ...(serializedNode as any).fields.data,\n },\n version: 2,\n }\n }\n const node = $createBlockNode(serializedNode.fields)\n node.setFormat(serializedNode.format)\n return node\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return (\n <BlockComponent\n cacheBuster={this.getCacheBuster()}\n formData={this.getFields()}\n nodeKey={this.getKey()}\n />\n )\n }\n\n override exportJSON(): SerializedBlockNode {\n return super.exportJSON()\n }\n}\n\nexport function $createBlockNode(fields: BlockFieldsOptionalID): BlockNode {\n return $applyNodeReplacement(\n new BlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isBlockNode(node: BlockNode | LexicalNode | null | undefined): node is BlockNode {\n return node instanceof BlockNode\n}\n"],"mappings":"AAAA;;;AACA,OAAOA,QAAA,MAAc;AACrB,SACEC,qBAAqB,QAIhB;AACP,OAAOC,KAAA,MAAyB;AAIhC,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAE/B,OAAO,MAAMC,SAAA,SAAkBF,eAAA;EAC7B,OAAgBG,MAAMC,IAAqB,EAAmB;IAC5D,OAAO,KAAK,CAACD,KAAA,CAAMC,IAAA;EACrB;EAEA,OAAgBC,QAAA,EAAkB;IAChC,OAAO,KAAK,CAACA,OAAA;EACf;EAEA,OAAgBC,WAAWC,cAAmC,EAAa;IACzE,IAAIA,cAAA,CAAeC,OAAO,KAAK,GAAG;MAChC;MACAD,cAAA,GAAiB;QACf,GAAGA,cAAc;QACjBE,MAAA,EAAQ;UACN,GAAGF,cAAC,CAAuBE,MAAM,CAACC;QACpC;QACAF,OAAA,EAAS;MACX;IACF;IACA,MAAMJ,IAAA,GAAOO,gBAAA,CAAiBJ,cAAA,CAAeE,MAAM;IACnDL,IAAA,CAAKQ,SAAS,CAACL,cAAA,CAAeM,MAAM;IACpC,OAAOT,IAAA;EACT;EAESU,SAASC,MAAqB,EAAEC,MAAoB,EAAe;IAC1E,oBACEC,IAAA,CAAChB,cAAA;MACCiB,WAAA,EAAa,IAAI,CAACC,cAAc;MAChCC,QAAA,EAAU,IAAI,CAACC,SAAS;MACxBC,OAAA,EAAS,IAAI,CAACC,MAAM;;EAG1B;EAESC,WAAA,EAAkC;IACzC,OAAO,KAAK,CAACA,UAAA;EACf;AACF;AAEA,OAAO,SAASb,iBAAiBF,MAA6B;EAC5D,OAAOX,qBAAA,CACL,IAAII,SAAA,CAAU;IACZO,MAAA,EAAQ;MACN,GAAGA,MAAM;MACTgB,EAAA,EAAIhB,MAAA,EAAQgB,EAAA,IAAM,IAAI5B,QAAA,CAAS6B,OAAO,GAAGC,WAAW;IACtD;EACF;AAEJ;AAEA,OAAO,SAASC,aAAaxB,IAAgD;EAC3E,OAAOA,IAAA,YAAgBF,SAAA;AACzB","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type EditorConfig, type LexicalEditor, type LexicalNode } from 'lexical';
|
|
2
2
|
import { type JSX } from 'react';
|
|
3
3
|
import type { InlineBlockFields, SerializedInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js';
|
|
4
4
|
import { ServerInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlineBlocksNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/nodes/InlineBlocksNode.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InlineBlocksNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/nodes/InlineBlocksNode.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,SAAS,CAAA;AAChB,OAAc,EAAE,KAAK,GAAG,EAAE,MAAM,OAAO,CAAA;AAEvC,OAAO,KAAK,EACV,iBAAiB,EACjB,yBAAyB,EAC1B,MAAM,wCAAwC,CAAA;AAE/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAA;AAQ9E,qBAAa,eAAgB,SAAQ,qBAAqB;WACxC,KAAK,CAAC,IAAI,EAAE,qBAAqB,GAAG,qBAAqB;WAIzD,OAAO,IAAI,MAAM;WAIjB,UAAU,CAAC,cAAc,EAAE,yBAAyB,GAAG,eAAe;IAK7E,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO;IAUlE,UAAU,IAAI,yBAAyB;CAGjD;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,CAAC,iBAAiB,EAAE,IAAI,CAAC,GAAG,eAAe,CAShG;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,eAAe,GAAG,WAAW,GAAG,IAAI,GAAG,SAAS,GACrD,IAAI,IAAI,eAAe,CAEzB"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
4
|
import ObjectID from 'bson-objectid';
|
|
5
|
+
import { $applyNodeReplacement } from 'lexical';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
import { ServerInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js';
|
|
7
8
|
const InlineBlockComponent = /*#__PURE__*/React.lazy(() => import('../componentInline/index.js').then(module => ({
|
|
@@ -30,12 +31,12 @@ export class InlineBlockNode extends ServerInlineBlockNode {
|
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
export function $createInlineBlockNode(fields) {
|
|
33
|
-
return new InlineBlockNode({
|
|
34
|
+
return $applyNodeReplacement(new InlineBlockNode({
|
|
34
35
|
fields: {
|
|
35
36
|
...fields,
|
|
36
37
|
id: fields?.id || new ObjectID.default().toHexString()
|
|
37
38
|
}
|
|
38
|
-
});
|
|
39
|
+
}));
|
|
39
40
|
}
|
|
40
41
|
export function $isInlineBlockNode(node) {
|
|
41
42
|
return node instanceof InlineBlockNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlineBlocksNode.js","names":["ObjectID","React","ServerInlineBlockNode","InlineBlockComponent","lazy","then","module","default","InlineBlockNode","clone","node","getType","importJSON","serializedNode","$createInlineBlockNode","fields","decorate","editor","config","_jsx","cacheBuster","getCacheBuster","formData","getFields","nodeKey","getKey","exportJSON","id","toHexString","$isInlineBlockNode"],"sources":["../../../../../src/features/blocks/client/nodes/InlineBlocksNode.tsx"],"sourcesContent":["'use client'\nimport
|
|
1
|
+
{"version":3,"file":"InlineBlocksNode.js","names":["ObjectID","$applyNodeReplacement","React","ServerInlineBlockNode","InlineBlockComponent","lazy","then","module","default","InlineBlockNode","clone","node","getType","importJSON","serializedNode","$createInlineBlockNode","fields","decorate","editor","config","_jsx","cacheBuster","getCacheBuster","formData","getFields","nodeKey","getKey","exportJSON","id","toHexString","$isInlineBlockNode"],"sources":["../../../../../src/features/blocks/client/nodes/InlineBlocksNode.tsx"],"sourcesContent":["'use client'\nimport ObjectID from 'bson-objectid'\nimport {\n $applyNodeReplacement,\n type EditorConfig,\n type LexicalEditor,\n type LexicalNode,\n} from 'lexical'\nimport React, { type JSX } from 'react'\n\nimport type {\n InlineBlockFields,\n SerializedInlineBlockNode,\n} from '../../server/nodes/InlineBlocksNode.js'\n\nimport { ServerInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js'\n\nconst InlineBlockComponent = React.lazy(() =>\n import('../componentInline/index.js').then((module) => ({\n default: module.InlineBlockComponent,\n })),\n)\n\nexport class InlineBlockNode extends ServerInlineBlockNode {\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): InlineBlockNode {\n const node = $createInlineBlockNode(serializedNode.fields)\n return node\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return (\n <InlineBlockComponent\n cacheBuster={this.getCacheBuster()}\n formData={this.getFields()}\n nodeKey={this.getKey()}\n />\n )\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return super.exportJSON()\n }\n}\n\nexport function $createInlineBlockNode(fields: Exclude<InlineBlockFields, 'id'>): InlineBlockNode {\n return $applyNodeReplacement(\n new InlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isInlineBlockNode(\n node: InlineBlockNode | LexicalNode | null | undefined,\n): node is InlineBlockNode {\n return node instanceof InlineBlockNode\n}\n"],"mappings":"AAAA;;;AACA,OAAOA,QAAA,MAAc;AACrB,SACEC,qBAAqB,QAIhB;AACP,OAAOC,KAAA,MAAyB;AAOhC,SAASC,qBAAqB,QAAQ;AAEtC,MAAMC,oBAAA,gBAAuBF,KAAA,CAAMG,IAAI,CAAC,MACtC,MAAM,CAAC,+BAA+BC,IAAI,CAAEC,MAAA,KAAY;EACtDC,OAAA,EAASD,MAAA,CAAOH;AAClB;AAGF,OAAO,MAAMK,eAAA,SAAwBN,qBAAA;EACnC,OAAgBO,MAAMC,IAA2B,EAAyB;IACxE,OAAO,KAAK,CAACD,KAAA,CAAMC,IAAA;EACrB;EAEA,OAAgBC,QAAA,EAAkB;IAChC,OAAO,KAAK,CAACA,OAAA;EACf;EAEA,OAAgBC,WAAWC,cAAyC,EAAmB;IACrF,MAAMH,IAAA,GAAOI,sBAAA,CAAuBD,cAAA,CAAeE,MAAM;IACzD,OAAOL,IAAA;EACT;EAESM,SAASC,MAAqB,EAAEC,MAAoB,EAAe;IAC1E,oBACEC,IAAA,CAAChB,oBAAA;MACCiB,WAAA,EAAa,IAAI,CAACC,cAAc;MAChCC,QAAA,EAAU,IAAI,CAACC,SAAS;MACxBC,OAAA,EAAS,IAAI,CAACC,MAAM;;EAG1B;EAESC,WAAA,EAAwC;IAC/C,OAAO,KAAK,CAACA,UAAA;EACf;AACF;AAEA,OAAO,SAASZ,uBAAuBC,MAAwC;EAC7E,OAAOf,qBAAA,CACL,IAAIQ,eAAA,CAAgB;IAClBO,MAAA,EAAQ;MACN,GAAGA,MAAM;MACTY,EAAA,EAAIZ,MAAA,EAAQY,EAAA,IAAM,IAAI5B,QAAA,CAASQ,OAAO,GAAGqB,WAAW;IACtD;EACF;AAEJ;AAEA,OAAO,SAASC,mBACdnB,IAAsD;EAEtD,OAAOA,IAAA,YAAgBF,eAAA;AACzB","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js';
|
|
2
|
-
import type { DOMConversionMap, DOMExportOutput, EditorConfig, ElementFormatType, LexicalEditor, LexicalNode, NodeKey } from 'lexical';
|
|
3
2
|
import type { JsonObject } from 'payload';
|
|
4
3
|
import type { JSX } from 'react';
|
|
5
4
|
import { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js';
|
|
5
|
+
import { type DOMConversionMap, type DOMExportOutput, type EditorConfig, type ElementFormatType, type LexicalEditor, type LexicalNode, type NodeKey } from 'lexical';
|
|
6
6
|
import type { StronglyTypedLeafNode } from '../../../../nodeTypes.js';
|
|
7
7
|
type BaseBlockFields<TBlockFields extends JsonObject = JsonObject> = {
|
|
8
8
|
/** Block form data */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlocksNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/server/nodes/BlocksNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAA;AAC/F,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"BlocksNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/server/nodes/BlocksNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAA;AAC/F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,EAAE,kBAAkB,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AS7C,OAAO,IAAI,MAAM;WAIjB,SAAS,IAAI,gBAAgB,CAAC,cAAc,CAAC,GAAG,IAAI;WAIpD,UAAU,CAAC,cAAc,EAAE,mBAAmB,GAAG,eAAe;IAgBhF,MAAM,CAAC,QAAQ,IAAI,KAAK;IAIf,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO;IAIlE,SAAS,IAAI,eAAe;IAQ5B,UAAU,IAAI,mBAAmB;IAS1C,cAAc,IAAI,MAAM;IAIxB,SAAS,IAAI,WAAW;IAIf,cAAc,IAAI,MAAM;IAIjC,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,sBAAsB,CAAC,EAAE,OAAO,GAAG,IAAI;CAOvE;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,qBAAqB,GAAG,eAAe,CASrF;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,eAAe,GAAG,SAAS,GACrD,IAAI,IAAI,eAAe,CAEzB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js';
|
|
2
2
|
import ObjectID from 'bson-objectid';
|
|
3
|
+
import { $applyNodeReplacement } from 'lexical';
|
|
3
4
|
export class ServerBlockNode extends DecoratorBlockNode {
|
|
4
5
|
__cacheBuster;
|
|
5
6
|
__fields;
|
|
@@ -82,12 +83,12 @@ export class ServerBlockNode extends DecoratorBlockNode {
|
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
export function $createServerBlockNode(fields) {
|
|
85
|
-
return new ServerBlockNode({
|
|
86
|
+
return $applyNodeReplacement(new ServerBlockNode({
|
|
86
87
|
fields: {
|
|
87
88
|
...fields,
|
|
88
89
|
id: fields?.id || new ObjectID.default().toHexString()
|
|
89
90
|
}
|
|
90
|
-
});
|
|
91
|
+
}));
|
|
91
92
|
}
|
|
92
93
|
export function $isServerBlockNode(node) {
|
|
93
94
|
return node instanceof ServerBlockNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlocksNode.js","names":["DecoratorBlockNode","ObjectID","ServerBlockNode","__cacheBuster","__fields","constructor","cacheBuster","fields","format","key","clone","node","__format","__key","getType","importDOM","importJSON","serializedNode","version","data","$createServerBlockNode","setFormat","isInline","decorate","editor","config","exportDOM","element","document","createElement","text","createTextNode","getTextContent","append","exportJSON","type","getFields","getCacheBuster","getLatest","setFields","preventFormStateUpdate","writable","getWritable","id","default","toHexString","$isServerBlockNode"],"sources":["../../../../../src/features/blocks/server/nodes/BlocksNode.tsx"],"sourcesContent":["import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type {
|
|
1
|
+
{"version":3,"file":"BlocksNode.js","names":["DecoratorBlockNode","ObjectID","$applyNodeReplacement","ServerBlockNode","__cacheBuster","__fields","constructor","cacheBuster","fields","format","key","clone","node","__format","__key","getType","importDOM","importJSON","serializedNode","version","data","$createServerBlockNode","setFormat","isInline","decorate","editor","config","exportDOM","element","document","createElement","text","createTextNode","getTextContent","append","exportJSON","type","getFields","getCacheBuster","getLatest","setFields","preventFormStateUpdate","writable","getWritable","id","default","toHexString","$isServerBlockNode"],"sources":["../../../../../src/features/blocks/server/nodes/BlocksNode.tsx"],"sourcesContent":["import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type { JsonObject } from 'payload'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport ObjectID from 'bson-objectid'\nimport {\n $applyNodeReplacement,\n type DOMConversionMap,\n type DOMExportOutput,\n type EditorConfig,\n type ElementFormatType,\n type LexicalEditor,\n type LexicalNode,\n type NodeKey,\n} from 'lexical'\n\nimport type { StronglyTypedLeafNode } from '../../../../nodeTypes.js'\n\ntype BaseBlockFields<TBlockFields extends JsonObject = JsonObject> = {\n /** Block form data */\n blockName: string\n blockType: string\n} & TBlockFields\n\nexport type BlockFields<TBlockFields extends JsonObject = JsonObject> = {\n id: string\n} & BaseBlockFields<TBlockFields>\n\nexport type BlockFieldsOptionalID<TBlockFields extends JsonObject = JsonObject> = {\n id?: string\n} & BaseBlockFields<TBlockFields>\n\nexport type SerializedBlockNode<TBlockFields extends JsonObject = JsonObject> = {\n fields: BlockFields<TBlockFields>\n} & StronglyTypedLeafNode<SerializedDecoratorBlockNode, 'block'>\n\nexport class ServerBlockNode extends DecoratorBlockNode {\n __cacheBuster: number\n __fields: BlockFields\n\n constructor({\n cacheBuster,\n fields,\n format,\n key,\n }: {\n cacheBuster?: number\n fields: BlockFields\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__fields = fields\n this.__cacheBuster = cacheBuster || 0\n }\n\n static override clone(node: ServerBlockNode): ServerBlockNode {\n return new this({\n cacheBuster: node.__cacheBuster,\n fields: node.__fields,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'block'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static override importJSON(serializedNode: SerializedBlockNode): ServerBlockNode {\n if (serializedNode.version === 1) {\n // Convert (version 1 had the fields wrapped in another, unnecessary data property)\n serializedNode = {\n ...serializedNode,\n fields: {\n ...(serializedNode as any).fields.data,\n },\n version: 2,\n }\n }\n const node = $createServerBlockNode(serializedNode.fields)\n node.setFormat(serializedNode.format)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return null as unknown as JSX.Element\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('div')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedBlockNode {\n return {\n ...super.exportJSON(),\n type: 'block',\n fields: this.getFields(),\n version: 2,\n }\n }\n\n getCacheBuster(): number {\n return this.getLatest().__cacheBuster\n }\n\n getFields(): BlockFields {\n return this.getLatest().__fields\n }\n\n override getTextContent(): string {\n return `Block Field`\n }\n\n setFields(fields: BlockFields, preventFormStateUpdate?: boolean): void {\n const writable = this.getWritable()\n writable.__fields = fields\n if (!preventFormStateUpdate) {\n writable.__cacheBuster++\n }\n }\n}\n\nexport function $createServerBlockNode(fields: BlockFieldsOptionalID): ServerBlockNode {\n return $applyNodeReplacement(\n new ServerBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isServerBlockNode(\n node: LexicalNode | null | ServerBlockNode | undefined,\n): node is ServerBlockNode {\n return node instanceof ServerBlockNode\n}\n"],"mappings":"AAIA,SAASA,kBAAkB,QAAQ;AACnC,OAAOC,QAAA,MAAc;AACrB,SACEC,qBAAqB,QAQhB;AAsBP,OAAO,MAAMC,eAAA,SAAwBH,kBAAA;EACnCI,aAAA;EACAC,QAAA;EAEAC,YAAY;IACVC,WAAW;IACXC,MAAM;IACNC,MAAM;IACNC;EAAG,CAMJ,EAAE;IACD,KAAK,CAACD,MAAA,EAAQC,GAAA;IACd,IAAI,CAACL,QAAQ,GAAGG,MAAA;IAChB,IAAI,CAACJ,aAAa,GAAGG,WAAA,IAAe;EACtC;EAEA,OAAgBI,MAAMC,IAAqB,EAAmB;IAC5D,OAAO,IAAI,IAAI,CAAC;MACdL,WAAA,EAAaK,IAAA,CAAKR,aAAa;MAC/BI,MAAA,EAAQI,IAAA,CAAKP,QAAQ;MACrBI,MAAA,EAAQG,IAAA,CAAKC,QAAQ;MACrBH,GAAA,EAAKE,IAAA,CAAKE;IACZ;EACF;EAEA,OAAgBC,QAAA,EAAkB;IAChC,OAAO;EACT;EAEA,OAAgBC,UAAA,EAAqD;IACnE,OAAO,CAAC;EACV;EAEA,OAAgBC,WAAWC,cAAmC,EAAmB;IAC/E,IAAIA,cAAA,CAAeC,OAAO,KAAK,GAAG;MAChC;MACAD,cAAA,GAAiB;QACf,GAAGA,cAAc;QACj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AAA,EAAQoC,EAAA,IAAM,IAAI3C,QAAA,CAAS4C,OAAO,GAAGC,WAAW;IACtD;EACF;AAEJ;AAEA,OAAO,SAASC,mBACdnC,IAAsD;EAEtD,OAAOA,IAAA,YAAgBT,eAAA;AACzB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlineBlocksNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/server/nodes/InlineBlocksNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,aAAa,EACb,WAAW,EACX,OAAO,EACP,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAGhC,OAAO,
|
|
1
|
+
{"version":3,"file":"InlineBlocksNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/server/nodes/InlineBlocksNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,aAAa,EACb,WAAW,EACX,OAAO,EACP,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAGhC,OAAO,EAAyB,aAAa,EAAE,MAAM,SAAS,CAAA;AAE9D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAErE,MAAM,MAAM,iBAAiB,CAAC,kBAAkB,SAAS,UAAU,GAAG,UAAU,IAAI;IAClF,SAAS,EAAE,MAAM,CAAA;IACjB,EAAE,EAAE,MAAM,CAAA;CACX,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AwB,CACtC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,qBAAqB,GAAG,SAAS,GAC3D,IAAI,IAAI,qBAAqB,CAE/B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import ObjectID from 'bson-objectid';
|
|
2
|
-
import { DecoratorNode } from 'lexical';
|
|
2
|
+
import { $applyNodeReplacement, DecoratorNode } from 'lexical';
|
|
3
3
|
export class ServerInlineBlockNode extends DecoratorNode {
|
|
4
4
|
__cacheBuster;
|
|
5
5
|
__fields;
|
|
@@ -83,12 +83,12 @@ export class ServerInlineBlockNode extends DecoratorNode {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
export function $createServerInlineBlockNode(fields) {
|
|
86
|
-
return new ServerInlineBlockNode({
|
|
86
|
+
return $applyNodeReplacement(new ServerInlineBlockNode({
|
|
87
87
|
fields: {
|
|
88
88
|
...fields,
|
|
89
89
|
id: fields?.id || new ObjectID.default().toHexString()
|
|
90
90
|
}
|
|
91
|
-
});
|
|
91
|
+
}));
|
|
92
92
|
}
|
|
93
93
|
export function $isServerInlineBlockNode(node) {
|
|
94
94
|
return node instanceof ServerInlineBlockNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlineBlocksNode.js","names":["ObjectID","DecoratorNode","ServerInlineBlockNode","__cacheBuster","__fields","constructor","cacheBuster","fields","key","clone","node","__key","getType","importDOM","importJSON","serializedNode","$createServerInlineBlockNode","isInline","canIndent","createDOM","element","document","createElement","classList","add","decorate","editor","config","exportDOM","text","createTextNode","getTextContent","append","exportJSON","type","getFields","version","getCacheBuster","getLatest","setFields","preventFormStateUpdate","writable","getWritable","updateDOM","id","default","toHexString","$isServerInlineBlockNode"],"sources":["../../../../../src/features/blocks/server/nodes/InlineBlocksNode.tsx"],"sourcesContent":["import type {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n} from 'lexical'\nimport type { JsonObject } from 'payload'\nimport type React from 'react'\nimport type { JSX } from 'react'\n\nimport ObjectID from 'bson-objectid'\nimport { DecoratorNode } from 'lexical'\n\nimport type { StronglyTypedLeafNode } from '../../../../nodeTypes.js'\n\nexport type InlineBlockFields<TInlineBlockFields extends JsonObject = JsonObject> = {\n blockType: string\n id: string\n} & TInlineBlockFields\n\nexport type SerializedInlineBlockNode<TBlockFields extends JsonObject = JsonObject> = {\n fields: InlineBlockFields<TBlockFields>\n} & StronglyTypedLeafNode<SerializedLexicalNode, 'inlineBlock'>\n\nexport class ServerInlineBlockNode extends DecoratorNode<null | React.ReactElement> {\n __cacheBuster: number\n __fields: InlineBlockFields\n\n constructor({\n cacheBuster,\n fields,\n key,\n }: {\n cacheBuster?: number\n fields: InlineBlockFields\n key?: NodeKey\n }) {\n super(key)\n this.__fields = fields\n this.__cacheBuster = cacheBuster || 0\n }\n\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return new this({\n cacheBuster: node.__cacheBuster,\n fields: node.__fields,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'inlineBlock'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): ServerInlineBlockNode {\n const node = $createServerInlineBlockNode(serializedNode.fields)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n canIndent() {\n return true\n }\n override createDOM() {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n return element\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n return null\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return {\n type: 'inlineBlock',\n fields: this.getFields(),\n version: 1,\n }\n }\n\n getCacheBuster(): number {\n return this.getLatest().__cacheBuster\n }\n\n getFields(): InlineBlockFields {\n return this.getLatest().__fields\n }\n\n override getTextContent(): string {\n return `Block Field`\n }\n\n override isInline() {\n return true\n }\n\n setFields(fields: InlineBlockFields, preventFormStateUpdate?: boolean): void {\n const writable = this.getWritable()\n writable.__fields = fields\n if (!preventFormStateUpdate) {\n writable.__cacheBuster++\n }\n }\n\n override updateDOM(): boolean {\n return false\n }\n}\n\nexport function $createServerInlineBlockNode(\n fields: Exclude<InlineBlockFields, 'id'>,\n): ServerInlineBlockNode {\n return new ServerInlineBlockNode({\n
|
|
1
|
+
{"version":3,"file":"InlineBlocksNode.js","names":["ObjectID","$applyNodeReplacement","DecoratorNode","ServerInlineBlockNode","__cacheBuster","__fields","constructor","cacheBuster","fields","key","clone","node","__key","getType","importDOM","importJSON","serializedNode","$createServerInlineBlockNode","isInline","canIndent","createDOM","element","document","createElement","classList","add","decorate","editor","config","exportDOM","text","createTextNode","getTextContent","append","exportJSON","type","getFields","version","getCacheBuster","getLatest","setFields","preventFormStateUpdate","writable","getWritable","updateDOM","id","default","toHexString","$isServerInlineBlockNode"],"sources":["../../../../../src/features/blocks/server/nodes/InlineBlocksNode.tsx"],"sourcesContent":["import type {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n} from 'lexical'\nimport type { JsonObject } from 'payload'\nimport type React from 'react'\nimport type { JSX } from 'react'\n\nimport ObjectID from 'bson-objectid'\nimport { $applyNodeReplacement, DecoratorNode } from 'lexical'\n\nimport type { StronglyTypedLeafNode } from '../../../../nodeTypes.js'\n\nexport type InlineBlockFields<TInlineBlockFields extends JsonObject = JsonObject> = {\n blockType: string\n id: string\n} & TInlineBlockFields\n\nexport type SerializedInlineBlockNode<TBlockFields extends JsonObject = JsonObject> = {\n fields: InlineBlockFields<TBlockFields>\n} & StronglyTypedLeafNode<SerializedLexicalNode, 'inlineBlock'>\n\nexport class ServerInlineBlockNode extends DecoratorNode<null | React.ReactElement> {\n __cacheBuster: number\n __fields: InlineBlockFields\n\n constructor({\n cacheBuster,\n fields,\n key,\n }: {\n cacheBuster?: number\n fields: InlineBlockFields\n key?: NodeKey\n }) {\n super(key)\n this.__fields = fields\n this.__cacheBuster = cacheBuster || 0\n }\n\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return new this({\n cacheBuster: node.__cacheBuster,\n fields: node.__fields,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'inlineBlock'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): ServerInlineBlockNode {\n const node = $createServerInlineBlockNode(serializedNode.fields)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n canIndent() {\n return true\n }\n override createDOM() {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n return element\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n return null\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return {\n type: 'inlineBlock',\n fields: this.getFields(),\n version: 1,\n }\n }\n\n getCacheBuster(): number {\n return this.getLatest().__cacheBuster\n }\n\n getFields(): InlineBlockFields {\n return this.getLatest().__fields\n }\n\n override getTextContent(): string {\n return `Block Field`\n }\n\n override isInline() {\n return true\n }\n\n setFields(fields: InlineBlockFields, preventFormStateUpdate?: boolean): void {\n const writable = this.getWritable()\n writable.__fields = fields\n if (!preventFormStateUpdate) {\n writable.__cacheBuster++\n }\n }\n\n override updateDOM(): boolean {\n return false\n }\n}\n\nexport function $createServerInlineBlockNode(\n fields: Exclude<InlineBlockFields, 'id'>,\n): ServerInlineBlockNode {\n return $applyNodeReplacement(\n new ServerInlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isServerInlineBlockNode(\n node: LexicalNode | null | ServerInlineBlockNode | undefined,\n): node is ServerInlineBlockNode {\n return node instanceof ServerInlineBlockNode\n}\n"],"mappings":"AAaA,OAAOA,QAAA,MAAc;AACrB,SAASC,qBAAqB,EAAEC,aAAa,QAAQ;AAarD,OAAO,MAAMC,qBAAA,SAA8BD,aAAA;EACzCE,aAAA;EACAC,QAAA;EAEAC,YAAY;IACVC,WAAW;IACXC,MAAM;IACNC;EAAG,CAKJ,EAAE;IACD,KAAK,CAACA,GAAA;IACN,IAAI,CAACJ,QAAQ,GAAGG,MAAA;IAChB,IAAI,CAACJ,aAAa,GAAGG,WAAA,IAAe;EACtC;EAEA,OAAgBG,MAAMC,IAA2B,EAAyB;IACxE,OAAO,IAAI,IAAI,CAAC;MACdJ,WAAA,EAAaI,IAAA,CAAKP,aAAa;MAC/BI,MAAA,EAAQG,IAAA,CAAKN,QAAQ;MACrBI,GAAA,EAAKE,IAAA,CAAKC;IACZ;EACF;EAEA,OAAgBC,QAAA,EAAkB;IAChC,OAAO;EACT;EAEA,OAAgBC,UAAA,EAAqD;IACnE,OAAO,CAAC;EACV;EAEA,OAAgBC,WAAWC,cAAyC,EAAyB;IAC3F,MAAML,IAAA,GAAOM,4BAAA,CAA6BD,cAAA,CAAeR,MAAM;IAC/D,OAAOG,IAAA;EACT;EAEA,OAAOO,SAAA,EAAkB;IACvB,OAAO;EACT;EAEAC,UAAA,EAAY;IACV,OAAO;EACT;EACSC,UAAA,EAAY;IACnB,MAAMC,OAAA,GAAUC,QAAA,CAASC,aAAa,CAAC;IACvCF,OAAA,CAAQG,SAAS,CAACC,GAAG,CAAC;IAEtB,OAAOJ,OAAA;EACT;EAESK,SAASC,MAAqB,EAAEC,MAAoB,EAAsB;IACjF,OAAO;EACT;EAESC,UAAA,EAA6B;IACpC,MAAMR,OAAA,GAAUC,QAAA,CAASC,aAAa,CAAC;IACvCF,OAAA,CAAQG,SAAS,CAACC,GAAG,CAAC;IAEtB,MAAMK,IAAA,GAAOR,QAAA,CAASS,cAAc,CAAC,IAAI,CAACC,cAAc;IACxDX,OAAA,CAAQY,MAAM,CAACH,IAAA;IACf,OAAO;MAAET;IAAQ;EACnB;EAESa,WAAA,EAAwC;IAC/C,OAAO;MACLC,IAAA,EAAM;MACN3B,MAAA,EAAQ,IAAI,CAAC4B,SAAS;MACtBC,OAAA,EAAS;IACX;EACF;EAEAC,eAAA,EAAyB;IACvB,OAAO,IAAI,CAACC,SAAS,GAAGnC,aAAa;EACvC;EAEAgC,UAAA,EAA+B;IAC7B,OAAO,IAAI,CAACG,SAAS,GAAGlC,QAAQ;EAClC;EAES2B,eAAA,EAAyB;IAChC,OAAO,aAAa;EACtB;EAESd,SAAA,EAAW;IAClB,OAAO;EACT;EAEAsB,UAAUhC,MAAyB,EAAEiC,sBAAgC,EAAQ;IAC3E,MAAMC,QAAA,GAAW,IAAI,CAACC,WAAW;IACjCD,QAAA,CAASrC,QAAQ,GAAGG,MAAA;IACpB,IAAI,CAACiC,sBAAA,EAAwB;MAC3BC,QAAA,CAAStC,aAAa;IACxB;EACF;EAESwC,UAAA,EAAqB;IAC5B,OAAO;EACT;AACF;AAEA,OAAO,SAAS3B,6BACdT,MAAwC;EAExC,OAAOP,qBAAA,CACL,IAAIE,qBAAA,CAAsB;IACxBK,MAAA,EAAQ;MACN,GAAGA,MAAM;MACTqC,EAAA,EAAIrC,MAAA,EAAQqC,EAAA,IAAM,IAAI7C,QAAA,CAAS8C,OAAO,GAAGC,WAAW;IACtD;EACF;AAEJ;AAEA,OAAO,SAASC,yBACdrC,IAA4D;EAE5D,OAAOA,IAAA,YAAgBR,qBAAA;AACzB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoLinkNode.js","names":["$applyNodeReplacement","$isElementNode","LinkNode","AutoLinkNode","clone","node","id","fields","__fields","key","__key","getType","importDOM","importJSON","serializedNode","$createAutoLinkNode","updateFromJSON","version","doc","value","exportJSON","serialized","type","children","direction","format","indent","insertNewAfter","selection","restoreSelection","element","getParentOrThrow","linkNode","append","setFields","$isAutoLinkNode"],"sources":["../../../../src/features/link/nodes/AutoLinkNode.ts"],"sourcesContent":["import type { ElementNode, LexicalNode, LexicalUpdateJSON, RangeSelection } from 'lexical'\n\nimport { $applyNodeReplacement, $isElementNode } from 'lexical'\n\nimport type { LinkFields, SerializedAutoLinkNode } from './types.js'\n\nimport { LinkNode } from './LinkNode.js'\n\n// Custom node type to override `canInsertTextAfter` that will\n// allow typing within the link\n\nexport class AutoLinkNode extends LinkNode {\n static override clone(node: AutoLinkNode): AutoLinkNode {\n return new
|
|
1
|
+
{"version":3,"file":"AutoLinkNode.js","names":["$applyNodeReplacement","$isElementNode","LinkNode","AutoLinkNode","clone","node","id","fields","__fields","key","__key","getType","importDOM","importJSON","serializedNode","$createAutoLinkNode","updateFromJSON","version","doc","value","exportJSON","serialized","type","children","direction","format","indent","insertNewAfter","selection","restoreSelection","element","getParentOrThrow","linkNode","append","setFields","$isAutoLinkNode"],"sources":["../../../../src/features/link/nodes/AutoLinkNode.ts"],"sourcesContent":["import type { ElementNode, LexicalNode, LexicalUpdateJSON, RangeSelection } from 'lexical'\n\nimport { $applyNodeReplacement, $isElementNode } from 'lexical'\n\nimport type { LinkFields, SerializedAutoLinkNode } from './types.js'\n\nimport { LinkNode } from './LinkNode.js'\n\n// Custom node type to override `canInsertTextAfter` that will\n// allow typing within the link\n\nexport class AutoLinkNode extends LinkNode {\n static override clone(node: AutoLinkNode): AutoLinkNode {\n return new this({ id: '', fields: node.__fields, key: node.__key })\n }\n\n static override getType(): string {\n return 'autolink'\n }\n\n static override importDOM(): null {\n // TODO: Should link node should handle the import over autolink?\n return null\n }\n\n static override importJSON(serializedNode: SerializedAutoLinkNode): AutoLinkNode {\n const node = $createAutoLinkNode({}).updateFromJSON(serializedNode)\n\n /**\n * @todo remove in 4.0\n */\n if (\n serializedNode.version === 1 &&\n typeof serializedNode.fields?.doc?.value === 'object' &&\n serializedNode.fields?.doc?.value?.id\n ) {\n serializedNode.fields.doc.value = serializedNode.fields.doc.value.id\n serializedNode.version = 2\n }\n\n return node\n }\n\n // @ts-expect-error\n exportJSON(): SerializedAutoLinkNode {\n const serialized = super.exportJSON()\n return {\n type: 'autolink',\n children: serialized.children,\n direction: serialized.direction,\n fields: serialized.fields,\n format: serialized.format,\n indent: serialized.indent,\n version: 2,\n }\n }\n\n override insertNewAfter(selection: RangeSelection, restoreSelection = true): ElementNode | null {\n const element = this.getParentOrThrow().insertNewAfter(selection, restoreSelection)\n if ($isElementNode(element)) {\n const linkNode = $createAutoLinkNode({ fields: this.__fields })\n element.append(linkNode)\n return linkNode\n }\n return null\n }\n\n override updateFromJSON(serializedNode: LexicalUpdateJSON<SerializedAutoLinkNode>): this {\n return super.updateFromJSON(serializedNode).setFields(serializedNode.fields)\n }\n}\n\nexport function $createAutoLinkNode({ fields }: { fields?: LinkFields }): AutoLinkNode {\n return $applyNodeReplacement(new AutoLinkNode({ id: '', fields }))\n}\nexport function $isAutoLinkNode(node: LexicalNode | null | undefined): node is AutoLinkNode {\n return node instanceof AutoLinkNode\n}\n"],"mappings":"AAEA,SAASA,qBAAqB,EAAEC,cAAc,QAAQ;AAItD,SAASC,QAAQ,QAAQ;AAEzB;AACA;AAEA,OAAO,MAAMC,YAAA,SAAqBD,QAAA;EAChC,OAAgBE,MAAMC,IAAkB,EAAgB;IACtD,OAAO,IAAI,IAAI,CAAC;MAAEC,EAAA,EAAI;MAAIC,MAAA,EAAQF,IAAA,CAAKG,QAAQ;MAAEC,GAAA,EAAKJ,IAAA,CAAKK;IAAM;EACnE;EAEA,OAAgBC,QAAA,EAAkB;IAChC,OAAO;EACT;EAEA,OAAgBC,UAAA,EAAkB;IAChC;IACA,OAAO;EACT;EAEA,OAAgBC,WAAWC,cAAsC,EAAgB;IAC/E,MAAMT,IAAA,GAAOU,mBAAA,CAAoB,CAAC,GAAGC,cAAc,CAACF,cAAA;IAEpD;;;IAGA,IACEA,cAAA,CAAeG,OAA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AA,EAAI;IAAIC;EAAO;AACjE;AACA,OAAO,SAAS4B,gBAAgB9B,IAAoC;EAClE,OAAOA,IAAA,YAAgBF,YAAA;AACzB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkNode.js","names":["addClassNamesToElement","isHTMLAnchorElement","ObjectID","$applyNodeReplacement","$createTextNode","$getSelection","$isElementNode","$isRangeSelection","createCommand","ElementNode","SUPPORTED_URL_PROTOCOLS","Set","LinkNode","__fields","__id","constructor","id","fields","linkType","newTab","key","clone","node","__key","getType","importDOM","a","conversion","$convertAnchorElement","priority","importJSON","serializedNode","$createLinkNode","updateFromJSON","version","doc","value","default","toHexString","canBeEmpty","canInsertTextAfter","canInsertTextBefore","createDOM","config","element","document","createElement","href","sanitizeUrl","url","target","rel","manageRel","theme","link","exportJSON","getFields","returnObject","type","getID","extractWithChild","child","selection","destination","anchorNode","anchor","getNode","focusNode","focus","isParentOf","getTextContent","length","getLatest","insertNewAfter","restoreSelection","getParentOrThrow","linkNode","append","isInline","parsedUrl","URL","has","protocol","e","setFields","writable","getWritable","setID","updateDOM","prevNode","removeAttribute","domNode","content","textContent","getAttribute","$isLinkNode","TOGGLE_LINK_COMMAND","$toggleLink","payload","selectedNodes","nodes","extract","forEach","parent","getParent","children","getChildren","insertBefore","remove","firstNode","$getLinkAncestor","text","getLastChild","prevParent","is","getPreviousSibling","insertAfter","$getAncestor","ancestor","predicate","input","action","result","mutableInput","includes","re","RegExp","replace","trim"],"sources":["../../../../src/features/link/nodes/LinkNode.ts"],"sourcesContent":["import type {\n BaseSelection,\n DOMConversionMap,\n DOMConversionOutput,\n EditorConfig,\n ElementNode as ElementNodeType,\n LexicalCommand,\n LexicalNode,\n LexicalUpdateJSON,\n NodeKey,\n RangeSelection,\n} from 'lexical'\n\nimport { addClassNamesToElement, isHTMLAnchorElement } from '@lexical/utils'\nimport ObjectID from 'bson-objectid'\nimport {\n $applyNodeReplacement,\n $createTextNode,\n $getSelection,\n $isElementNode,\n $isRangeSelection,\n createCommand,\n ElementNode,\n} from 'lexical'\n\nimport type { LinkPayload } from '../client/plugins/floatingLinkEditor/types.js'\nimport type { LinkFields, SerializedLinkNode } from './types.js'\n\nconst SUPPORTED_URL_PROTOCOLS = new Set(['http:', 'https:', 'mailto:', 'sms:', 'tel:'])\n\n/** @noInheritDoc */\nexport class LinkNode extends ElementNode {\n __fields: LinkFields\n __id: string\n\n constructor({\n id,\n fields = {\n linkType: 'custom',\n newTab: false,\n },\n key,\n }: {\n fields?: LinkFields\n id: string\n key?: NodeKey\n }) {\n super(key)\n this.__fields = fields\n this.__id = id\n }\n\n static override clone(node: LinkNode): LinkNode {\n return new LinkNode({\n id: node.__id,\n fields: node.__fields,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'link'\n }\n\n static override importDOM(): DOMConversionMap | null {\n return {\n a: (node: Node) => ({\n conversion: $convertAnchorElement,\n priority: 1,\n }),\n }\n }\n\n static override importJSON(serializedNode: SerializedLinkNode): LinkNode {\n const node = $createLinkNode({}).updateFromJSON(serializedNode)\n\n /**\n * @todo remove this in 4.0\n */\n if (\n serializedNode.version === 1 &&\n typeof serializedNode.fields?.doc?.value === 'object' &&\n serializedNode.fields?.doc?.value?.id\n ) {\n serializedNode.fields.doc.value = serializedNode.fields.doc.value.id\n serializedNode.version = 2\n }\n\n if (serializedNode.version === 2 && !serializedNode.id) {\n serializedNode.id = new ObjectID.default().toHexString()\n serializedNode.version = 3\n }\n return node\n }\n\n override canBeEmpty(): false {\n return false\n }\n\n override canInsertTextAfter(): false {\n return false\n }\n\n override canInsertTextBefore(): false {\n return false\n }\n\n override createDOM(config: EditorConfig): HTMLAnchorElement {\n const element = document.createElement('a')\n if (this.__fields?.linkType === 'custom') {\n element.href = this.sanitizeUrl(this.__fields.url ?? '')\n }\n if (this.__fields?.newTab ?? false) {\n element.target = '_blank'\n }\n\n if (this.__fields?.newTab === true && this.__fields?.linkType === 'custom') {\n element.rel = manageRel(element.rel, 'add', 'noopener')\n }\n\n addClassNamesToElement(element, config.theme.link)\n return element\n }\n\n override exportJSON(): SerializedLinkNode {\n const fields = this.getFields()\n\n if (fields?.linkType === 'internal') {\n delete fields.url\n } else if (fields?.linkType === 'custom') {\n delete fields.doc\n }\n\n const returnObject: SerializedLinkNode = {\n ...super.exportJSON(),\n type: 'link',\n fields,\n version: 3,\n }\n const id = this.getID()\n if (id) {\n returnObject.id = id\n }\n return returnObject\n }\n\n override extractWithChild(\n child: LexicalNode,\n selection: BaseSelection,\n destination: 'clone' | 'html',\n ): boolean {\n if (!$isRangeSelection(selection)) {\n return false\n }\n\n const anchorNode = selection.anchor.getNode()\n const focusNode = selection.focus.getNode()\n\n return (\n this.isParentOf(anchorNode) &&\n this.isParentOf(focusNode) &&\n selection.getTextContent().length > 0\n )\n }\n\n getFields(): LinkFields {\n return this.getLatest().__fields\n }\n\n getID(): string {\n return this.getLatest().__id\n }\n\n override insertNewAfter(\n selection: RangeSelection,\n restoreSelection = true,\n ): ElementNodeType | null {\n const element = this.getParentOrThrow().insertNewAfter(selection, restoreSelection)\n if ($isElementNode(element)) {\n const linkNode = $createLinkNode({ fields: this.__fields })\n element.append(linkNode)\n return linkNode\n }\n return null\n }\n\n override isInline(): true {\n return true\n }\n\n sanitizeUrl(url: string): string {\n try {\n const parsedUrl = new URL(url)\n\n if (!SUPPORTED_URL_PROTOCOLS.has(parsedUrl.protocol)) {\n return 'about:blank'\n }\n } catch (e) {\n return 'https://'\n }\n return url\n }\n\n setFields(fields: LinkFields): this {\n const writable = this.getWritable()\n writable.__fields = fields\n return writable\n }\n\n setID(id: string): this {\n const writable = this.getWritable()\n writable.__id = id\n return writable\n }\n\n override updateDOM(prevNode: this, anchor: HTMLAnchorElement, config: EditorConfig): boolean {\n const url = this.__fields?.url\n const newTab = this.__fields?.newTab\n if (url != null && url !== prevNode.__fields?.url && this.__fields?.linkType === 'custom') {\n anchor.href = url\n }\n if (this.__fields?.linkType === 'internal' && prevNode.__fields?.linkType === 'custom') {\n anchor.removeAttribute('href')\n }\n\n // TODO: not 100% sure why we're settign rel to '' - revisit\n // Start rel config here, then check newTab below\n if (anchor.rel == null) {\n anchor.rel = ''\n }\n\n if (newTab !== prevNode.__fields?.newTab) {\n if (newTab ?? false) {\n anchor.target = '_blank'\n if (this.__fields?.linkType === 'custom') {\n anchor.rel = manageRel(anchor.rel, 'add', 'noopener')\n }\n } else {\n anchor.removeAttribute('target')\n anchor.rel = manageRel(anchor.rel, 'remove', 'noopener')\n }\n }\n\n return false\n }\n\n override updateFromJSON(serializedNode: LexicalUpdateJSON<SerializedLinkNode>): this {\n return super\n .updateFromJSON(serializedNode)\n .setFields(serializedNode.fields)\n .setID(serializedNode.id as string)\n }\n}\n\nfunction $convertAnchorElement(domNode: Node): DOMConversionOutput {\n let node: LinkNode | null = null\n if (isHTMLAnchorElement(domNode)) {\n const content = domNode.textContent\n if (content !== null && content !== '') {\n node = $createLinkNode({\n id: new ObjectID.default().toHexString(),\n fields: {\n doc: null,\n linkType: 'custom',\n newTab: domNode.getAttribute('target') === '_blank',\n url: domNode.getAttribute('href') ?? '',\n },\n })\n }\n }\n return { node }\n}\n\nexport function $createLinkNode({ id, fields }: { fields?: LinkFields; id?: string }): LinkNode {\n return $applyNodeReplacement(\n new LinkNode({\n id: id ?? new ObjectID.default().toHexString(),\n fields,\n }),\n )\n}\n\nexport function $isLinkNode(node: LexicalNode | null | undefined): node is LinkNode {\n return node instanceof LinkNode\n}\n\nexport const TOGGLE_LINK_COMMAND: LexicalCommand<LinkPayload | null> =\n createCommand('TOGGLE_LINK_COMMAND')\n\nexport function $toggleLink(payload: ({ fields: LinkFields } & LinkPayload) | null): void {\n const selection = $getSelection()\n\n if (!$isRangeSelection(selection) && (payload === null || !payload.selectedNodes?.length)) {\n return\n }\n const nodes = $isRangeSelection(selection)\n ? selection.extract()\n : payload === null\n ? []\n : payload.selectedNodes\n\n if (payload === null) {\n // Remove LinkNodes\n nodes?.forEach((node) => {\n const parent = node.getParent()\n\n if ($isLinkNode(parent)) {\n const children = parent.getChildren()\n\n children.forEach((child) => {\n parent.insertBefore(child)\n })\n\n parent.remove()\n }\n })\n\n return\n }\n // Add or merge LinkNodes\n if (nodes?.length === 1) {\n const firstNode = nodes[0]!\n // if the first node is a LinkNode or if its\n // parent is a LinkNode, we update the URL, target and rel.\n const linkNode: LinkNode | null = $isLinkNode(firstNode)\n ? firstNode\n : $getLinkAncestor(firstNode)\n if (linkNode !== null) {\n linkNode.setFields(payload.fields)\n\n if (payload.text != null && payload.text !== linkNode.getTextContent()) {\n // remove all children and add child with new textcontent:\n linkNode.append($createTextNode(payload.text))\n linkNode.getChildren().forEach((child) => {\n if (child !== linkNode.getLastChild()) {\n child.remove()\n }\n })\n }\n return\n }\n }\n\n let prevParent: ElementNodeType | LinkNode | null = null\n let linkNode: LinkNode | null = null\n\n nodes?.forEach((node) => {\n const parent = node.getParent()\n\n if (parent === linkNode || parent === null || ($isElementNode(node) && !node.isInline())) {\n return\n }\n\n if ($isLinkNode(parent)) {\n linkNode = parent\n parent.setFields(payload.fields)\n if (payload.text != null && payload.text !== parent.getTextContent()) {\n // remove all children and add child with new textcontent:\n parent.append($createTextNode(payload.text))\n parent.getChildren().forEach((child) => {\n if (child !== parent.getLastChild()) {\n child.remove()\n }\n })\n }\n return\n }\n\n if (!parent.is(prevParent)) {\n prevParent = parent\n linkNode = $createLinkNode({ fields: payload.fields })\n\n if ($isLinkNode(parent)) {\n if (node.getPreviousSibling() === null) {\n parent.insertBefore(linkNode)\n } else {\n parent.insertAfter(linkNode)\n }\n } else {\n node.insertBefore(linkNode)\n }\n }\n\n if ($isLinkNode(node)) {\n if (node.is(linkNode)) {\n return\n }\n if (linkNode !== null) {\n const children = node.getChildren()\n linkNode.append(...children)\n }\n\n node.remove()\n return\n }\n\n if (linkNode !== null) {\n linkNode.append(node)\n }\n })\n}\n\nfunction $getLinkAncestor(node: LexicalNode): LinkNode | null {\n return $getAncestor(node, (ancestor) => $isLinkNode(ancestor)) as LinkNode\n}\n\nfunction $getAncestor(\n node: LexicalNode,\n predicate: (ancestor: LexicalNode) => boolean,\n): LexicalNode | null {\n let parent: LexicalNode | null = node\n while (parent !== null) {\n parent = parent.getParent()\n if (parent === null || predicate(parent)) {\n break\n }\n }\n return parent\n}\n\nfunction manageRel(input: string, action: 'add' | 'remove', value: string): string {\n let result: string\n let mutableInput = `${input}`\n if (action === 'add') {\n // if we somehow got out of sync - clean up\n if (mutableInput.includes(value)) {\n const re = new RegExp(value, 'g')\n mutableInput = mutableInput.replace(re, '').trim()\n }\n mutableInput = mutableInput.trim()\n result = mutableInput.length === 0 ? `${value}` : `${mutableInput} ${value}`\n } else {\n const re = new RegExp(value, 'g')\n result = mutableInput.replace(re, '').trim()\n }\n return result\n}\n"],"mappings":"AAaA,SAASA,sBAAsB,EAAEC,mBAAmB,QAAQ;AAC5D,OAAOC,QAAA,MAAc;AACrB,SACEC,qBAAqB,EACrBC,eAAe,EACfC,aAAa,EACbC,cAAc,EACdC,iBAAiB,EACjBC,aAAa,EACbC,WAAW,QACN;AAKP,MAAMC,uBAAA,GAA0B,IAAIC,GAAA,CAAI,CAAC,SAAS,UAAU,WAAW,QAAQ,OAAO;AAEtF;AACA,OAAO,MAAMC,QAAA,SAAiBH,WAAA;EAC5BI,QAAA;EACAC,IAAA;EAEAC,YAAY;IACVC,EAAE;IACFC,MAAA,GAAS;MACPC,QAAA,EAAU;MACVC,MAAA,EAAQ;IACV,CAAC;IACDC;EAAG,CAKJ,EAAE;IACD,KAAK,CAACA,GAAA;IACN,IAAI,CAACP,QAAQ,GAAGI,MAAA;IAChB,IAAI,CAACH,IAAI,GAAGE,EAAA;EACd;EAEA,OAAgBK,MAAMC,IAAc,EAAY;IAC9C,OAAO,IAAIV,QAAA,CAAS;MAClBI,EAAA,EAAIM,IAAA,CAAKR,IAAI;MACbG,MAAA,EAAQK,IAAA,CAAKT,QAAQ;MACrBO,GAAA,EAAKE,IAAA,CAAKC;IACZ;EACF;EAEA,OAA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CAAUhB,MAAA,GAAS;MACxC;IACF;EACF;EACA,OAAOA,MAAA;AACT;AAEA,SAASnD,UAAUoE,KAAa,EAAEC,MAAwB,EAAErF,KAAa;EACvE,IAAIsF,MAAA;EACJ,IAAIC,YAAA,GAAe,GAAGH,KAAA,EAAO;EAC7B,IAAIC,MAAA,KAAW,OAAO;IACpB;IACA,IAAIE,YAAA,CAAaC,QAAQ,CAACxF,KAAA,GAAQ;MAChC,MAAMyF,EAAA,GAAK,IAAIC,MAAA,CAAO1F,KAAA,EAAO;MAC7BuF,YAAA,GAAeA,YAAA,CAAaI,OAAO,CAACF,EAAA,EAAI,IAAIG,IAAI;IAClD;IACAL,YAAA,GAAeA,YAAA,CAAaK,IAAI;IAChCN,MAAA,GAASC,YAAA,CAAapD,MAAM,KAAK,IAAI,GAAGnC,KAAA,EAAO,GAAG,GAAGuF,YAAA,IAAgBvF,KAAA,EAAO;EAC9E,OAAO;IACL,MAAMyF,EAAA,GAAK,IAAIC,MAAA,CAAO1F,KAAA,EAAO;IAC7BsF,MAAA,GAASC,YAAA,CAAaI,OAAO,CAACF,EAAA,EAAI,IAAIG,IAAI;EAC5C;EACA,OAAON,MAAA;AACT","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"LinkNode.js","names":["addClassNamesToElement","isHTMLAnchorElement","ObjectID","$applyNodeReplacement","$createTextNode","$getSelection","$isElementNode","$isRangeSelection","createCommand","ElementNode","SUPPORTED_URL_PROTOCOLS","Set","LinkNode","__fields","__id","constructor","id","fields","linkType","newTab","key","clone","node","__key","getType","importDOM","a","conversion","$convertAnchorElement","priority","importJSON","serializedNode","$createLinkNode","updateFromJSON","version","doc","value","default","toHexString","canBeEmpty","canInsertTextAfter","canInsertTextBefore","createDOM","config","element","document","createElement","href","sanitizeUrl","url","target","rel","manageRel","theme","link","exportJSON","getFields","returnObject","type","getID","extractWithChild","child","selection","destination","anchorNode","anchor","getNode","focusNode","focus","isParentOf","getTextContent","length","getLatest","insertNewAfter","restoreSelection","getParentOrThrow","linkNode","append","isInline","parsedUrl","URL","has","protocol","e","setFields","writable","getWritable","setID","updateDOM","prevNode","removeAttribute","domNode","content","textContent","getAttribute","$isLinkNode","TOGGLE_LINK_COMMAND","$toggleLink","payload","selectedNodes","nodes","extract","forEach","parent","getParent","children","getChildren","insertBefore","remove","firstNode","$getLinkAncestor","text","getLastChild","prevParent","is","getPreviousSibling","insertAfter","$getAncestor","ancestor","predicate","input","action","result","mutableInput","includes","re","RegExp","replace","trim"],"sources":["../../../../src/features/link/nodes/LinkNode.ts"],"sourcesContent":["import type {\n BaseSelection,\n DOMConversionMap,\n DOMConversionOutput,\n EditorConfig,\n ElementNode as ElementNodeType,\n LexicalCommand,\n LexicalNode,\n LexicalUpdateJSON,\n NodeKey,\n RangeSelection,\n} from 'lexical'\n\nimport { addClassNamesToElement, isHTMLAnchorElement } from '@lexical/utils'\nimport ObjectID from 'bson-objectid'\nimport {\n $applyNodeReplacement,\n $createTextNode,\n $getSelection,\n $isElementNode,\n $isRangeSelection,\n createCommand,\n ElementNode,\n} from 'lexical'\n\nimport type { LinkPayload } from '../client/plugins/floatingLinkEditor/types.js'\nimport type { LinkFields, SerializedLinkNode } from './types.js'\n\nconst SUPPORTED_URL_PROTOCOLS = new Set(['http:', 'https:', 'mailto:', 'sms:', 'tel:'])\n\n/** @noInheritDoc */\nexport class LinkNode extends ElementNode {\n __fields: LinkFields\n __id: string\n\n constructor({\n id,\n fields = {\n linkType: 'custom',\n newTab: false,\n },\n key,\n }: {\n fields?: LinkFields\n id: string\n key?: NodeKey\n }) {\n super(key)\n this.__fields = fields\n this.__id = id\n }\n\n static override clone(node: LinkNode): LinkNode {\n return new this({\n id: node.__id,\n fields: node.__fields,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'link'\n }\n\n static override importDOM(): DOMConversionMap | null {\n return {\n a: (node: Node) => ({\n conversion: $convertAnchorElement,\n priority: 1,\n }),\n }\n }\n\n static override importJSON(serializedNode: SerializedLinkNode): LinkNode {\n const node = $createLinkNode({}).updateFromJSON(serializedNode)\n\n /**\n * @todo remove this in 4.0\n */\n if (\n serializedNode.version === 1 &&\n typeof serializedNode.fields?.doc?.value === 'object' &&\n serializedNode.fields?.doc?.value?.id\n ) {\n serializedNode.fields.doc.value = serializedNode.fields.doc.value.id\n serializedNode.version = 2\n }\n\n if (serializedNode.version === 2 && !serializedNode.id) {\n serializedNode.id = new ObjectID.default().toHexString()\n serializedNode.version = 3\n }\n return node\n }\n\n override canBeEmpty(): false {\n return false\n }\n\n override canInsertTextAfter(): false {\n return false\n }\n\n override canInsertTextBefore(): false {\n return false\n }\n\n override createDOM(config: EditorConfig): HTMLAnchorElement {\n const element = document.createElement('a')\n if (this.__fields?.linkType === 'custom') {\n element.href = this.sanitizeUrl(this.__fields.url ?? '')\n }\n if (this.__fields?.newTab ?? false) {\n element.target = '_blank'\n }\n\n if (this.__fields?.newTab === true && this.__fields?.linkType === 'custom') {\n element.rel = manageRel(element.rel, 'add', 'noopener')\n }\n\n addClassNamesToElement(element, config.theme.link)\n return element\n }\n\n override exportJSON(): SerializedLinkNode {\n const fields = this.getFields()\n\n if (fields?.linkType === 'internal') {\n delete fields.url\n } else if (fields?.linkType === 'custom') {\n delete fields.doc\n }\n\n const returnObject: SerializedLinkNode = {\n ...super.exportJSON(),\n type: 'link',\n fields,\n version: 3,\n }\n const id = this.getID()\n if (id) {\n returnObject.id = id\n }\n return returnObject\n }\n\n override extractWithChild(\n child: LexicalNode,\n selection: BaseSelection,\n destination: 'clone' | 'html',\n ): boolean {\n if (!$isRangeSelection(selection)) {\n return false\n }\n\n const anchorNode = selection.anchor.getNode()\n const focusNode = selection.focus.getNode()\n\n return (\n this.isParentOf(anchorNode) &&\n this.isParentOf(focusNode) &&\n selection.getTextContent().length > 0\n )\n }\n\n getFields(): LinkFields {\n return this.getLatest().__fields\n }\n\n getID(): string {\n return this.getLatest().__id\n }\n\n override insertNewAfter(\n selection: RangeSelection,\n restoreSelection = true,\n ): ElementNodeType | null {\n const element = this.getParentOrThrow().insertNewAfter(selection, restoreSelection)\n if ($isElementNode(element)) {\n const linkNode = $createLinkNode({ fields: this.__fields })\n element.append(linkNode)\n return linkNode\n }\n return null\n }\n\n override isInline(): true {\n return true\n }\n\n sanitizeUrl(url: string): string {\n try {\n const parsedUrl = new URL(url)\n\n if (!SUPPORTED_URL_PROTOCOLS.has(parsedUrl.protocol)) {\n return 'about:blank'\n }\n } catch (e) {\n return 'https://'\n }\n return url\n }\n\n setFields(fields: LinkFields): this {\n const writable = this.getWritable()\n writable.__fields = fields\n return writable\n }\n\n setID(id: string): this {\n const writable = this.getWritable()\n writable.__id = id\n return writable\n }\n\n override updateDOM(prevNode: this, anchor: HTMLAnchorElement, config: EditorConfig): boolean {\n const url = this.__fields?.url\n const newTab = this.__fields?.newTab\n if (url != null && url !== prevNode.__fields?.url && this.__fields?.linkType === 'custom') {\n anchor.href = url\n }\n if (this.__fields?.linkType === 'internal' && prevNode.__fields?.linkType === 'custom') {\n anchor.removeAttribute('href')\n }\n\n // TODO: not 100% sure why we're settign rel to '' - revisit\n // Start rel config here, then check newTab below\n if (anchor.rel == null) {\n anchor.rel = ''\n }\n\n if (newTab !== prevNode.__fields?.newTab) {\n if (newTab ?? false) {\n anchor.target = '_blank'\n if (this.__fields?.linkType === 'custom') {\n anchor.rel = manageRel(anchor.rel, 'add', 'noopener')\n }\n } else {\n anchor.removeAttribute('target')\n anchor.rel = manageRel(anchor.rel, 'remove', 'noopener')\n }\n }\n\n return false\n }\n\n override updateFromJSON(serializedNode: LexicalUpdateJSON<SerializedLinkNode>): this {\n return super\n .updateFromJSON(serializedNode)\n .setFields(serializedNode.fields)\n .setID(serializedNode.id as string)\n }\n}\n\nfunction $convertAnchorElement(domNode: Node): DOMConversionOutput {\n let node: LinkNode | null = null\n if (isHTMLAnchorElement(domNode)) {\n const content = domNode.textContent\n if (content !== null && content !== '') {\n node = $createLinkNode({\n id: new ObjectID.default().toHexString(),\n fields: {\n doc: null,\n linkType: 'custom',\n newTab: domNode.getAttribute('target') === '_blank',\n url: domNode.getAttribute('href') ?? '',\n },\n })\n }\n }\n return { node }\n}\n\nexport function $createLinkNode({ id, fields }: { fields?: LinkFields; id?: string }): LinkNode {\n return $applyNodeReplacement(\n new LinkNode({\n id: id ?? new ObjectID.default().toHexString(),\n fields,\n }),\n )\n}\n\nexport function $isLinkNode(node: LexicalNode | null | undefined): node is LinkNode {\n return node instanceof LinkNode\n}\n\nexport const TOGGLE_LINK_COMMAND: LexicalCommand<LinkPayload | null> =\n createCommand('TOGGLE_LINK_COMMAND')\n\nexport function $toggleLink(payload: ({ fields: LinkFields } & LinkPayload) | null): void {\n const selection = $getSelection()\n\n if (!$isRangeSelection(selection) && (payload === null || !payload.selectedNodes?.length)) {\n return\n }\n const nodes = $isRangeSelection(selection)\n ? selection.extract()\n : payload === null\n ? []\n : payload.selectedNodes\n\n if (payload === null) {\n // Remove LinkNodes\n nodes?.forEach((node) => {\n const parent = node.getParent()\n\n if ($isLinkNode(parent)) {\n const children = parent.getChildren()\n\n children.forEach((child) => {\n parent.insertBefore(child)\n })\n\n parent.remove()\n }\n })\n\n return\n }\n // Add or merge LinkNodes\n if (nodes?.length === 1) {\n const firstNode = nodes[0]!\n // if the first node is a LinkNode or if its\n // parent is a LinkNode, we update the URL, target and rel.\n const linkNode: LinkNode | null = $isLinkNode(firstNode)\n ? firstNode\n : $getLinkAncestor(firstNode)\n if (linkNode !== null) {\n linkNode.setFields(payload.fields)\n\n if (payload.text != null && payload.text !== linkNode.getTextContent()) {\n // remove all children and add child with new textcontent:\n linkNode.append($createTextNode(payload.text))\n linkNode.getChildren().forEach((child) => {\n if (child !== linkNode.getLastChild()) {\n child.remove()\n }\n })\n }\n return\n }\n }\n\n let prevParent: ElementNodeType | LinkNode | null = null\n let linkNode: LinkNode | null = null\n\n nodes?.forEach((node) => {\n const parent = node.getParent()\n\n if (parent === linkNode || parent === null || ($isElementNode(node) && !node.isInline())) {\n return\n }\n\n if ($isLinkNode(parent)) {\n linkNode = parent\n parent.setFields(payload.fields)\n if (payload.text != null && payload.text !== parent.getTextContent()) {\n // remove all children and add child with new textcontent:\n parent.append($createTextNode(payload.text))\n parent.getChildren().forEach((child) => {\n if (child !== parent.getLastChild()) {\n child.remove()\n }\n })\n }\n return\n }\n\n if (!parent.is(prevParent)) {\n prevParent = parent\n linkNode = $createLinkNode({ fields: payload.fields })\n\n if ($isLinkNode(parent)) {\n if (node.getPreviousSibling() === null) {\n parent.insertBefore(linkNode)\n } else {\n parent.insertAfter(linkNode)\n }\n } else {\n node.insertBefore(linkNode)\n }\n }\n\n if ($isLinkNode(node)) {\n if (node.is(linkNode)) {\n return\n }\n if (linkNode !== null) {\n const children = node.getChildren()\n linkNode.append(...children)\n }\n\n node.remove()\n return\n }\n\n if (linkNode !== null) {\n linkNode.append(node)\n }\n })\n}\n\nfunction $getLinkAncestor(node: LexicalNode): LinkNode | null {\n return $getAncestor(node, (ancestor) => $isLinkNode(ancestor)) as LinkNode\n}\n\nfunction $getAncestor(\n node: LexicalNode,\n predicate: (ancestor: LexicalNode) => boolean,\n): LexicalNode | null {\n let parent: LexicalNode | null = node\n while (parent !== null) {\n parent = parent.getParent()\n if (parent === null || predicate(parent)) {\n break\n }\n }\n return parent\n}\n\nfunction manageRel(input: string, action: 'add' | 'remove', value: string): string {\n let result: string\n let mutableInput = `${input}`\n if (action === 'add') {\n // if we somehow got out of sync - clean up\n if (mutableInput.includes(value)) {\n const re = new RegExp(value, 'g')\n mutableInput = mutableInput.replace(re, '').trim()\n }\n mutableInput = mutableInput.trim()\n result = mutableInput.length === 0 ? `${value}` : `${mutableInput} ${value}`\n } else {\n const re = new RegExp(value, 'g')\n result = mutableInput.replace(re, '').trim()\n }\n return result\n}\n"],"mappings":"AAaA,SAASA,sBAAsB,EAAEC,mBAAmB,QAAQ;AAC5D,OAAOC,QAAA,MAAc;AACrB,SACEC,qBAAqB,EACrBC,eAAe,EACfC,aAAa,EACbC,cAAc,EACdC,iBAAiB,EAC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O;IAC7BsF,MAAA,GAASC,YAAA,CAAaI,OAAO,CAACF,EAAA,EAAI,IAAIG,IAAI;EAC5C;EACA,OAAON,MAAA;AACT","ignoreList":[]}
|
package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChG,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAGhC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChG,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAGhC,OAAO,EAAyB,aAAa,EAAE,MAAM,SAAS,CAAA;AAG9D,MAAM,MAAM,wBAAwB,GAAG;IACrC,QAAQ,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,8BAA8B,GAAG,MAAM,CACjD;IACE,IAAI,EAAE,wBAAwB,CAAA;CAC/B,EACD,qBAAqB,CACtB,CAAA;AAQD,oBAAoB;AACpB,qBAAa,oBAAqB,SAAQ,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC;IAClE,MAAM,EAAE,wBAAwB,CAAA;gBAEpB,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;QAAE,IAAI,EAAE,wBAAwB,CAAC;QAAC,GAAG,CAAC,EAAE,OAAO,CAAA;KAAE;WAK5D,KAAK,CAAC,IAAI,EAAE,oBAAoB,GAAG,oBAAoB;WAOvD,OAAO,IAAI,MAAM;WAIjB,UAAU,CAAC,cAAc,EAAE,8BAA8B,GAAG,oBAAoB;IAKhG,kBAAkB,IAAI,IAAI;IAI1B,mBAAmB,IAAI,IAAI;IAIlB,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,WAAW;IAM5C,QAAQ,IAAI,GAAG,CAAC,OAAO;IAIvB,UAAU,IAAI,8BAA8B;IAU5C,QAAQ,IAAI,OAAO;IAInB,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,WAAW,GAAG,OAAO;CAG9D;AAED,wBAAgB,2BAA2B,CAAC,EAC1C,IAAI,GACL,EAAE;IACD,IAAI,EAAE,wBAAwB,CAAA;CAC/B,GAAG,oBAAoB,CAMvB;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GACnC,IAAI,IAAI,oBAAoB,CAE9B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { addClassNamesToElement } from '@lexical/utils';
|
|
3
|
-
import { DecoratorNode } from 'lexical';
|
|
3
|
+
import { $applyNodeReplacement, DecoratorNode } from 'lexical';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
const Component = /*#__PURE__*/React.lazy(() => import('./Component.js').then(module => ({
|
|
6
6
|
default: module.UnknownConvertedNodeComponent
|
|
@@ -16,7 +16,7 @@ export class UnknownConvertedNode extends DecoratorNode {
|
|
|
16
16
|
this.__data = data;
|
|
17
17
|
}
|
|
18
18
|
static clone(node) {
|
|
19
|
-
return new
|
|
19
|
+
return new this({
|
|
20
20
|
data: node.__data,
|
|
21
21
|
key: node.__key
|
|
22
22
|
});
|
|
@@ -64,9 +64,9 @@ export class UnknownConvertedNode extends DecoratorNode {
|
|
|
64
64
|
export function $createUnknownConvertedNode({
|
|
65
65
|
data
|
|
66
66
|
}) {
|
|
67
|
-
return new UnknownConvertedNode({
|
|
67
|
+
return $applyNodeReplacement(new UnknownConvertedNode({
|
|
68
68
|
data
|
|
69
|
-
});
|
|
69
|
+
}));
|
|
70
70
|
}
|
|
71
71
|
export function $isUnknownConvertedNode(node) {
|
|
72
72
|
return node instanceof UnknownConvertedNode;
|
package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["addClassNamesToElement","DecoratorNode","React","Component","lazy","then","module","default","UnknownConvertedNodeComponent","UnknownConvertedNode","__data","constructor","data","key","clone","node","__key","getType","importJSON","serializedNode","$createUnknownConvertedNode","canInsertTextAfter","canInsertTextBefore","createDOM","config","element","document","createElement","decorate","_jsx","exportJSON","type","version","isInline","updateDOM","prevNode","dom","$isUnknownConvertedNode"],"sources":["../../../../../../src/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.tsx"],"sourcesContent":["import type { EditorConfig, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from 'lexical'\nimport type { JSX } from 'react'\n\nimport { addClassNamesToElement } from '@lexical/utils'\nimport { DecoratorNode } from 'lexical'\nimport * as React from 'react'\n\nexport type UnknownConvertedNodeData = {\n nodeData: unknown\n nodeType: string\n}\n\nexport type SerializedUnknownConvertedNode = Spread<\n {\n data: UnknownConvertedNodeData\n },\n SerializedLexicalNode\n>\n\nconst Component = React.lazy(() =>\n import('./Component.js').then((module) => ({\n default: module.UnknownConvertedNodeComponent,\n })),\n)\n\n/** @noInheritDoc */\nexport class UnknownConvertedNode extends DecoratorNode<JSX.Element> {\n __data: UnknownConvertedNodeData\n\n constructor({ data, key }: { data: UnknownConvertedNodeData; key?: NodeKey }) {\n super(key)\n this.__data = data\n }\n\n static override clone(node: UnknownConvertedNode): UnknownConvertedNode {\n return new
|
|
1
|
+
{"version":3,"file":"index.js","names":["addClassNamesToElement","$applyNodeReplacement","DecoratorNode","React","Component","lazy","then","module","default","UnknownConvertedNodeComponent","UnknownConvertedNode","__data","constructor","data","key","clone","node","__key","getType","importJSON","serializedNode","$createUnknownConvertedNode","canInsertTextAfter","canInsertTextBefore","createDOM","config","element","document","createElement","decorate","_jsx","exportJSON","type","version","isInline","updateDOM","prevNode","dom","$isUnknownConvertedNode"],"sources":["../../../../../../src/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.tsx"],"sourcesContent":["import type { EditorConfig, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from 'lexical'\nimport type { JSX } from 'react'\n\nimport { addClassNamesToElement } from '@lexical/utils'\nimport { $applyNodeReplacement, DecoratorNode } from 'lexical'\nimport * as React from 'react'\n\nexport type UnknownConvertedNodeData = {\n nodeData: unknown\n nodeType: string\n}\n\nexport type SerializedUnknownConvertedNode = Spread<\n {\n data: UnknownConvertedNodeData\n },\n SerializedLexicalNode\n>\n\nconst Component = React.lazy(() =>\n import('./Component.js').then((module) => ({\n default: module.UnknownConvertedNodeComponent,\n })),\n)\n\n/** @noInheritDoc */\nexport class UnknownConvertedNode extends DecoratorNode<JSX.Element> {\n __data: UnknownConvertedNodeData\n\n constructor({ data, key }: { data: UnknownConvertedNodeData; key?: NodeKey }) {\n super(key)\n this.__data = data\n }\n\n static override clone(node: UnknownConvertedNode): UnknownConvertedNode {\n return new this({\n data: node.__data,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'unknownConverted'\n }\n\n static override importJSON(serializedNode: SerializedUnknownConvertedNode): UnknownConvertedNode {\n const node = $createUnknownConvertedNode({ data: serializedNode.data })\n return node\n }\n\n canInsertTextAfter(): true {\n return true\n }\n\n canInsertTextBefore(): true {\n return true\n }\n\n override createDOM(config: EditorConfig): HTMLElement {\n const element = document.createElement('span')\n addClassNamesToElement(element, 'unknownConverted')\n return element\n }\n\n override decorate(): JSX.Element {\n return <Component data={this.__data} />\n }\n\n override exportJSON(): SerializedUnknownConvertedNode {\n return {\n type: this.getType(),\n data: this.__data,\n version: 1,\n }\n }\n\n // Mutation\n\n override isInline(): boolean {\n return true\n }\n\n override updateDOM(prevNode: this, dom: HTMLElement): boolean {\n return false\n }\n}\n\nexport function $createUnknownConvertedNode({\n data,\n}: {\n data: UnknownConvertedNodeData\n}): UnknownConvertedNode {\n return $applyNodeReplacement(\n new UnknownConvertedNode({\n data,\n }),\n )\n}\n\nexport function $isUnknownConvertedNode(\n node: LexicalNode | null | undefined,\n): node is UnknownConvertedNode {\n return node instanceof UnknownConvertedNode\n}\n"],"mappings":";AAGA,SAASA,sBAAsB,QAAQ;AACvC,SAASC,qBAAqB,EAAEC,aAAa,QAAQ;AACrD,YAAYC,KAAA,MAAW;AAcvB,MAAMC,SAAA,gBAAYD,KAAA,CAAME,IAAI,CAAC,MAC3B,MAAM,CAAC,kBAAkBC,IAAI,CAAEC,MAAA,KAAY;EACzCC,OAAA,EAASD,MAAA,CAAOE;AAClB;AAGF;AACA,OAAO,MAAMC,oBAAA,SAA6BR,aAAA;EACxCS,MAAA;EAEAC,YAAY;IAAEC,IAAI;IAAEC;EAAG,CAAqD,EAAE;IAC5E,KAAK,CAACA,GAAA;IACN,IAAI,CAACH,MAAM,GAAGE,IAAA;EAChB;EAEA,OAAgBE,MAAMC,IAA0B,EAAwB;IACtE,OAAO,IAAI,IAAI,CAAC;MACdH,IAAA,EAAMG,IAAA,CAAKL,MAAM;MACjBG,GAAA,EAAKE,IAAA,CAAKC;IACZ;EACF;EAEA,OAAgBC,QAAA,EAAkB;IAChC,OAAO;EACT;EAEA,OAAgBC,WAAWC,cAA8C,EAAwB;IAC/F,MAAMJ,IAAA,GAAOK,2BAAA,CAA4B;MAAER,IAAA,EAAMO,cAAA,CAAeP;IAAK;IACrE,OAAOG,IAAA;EACT;EAEAM,mBAAA,EAA2B;IACzB,OAAO;EACT;EAEAC,oBAAA,EAA4B;IAC1B,OAAO;EACT;EAESC,UAAUC,MAAoB,EAAe;IACpD,MAAMC,OAAA,GAAUC,QAAA,CAASC,aAAa,CAAC;IACvC5B,sBAAA,CAAuB0B,OAAA,EAAS;IAChC,OAAOA,OAAA;EACT;EAESG,SAAA,EAAwB;IAC/B,oBAAOC,IAAA,CAAC1B,SAAA;MAAUS,IAAA,EAAM,IAAI,CAACF;;EAC/B;EAESoB,WAAA,EAA6C;IACpD,OAAO;MACLC,IAAA,EAAM,IAAI,CAACd,OAAO;MAClBL,IAAA,EAAM,IAAI,CAACF,MAAM;MACjBsB,OAAA,EAAS;IACX;EACF;EAEA;EAESC,SAAA,EAAoB;IAC3B,OAAO;EACT;EAESC,UAAUC,QAAc,EAAEC,GAAgB,EAAW;IAC5D,OAAO;EACT;AACF;AAEA,OAAO,SAAShB,4BAA4B;EAC1CR;AAAI,CAGL;EACC,OAAOZ,qBAAA,CACL,IAAIS,oBAAA,CAAqB;IACvBG;EACF;AAEJ;AAEA,OAAO,SAASyB,wBACdtB,IAAoC;EAEpC,OAAOA,IAAA,YAAgBN,oBAAA;AACzB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChG,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAGhC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,OAAO,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChG,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAGhC,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
|
-
import { DecoratorNode } from 'lexical';
|
|
3
|
+
import { $applyNodeReplacement, DecoratorNode } from 'lexical';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
const Component = /*#__PURE__*/React.lazy(() => import('./Component.js').then(module => ({
|
|
6
6
|
default: module.UnknownConvertedNodeComponent
|
|
@@ -16,7 +16,7 @@ export class UnknownConvertedNode extends DecoratorNode {
|
|
|
16
16
|
this.__data = data;
|
|
17
17
|
}
|
|
18
18
|
static clone(node) {
|
|
19
|
-
return new
|
|
19
|
+
return new this({
|
|
20
20
|
data: node.__data,
|
|
21
21
|
key: node.__key
|
|
22
22
|
});
|
|
@@ -64,9 +64,9 @@ export class UnknownConvertedNode extends DecoratorNode {
|
|
|
64
64
|
export function $createUnknownConvertedNode({
|
|
65
65
|
data
|
|
66
66
|
}) {
|
|
67
|
-
return new UnknownConvertedNode({
|
|
67
|
+
return $applyNodeReplacement(new UnknownConvertedNode({
|
|
68
68
|
data
|
|
69
|
-
});
|
|
69
|
+
}));
|
|
70
70
|
}
|
|
71
71
|
export function $isUnknownConvertedNode(node) {
|
|
72
72
|
return node instanceof UnknownConvertedNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["addClassNamesToElement","DecoratorNode","React","Component","lazy","then","module","default","UnknownConvertedNodeComponent","UnknownConvertedNode","__data","constructor","data","key","clone","node","__key","getType","importJSON","serializedNode","$createUnknownConvertedNode","canInsertTextAfter","canInsertTextBefore","createDOM","config","element","document","createElement","decorate","_jsx","exportJSON","type","version","isInline","updateDOM","prevNode","dom","$isUnknownConvertedNode"],"sources":["../../../../../../src/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.tsx"],"sourcesContent":["import type { EditorConfig, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from 'lexical'\nimport type { JSX } from 'react'\n\nimport { addClassNamesToElement } from '@lexical/utils'\nimport { DecoratorNode } from 'lexical'\nimport * as React from 'react'\n\nexport type UnknownConvertedNodeData = {\n nodeData: unknown\n nodeType: string\n}\n\nexport type SerializedUnknownConvertedNode = Spread<\n {\n data: UnknownConvertedNodeData\n },\n SerializedLexicalNode\n>\n\nconst Component = React.lazy(() =>\n import('./Component.js').then((module) => ({\n default: module.UnknownConvertedNodeComponent,\n })),\n)\n\n/** @noInheritDoc */\nexport class UnknownConvertedNode extends DecoratorNode<JSX.Element> {\n __data: UnknownConvertedNodeData\n\n constructor({ data, key }: { data: UnknownConvertedNodeData; key?: NodeKey }) {\n super(key)\n this.__data = data\n }\n\n static override clone(node: UnknownConvertedNode): UnknownConvertedNode {\n return new
|
|
1
|
+
{"version":3,"file":"index.js","names":["addClassNamesToElement","$applyNodeReplacement","DecoratorNode","React","Component","lazy","then","module","default","UnknownConvertedNodeComponent","UnknownConvertedNode","__data","constructor","data","key","clone","node","__key","getType","importJSON","serializedNode","$createUnknownConvertedNode","canInsertTextAfter","canInsertTextBefore","createDOM","config","element","document","createElement","decorate","_jsx","exportJSON","type","version","isInline","updateDOM","prevNode","dom","$isUnknownConvertedNode"],"sources":["../../../../../../src/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.tsx"],"sourcesContent":["import type { EditorConfig, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from 'lexical'\nimport type { JSX } from 'react'\n\nimport { addClassNamesToElement } from '@lexical/utils'\nimport { $applyNodeReplacement, DecoratorNode } from 'lexical'\nimport * as React from 'react'\n\nexport type UnknownConvertedNodeData = {\n nodeData: unknown\n nodeType: string\n}\n\nexport type SerializedUnknownConvertedNode = Spread<\n {\n data: UnknownConvertedNodeData\n },\n SerializedLexicalNode\n>\n\nconst Component = React.lazy(() =>\n import('./Component.js').then((module) => ({\n default: module.UnknownConvertedNodeComponent,\n })),\n)\n\n/** @noInheritDoc */\nexport class UnknownConvertedNode extends DecoratorNode<JSX.Element> {\n __data: UnknownConvertedNodeData\n\n constructor({ data, key }: { data: UnknownConvertedNodeData; key?: NodeKey }) {\n super(key)\n this.__data = data\n }\n\n static override clone(node: UnknownConvertedNode): UnknownConvertedNode {\n return new this({\n data: node.__data,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'unknownConverted'\n }\n\n static override importJSON(serializedNode: SerializedUnknownConvertedNode): UnknownConvertedNode {\n const node = $createUnknownConvertedNode({ data: serializedNode.data })\n return node\n }\n\n canInsertTextAfter(): true {\n return true\n }\n\n canInsertTextBefore(): true {\n return true\n }\n\n override createDOM(config: EditorConfig): HTMLElement {\n const element = document.createElement('span')\n addClassNamesToElement(element, 'unknownConverted')\n return element\n }\n\n override decorate(): JSX.Element {\n return <Component data={this.__data} />\n }\n\n override exportJSON(): SerializedUnknownConvertedNode {\n return {\n type: this.getType(),\n data: this.__data,\n version: 1,\n }\n }\n\n // Mutation\n\n override isInline(): boolean {\n return true\n }\n\n override updateDOM(prevNode: this, dom: HTMLElement): boolean {\n return false\n }\n}\n\nexport function $createUnknownConvertedNode({\n data,\n}: {\n data: UnknownConvertedNodeData\n}): UnknownConvertedNode {\n return $applyNodeReplacement(\n new UnknownConvertedNode({\n data,\n }),\n )\n}\n\nexport function $isUnknownConvertedNode(\n node: LexicalNode | null | undefined,\n): node is UnknownConvertedNode {\n return node instanceof UnknownConvertedNode\n}\n"],"mappings":";AAGA,SAASA,sBAAsB,QAAQ;AACvC,SAASC,qBAAqB,EAAEC,aAAa,QAAQ;AACrD,YAAYC,KAAA,MAAW;AAcvB,MAAMC,SAAA,gBAAYD,KAAA,CAAME,IAAI,CAAC,MAC3B,MAAM,CAAC,kBAAkBC,IAAI,CAAEC,MAAA,KAAY;EACzCC,OAAA,EAASD,MAAA,CAAOE;AAClB;AAGF;AACA,OAAO,MAAMC,oBAAA,SAA6BR,aAAA;EACxCS,MAAA;EAEAC,YAAY;IAAEC,IAAI;IAAEC;EAAG,CAAqD,EAAE;IAC5E,KAAK,CAACA,GAAA;IACN,IAAI,CAACH,MAAM,GAAGE,IAAA;EAChB;EAEA,OAAgBE,MAAMC,IAA0B,EAAwB;IACtE,OAAO,IAAI,IAAI,CAAC;MACdH,IAAA,EAAMG,IAAA,CAAKL,MAAM;MACjBG,GAAA,EAAKE,IAAA,CAAKC;IACZ;EACF;EAEA,OAAgBC,QAAA,EAAkB;IAChC,OAAO;EACT;EAEA,OAAgBC,WAAWC,cAA8C,EAAwB;IAC/F,MAAMJ,IAAA,GAAOK,2BAAA,CAA4B;MAAER,IAAA,EAAMO,cAAA,CAAeP;IAAK;IACrE,OAAOG,IAAA;EACT;EAEAM,mBAAA,EAA2B;IACzB,OAAO;EACT;EAEAC,oBAAA,EAA4B;IAC1B,OAAO;EACT;EAESC,UAAUC,MAAoB,EAAe;IACpD,MAAMC,OAAA,GAAUC,QAAA,CAASC,aAAa,CAAC;IACvC5B,sBAAA,CAAuB0B,OAAA,EAAS;IAChC,OAAOA,OAAA;EACT;EAESG,SAAA,EAAwB;IAC/B,oBAAOC,IAAA,CAAC1B,SAAA;MAAUS,IAAA,EAAM,IAAI,CAACF;;EAC/B;EAESoB,WAAA,EAA6C;IACpD,OAAO;MACLC,IAAA,EAAM,IAAI,CAACd,OAAO;MAClBL,IAAA,EAAM,IAAI,CAACF,MAAM;MACjBsB,OAAA,EAAS;IACX;EACF;EAEA;EAESC,SAAA,EAAoB;IAC3B,OAAO;EACT;EAESC,UAAUC,QAAc,EAAEC,GAAgB,EAAW;IAC5D,OAAO;EACT;AACF;AAEA,OAAO,SAAShB,4BAA4B;EAC1CR;AAAI,CAGL;EACC,OAAOZ,qBAAA,CACL,IAAIS,oBAAA,CAAqB;IACvBG;EACF;AAEJ;AAEA,OAAO,SAASyB,wBACdtB,IAAoC;EAEpC,OAAOA,IAAA,YAAgBN,oBAAA;AACzB","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DOMConversionMap, EditorConfig, LexicalEditor, LexicalNode } from 'lexical';
|
|
2
1
|
import type { JSX } from 'react';
|
|
2
|
+
import { type DOMConversionMap, type EditorConfig, type LexicalEditor, type LexicalNode } from 'lexical';
|
|
3
3
|
import type { RelationshipData, SerializedRelationshipNode } from '../../server/nodes/RelationshipNode.js';
|
|
4
4
|
import { RelationshipServerNode } from '../../server/nodes/RelationshipNode.js';
|
|
5
5
|
export declare class RelationshipNode extends RelationshipServerNode {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RelationshipNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/relationship/client/nodes/RelationshipNode.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"RelationshipNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/relationship/client/nodes/RelationshipNode.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,EAEL,KAAK,gBAAgB,EAErB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,SAAS,CAAA;AAGhB,OAAO,KAAK,EACV,gBAAgB,EAChB,0BAA0B,EAC3B,MAAM,wCAAwC,CAAA;AAE/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,wCAAwC,CAAA;AAsB/E,qBAAa,gBAAiB,SAAQ,sBAAsB;WAC1C,KAAK,CAAC,IAAI,EAAE,sBAAsB,GAAG,sBAAsB;WAI3D,OAAO,IAAI,MAAM;WAIjB,SAAS,IAAI,gBAAgB,CAAC,cAAc,CAAC,GAAG,IAAI;WAiBpD,UAAU,CAAC,cAAc,EAAE,0BAA0B,GAAG,gBAAgB;IAc/E,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO;IAWlE,UAAU,IAAI,0BAA0B;CAGlD;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,gBAAgB,GAAG,gBAAgB,CAMhF;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,gBAAgB,GAAG,SAAS,GACtD,IAAI,IAAI,gBAAgB,CAE1B"}
|