@payloadcms/richtext-lexical 3.90.2 → 3.91.0-internal.07e4582
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/Field-5ZXLEL3U.js +2 -0
- package/dist/exports/client/{Field-YZR46UCY.js.map → Field-5ZXLEL3U.js.map} +3 -3
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/{chunk-XFA5M7FY.js → chunk-IIZYDMRJ.js} +2 -2
- package/dist/exports/client/chunk-IIZYDMRJ.js.map +7 -0
- package/dist/exports/client/componentInline-YMJQCGVL.js +2 -0
- package/dist/exports/client/index.js +17 -17
- package/dist/exports/client/index.js.map +3 -3
- package/dist/features/blocks/client/component/index.d.ts.map +1 -1
- package/dist/features/blocks/client/component/index.js +6 -6
- package/dist/features/blocks/client/component/index.js.map +1 -1
- package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
- package/dist/features/blocks/client/componentInline/index.js +3 -3
- package/dist/features/blocks/client/componentInline/index.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts +2 -0
- package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts.map +1 -1
- package/dist/lexical/plugins/NodeViewOverridePlugin/index.js +23 -0
- package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +1 -1
- package/dist/lexical/plugins/NodeViewOverridePlugin/index.spec.js +51 -0
- package/dist/lexical/plugins/NodeViewOverridePlugin/index.spec.js.map +1 -0
- package/package.json +6 -6
- package/dist/exports/client/Field-YZR46UCY.js +0 -2
- package/dist/exports/client/chunk-XFA5M7FY.js.map +0 -7
- package/dist/exports/client/componentInline-A4H3EY3L.js +0 -2
- /package/dist/exports/client/{componentInline-A4H3EY3L.js.map → componentInline-YMJQCGVL.js.map} +0 -0
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
|
|
2
|
+
export declare function refreshBlockDecorators(editor: ReturnType<typeof useLexicalComposerContext>[0]): void;
|
|
1
3
|
export declare function NodeViewOverridePlugin(): null;
|
|
2
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lexical/plugins/NodeViewOverridePlugin/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lexical/plugins/NodeViewOverridePlugin/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAA;AAUpF,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC,CAAC,CAAC,GACtD,IAAI,CAkBN;AAED,wBAAgB,sBAAsB,IAAI,IAAI,CAwB7C"}
|
|
@@ -2,9 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
4
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
|
|
5
|
+
import { $getRoot, HISTORY_MERGE_TAG } from 'lexical';
|
|
5
6
|
import { useEffect } from 'react';
|
|
6
7
|
import { useRichTextView } from '../../../field/RichTextViewProvider.js';
|
|
7
8
|
import { clearEditorNodeViews, registerEditorNodeViews } from '../../nodes/index.js';
|
|
9
|
+
// `LexicalComposer` re-mounts with a new `editor` whenever `currentView` changes,
|
|
10
|
+
// so decorator nodes run their initial `decorate()` before this effect registers the view's overrides.
|
|
11
|
+
// Mark existing block decorators dirty after registering so they re-decorate with the resolved custom `Block` component.
|
|
12
|
+
export function refreshBlockDecorators(editor) {
|
|
13
|
+
editor.update(() => {
|
|
14
|
+
const walk = node => {
|
|
15
|
+
const type = node.getType();
|
|
16
|
+
if (type === 'block' || type === 'inlineBlock') {
|
|
17
|
+
node.markDirty();
|
|
18
|
+
}
|
|
19
|
+
if ('getChildren' in node && typeof node.getChildren === 'function') {
|
|
20
|
+
for (const child of node.getChildren()) {
|
|
21
|
+
walk(child);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
walk($getRoot());
|
|
26
|
+
}, {
|
|
27
|
+
tag: HISTORY_MERGE_TAG
|
|
28
|
+
});
|
|
29
|
+
}
|
|
8
30
|
export function NodeViewOverridePlugin() {
|
|
9
31
|
const $ = _c(5);
|
|
10
32
|
const [editor] = useLexicalComposerContext();
|
|
@@ -31,6 +53,7 @@ export function NodeViewOverridePlugin() {
|
|
|
31
53
|
registerEditorNodeViews(editor, views[currentView]?.nodes);
|
|
32
54
|
}
|
|
33
55
|
}
|
|
56
|
+
refreshBlockDecorators(editor);
|
|
34
57
|
};
|
|
35
58
|
t1 = [editor, views, currentView];
|
|
36
59
|
$[0] = currentView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","useEffect","useRichTextView","clearEditorNodeViews","registerEditorNodeViews","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$getRoot","HISTORY_MERGE_TAG","useEffect","useRichTextView","clearEditorNodeViews","registerEditorNodeViews","refreshBlockDecorators","editor","update","walk","node","type","getType","markDirty","getChildren","child","tag","NodeViewOverridePlugin","$","currentView","views","t0","t1","default","nodes"],"sources":["../../../../src/lexical/plugins/NodeViewOverridePlugin/index.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $getRoot, HISTORY_MERGE_TAG, type LexicalNode } from 'lexical'\nimport { useEffect } from 'react'\n\nimport { useRichTextView } from '../../../field/RichTextViewProvider.js'\nimport { clearEditorNodeViews, registerEditorNodeViews } from '../../nodes/index.js'\n\n// `LexicalComposer` re-mounts with a new `editor` whenever `currentView` changes,\n// so decorator nodes run their initial `decorate()` before this effect registers the view's overrides.\n// Mark existing block decorators dirty after registering so they re-decorate with the resolved custom `Block` component.\nexport function refreshBlockDecorators(\n editor: ReturnType<typeof useLexicalComposerContext>[0],\n): void {\n editor.update(\n () => {\n const walk = (node: LexicalNode): void => {\n const type = node.getType()\n if (type === 'block' || type === 'inlineBlock') {\n node.markDirty()\n }\n if ('getChildren' in node && typeof node.getChildren === 'function') {\n for (const child of node.getChildren() as LexicalNode[]) {\n walk(child)\n }\n }\n }\n walk($getRoot())\n },\n { tag: HISTORY_MERGE_TAG },\n )\n}\n\nexport function NodeViewOverridePlugin(): null {\n const [editor] = useLexicalComposerContext()\n const { currentView, views } = useRichTextView()\n\n useEffect(() => {\n if (!views) {\n return\n }\n\n if (currentView === 'default') {\n if (views.default) {\n registerEditorNodeViews(editor, views.default?.nodes)\n } else {\n clearEditorNodeViews(editor)\n }\n } else if (views[currentView]) {\n clearEditorNodeViews(editor)\n registerEditorNodeViews(editor, views[currentView]?.nodes)\n }\n\n refreshBlockDecorators(editor)\n }, [editor, views, currentView])\n\n return null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AACA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,QAAQ,EAAEC,iBAAiB,QAA0B;AAC9D,SAASC,SAAS,QAAQ;AAE1B,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,EAAEC,uBAAuB,QAAQ;AAE9D;AACA;AACA;AACA,OAAO,SAASC,uBACdC,MAAuD;EAEvDA,MAAA,CAAOC,MAAM,CACX;IACE,MAAMC,IAAA,GAAQC,IAAA;MACZ,MAAMC,IAAA,GAAOD,IAAA,CAAKE,OAAO;MACzB,IAAID,IAAA,KAAS,WAAWA,IAAA,KAAS,eAAe;QAC9CD,IAAA,CAAKG,SAAS;MAChB;MACA,IAAI,iBAAiBH,IAAA,IAAQ,OAAOA,IAAA,CAAKI,WAAW,KAAK,YAAY;QACnE,KAAK,MAAMC,KAAA,IAASL,IAAA,CAAKI,WAAW,IAAqB;UACvDL,IAAA,CAAKM,KAAA;QACP;MACF;IACF;IACAN,IAAA,CAAKT,QAAA;EACP,GACA;IAAEgB,GAAA,EAAKf;EAAkB;AAE7B;AAEA,OAAO,SAAAgB,uBAAA;EAAA,MAAAC,CAAA,GAAApB,EAAA;EACL,OAAAS,MAAA,IAAiBR,yBAAA;EACjB;IAAAoB,WAAA;IAAAC;EAAA,IAA+BjB,eAAA;EAAA,IAAAkB,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAJ,CAAA,QAAAC,WAAA,IAAAD,CAAA,QAAAX,MAAA,IAAAW,CAAA,QAAAE,KAAA;IAErBC,EAAA,GAAAA,CAAA;MAAA,KACHD,KAAA;QAAA;MAAA;MAAA,IAIDD,WAAA,KAAgB;QAAA,IACdC,KAAA,CAAAG,OAAA;UACFlB,uBAAA,CAAwBE,MAAA,EAAQa,KAAA,CAAAG,OAAA,EAAAC,KAAe;QAAA;UAE/CpB,oBAAA,CAAqBG,MAAA;QAAA;MAAA;QAAA,IAEda,KAAK,CAACD,WAAA;UACff,oBAAA,CAAqBG,MAAA;UACrBF,uBAAA,CAAwBE,MAAA,EAAQa,KAAK,CAACD,WAAA,GAAAK,KAAc;QAAA;MAAA;MAGtDlB,sBAAA,CAAuBC,MAAA;IAAA;IACtBe,EAAA,IAACf,MAAA,EAAQa,KAAA,EAAOD,WAAA;IAAYD,CAAA,MAAAC,WAAA;IAAAD,CAAA,MAAAX,MAAA;IAAAW,CAAA,MAAAE,KAAA;IAAAF,CAAA,MAAAG,EAAA;IAAAH,CAAA,MAAAI,EAAA;EAAA;IAAAD,EAAA,GAAAH,CAAA;IAAAI,EAAA,GAAAJ,CAAA;EAAA;EAjB/BhB,SAAA,CAAUmB,EAiBV,EAAGC,EAA4B;EAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { $createParagraphNode, $getRoot, createEditor, HISTORY_MERGE_TAG, ParagraphNode } from 'lexical';
|
|
3
|
+
import { describe, expect, it } from 'vitest';
|
|
4
|
+
import { $createBlockNode, BlockNode } from '../../../features/blocks/client/nodes/BlocksNode.js';
|
|
5
|
+
import { $createInlineBlockNode, InlineBlockNode } from '../../../features/blocks/client/nodes/InlineBlocksNode.js';
|
|
6
|
+
import { refreshBlockDecorators } from './index.js';
|
|
7
|
+
describe('refreshBlockDecorators', () => {
|
|
8
|
+
it('should mark existing block and inline block decorators dirty with the history merge tag', async () => {
|
|
9
|
+
const editor = createEditor({
|
|
10
|
+
namespace: 'node-view-override-plugin-test',
|
|
11
|
+
nodes: [BlockNode, InlineBlockNode, ParagraphNode],
|
|
12
|
+
onError: error => {
|
|
13
|
+
throw error;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
const rootElement = document.createElement('div');
|
|
17
|
+
document.body.append(rootElement);
|
|
18
|
+
editor.setRootElement(rootElement);
|
|
19
|
+
let blockKey = '';
|
|
20
|
+
let inlineBlockKey = '';
|
|
21
|
+
editor.update(() => {
|
|
22
|
+
const block = $createBlockNode({
|
|
23
|
+
blockName: '',
|
|
24
|
+
blockType: 'testBlock'
|
|
25
|
+
});
|
|
26
|
+
blockKey = block.getKey();
|
|
27
|
+
const inlineBlock = $createInlineBlockNode({
|
|
28
|
+
blockName: '',
|
|
29
|
+
blockType: 'testInlineBlock'
|
|
30
|
+
});
|
|
31
|
+
inlineBlockKey = inlineBlock.getKey();
|
|
32
|
+
const paragraph = $createParagraphNode().append(inlineBlock);
|
|
33
|
+
$getRoot().append(block, paragraph);
|
|
34
|
+
}, {
|
|
35
|
+
discrete: true
|
|
36
|
+
});
|
|
37
|
+
const updateTags = new Promise(resolve => {
|
|
38
|
+
editor.registerUpdateListener(({
|
|
39
|
+
dirtyLeaves,
|
|
40
|
+
tags
|
|
41
|
+
}) => {
|
|
42
|
+
if (dirtyLeaves.has(blockKey) && dirtyLeaves.has(inlineBlockKey)) {
|
|
43
|
+
resolve(tags);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
refreshBlockDecorators(editor);
|
|
48
|
+
await expect(updateTags).resolves.toContain(HISTORY_MERGE_TAG);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=index.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.spec.js","names":["$createParagraphNode","$getRoot","createEditor","HISTORY_MERGE_TAG","ParagraphNode","describe","expect","it","$createBlockNode","BlockNode","$createInlineBlockNode","InlineBlockNode","refreshBlockDecorators","editor","namespace","nodes","onError","error","rootElement","document","createElement","body","append","setRootElement","blockKey","inlineBlockKey","update","block","blockName","blockType","getKey","inlineBlock","paragraph","discrete","updateTags","Promise","resolve","registerUpdateListener","dirtyLeaves","tags","has","resolves","toContain"],"sources":["../../../../src/lexical/plugins/NodeViewOverridePlugin/index.spec.ts"],"sourcesContent":["// @vitest-environment jsdom\n\nimport {\n $createParagraphNode,\n $getRoot,\n createEditor,\n HISTORY_MERGE_TAG,\n ParagraphNode,\n} from 'lexical'\nimport { describe, expect, it } from 'vitest'\n\nimport { $createBlockNode, BlockNode } from '../../../features/blocks/client/nodes/BlocksNode.js'\nimport {\n $createInlineBlockNode,\n InlineBlockNode,\n} from '../../../features/blocks/client/nodes/InlineBlocksNode.js'\nimport { refreshBlockDecorators } from './index.js'\n\ndescribe('refreshBlockDecorators', () => {\n it('should mark existing block and inline block decorators dirty with the history merge tag', async () => {\n const editor = createEditor({\n namespace: 'node-view-override-plugin-test',\n nodes: [BlockNode, InlineBlockNode, ParagraphNode],\n onError: (error) => {\n throw error\n },\n })\n const rootElement = document.createElement('div')\n document.body.append(rootElement)\n editor.setRootElement(rootElement)\n let blockKey = ''\n let inlineBlockKey = ''\n\n editor.update(\n () => {\n const block = $createBlockNode({\n blockName: '',\n blockType: 'testBlock',\n })\n blockKey = block.getKey()\n const inlineBlock = $createInlineBlockNode({\n blockName: '',\n blockType: 'testInlineBlock',\n })\n inlineBlockKey = inlineBlock.getKey()\n const paragraph = $createParagraphNode().append(inlineBlock)\n $getRoot().append(block, paragraph)\n },\n { discrete: true },\n )\n\n const updateTags = new Promise<Set<string>>((resolve) => {\n editor.registerUpdateListener(({ dirtyLeaves, tags }) => {\n if (dirtyLeaves.has(blockKey) && dirtyLeaves.has(inlineBlockKey)) {\n resolve(tags)\n }\n })\n })\n\n refreshBlockDecorators(editor)\n\n await expect(updateTags).resolves.toContain(HISTORY_MERGE_TAG)\n })\n})\n"],"mappings":"AAAA;AAEA,SACEA,oBAAoB,EACpBC,QAAQ,EACRC,YAAY,EACZC,iBAAiB,EACjBC,aAAa,QACR;AACP,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ;AAErC,SAASC,gBAAgB,EAAEC,SAAS,QAAQ;AAC5C,SACEC,sBAAsB,EACtBC,eAAe,QACV;AACP,SAASC,sBAAsB,QAAQ;AAEvCP,QAAA,CAAS,0BAA0B;EACjCE,EAAA,CAAG,2FAA2F;IAC5F,MAAMM,MAAA,GAASX,YAAA,CAAa;MAC1BY,SAAA,EAAW;MACXC,KAAA,EAAO,CAACN,SAAA,EAAWE,eAAA,EAAiBP,aAAA,CAAc;MAClDY,OAAA,EAAUC,KAAA;QACR,MAAMA,KAAA;MACR;IACF;IACA,MAAMC,WAAA,GAAcC,QAAA,CAASC,aAAa,CAAC;IAC3CD,QAAA,CAASE,IAAI,CAACC,MAAM,CAACJ,WAAA;IACrBL,MAAA,CAAOU,cAAc,CAACL,WAAA;IACtB,IAAIM,QAAA,GAAW;IACf,IAAIC,cAAA,GAAiB;IAErBZ,MAAA,CAAOa,MAAM,CACX;MACE,MAAMC,KAAA,GAAQnB,gBAAA,CAAiB;QAC7BoB,SAAA,EAAW;QACXC,SAAA,EAAW;MACb;MACAL,QAAA,GAAWG,KAAA,CAAMG,MAAM;MACvB,MAAMC,WAAA,GAAcrB,sBAAA,CAAuB;QACzCkB,SAAA,EAAW;QACXC,SAAA,EAAW;MACb;MACAJ,cAAA,GAAiBM,WAAA,CAAYD,MAAM;MACnC,MAAME,SAAA,GAAYhC,oBAAA,GAAuBsB,MAAM,CAACS,WAAA;MAChD9B,QAAA,GAAWqB,MAAM,CAACK,KAAA,EAAOK,SAAA;IAC3B,GACA;MAAEC,QAAA,EAAU;IAAK;IAGnB,MAAMC,UAAA,GAAa,IAAIC,OAAA,CAAsBC,OAAA;MAC3CvB,MAAA,CAAOwB,sBAAsB,CAAC,CAAC;QAAEC,WAAW;QAAEC;MAAI,CAAE;QAClD,IAAID,WAAA,CAAYE,GAAG,CAAChB,QAAA,KAAac,WAAA,CAAYE,GAAG,CAACf,cAAA,GAAiB;UAChEW,OAAA,CAAQG,IAAA;QACV;MACF;IACF;IAEA3B,sBAAA,CAAuBC,MAAA;IAEvB,MAAMP,MAAA,CAAO4B,UAAA,EAAYO,QAAQ,CAACC,SAAS,CAACvC,iBAAA;EAC9C;AACF","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/richtext-lexical",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.91.0-internal.07e4582",
|
|
4
4
|
"description": "The officially supported Lexical richtext adapter for Payload",
|
|
5
5
|
"homepage": "https://payloadcms.com",
|
|
6
6
|
"repository": {
|
|
@@ -448,8 +448,8 @@
|
|
|
448
448
|
"react-error-boundary": "4.1.2",
|
|
449
449
|
"ts-essentials": "10.0.3",
|
|
450
450
|
"uuid": "13.0.2",
|
|
451
|
-
"@payloadcms/
|
|
452
|
-
"@payloadcms/
|
|
451
|
+
"@payloadcms/ui": "3.91.0-internal.07e4582",
|
|
452
|
+
"@payloadcms/translations": "3.91.0-internal.07e4582"
|
|
453
453
|
},
|
|
454
454
|
"devDependencies": {
|
|
455
455
|
"@babel/cli": "7.27.2",
|
|
@@ -468,7 +468,7 @@
|
|
|
468
468
|
"esbuild": "0.27.1",
|
|
469
469
|
"esbuild-sass-plugin": "3.3.1",
|
|
470
470
|
"swc-plugin-transform-remove-imports": "8.3.0",
|
|
471
|
-
"payload": "3.
|
|
471
|
+
"payload": "3.91.0-internal.07e4582",
|
|
472
472
|
"@payloadcms/eslint-config": "3.28.0"
|
|
473
473
|
},
|
|
474
474
|
"peerDependencies": {
|
|
@@ -476,8 +476,8 @@
|
|
|
476
476
|
"@faceless-ui/scroll-info": "2.0.0",
|
|
477
477
|
"react": "^19.0.1 || ^19.1.2 || ^19.2.1",
|
|
478
478
|
"react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1",
|
|
479
|
-
"@payloadcms/next": "3.
|
|
480
|
-
"payload": "3.
|
|
479
|
+
"@payloadcms/next": "3.91.0-internal.07e4582",
|
|
480
|
+
"payload": "3.91.0-internal.07e4582"
|
|
481
481
|
},
|
|
482
482
|
"engines": {
|
|
483
483
|
"node": "^18.20.2 || >=20.9.0"
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";import{a as Ae,e as Be,g as O,h as I,j as Oe,k as Ie,l as Fe,m as $e,n as Ee,o as Ne,p as Ke}from"./chunk-QAW5QKEM.js";import{a as Me,b as w}from"./chunk-BZZVLW4U.js";import{jsx as L,jsxs as le}from"react/jsx-runtime";import{BulkUploadProvider as er,FieldDescription as tr,FieldError as or,FieldLabel as nr,isFieldRTL as rr,RenderCustomComponent as Mt,useConfig as ir,useEditDepth as sr,useEffectEvent as lr,useField as ar,useLocale as cr}from"@payloadcms/ui";import{mergeFieldStyles as ur}from"@payloadcms/ui/shared";import{dequal as dr}from"dequal/lite";import At,{useCallback as Bt,useEffect as Ot,useMemo as fr,useState as It}from"react";import{ErrorBoundary as mr}from"react-error-boundary";import"./bundled.css";import{jsx as F}from"react/jsx-runtime";import{LexicalComposer as Wn}from"@lexical/react/LexicalComposer.js";import{useEditDepth as Yn}from"@payloadcms/ui";import*as _t from"react";import{useMemo as Gn}from"react";import{c as kn}from"react/compiler-runtime";import{jsx as b,jsxs as ie}from"react/jsx-runtime";import{useLexicalComposerContext as vn}from"@lexical/react/LexicalComposerContext.js";import{LexicalErrorBoundary as Ln}from"@lexical/react/LexicalErrorBoundary.js";import{HistoryPlugin as Dn}from"@lexical/react/LexicalHistoryPlugin.js";import{OnChangePlugin as Mn}from"@lexical/react/LexicalOnChangePlugin.js";import{RichTextPlugin as An}from"@lexical/react/LexicalRichTextPlugin.js";import{useLexicalEditable as Bn}from"@lexical/react/useLexicalEditable";import{BLUR_COMMAND as On,COMMAND_PRIORITY_LOW as Rt,FOCUS_COMMAND as In}from"lexical";import*as X from"react";import{useEffect as Fn,useState as $n}from"react";import{jsx as je}from"react/jsx-runtime";import"react";var K=({anchorElem:e,clientProps:t,plugin:o})=>o.position==="floatingAnchorElem"&&e?o.Component&&je(o.Component,{anchorElem:e,clientProps:t}):o.Component&&je(o.Component,{clientProps:t});import{c as zt}from"react/compiler-runtime";import{copyToClipboard as ze}from"@lexical/clipboard";import{useLexicalComposerContext as Ht}from"@lexical/react/LexicalComposerContext.js";import{objectKlassEquals as Vt}from"@lexical/utils";import He from"bson-objectid";import{$getSelection as Wt,$isNodeSelection as Yt,COMMAND_PRIORITY_LOW as Gt,COPY_COMMAND as Ut}from"lexical";import{useEffect as Jt}from"react";var we=e=>{if("fields"in e&&typeof e.fields=="object"&&e.fields!==null&&"id"in e.fields?e.fields.id=new He.default().toHexString():"id"in e&&(e.id=new He.default().toHexString()),e.children)for(let t of e.children)we(t)};function Ve(){let e=zt(3),[t]=Ht(),o,n;return e[0]!==t?(o=()=>t.registerCommand(Ut,r=>{let c=Wt();if(Yt(c)){let s=c.getNodes()[0]?.exportJSON(),a=JSON.parse(JSON.stringify(s));we(a);let f={namespace:t._config.namespace,nodes:[a]},p=JSON.stringify(f);return ze(t,null,{"application/x-lexical-editor":p,"text/plain":""}).catch(qt),!0}return ze(t,Vt(r,ClipboardEvent)?r:null).then(()=>{if(!(r instanceof ClipboardEvent)||!r.clipboardData)throw new Error("No clipboard event");let l=r.clipboardData.getData("application/x-lexical-editor");if(!l)return!0;let s=JSON.parse(l);for(let f of s.nodes)we(f);let a=JSON.stringify(s);r.clipboardData.setData("application/x-lexical-editor",a)}).catch(l=>{throw r instanceof ClipboardEvent&&r.clipboardData?.setData("application/x-lexical-editor",""),l}),!0},Gt),n=[t],e[0]=t,e[1]=o,e[2]=n):(o=e[1],n=e[2]),Jt(o,n),null}function qt(e){throw e}import{c as Qt}from"react/compiler-runtime";import{useLexicalComposerContext as Xt}from"@lexical/react/LexicalComposerContext";import{$findMatchingParent as ae,mergeRegister as Zt}from"@lexical/utils";import{$createNodeSelection as eo,$getEditor as oe,$getNearestNodeFromDOMNode as to,$getSelection as ce,$isDecoratorNode as j,$isElementNode as Se,$isLineBreakNode as oo,$isNodeSelection as ue,$isRangeSelection as We,$isRootOrShadowRoot as no,$isTextNode as ro,$setSelection as Ye,CLICK_COMMAND as io,COMMAND_PRIORITY_LOW as G,KEY_ARROW_DOWN_COMMAND as so,KEY_ARROW_UP_COMMAND as lo,KEY_BACKSPACE_COMMAND as ao,KEY_DELETE_COMMAND as co,SELECTION_CHANGE_COMMAND as uo}from"lexical";import{useEffect as fo}from"react";function Ge(){let e=Qt(3),[t]=Xt(),o=Co,n,r;return e[0]!==t?(n=()=>Zt(t.registerCommand(io,xo,G),t.registerCommand(co,o,G),t.registerCommand(ao,o,G),t.registerCommand(uo,yo,G),t.registerCommand(lo,go,G),t.registerCommand(so,mo,G)),r=[t],e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]),fo(n,r),null}function mo(e){let t=ce();if(ue(t)){e.preventDefault();let l=t.getNodes()[0]?.getNextSibling();if(j(l)){let f=oe().getElementByKey(l.getKey());return f&&ne({element:f,node:l}),!0}if(!Se(l))return!0;let s=l.getFirstDescendant()??l;return s&&(ae(s,de)?.selectEnd(),e.preventDefault()),!0}if(!We(t))return!1;let n=(t.isBackward()?t.anchor:t.focus).getNode(),r=ae(n,po),c=r?.getNextSibling();if(!r||c!==Ue(r))return!1;if(j(c)){let l=oe().getElementByKey(c.getKey());if(l)return ne({element:l,node:c}),e.preventDefault(),!0}return!1}function po(e){return Ue(e)!==null}function go(e){let t=ce();if(ue(t)){let l=t.getNodes()[0]?.getPreviousSibling();if(j(l)){let f=oe().getElementByKey(l.getKey());return f?(ne({element:f,node:l}),e.preventDefault(),!0):!1}if(!Se(l))return!1;let s=l.getLastDescendant()??l;return s?(ae(s,de)?.selectStart(),e.preventDefault(),!0):!1}if(!We(t))return!1;let n=(t.isBackward()?t.anchor:t.focus).getNode(),r=ae(n,ho),c=r?.getPreviousSibling();if(!r||c!==Je(r))return!1;if(j(c)){let l=oe().getElementByKey(c.getKey());if(l)return ne({element:l,node:c}),e.preventDefault(),!0}return!1}function ho(e){return Je(e)!==null}function yo(){let e=No();return document.querySelector(".decorator-selected")?.classList.remove("decorator-selected"),e?(e.element?.classList.add("decorator-selected"),!0):!1}function xo(e){document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");let t=Eo(e);if(!t)return!0;let{target:o}=e;return!(o instanceof HTMLElement)||o.isContentEditable||o.closest('button, textarea, input, .react-select, .code-editor, .no-select-decorator, [role="button"]')?Ye(null):ne(t),!0}function Co(e){let t=ce();return ue(t)?(e.preventDefault(),t.getNodes().forEach(bo),!0):!1}function bo(e){e.remove()}function Eo(e){if(!(e.target instanceof HTMLElement))return;let t=e.target.closest('[data-lexical-decorator="true"]');if(!(t instanceof HTMLElement))return;let o=to(t);return j(o)?{element:t,node:o}:void 0}function No(){let e=ce();if(!ue(e))return;let t=e.getNodes();if(t.length!==1)return;let o=t[0];return j(o)?{decorator:o,element:oe().getElementByKey(o.getKey())}:void 0}function ne({element:e,node:t}){document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");let o=eo();o.add(t.getKey()),Ye(o),e.scrollIntoView({behavior:"smooth",block:"nearest"}),e.classList.add("decorator-selected")}function de(e){if(j(e)&&!e.isInline())return!0;if(!Se(e)||no(e))return!1;let t=e.getFirstChild(),o=t===null||oo(t)||ro(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&o}function Ue(e){let t=e.getNextSibling();for(;t!==null;){if(de(t))return t;t=t.getNextSibling()}return null}function Je(e){let t=e.getPreviousSibling();for(;t!==null;){if(de(t))return t;t=t.getPreviousSibling()}return null}import{jsx as Pe}from"react/jsx-runtime";import{useLexicalComposerContext as _o}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as ko,isHTMLElement as vo}from"lexical";import*as Ze from"react";import{useCallback as Lo,useEffect as Xe,useRef as Do,useState as Mo}from"react";import{createPortal as Ao}from"react-dom";var U=(e,t,o,n,r=50,c=25)=>{let l=0;if(e&&!e.contains(n)){let{bottom:s,left:a,right:f,top:p}=e.getBoundingClientRect(),u=p+window.scrollY,i=s+window.scrollY;if(o<u-c||o>i+c||t<a-r||t>f+r)return-1;(t<a||t>f)&&(l=t<a?t-a:t-f)}return l};import{$getNodeByKey as me}from"lexical";function J(e){let t=e.getBoundingClientRect(),o=getComputedStyle(e).getPropertyValue("transform");if(!o||o==="none")return t;let n=o.split(",").pop();return t.y=t.y-Number(n?.replace(")","")),t}function fe(e){let t=(a,f)=>a?parseFloat(window.getComputedStyle(a)[f]):0,{marginBottom:o,marginTop:n}=window.getComputedStyle(e),r=t(e.previousElementSibling,"marginBottom"),c=t(e.nextElementSibling,"marginTop"),l=Math.max(parseFloat(n),r);return{marginBottom:Math.max(parseFloat(o),c),marginTop:l}}import{$getRoot as wo}from"lexical";function z(e){return e.getEditorState().read(()=>wo().getChildrenKeys())}var So=1,Po=-1,qe=0,A={props:null,result:null};function Ro(e,t,o=20){let n=e.x-t.x,r=e.y-t.y;return n*n+r*r<=o*o}function q(e){let{anchorElem:t,cache_threshold:o=20,editor:n,fuzzy:r=!1,horizontalOffset:c=0,point:{x:l,y:s},startIndex:a=0,useEdgeAsDefault:f=!1}=e;if(o>0&&A.props&&A.result&&A.props.fuzzy===e.fuzzy&&A.props.horizontalOffset===e.horizontalOffset&&A.props.useEdgeAsDefault===e.useEdgeAsDefault&&Ro(A.props.point,e.point,o))return A.result;let p=t.getBoundingClientRect(),u=z(n),i={blockElem:null,blockNode:null,distance:1/0,foundAtIndex:-1,isFoundNodeEmptyParagraph:!1};return n.getEditorState().read(()=>{if(f){let h=n.getElementByKey(u[0]),m=n.getElementByKey(u[u.length-1]);if(h&&m){let[d,g]=[J(h),J(m)];if(s<d.top?(i.blockElem=h,i.distance=d.top-s,i.blockNode=me(u[0]),i.foundAtIndex=0):s>g.bottom&&(i.distance=s-g.bottom,i.blockNode=me(u[u.length-1]),i.blockElem=m,i.foundAtIndex=u.length-1),i?.blockElem)return{blockElem:null,isFoundNodeEmptyParagraph:!1}}}let y=a,x=qe;for(;y>=0&&y<u.length;){let h=u[y],m=n.getElementByKey(h);if(m===null)break;let d=new I(l+c,s),g=$e.fromDOMRect(J(m)),{marginBottom:C,marginTop:P}=fe(m),R=g.generateNewRect({bottom:g.bottom+C,left:p.left,right:p.right,top:g.top-P}),{distance:S,isOnBottomSide:_,isOnTopSide:N}=R.distanceFromPoint(d);if(S===0){i.blockElem=m,i.blockNode=me(h),i.foundAtIndex=y,i.distance=S,i.blockNode&&i.blockNode.getType()==="paragraph"&&i.blockNode.getTextContent()===""&&(!r&&!e.returnEmptyParagraphs&&(i.blockElem=null,i.blockNode=null),i.isFoundNodeEmptyParagraph=!0);break}else r&&S<i.distance&&(i.blockElem=m,i.blockNode=me(h),i.distance=S,i.foundAtIndex=y);x===qe&&(N?x=Po:_?x=So:x=1/0),y+=x}}),A.props=e,A.result={blockElem:i.blockElem,blockNode:i.blockNode,foundAtIndex:i.foundAtIndex,isFoundNodeEmptyParagraph:i.isFoundNodeEmptyParagraph},{blockElem:i.blockElem,blockNode:i.blockNode,foundAtIndex:i.foundAtIndex,isFoundNodeEmptyParagraph:i.isFoundNodeEmptyParagraph}}function pe(e,t){return!!e.closest(`.${t}`)}var To=["IMG","INPUT","TEXTAREA","SELECT","BUTTON","VIDEO","OBJECT","EMBED","IFRAME","HR"];function Qe(e){if(!e||To.includes(e.tagName)||e.offsetHeight===0||e.offsetWidth===0)return!1;let t=window.getComputedStyle(e);return!(t.display==="table-cell"||t.position==="absolute"||t.visibility==="hidden"||t.opacity==="0")}function ge(e,t,o,n=0){if(!e){t.style.opacity="0",t.style.transform="translate(-10000px, -10000px)";return}let r=e.getBoundingClientRect(),c=window.getComputedStyle(e),l=t.getBoundingClientRect(),s=o.getBoundingClientRect(),a;if(["LexicalEditorTheme__block","LexicalEditorTheme__upload","LexicalEditorTheme__relationship"].some(u=>e.classList.contains(u)||e.firstElementChild?.classList.contains(u)))a=r.top+8-s.top;else{let u=Qe(e)?parseInt(c.lineHeight,10):0;a=r.top+(u-l.height)/2-s.top}let p=n;t.style.opacity="1",t.style.transform=`translate(${p}px, ${a}px)`}var Bo="add-block-menu",he=1/0;function Oo(e){return e===0?1/0:he>=0&&he<e?he:Math.floor(e/2)}function Io(e,t,o){let n=t.parentElement,{editorConfig:r}=w(),c=r?.admin?.hideGutter?-24:12,l=Do(null),[s,a]=Mo(null);Xe(()=>{function p(u){let i=u.target;if(!vo(i))return;let y=U(n,u.pageX,u.pageY,i);if(y===-1){a(null);return}if(pe(i,Bo))return;let x=z(e),{blockElem:h,blockNode:m,foundAtIndex:d}=q({anchorElem:t,cache_threshold:0,editor:e,horizontalOffset:-y,point:new I(u.x,u.y),returnEmptyParagraphs:!0,startIndex:Oo(x.length),useEdgeAsDefault:!1});he=d,h&&m&&(s?.node!==m||s?.elem!==h)&&a({elem:h,node:m})}return document?.addEventListener("mousemove",p),()=>{document?.removeEventListener("mousemove",p)}},[n,t,e,s]),Xe(()=>{l.current&&s?.node&&ge(s?.elem,l.current,t,c)},[t,s,c]);let f=Lo(p=>{let u=s;u?.node&&(e.update(()=>{let i=!0;if((u?.node.getType()!=="paragraph"||u.node.getTextContent()!=="")&&(i=!1),!i){let y=ko();u?.node.insertAfter(y),setTimeout(()=>{u={elem:e.getElementByKey(y.getKey()),node:y},a(u)},0)}}),setTimeout(()=>{e.update(()=>{e.focus(),u?.node&&"select"in u.node&&typeof u.node.select=="function"&&u.node.select()})},1),setTimeout(()=>{e.dispatchCommand(Ie,{node:u?.node})},2),p.stopPropagation(),p.preventDefault())},[e,s]);return Ao(Pe(Ze.Fragment,{children:Pe("button",{"aria-label":"Add block",className:"icon add-block-menu",onClick:p=>{f(p)},ref:l,type:"button",children:Pe("div",{className:o?"icon":""})})}),t)}function et(e){let{anchorElem:t}=e,o=t===void 0?document.body:t,[n]=_o();return Io(n,o,n._editable)}import{jsx as ye,jsxs as $o}from"react/jsx-runtime";import{useLexicalComposerContext as Ko}from"@lexical/react/LexicalComposerContext.js";import{eventFiles as nt}from"@lexical/rich-text";import{$getNearestNodeFromDOMNode as rt,$getNodeByKey as jo,isHTMLElement as Re}from"lexical";import*as ct from"react";import{useEffect as Te,useRef as xe,useState as it}from"react";import{createPortal as zo}from"react-dom";var tt=0,Fo=-24;var H=0;function ot(e,t,o,n,r,c,l,s,a,f=!1){let{height:p,top:u}=n.getBoundingClientRect(),{top:i,width:y}=l.getBoundingClientRect(),{marginBottom:x,marginTop:h}=fe(n),m=u,d=c>=u+p/2+window.scrollY,g=!1;if(r?.elem)if(n!==r?.elem)(d&&r?.elem&&r?.elem===n.nextElementSibling||!d&&r?.elem&&r?.elem===n.previousElementSibling)&&(H++,H<200&&(g=!0));else{H++;let S=r?.boundingBox?.y,_=n.getBoundingClientRect().y;(d===r?.isBelow&&S===_||H<200)&&(g=!1)}if(g)return{isBelow:d,willStayInSamePosition:g};f?m+=p/2:d?m+=p+x/2:m-=h/2;let C=0;f||(d?C=-tt:C=tt);let P=m-i+C,R=Fo-t;return o.style.width=`calc(${y}px - ${e})`,o.style.opacity=".8",o.style.transform=`translate(${R}px, calc(${P}px - 2px))`,r?.elem&&(r.elem.style.opacity="",r?.elem===n?d?r.elem.style.marginTop="":r.elem.style.marginBottom="":(r.elem.style.marginBottom="",r.elem.style.marginTop="")),H=0,{isBelow:d,willStayInSamePosition:g}}var Ho="draggable-block-menu",st="application/x-lexical-drag-block",re=1/0;function lt(e){return e===0?1/0:re>=0&&re<e?re:Math.floor(e/2)}function Vo(e,t){let{transform:o}=t.style;e.setDragImage(t,0,0),setTimeout(()=>{t.style.transform=o})}function at(e,t){e&&(e.style.opacity="0"),t&&(t.style.opacity="",t.style.marginBottom="",t.style.marginTop="")}function Wo(e,t,o){let n=t.parentElement,r=xe(null),c=xe(null),l=xe(null),s=xe(!1),[a,f]=it(null),[p,u]=it(null),{editorConfig:i}=w(),y=i?.admin?.hideGutter?-44:-8;Te(()=>{function m(d){let g=d.target;if(!Re(g))return;let C=U(n,d.pageX,d.pageY,g);if(C===-1){f(null);return}if(pe(g,Ho))return;let P=z(e),{blockElem:R,foundAtIndex:S,isFoundNodeEmptyParagraph:_}=q({anchorElem:t,cache_threshold:0,editor:e,horizontalOffset:-C,point:new I(d.x,d.y),startIndex:lt(P.length),useEdgeAsDefault:!1,verbose:!1});re=S,!(!R&&!_)&&a!==R&&f(R)}return document?.addEventListener("mousemove",m),()=>{document?.removeEventListener("mousemove",m)}},[n,t,e,a]),Te(()=>{r.current&&ge(a,r.current,t,y)},[t,a,y]),Te(()=>{function m(g){if(!s.current)return!1;let[C]=nt(g);if(C)return!1;let{pageY:P,target:R}=g;if(!Re(R))return!1;let S=U(n,g.pageX,g.pageY,R,100,50),_=z(e),{blockElem:N,foundAtIndex:ee,isFoundNodeEmptyParagraph:v}=q({anchorElem:t,editor:e,fuzzy:!0,horizontalOffset:-S,point:new I(g.x,g.y),startIndex:lt(_.length),useEdgeAsDefault:!0,verbose:!0});re=ee;let T=c.current;if(N===null||T===null)return!1;if(a!==N){let{isBelow:k,willStayInSamePosition:V}=ot(i?.admin?.hideGutter?"0px":"3rem",y+(i?.admin?.hideGutter?r?.current?.getBoundingClientRect()?.width??0:-(r?.current?.getBoundingClientRect()?.width??0)),T,N,p,P,t,g,l,v);g.preventDefault(),V||u({boundingBox:N.getBoundingClientRect(),elem:N,isBelow:k})}else p?.elem&&(at(T,p.elem),u({boundingBox:N.getBoundingClientRect(),elem:N,isBelow:!1}));return!0}function d(g){if(!s.current)return!1;let[C]=nt(g);if(C)return!1;let{dataTransfer:P,pageY:R,target:S}=g,_=P?.getData(st)||"";return e.update(()=>{let N=jo(_);if(!N||!Re(S))return!1;let ee=U(n,g.pageX,g.pageY,S,100,50),{blockElem:v,isFoundNodeEmptyParagraph:T}=q({anchorElem:t,editor:e,fuzzy:!0,horizontalOffset:-ee,point:new I(g.x,g.y),useEdgeAsDefault:!0});if(!v)return!1;let k=rt(v);if(!k)return!1;if(k===N)return!0;let{height:V,top:$}=J(v),W=R>=$+V/2+window.scrollY;T?(k.insertBefore(N),k.remove()):W?k.insertAfter(N):k.insertBefore(N),a!==null&&f(null),document.querySelectorAll(".lexical-block-highlighter").forEach(D=>{D.remove()});let be=e.getElementByKey(N.getKey());setTimeout(()=>{let D=be?.getBoundingClientRect();if(!D)return;let E=document.createElement("div");E.className="lexical-block-highlighter",E.style.backgroundColor="var(--theme-elevation-1000",E.style.transition="opacity 0.5s ease-in-out",E.style.zIndex="1",E.style.pointerEvents="none",E.style.boxSizing="border-box",E.style.borderRadius="4px",E.style.position="absolute",document.body.appendChild(E),E.style.opacity="0.1",E.style.height=`${D.height+8}px`,E.style.width=`${D.width+8}px`,E.style.top=`${D.top+window.scrollY-4}px`,E.style.left=`${D.left-4}px`,setTimeout(()=>{E.style.opacity="0",setTimeout(()=>{E.remove()},500)},1e3)},120)}),!0}return document.addEventListener("dragover",m),document.addEventListener("drop",d),()=>{document.removeEventListener("dragover",m),document.removeEventListener("drop",d)}},[n,y,t,e,p,a,i?.admin?.hideGutter]);function x(m){let d=m.dataTransfer;if(!d||!a)return;Vo(d,a);let g="";e.update(()=>{let C=rt(a);C&&(g=C.getKey())}),s.current=!0,d.setData(st,g)}function h(){s.current=!1,p?.elem&&at(c.current,p?.elem)}return zo($o(ct.Fragment,{children:[ye("button",{"aria-label":"Drag to move",className:"icon draggable-block-menu",draggable:!0,onDragEnd:h,onDragStart:x,ref:r,type:"button",children:ye("div",{className:o?"icon":""})}),ye("div",{className:"draggable-block-target-line",ref:c}),ye("div",{className:"debug-highlight",ref:l})]}),t)}function ut(e){let{anchorElem:t}=e,o=t===void 0?document.body:t,[n]=Ko();return Wo(n,o,n._editable)}import{c as Yo}from"react/compiler-runtime";import{jsx as _e}from"react/jsx-runtime";import{useLexicalComposerContext as Go}from"@lexical/react/LexicalComposerContext";import{$createParagraphNode as Uo,$getRoot as Jo}from"lexical";import"react";var dt="insert-paragraph-at-end",ft=()=>{let e=Yo(2),[t]=Go(),{editorConfig:o}=w();if(o?.admin?.hideInsertParagraphAtEnd)return null;let n;return e[0]!==t?(n=_e("div",{"aria-label":"Insert Paragraph",className:dt,onClick:()=>{t.update(qo)},role:"button",tabIndex:0,children:_e("div",{className:`${dt}-inside`,children:_e("span",{children:"+"})})}),e[0]=t,e[1]=n):n=e[1],n};function qo(){let e=Uo();Jo().append(e),e.select()}import{c as Qo}from"react/compiler-runtime";import{useLexicalComposerContext as Xo}from"@lexical/react/LexicalComposerContext";import*as mt from"react";var pt=()=>{let e=Qo(4),{editorConfig:t}=w(),[o]=Xo(),n,r;return e[0]!==o||e[1]!==t.features.markdownTransformers?(n=()=>Ae(o,t.features.markdownTransformers??[]),r=[o,t.features.markdownTransformers],e[0]=o,e[1]=t.features.markdownTransformers,e[2]=n,e[3]=r):(n=e[2],r=e[3]),mt.useEffect(n,r),null};import{c as Zo}from"react/compiler-runtime";import{useLexicalComposerContext as en}from"@lexical/react/LexicalComposerContext.js";import{useEffect as tn}from"react";function gt(){let e=Zo(5),[t]=en(),{currentView:o,views:n}=O(),r,c;return e[0]!==o||e[1]!==t||e[2]!==n?(r=()=>{n&&(o==="default"?n.default?Ee(t,n.default?.nodes):Ne(t):n[o]&&(Ne(t),Ee(t,n[o]?.nodes)))},c=[t,n,o],e[0]=o,e[1]=t,e[2]=n,e[3]=r,e[4]=c):(r=e[3],c=e[4]),tn(r,c),null}import{useLexicalComposerContext as on}from"@lexical/react/LexicalComposerContext";import{$getSelection as nn,$isRangeSelection as rn,RootNode as sn}from"lexical";import{useEffect as ln}from"react";function ht(){let[e]=on();return ln(()=>e.registerNodeTransform(sn,t=>{let o=nn();if(rn(o)){let n=o.anchor.getNode(),r=o.focus.getNode();(!n.isAttached()||!r.isAttached())&&(t.selectEnd(),console.warn("updateEditor: selection has been moved to the end of the editor because the previously selected nodes have been removed and selection wasn't moved to another node. Ensure selection changes after removing/replacing a selected node."))}return!1}),[e]),null}import{useLexicalComposerContext as an}from"@lexical/react/LexicalComposerContext";import{$getSelection as cn,COMMAND_PRIORITY_LOW as un,SELECT_ALL_COMMAND as dn}from"lexical";import{useEffect as fn}from"react";function yt(){let[e]=an();return fn(()=>e.registerCommand(dn,()=>{if(cn())return!1;let o=document.activeElement;return o instanceof HTMLInputElement&&o.select(),!0},un),[e]),null}import{jsx as Q,jsxs as Ct}from"react/jsx-runtime";import{useLexicalComposerContext as pn}from"@lexical/react/LexicalComposerContext.js";import{useTranslation as bt}from"@payloadcms/ui";import{useCallback as gn,useMemo as hn,useState as yn}from"react";import"react";import*as Et from"react-dom";import{c as mn}from"react/compiler-runtime";import"react";function xt(e,t){let o=mn(4),{maxLength:n,minLength:r}=t,c=n===void 0?75:n,l=r===void 0?1:r,s;return o[0]!==c||o[1]!==l||o[2]!==e?(s=a=>{let{query:f}=a,p="[^"+e+Oe+"\\s]",i=new RegExp("(^|\\s|\\()(["+e+"]((?:"+p+"){0,"+c+"}))$").exec(f);if(i!==null){let y=i[1],x=i[3];if(x.length>=l)return{leadOffset:i.index+y.length,matchingString:x,replaceableString:i[2]}}return null},o[0]=c,o[1]=l,o[2]=e,o[3]=s):s=o[3],s}var B="slash-menu-popup";function xn({isSelected:e,item:t,onClick:o,onMouseEnter:n,ref:r}){let{fieldProps:{featureClientSchemaMap:c,schemaPath:l}}=w(),{i18n:s}=bt(),a=`${B}__item ${B}__item-${t.key}`;e&&(a+=` ${B}__item--selected`);let f=t.key;return t.label&&(f=typeof t.label=="function"?t.label({featureClientSchemaMap:c,i18n:s,schemaPath:l}):t.label),f.length>25&&(f=f.substring(0,25)+"..."),Ct("button",{"aria-selected":e,className:a,id:B+"__item-"+t.key,onClick:o,onMouseEnter:n,ref:r,role:"option",tabIndex:-1,type:"button",children:[t?.Icon&&Q(t.Icon,{}),Q("span",{className:`${B}__item-text`,children:f})]},t.key)}function Nt({anchorElem:e=document.body}){let[t]=pn(),[o,n]=yn(null),{editorConfig:r}=w(),{i18n:c}=bt(),{fieldProps:{featureClientSchemaMap:l,schemaPath:s}}=w(),a=xt("/",{minLength:0}),f=gn(()=>{let u=[];for(let i of r.features.slashMenu.dynamicGroups)if(o){let y=i({editor:t,queryString:o});u=u.concat(y)}return u},[t,o,r?.features]),p=hn(()=>{let u=[];for(let i of r?.features.slashMenu.groups??[])u.push(i);if(o){let i=o.toLowerCase().replace(/[\s\-_]/g,"");u=u.map(x=>{let h=x.items.filter(m=>{let d=m.key;return m.label&&(d=typeof m.label=="function"?m.label({featureClientSchemaMap:l,i18n:c,schemaPath:s}):m.label),new RegExp(o,"gi").exec(d)||d.toLowerCase().replace(/[\s\-_]/g,"").includes(i)?!0:m.keywords!=null?m.keywords.some(C=>new RegExp(o,"gi").exec(C)?!0:C.toLowerCase().replace(/[\s\-_]/g,"").includes(i)):!1});return h.length?{...x,items:h}:null}),u=u.filter(x=>x!=null);let y=f();for(let x of y){let h=u.find(m=>m.key===x.key);h?u=u.filter(m=>m.key!==x.key):h={...x,items:[]},h?.items?.length&&(h.items=h.items.concat(h.items)),u.push(h)}}return u},[o,r?.features.slashMenu.groups,f,l,c,s]);return Q(Fe,{anchorElem:e,groups:p,menuRenderFn:(u,{selectedItemKey:i,selectItemAndCleanUp:y,setSelectedItemKey:x})=>u.current&&p.length?Et.createPortal(Q("div",{className:B,children:p.map(h=>{let m=h.key;return h.label&&l&&(m=typeof h.label=="function"?h.label({featureClientSchemaMap:l,i18n:c,schemaPath:s}):h.label),Ct("div",{className:`${B}__group ${B}__group-${h.key}`,children:[Q("div",{className:`${B}__group-title`,children:m}),h.items.map((d,g)=>Q(xn,{index:g,isSelected:i===d.key,item:d,onClick:()=>{x(d.key),y(d)},onMouseEnter:()=>{x(d.key)},ref:C=>{d.ref={current:C}}},d.key))]},h.key)})}),u.current):null,onQueryChange:n,triggerFn:a})}import{c as Cn}from"react/compiler-runtime";import{useLexicalComposerContext as bn}from"@lexical/react/LexicalComposerContext";import{TEXT_TYPE_TO_FORMAT as En,TextNode as Nn}from"lexical";import{useEffect as wn}from"react";function wt(e){let t=Cn(6),{features:o}=e,[n]=bn(),r;t[0]!==n||t[1]!==o.enabledFormats?(r=()=>{let l=Sn(o.enabledFormats);if(l.length!==0)return n.registerNodeTransform(Nn,s=>{l.forEach(a=>{s.hasFormat(a)&&s.toggleFormat(a)})})},t[0]=n,t[1]=o.enabledFormats,t[2]=r):r=t[2];let c;return t[3]!==n||t[4]!==o?(c=[n,o],t[3]=n,t[4]=o,t[5]=c):c=t[5],wn(r,c),null}function Sn(e){let t=Object.keys(En),o=new Set(e);return t.filter(n=>!o.has(n))}import{c as Pn}from"react/compiler-runtime";import{jsx as St}from"react/jsx-runtime";import{useLexicalComposerContext as Rn}from"@lexical/react/LexicalComposerContext";import{ContentEditable as Tn}from"@lexical/react/LexicalContentEditable.js";import{useTranslation as _n}from"@payloadcms/ui";import"react";function Pt(e){let t=Pn(5),{className:o,editorConfig:n}=e,{t:r}=_n(),[,c]=Rn(),{getTheme:l}=c,s;if(t[0]!==o||t[1]!==n?.admin?.placeholder||t[2]!==l||t[3]!==r){let a=l();s=St(Tn,{"aria-placeholder":r("lexical:general:placeholder"),className:o??"ContentEditable__root",placeholder:St("p",{className:a?.placeholder,children:n?.admin?.placeholder??r("lexical:general:placeholder")})}),t[0]=o,t[1]=n?.admin?.placeholder,t[2]=l,t[3]=r,t[4]=s}else s=t[4];return s}var Tt=e=>{let t=kn(13),{editorConfig:o,editorContainerRef:n,isSmallWidthViewport:r,onChange:c,rtl:l}=e,s=w(),[a]=vn(),f=Bn(),[p,u]=$n(null),i;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=d=>{d!==null&&u(d)},t[0]=i):i=t[0];let y=i,x,h;t[1]!==a||t[2]!==s?(x=()=>{if(!s?.uuid){console.error("Lexical Editor must be used within an EditorConfigProvider");return}s?.parentEditor?.uuid&&s.parentEditor?.registerChild(s.uuid,s);let d=()=>{s.focusEditor(s)},g=()=>{s.blurEditor(s)},C=a.registerCommand(In,()=>(d(),!0),Rt),P=a.registerCommand(On,()=>(g(),!0),Rt);return()=>{C(),P(),s.parentEditor?.unregisterChild?.(s.uuid)}},h=[a,s],t[1]=a,t[2]=s,t[3]=x,t[4]=h):(x=t[3],h=t[4]),Fn(x,h);let m;return t[5]!==o||t[6]!==n||t[7]!==p||t[8]!==f||t[9]!==r||t[10]!==c||t[11]!==l?(m=ie(X.Fragment,{children:[o.features.plugins?.map(Kn),ie("div",{className:"editor-container",dir:l?"rtl":void 0,ref:n,children:[o.features.plugins?.map(jn),b(An,{contentEditable:b("div",{className:"editor-scroller",children:b("div",{className:"editor",ref:y,children:b(Pt,{editorConfig:o})})}),ErrorBoundary:Ln}),b(ht,{}),f&&b(ft,{}),b(Ge,{}),b(Ve,{}),b(wt,{features:o.features}),b(yt,{}),b(gt,{}),f&&b(Mn,{ignoreSelectionChange:!0,onChange:(d,g,C)=>{(!C.has("focus")||C.size>1)&&c?.(d,g,C)}}),p&&ie(X.Fragment,{children:[!r&&f&&ie(X.Fragment,{children:[o.admin?.hideDraggableBlockElement?null:b(ut,{anchorElem:p}),o.admin?.hideAddBlockButton?null:b(et,{anchorElem:p})]}),o.features.plugins?.map(d=>{if(d.position==="floatingAnchorElem"&&!(d.desktopOnly===!0&&r))return b(K,{anchorElem:p,clientProps:d.clientProps,plugin:d},d.key)}),f&&b(X.Fragment,{children:b(Nt,{anchorElem:p})})]}),f&&ie(X.Fragment,{children:[b(Dn,{}),o?.features?.markdownTransformers?.length>0&&b(pt,{})]}),o.features.plugins?.map(zn),o.features.plugins?.map(Hn)]}),o.features.plugins?.map(Vn)]}),t[5]=o,t[6]=n,t[7]=p,t[8]=f,t[9]=r,t[10]=c,t[11]=l,t[12]=m):m=t[12],m};function Kn(e){if(e.position==="aboveContainer")return b(K,{clientProps:e.clientProps,plugin:e},e.key)}function jn(e){if(e.position==="top")return b(K,{clientProps:e.clientProps,plugin:e},e.key)}function zn(e){if(e.position==="normal")return b(K,{clientProps:e.clientProps,plugin:e},e.key)}function Hn(e){if(e.position==="bottom")return b(K,{clientProps:e.clientProps,plugin:e},e.key)}function Vn(e){if(e.position==="belowContainer")return b(K,{clientProps:e.clientProps,plugin:e},e.key)}var kt=({children:e,providers:t})=>{if(!t?.length)return e;let o=t[0];return t.length>1?F(o,{children:F(kt,{providers:t.slice(1),children:e})}):F(o,{children:e})},vt=e=>{let{composerKey:t,editorConfig:o,fieldProps:n,isSmallWidthViewport:r,onChange:c,readOnly:l,rtl:s,value:a}=e,{currentView:f,views:p}=O(),u=w(),i=Yn(),y=_t.useRef(null),x=Gn(()=>{if(a&&typeof a!="object")throw new Error("The value passed to the Lexical editor is not an object. This is not supported. Please remove the data from the field and start again. This is the value that was passed in: "+JSON.stringify(a));if(a&&Array.isArray(a)&&!("root"in a))throw new Error("You have tried to pass in data from the old Slate editor to the new Lexical editor. The data structure is different, thus you will have to migrate your data. We offer a one-line migration script which migrates all your rich text fields: https://payloadcms.com/docs/lexical/migration#migration-via-migration-script-recommended");if(a&&"jsonContent"in a)throw new Error("You have tried to pass in data from payload-plugin-lexical. The data structure is different, thus you will have to migrate your data. Migration guide: https://payloadcms.com/docs/lexical/migration#migrating-from-payload-plugin-lexical");let h=p?.[f]?.nodes;return{editable:l!==!0,editorState:a!=null?JSON.stringify(a):void 0,namespace:o.lexical.namespace,nodes:Ke({editorConfig:o,nodeViews:h}),onError:m=>{throw m},theme:o.lexical.theme}},[o,p,f]);return x?F(Wn,{initialConfig:x,children:F(Me,{editorConfig:o,editorContainerRef:y,fieldProps:n,parentContext:u?.editDepth===i?u:void 0,children:F(kt,{providers:o.features.providers,children:F(Tt,{editorConfig:o,editorContainerRef:y,isSmallWidthViewport:r,onChange:c,rtl:s})})})},t+x.editable+f):F("p",{children:"Loading..."})};import{c as Un}from"react/compiler-runtime";import{jsx as Z,jsxs as Jn}from"react/jsx-runtime";import{ChevronIcon as qn,Popup as Qn,PopupList as Lt}from"@payloadcms/ui";import"react";function Dt(){let e=Un(5),{currentView:t,setCurrentView:o,views:n}=O();if(!n||Object.keys(n).length===0)return null;let r,c;if(e[0]!==t||e[1]!==o||e[2]!==n){c=Symbol.for("react.early_return_sentinel");e:{let l=Object.keys(n);if(!l.some(Zn)){c=null;break e}let a=["default",...l.filter(Xn)],f=t.charAt(0).toUpperCase()+t.slice(1);r=Z("div",{className:"lexical-view-selector",children:Z(Qn,{button:Jn("button",{className:"lexical-view-selector__button",type:"button",children:[Z("span",{className:"lexical-view-selector__label",children:f}),Z(qn,{className:"lexical-view-selector__icon"})]}),buttonType:"custom",horizontalAlign:"left",render:p=>{let{close:u}=p;return Z(Lt.ButtonGroup,{children:a.map(i=>{let y=i.charAt(0).toUpperCase()+i.slice(1);return Z(Lt.Button,{active:i===t,disabled:i===t,onClick:()=>{o?.(i),u()},children:y},i)})})},size:"large"})})}e[0]=t,e[1]=o,e[2]=n,e[3]=r,e[4]=c}else r=e[3],c=e[4];return c!==Symbol.for("react.early_return_sentinel")?c:r}function Xn(e){return e!=="default"}function Zn(e){return e!=="default"}var se="rich-text-lexical",pr=e=>{let{editorConfig:t,field:o,field:{admin:{className:n,description:r,readOnly:c}={},label:l,localized:s,required:a},path:f,readOnly:p,schemaPath:u,validate:i}=e,y=p||c,x=cr(),{config:{localization:h}}=ir(),m=rr({fieldLocalized:s,locale:x,localizationConfig:h||void 0}),d=sr(),{isControlledByParent:g}=O(),C=Bt((M,te)=>typeof i=="function"?i(M,{...te,required:a}):!0,[i,a]),{customComponents:{AfterInput:P,BeforeInput:R,Description:S,Error:_,Label:N}={},disabled:ee,initialValue:v,path:T,setValue:k,showError:V,value:$}=ar({potentiallyStalePath:f,validate:C}),Ce=y||ee,[W,ke]=It(!1),[be,D]=It(),E=At.useRef(v),Y=At.useRef($);Ot(()=>{let M=()=>{let te=window.matchMedia("(max-width: 768px)").matches;te!==W&&ke(te)};return M(),window.addEventListener("resize",M),()=>{window.removeEventListener("resize",M)}},[W]);let Ft=["field-type",se,n,V&&"error",Ce&&`${se}--read-only`,t?.admin?.hideGutter!==!0&&!W?`${se}--show-gutter`:null].filter(Boolean).join(" "),ve=`${T}.${d}`,Le=Be(),$t=Bt(M=>{Le(()=>{let De=M.toJSON();Y.current=De,k(De)})},[k,Le]),Kt=fr(()=>ur(o),[o]),jt=lr(M=>{Y.current!==$&&!dr(Y.current!=null?JSON.parse(JSON.stringify(Y.current)):Y.current,$)&&(E.current=M,Y.current=$,D(new Date))});return Ot(()=>{Object.is(v,E.current)||jt(v)},[v]),le("div",{className:Ft,"data-field-path":T,"data-field-schemapath":u,"data-lexical-view":t?.view,style:Kt,children:[L(Mt,{CustomComponent:_,Fallback:L(or,{path:T,showError:V})}),le("div",{className:`${se}__label-row`,children:[N||L(nr,{label:l,localized:s,path:T,required:a}),!g&&L(Dt,{})]}),le("div",{className:`${se}__wrap`,children:[le(mr,{fallbackRender:gr,onReset:()=>{},children:[R,L(er,{drawerSlugPrefix:`lexical-${T}`,children:L(vt,{composerKey:ve,editorConfig:t,fieldProps:e,isSmallWidthViewport:W,onChange:$t,readOnly:Ce,rtl:m,value:$},JSON.stringify({path:T,rerenderProviderKey:be}))}),P]}),L(Mt,{CustomComponent:S,Fallback:L(tr,{description:r,path:T})})]})]},ve)};function gr({error:e}){return le("div",{className:"errorBoundary",role:"alert",children:[L("p",{children:"Something went wrong:"}),L("pre",{style:{color:"red"},children:e.message})]})}var Pl=pr;export{Pl as RichText};
|
|
2
|
-
//# sourceMappingURL=Field-YZR46UCY.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/features/blocks/client/componentInline/index.tsx", "../../../src/features/blocks/client/nodes/InlineBlocksNode.tsx", "../../../src/features/blocks/server/nodes/InlineBlocksNode.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport type { BlocksFieldClient, ClientBlock, Data, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n FormSubmit,\n RenderFields,\n ShimmerEffect,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey, SKIP_DOM_SELECTION_TAG } from 'lexical'\n\nimport './index.scss'\n\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ViewMapInlineBlockComponentProps } from '../../../../types.js'\nimport type { InlineBlockFields } from '../../server/nodes/InlineBlocksNode.js'\nimport type { BlockComponentProps } from '../component/index.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isInlineBlockNode } from '../nodes/InlineBlocksNode.js'\n\nexport type InlineBlockComponentProps<\n TFormData extends Record<string, unknown> = InlineBlockFields,\n> = {\n readonly CustomBlock?: React.FC<ViewMapInlineBlockComponentProps>\n readonly CustomLabel?: React.FC<ViewMapInlineBlockComponentProps>\n} & Pick<BlockComponentProps<TFormData>, 'cacheBuster' | 'className' | 'formData' | 'nodeKey'>\n\nexport type InlineBlockComponentContextType = {\n EditButton?: React.FC\n initialState: false | FormState | undefined\n InlineBlockContainer?: React.FC<{ children: React.ReactNode }>\n Label?: React.FC\n nodeKey?: string\n RemoveButton?: React.FC\n}\n\nconst InlineBlockComponentContext = createContext<InlineBlockComponentContextType>({\n initialState: false,\n})\n\nexport const useInlineBlockComponentContext = () => React.use(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<InlineBlockComponentProps<InlineBlockFields>> = (\n props,\n) => {\n const {\n cacheBuster,\n className: baseClass,\n CustomBlock: CustomBlockFromProps,\n CustomLabel: CustomLabelFromProps,\n formData,\n nodeKey,\n } = props\n\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n const { i18n, t } = useTranslation<object, string>()\n const {\n createdInlineBlock,\n fieldProps: { featureClientSchemaMap, initialLexicalFormState, schemaPath },\n setCreatedInlineBlock,\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { fields: parentDocumentFields } = useDocumentForm()\n\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n const firstTimeDrawer = useRef(false)\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(() => {\n // Initial form state that was calculated server-side. May have stale values\n const cachedFormState = initialLexicalFormState?.[formData.id]?.formState\n if (!cachedFormState) {\n return false\n }\n\n // Merge current formData values into the cached form state\n // This ensures that when the component remounts (e.g., due to view changes), we don't lose user edits\n return Object.fromEntries(\n Object.entries(cachedFormState).map(([fieldName, fieldState]) => [\n fieldName,\n fieldName in formData\n ? {\n ...fieldState,\n initialValue: formData[fieldName],\n value: formData[fieldName],\n }\n : fieldState,\n ]),\n )\n })\n\n const hasMounted = useRef(false)\n const prevCacheBuster = useRef(cacheBuster)\n useEffect(() => {\n if (hasMounted.current) {\n if (prevCacheBuster.current !== cacheBuster) {\n setInitialState(false)\n }\n prevCacheBuster.current = cacheBuster\n } else {\n hasMounted.current = true\n }\n }, [cacheBuster])\n\n const [formUuid] = React.useState(() => uuid())\n\n // Server-rendered custom components (from admin.components, NOT viewMap).\n // When viewMap components exist, we render them directly with formData instead.\n const [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomLabelFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.BlockLabel ?? undefined\n })\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomBlockFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.Block ?? undefined\n })\n\n const resolvedCustomBlock = useMemo(() => {\n if (CustomBlockFromProps) {\n return (\n <CustomBlockFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call\n useInlineBlockComponentContext={useInlineBlockComponentContext}\n />\n )\n }\n return CustomBlock\n }, [CustomBlockFromProps, baseClass, formData, nodeKey, CustomBlock])\n\n const resolvedCustomLabel = useMemo(() => {\n if (CustomLabelFromProps) {\n return (\n <CustomLabelFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call\n useInlineBlockComponentContext={useInlineBlockComponentContext}\n />\n )\n }\n return CustomLabel\n }, [CustomLabelFromProps, baseClass, formData, nodeKey, CustomLabel])\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-inlineBlocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { config } = useConfig()\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${formData.blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient\n\n const clientBlock: ClientBlock | undefined = blocksField.blockReferences\n ? typeof blocksField?.blockReferences?.[0] === 'string'\n ? config.blocksMap[blocksField?.blockReferences?.[0]]\n : blocksField?.blockReferences?.[0]\n : blocksField?.blocks?.[0]\n\n const clientBlockFields = clientBlock?.fields ?? []\n\n // Open drawer on \"mount\"\n useEffect(() => {\n if (!firstTimeDrawer.current && createdInlineBlock?.getKey() === nodeKey) {\n // > 2 because they always have \"id\" and \"blockName\" fields\n if (clientBlockFields.length > 2) {\n toggleDrawer()\n }\n setCreatedInlineBlock?.(undefined)\n firstTimeDrawer.current = true\n }\n }, [clientBlockFields.length, createdInlineBlock, nodeKey, setCreatedInlineBlock, toggleDrawer])\n\n const removeInlineBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock?.labels.singular, i18n)\n : clientBlock?.slug\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${clientBlock?.slug}.fields`\n\n // Initial state for newly created blocks\n useEffect(() => {\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n globalSlug,\n initialBlockData: formData,\n initialBlockFormState: formData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n const newFormStateData: InlineBlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state, { excludeFiles: true }),\n true,\n ) as InlineBlockFields\n\n // Things like default values may come back from the server => update the node with the new data\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = formData.blockType\n\n node.setFields(newData, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n\n setInitialState(state)\n if (!CustomLabelFromProps) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n editor,\n nodeKey,\n isEditable,\n CustomLabelFromProps,\n CustomBlockFromProps,\n schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n /**\n * HANDLE ONCHANGE\n */\n const onChange = useCallback(\n async ({ formState: prevFormState, submit }: { formState: FormState; submit?: boolean }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n if (submit) {\n if (!CustomLabelFromProps) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n\n return state\n },\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n isEditable,\n schemaFieldsPath,\n CustomBlockFromProps,\n CustomLabelFromProps,\n ],\n )\n // cleanup effect\n useEffect(() => {\n const isStateOutOfSync = (formData: InlineBlockFields, initialState: FormState) => {\n return Object.keys(initialState).some(\n (key) => initialState[key] && formData[key] !== initialState[key].value,\n )\n }\n\n return () => {\n // If the component is unmounted (either via removeInlineBlock or via lexical itself) and the form state got changed before,\n // we need to reset the initial state to force a re-fetch of the initial state when it gets mounted again (e.g. via lexical history undo).\n // Otherwise it would use an outdated initial state.\n if (initialState && isStateOutOfSync(formData, initialState)) {\n setInitialState(false)\n }\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [formData, initialState])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState: FormState, newData: Data) => {\n newData.blockType = formData.blockType\n\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData as InlineBlockFields, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n },\n [editor, nodeKey, formData],\n )\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeInlineBlock()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:remove', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, removeInlineBlock, t],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__editButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"edit\"\n onClick={() => {\n toggleDrawer()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, t, toggleDrawer],\n )\n\n const InlineBlockContainer = useMemo(\n () =>\n ({ children, className }: { children: React.ReactNode; className?: string }) => (\n <div\n className={[`${baseClass}__container`, baseClass + '-' + formData.blockType, className]\n .filter(Boolean)\n .join(' ')}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [baseClass, formData.blockType],\n )\n\n const Label = useMemo(() => {\n if (resolvedCustomLabel) {\n return () => resolvedCustomLabel\n } else {\n return () => (\n <div>{clientBlock?.labels ? getTranslation(clientBlock?.labels.singular, i18n) : ''}</div>\n )\n }\n }, [resolvedCustomLabel, clientBlock?.labels, i18n])\n\n if (!clientBlock) {\n return (\n <InlineBlockContainer className={`${baseClass}-not-found`}>\n <span>Error: Block '{formData.blockType}' not found</span>\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )\n }\n\n return (\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer\n return await onChange({ formState, submit: true })\n },\n ]}\n disableValidationOnSubmit\n el=\"div\"\n fields={clientBlock?.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState, data) => {\n onFormSubmit(formState, data)\n toggleDrawer()\n }}\n uuid={formUuid}\n >\n <EditDepthProvider>\n <Drawer\n className={''}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${formData?.id ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <>\n <RenderFields\n fields={clientBlock?.fields}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <FormSubmit programmaticSubmit={true}>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n {resolvedCustomBlock ? (\n <InlineBlockComponentContext\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {resolvedCustomBlock}\n </InlineBlockComponentContext>\n ) : (\n <InlineBlockContainer>\n {initialState ? <Label /> : <ShimmerEffect height=\"15px\" width=\"40px\" />}\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <EditButton />\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )}\n </Form>\n )\n}\n", "'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 { ViewMapInlineBlockComponentProps } from '../../../../types.js'\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 type InlineBlockDecorateFunction = (\n editor: LexicalEditor,\n config: EditorConfig,\n CustomBlock?: React.FC<ViewMapInlineBlockComponentProps>,\n CustomLabel?: React.FC<ViewMapInlineBlockComponentProps>,\n) => JSX.Element\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(\n ...[_editor, config, CustomBlock, CustomLabel]: Parameters<InlineBlockDecorateFunction>\n ): ReturnType<InlineBlockDecorateFunction> {\n return (\n <InlineBlockComponent\n cacheBuster={this.getCacheBuster()}\n className={config.theme.inlineBlock ?? 'LexicalEditorTheme__inlineBlock'}\n CustomBlock={CustomBlock}\n CustomLabel={CustomLabel}\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", "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 { addClassNamesToElement } from '@lexical/utils'\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\n override createDOM(config?: EditorConfig): HTMLElement {\n const element = document.createElement('span')\n addClassNamesToElement(element, config?.theme?.inlineBlock)\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"],
|
|
5
|
-
"mappings": "mJAIA,OAASA,6BAAAA,OAAiC,wCAC1C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AC,MAAA,CAAI3D,UAAW,GAAGC,CAAA,qBACjB0D,EAACuE,EAAA,CAAA,CAAA,IAED,IAAA,GA0EZ",
|
|
6
|
-
"names": ["useLexicalComposerContext", "useLexicalEditable", "getTranslation", "Button", "Drawer", "EditDepthProvider", "Form", "formatDrawerSlug", "FormSubmit", "RenderFields", "ShimmerEffect", "useConfig", "useDocumentForm", "useDocumentInfo", "useEditDepth", "useServerFunctions", "useTranslation", "abortAndIgnore", "$getNodeByKey", "SKIP_DOM_SELECTION_TAG", "deepCopyObjectSimpleWithoutReactComponents", "reduceFieldsToValues", "React", "createContext", "useCallback", "useEffect", "useMemo", "useRef", "v4", "uuid", "ObjectID", "$applyNodeReplacement", "React", "addClassNamesToElement", "ObjectID", "$applyNodeReplacement", "DecoratorNode", "ServerInlineBlockNode", "__cacheBuster", "__fields", "constructor", "cacheBuster", "fields", "key", "clone", "node", "__key", "getType", "importDOM", "importJSON", "serializedNode", "$createServerInlineBlockNode", "isInline", "canIndent", "createDOM", "config", "element", "document", "createElement", "theme", "inlineBlock", "decorate", "editor", "exportDOM", "classList", "add", "text", "createTextNode", "getTextContent", "append", "exportJSON", "type", "getFields", "version", "getCacheBuster", "getLatest", "setFields", "preventFormStateUpdate", "writable", "getWritable", "updateDOM", "id", "default", "toHexString", "InlineBlockComponent", "React", "lazy", "then", "module", "default", "InlineBlockNode", "ServerInlineBlockNode", "clone", "node", "getType", "importJSON", "serializedNode", "$createInlineBlockNode", "fields", "decorate", "_editor", "config", "CustomBlock", "CustomLabel", "_jsx", "cacheBuster", "getCacheBuster", "className", "theme", "inlineBlock", "formData", "getFields", "nodeKey", "getKey", "exportJSON", "$applyNodeReplacement", "id", "ObjectID", "toHexString", "$isInlineBlockNode", "InlineBlockComponentContext", "createContext", "initialState", "useInlineBlockComponentContext", "React", "use", "InlineBlockComponent", "props", "cacheBuster", "className", "baseClass", "CustomBlock", "CustomBlockFromProps", "CustomLabel", "CustomLabelFromProps", "formData", "nodeKey", "editor", "useLexicalComposerContext", "isEditable", "useLexicalEditable", "i18n", "t", "useTranslation", "createdInlineBlock", "fieldProps", "featureClientSchemaMap", "initialLexicalFormState", "schemaPath", "setCreatedInlineBlock", "uuid", "uuidFromContext", "useEditorConfigContext", "fields", "parentDocumentFields", "useDocumentForm", "getFormState", "useServerFunctions", "editDepth", "useEditDepth", "firstTimeDrawer", "useRef", "setInitialState", "useState", "cachedFormState", "id", "formState", "Object", "fromEntries", "entries", "map", "fieldName", "fieldState", "initialValue", "value", "hasMounted", "prevCacheBuster", "useEffect", "current", "formUuid", "setCustomLabel", "customComponents", "BlockLabel", "undefined", "setCustomBlock", "Block", "resolvedCustomBlock", "useMemo", "_jsx", "isEditor", "isJSXConverter", "resolvedCustomLabel", "drawerSlug", "formatDrawerSlug", "slug", "depth", "toggleDrawer", "useLexicalDrawer", "inlineBlockElemElemRef", "collectionSlug", "getDocPreferences", "globalSlug", "useDocumentInfo", "config", "useConfig", "componentMapRenderedBlockPath", "blockType", "blocksField", "clientBlock", "blockReferences", "blocksMap", "blocks", "clientBlockFields", "getKey", "length", "removeInlineBlock", "useCallback", "update", "$getNodeByKey", "remove", "blockDisplayName", "labels", "singular", "getTranslation", "onChangeAbortControllerRef", "AbortController", "schemaFieldsPath", "abortController", "state", "data", "docPermissions", "docPreferences", "documentFormState", "deepCopyObjectSimpleWithoutReactComponents", "excludeFiles", "initialBlockData", "initialBlockFormState", "operation", "readOnly", "renderAllFields", "signal", "newFormStateData", "reduceFieldsToValues", "node", "$isInlineBlockNode", "newData", "setFields", "tag", "SKIP_DOM_SELECTION_TAG", "abortAndIgnore", "onChange", "prevFormState", "submit", "controller", "isStateOutOfSync", "keys", "some", "key", "onFormSubmit", "RemoveButton", "Button", "buttonStyle", "disabled", "icon", "onClick", "e", "preventDefault", "round", "size", "tooltip", "label", "EditButton", "el", "InlineBlockContainer", "children", "filter", "Boolean", "join", "ref", "Label", "_jsxs", "Form", "beforeSubmit", "disableValidationOnSubmit", "onSubmit", "EditDepthProvider", "Drawer", "title", "_Fragment", "RenderFields", "forceRender", "parentIndexPath", "parentPath", "parentSchemaPath", "permissions", "FormSubmit", "programmaticSubmit", "ShimmerEffect", "height", "width"]
|
|
7
|
-
}
|
/package/dist/exports/client/{componentInline-A4H3EY3L.js.map → componentInline-YMJQCGVL.js.map}
RENAMED
|
File without changes
|