@payloadcms/richtext-lexical 3.28.0-internal.9962602 → 3.28.0-internal.c4e1bed
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-FLAQN6LU.js +2 -0
- package/dist/exports/client/Field-FLAQN6LU.js.map +7 -0
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/chunk-XO6X2M3F.js +12 -0
- package/dist/exports/client/chunk-XO6X2M3F.js.map +7 -0
- package/dist/exports/client/index.js +10 -10
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/blockquote/markdownTransformer.d.ts.map +1 -1
- package/dist/features/blockquote/markdownTransformer.js +1 -2
- package/dist/features/blockquote/markdownTransformer.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.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +137 -69
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +22 -5
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +9 -5
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts.map +1 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +3 -3
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
- package/dist/features/experimental_table/markdownTransformer.d.ts.map +1 -1
- package/dist/features/experimental_table/markdownTransformer.js +1 -1
- package/dist/features/experimental_table/markdownTransformer.js.map +1 -1
- package/dist/features/indent/client/index.d.ts +1 -1
- package/dist/features/indent/client/index.d.ts.map +1 -1
- package/dist/features/indent/client/index.js.map +1 -1
- package/dist/features/link/nodes/AutoLinkNode.d.ts +3 -2
- package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
- package/dist/features/link/nodes/AutoLinkNode.js +7 -6
- package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
- package/dist/features/link/nodes/LinkNode.d.ts +7 -5
- package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
- package/dist/features/link/nodes/LinkNode.js +13 -7
- package/dist/features/link/nodes/LinkNode.js.map +1 -1
- package/dist/features/link/nodes/types.d.ts +3 -0
- package/dist/features/link/nodes/types.d.ts.map +1 -1
- package/dist/features/link/nodes/types.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts +1 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.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.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +7 -6
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +12 -8
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +1 -2
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +1 -2
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
- package/dist/lexical/theme/EditorTheme.d.ts.map +1 -1
- package/dist/lexical/theme/EditorTheme.js +7 -0
- package/dist/lexical/theme/EditorTheme.js.map +1 -1
- package/dist/lexical/utils/guard.d.ts +3 -0
- package/dist/lexical/utils/guard.d.ts.map +1 -1
- package/dist/lexical/utils/guard.js +3 -0
- package/dist/lexical/utils/guard.js.map +1 -1
- package/package.json +18 -23
- package/dist/exports/client/Field-NNWFQETL.js +0 -2
- package/dist/exports/client/Field-NNWFQETL.js.map +0 -7
- package/dist/exports/client/chunk-OZ6Q4DWN.js +0 -12
- package/dist/exports/client/chunk-OZ6Q4DWN.js.map +0 -7
- package/dist/lexical-proxy/@lexical-react/LexicalTableOfContents.d.ts +0 -2
- package/dist/lexical-proxy/@lexical-react/LexicalTableOfContents.d.ts.map +0 -1
- package/dist/lexical-proxy/@lexical-react/LexicalTableOfContents.js +0 -2
- package/dist/lexical-proxy/@lexical-react/LexicalTableOfContents.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdownTransformer.d.ts","sourceRoot":"","sources":["../../../src/features/blockquote/markdownTransformer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"markdownTransformer.d.ts","sourceRoot":"","sources":["../../../src/features/blockquote/markdownTransformer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAA;AAEnF,eAAO,MAAM,mBAAmB,EAAE,kBAgCjC,CAAA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { $createQuoteNode, $isQuoteNode, QuoteNode } from '@lexical/rich-text';
|
|
2
|
-
import { $createLineBreakNode } from 'lexical';
|
|
3
2
|
export const MarkdownTransformer = {
|
|
4
3
|
type: 'element',
|
|
5
4
|
dependencies: [QuoteNode],
|
|
@@ -19,7 +18,7 @@ export const MarkdownTransformer = {
|
|
|
19
18
|
if (isImport) {
|
|
20
19
|
const previousNode = parentNode.getPreviousSibling();
|
|
21
20
|
if ($isQuoteNode(previousNode)) {
|
|
22
|
-
previousNode.splice(previousNode.getChildrenSize(), 0, [
|
|
21
|
+
previousNode.splice(previousNode.getChildrenSize(), 0, [...children]);
|
|
23
22
|
previousNode.select(0, 0);
|
|
24
23
|
parentNode.remove();
|
|
25
24
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdownTransformer.js","names":["$createQuoteNode","$isQuoteNode","QuoteNode","
|
|
1
|
+
{"version":3,"file":"markdownTransformer.js","names":["$createQuoteNode","$isQuoteNode","QuoteNode","MarkdownTransformer","type","dependencies","export","node","exportChildren","lines","split","output","line","push","join","regExp","replace","parentNode","children","_match","isImport","previousNode","getPreviousSibling","splice","getChildrenSize","select","remove","append"],"sources":["../../../src/features/blockquote/markdownTransformer.ts"],"sourcesContent":["import { $createQuoteNode, $isQuoteNode, QuoteNode } from '@lexical/rich-text'\n\nimport type { ElementTransformer } from '../../packages/@lexical/markdown/index.js'\n\nexport const MarkdownTransformer: ElementTransformer = {\n type: 'element',\n dependencies: [QuoteNode],\n export: (node, exportChildren) => {\n if (!$isQuoteNode(node)) {\n return null\n }\n\n const lines = exportChildren(node).split('\\n')\n const output: string[] = []\n for (const line of lines) {\n output.push('> ' + line)\n }\n return output.join('\\n')\n },\n regExp: /^>\\s/,\n replace: (parentNode, children, _match, isImport) => {\n if (isImport) {\n const previousNode = parentNode.getPreviousSibling()\n if ($isQuoteNode(previousNode)) {\n previousNode.splice(previousNode.getChildrenSize(), 0, [...children])\n previousNode.select(0, 0)\n parentNode.remove()\n return\n }\n }\n\n const node = $createQuoteNode()\n node.append(...children)\n parentNode.replace(node)\n node.select(0, 0)\n },\n}\n"],"mappings":"AAAA,SAASA,gBAAgB,EAAEC,YAAY,EAAEC,SAAS,QAAQ;AAI1D,OAAO,MAAMC,mBAAA,GAA0C;EACrDC,IAAA,EAAM;EACNC,YAAA,EAAc,CAACH,SAAA,CAAU;EACzBI,MAAA,EAAQA,CAACC,IAAA,EAAMC,cAAA;IACb,IAAI,CAACP,YAAA,CAAaM,IAAA,GAAO;MACvB,OAAO;IACT;IAEA,MAAME,KAAA,GAAQD,cAAA,CAAeD,IAAA,EAAMG,KAAK,CAAC;IACzC,MAAMC,MAAA,GAAmB,EAAE;IAC3B,KAAK,MAAMC,IAAA,IAAQH,KAAA,EAAO;MACxBE,MAAA,CAAOE,IAAI,CAAC,OAAOD,IAAA;IACrB;IACA,OAAOD,MAAA,CAAOG,IAAI,CAAC;EACrB;EACAC,MAAA,EAAQ;EACRC,OAAA,EAASA,CAACC,UAAA,EAAYC,QAAA,EAAUC,MAAA,EAAQC,QAAA;IACtC,IAAIA,QAAA,EAAU;MACZ,MAAMC,YAAA,GAAeJ,UAAA,CAAWK,kBAAkB;MAClD,IAAIrB,YAAA,CAAaoB,YAAA,GAAe;QAC9BA,YAAA,CAAaE,MAAM,CAACF,YAAA,CAAaG,eAAe,IAAI,GAAG,C,GAAIN,QAAA,CAAS;QACpEG,YAAA,CAAaI,MAAM,CAAC,GAAG;QACvBR,UAAA,CAAWS,MAAM;QACjB;MACF;IACF;IAEA,MAAMnB,IAAA,GAAOP,gBAAA;IACbO,IAAA,CAAKoB,MAAM,IAAIT,QAAA;IACfD,UAAA,CAAWD,OAAO,CAACT,IAAA;IACnBA,IAAA,CAAKkB,MAAM,CAAC,GAAG;EACjB;AACF","ignoreList":[]}
|
|
@@ -33,7 +33,7 @@ export declare class ServerBlockNode extends DecoratorBlockNode {
|
|
|
33
33
|
static importDOM(): DOMConversionMap<HTMLDivElement> | null;
|
|
34
34
|
static importJSON(serializedNode: SerializedBlockNode): ServerBlockNode;
|
|
35
35
|
static isInline(): false;
|
|
36
|
-
decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element
|
|
36
|
+
decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element;
|
|
37
37
|
exportDOM(): DOMExportOutput;
|
|
38
38
|
exportJSON(): SerializedBlockNode;
|
|
39
39
|
getCacheBuster(): number;
|
|
@@ -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,EACV,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,WAAW,EACX,OAAO,EACP,MAAM,EACP,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAA;AAGhF,KAAK,eAAe,CAAC,YAAY,SAAS,UAAU,GAAG,UAAU,IAAI;IACnE,sBAAsB;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB,GAAG,YAAY,CAAA;AAEhB,MAAM,MAAM,WAAW,CAAC,YAAY,SAAS,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,iBAAiB,CAAA;QAC1B,GAAG,CAAC,EAAE,OAAO,CAAA;KACd;WAMe,KAAK,CAAC,IAAI,EAAE,eAAe,GAAG,eAAe;WAS7C,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,CAOrF;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,eAAe,GAAG,SAAS,GACrD,IAAI,IAAI,eAAe,CAEzB"}
|
|
@@ -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 {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n ElementFormatType,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n Spread,\n} from 'lexical'\nimport type { JsonObject } from 'payload'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport ObjectID from 'bson-objectid'\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> = Spread<\n {\n children?: never // required so that our typed editor state doesn't automatically add children\n fields: BlockFields<TBlockFields>\n type: 'block'\n },\n SerializedDecoratorBlockNode\n>\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
|
|
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 {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n ElementFormatType,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n Spread,\n} from 'lexical'\nimport type { JsonObject } from 'payload'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport ObjectID from 'bson-objectid'\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> = Spread<\n {\n children?: never // required so that our typed editor state doesn't automatically add children\n fields: BlockFields<TBlockFields>\n type: 'block'\n },\n SerializedDecoratorBlockNode\n>\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 new ServerBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\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":"AAcA,SAASA,kBAAkB,QAAQ;AACnC,OAAOC,QAAA,MAAc;AAyBrB,OAAO,MAAMC,eAAA,SAAwBF,kBAAA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AAkC;IACzC,OAAO;MACL,GAAG,KAAK,CAACA,UAAA,EAAY;MACrBC,IAAA,EAAM;MACN5B,MAAA,EAAQ,IAAI,CAAC6B,SAAS;MACtBlB,OAAA,EAAS;IACX;EACF;EAEAmB,eAAA,EAAyB;IACvB,OAAO,IAAI,CAACC,SAAS,GAAGnC,aAAa;EACvC;EAEAiC,UAAA,EAAyB;IACvB,OAAO,IAAI,CAACE,SAAS,GAAGlC,QAAQ;EAClC;EAES4B,eAAA,EAAyB;IAChC,OAAO,aAAa;EACtB;EAEAO,UAAUhC,MAAmB,EAAEiC,sBAAgC,EAAQ;IACrE,MAAMC,QAAA,GAAW,IAAI,CAACC,WAAW;IACjCD,QAAA,CAASrC,QAAQ,GAAGG,MAAA;IACpB,IAAI,CAACiC,sBAAA,EAAwB;MAC3BC,QAAA,CAAStC,aAAa;IACxB;EACF;AACF;AAEA,OAAO,SAASiB,uBAAuBb,MAA6B;EAClE,OAAO,IAAIL,eAAA,CAAgB;IACzBK,MAAA,EAAQ;MACN,GAAGA,MAAM;MACToC,EAAA,EAAIpC,MAAA,EAAQoC,EAAA,IAAM,IAAI1C,QAAA,CAAS2C,OAAO,GAAGC,WAAW;IACtD;EACF;AACF;AAEA,OAAO,SAASC,mBACdnC,IAAsD;EAEtD,OAAOA,IAAA,YAAgBT,eAAA;AACzB","ignoreList":[]}
|
package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/features/experimental_table/client/plugins/TableActionMenuPlugin/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/features/experimental_table/client/plugins/TableActionMenuPlugin/index.tsx"],"names":[],"mappings":"AA8CA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAA;AAE3E,OAAO,cAAc,CAAA;AAovBrB,eAAO,MAAM,qBAAqB,EAAE,yBAQnC,CAAA"}
|
|
@@ -4,10 +4,10 @@ import { c as _c } from "react/compiler-runtime";
|
|
|
4
4
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
6
6
|
import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
|
|
7
|
-
import { $deleteTableColumn__EXPERIMENTAL, $deleteTableRow__EXPERIMENTAL, $getNodeTriplet, $getTableCellNodeFromLexicalNode, $getTableColumnIndexFromTableCellNode, $getTableNodeFromLexicalNodeOrThrow, $getTableRowIndexFromTableCellNode, $insertTableColumn__EXPERIMENTAL, $insertTableRow__EXPERIMENTAL, $isTableCellNode, $
|
|
7
|
+
import { $computeTableMapSkipCellCheck, $deleteTableColumn__EXPERIMENTAL, $deleteTableRow__EXPERIMENTAL, $getNodeTriplet, $getTableCellNodeFromLexicalNode, $getTableColumnIndexFromTableCellNode, $getTableNodeFromLexicalNodeOrThrow, $getTableRowIndexFromTableCellNode, $insertTableColumn__EXPERIMENTAL, $insertTableRow__EXPERIMENTAL, $isTableCellNode, $isTableSelection, $unmergeCell, getTableElement, getTableObserverFromTableElement, TableCellHeaderStates, TableCellNode } from '@lexical/table';
|
|
8
8
|
import { mergeRegister } from '@lexical/utils';
|
|
9
9
|
import { useScrollInfo } from '@payloadcms/ui';
|
|
10
|
-
import { $createParagraphNode, $getRoot, $getSelection, $isElementNode, $isParagraphNode, $isRangeSelection, $isTextNode, COMMAND_PRIORITY_CRITICAL, getDOMSelection, SELECTION_CHANGE_COMMAND } from 'lexical';
|
|
10
|
+
import { $createParagraphNode, $getRoot, $getSelection, $isElementNode, $isParagraphNode, $isRangeSelection, $isTextNode, COMMAND_PRIORITY_CRITICAL, getDOMSelection, isDOMNode, SELECTION_CHANGE_COMMAND } from 'lexical';
|
|
11
11
|
import * as React from 'react';
|
|
12
12
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
13
13
|
import { createPortal } from 'react-dom';
|
|
@@ -117,7 +117,7 @@ function TableActionMenu({
|
|
|
117
117
|
}, [contextRef, dropDownRef, editor, y]);
|
|
118
118
|
useEffect(() => {
|
|
119
119
|
function handleClickOutside(event) {
|
|
120
|
-
if (dropDownRef.current != null && contextRef.current != null && !dropDownRef.current.contains(event.target) && !contextRef.current.contains(event.target)) {
|
|
120
|
+
if (dropDownRef.current != null && contextRef.current != null && isDOMNode(event.target) && !dropDownRef.current.contains(event.target) && !contextRef.current.contains(event.target)) {
|
|
121
121
|
setIsMenuOpen(false);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
@@ -147,38 +147,88 @@ function TableActionMenu({
|
|
|
147
147
|
editor.update(() => {
|
|
148
148
|
const selection_0 = $getSelection();
|
|
149
149
|
if ($isTableSelection(selection_0)) {
|
|
150
|
-
|
|
151
|
-
columns,
|
|
152
|
-
rows
|
|
153
|
-
} = computeSelectionCount(selection_0);
|
|
150
|
+
// Get all selected cells and compute the total area
|
|
154
151
|
const nodes = selection_0.getNodes();
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
152
|
+
const tableCells = nodes.filter($isTableCellNode);
|
|
153
|
+
if (tableCells.length === 0) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
// Find the table node
|
|
157
|
+
const tableNode_0 = $getTableNodeFromLexicalNodeOrThrow(tableCells[0]);
|
|
158
|
+
const [gridMap] = $computeTableMapSkipCellCheck(tableNode_0, null, null);
|
|
159
|
+
// Find the boundaries of the selection including merged cells
|
|
160
|
+
let minRow = Infinity;
|
|
161
|
+
let maxRow = -Infinity;
|
|
162
|
+
let minCol = Infinity;
|
|
163
|
+
let maxCol = -Infinity;
|
|
164
|
+
// First pass: find the actual boundaries considering merged cells
|
|
165
|
+
const processedCells = new Set();
|
|
166
|
+
for (const row of gridMap) {
|
|
167
|
+
for (const mapCell of row) {
|
|
168
|
+
if (!mapCell || !mapCell.cell) {
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
const cellKey = mapCell.cell.getKey();
|
|
172
|
+
if (processedCells.has(cellKey)) {
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
if (tableCells.some(cell => cell.is(mapCell.cell))) {
|
|
176
|
+
processedCells.add(cellKey);
|
|
177
|
+
// Get the actual position of this cell in the grid
|
|
178
|
+
const cellStartRow = mapCell.startRow;
|
|
179
|
+
const cellStartCol = mapCell.startColumn;
|
|
180
|
+
const cellRowSpan = mapCell.cell.__rowSpan || 1;
|
|
181
|
+
const cellColSpan = mapCell.cell.__colSpan || 1;
|
|
182
|
+
// Update boundaries considering the cell's actual position and span
|
|
183
|
+
minRow = Math.min(minRow, cellStartRow);
|
|
184
|
+
maxRow = Math.max(maxRow, cellStartRow + cellRowSpan - 1);
|
|
185
|
+
minCol = Math.min(minCol, cellStartCol);
|
|
186
|
+
maxCol = Math.max(maxCol, cellStartCol + cellColSpan - 1);
|
|
173
187
|
}
|
|
174
188
|
}
|
|
175
189
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
190
|
+
// Validate boundaries
|
|
191
|
+
if (minRow === Infinity || minCol === Infinity) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
// The total span of the merged cell
|
|
195
|
+
const totalRowSpan = maxRow - minRow + 1;
|
|
196
|
+
const totalColSpan = maxCol - minCol + 1;
|
|
197
|
+
// Use the top-left cell as the target cell
|
|
198
|
+
const targetCellMap = gridMap?.[minRow]?.[minCol];
|
|
199
|
+
if (!targetCellMap?.cell) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const targetCell = targetCellMap.cell;
|
|
203
|
+
// Set the spans for the target cell
|
|
204
|
+
targetCell.setColSpan(totalColSpan);
|
|
205
|
+
targetCell.setRowSpan(totalRowSpan);
|
|
206
|
+
// Move content from other cells to the target cell
|
|
207
|
+
const seenCells = new Set([targetCell.getKey()]);
|
|
208
|
+
// Second pass: merge content and remove other cells
|
|
209
|
+
for (let row_0 = minRow; row_0 <= maxRow; row_0++) {
|
|
210
|
+
for (let col = minCol; col <= maxCol; col++) {
|
|
211
|
+
const mapCell_0 = gridMap?.[row_0]?.[col];
|
|
212
|
+
if (!mapCell_0?.cell) {
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
const currentCell = mapCell_0.cell;
|
|
216
|
+
const key = currentCell.getKey();
|
|
217
|
+
if (!seenCells.has(key)) {
|
|
218
|
+
seenCells.add(key);
|
|
219
|
+
const isEmpty = $cellContainsEmptyParagraph(currentCell);
|
|
220
|
+
if (!isEmpty) {
|
|
221
|
+
targetCell.append(...currentCell.getChildren());
|
|
222
|
+
}
|
|
223
|
+
currentCell.remove();
|
|
224
|
+
}
|
|
179
225
|
}
|
|
180
|
-
$selectLastDescendant(firstCell);
|
|
181
226
|
}
|
|
227
|
+
// Ensure target cell has content
|
|
228
|
+
if (targetCell.getChildrenSize() === 0) {
|
|
229
|
+
targetCell.append($createParagraphNode());
|
|
230
|
+
}
|
|
231
|
+
$selectLastDescendant(targetCell);
|
|
182
232
|
onClose();
|
|
183
233
|
}
|
|
184
234
|
});
|
|
@@ -190,10 +240,12 @@ function TableActionMenu({
|
|
|
190
240
|
};
|
|
191
241
|
const insertTableRowAtSelection = useCallback(shouldInsertAfter => {
|
|
192
242
|
editor.update(() => {
|
|
193
|
-
|
|
243
|
+
for (let i = 0; i < selectionCounts.rows; i++) {
|
|
244
|
+
$insertTableRow__EXPERIMENTAL(shouldInsertAfter);
|
|
245
|
+
}
|
|
194
246
|
onClose();
|
|
195
247
|
});
|
|
196
|
-
}, [editor, onClose]);
|
|
248
|
+
}, [editor, onClose, selectionCounts.rows]);
|
|
197
249
|
const insertTableColumnAtSelection = useCallback(shouldInsertAfter_0 => {
|
|
198
250
|
editor.update(() => {
|
|
199
251
|
for (let i_0 = 0; i_0 < selectionCounts.columns; i_0++) {
|
|
@@ -210,8 +262,8 @@ function TableActionMenu({
|
|
|
210
262
|
}, [editor, onClose]);
|
|
211
263
|
const deleteTableAtSelection = useCallback(() => {
|
|
212
264
|
editor.update(() => {
|
|
213
|
-
const
|
|
214
|
-
|
|
265
|
+
const tableNode_1 = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
|
|
266
|
+
tableNode_1.remove();
|
|
215
267
|
clearTableSelection();
|
|
216
268
|
onClose();
|
|
217
269
|
});
|
|
@@ -224,51 +276,45 @@ function TableActionMenu({
|
|
|
224
276
|
}, [editor, onClose]);
|
|
225
277
|
const toggleTableRowIsHeader = useCallback(() => {
|
|
226
278
|
editor.update(() => {
|
|
227
|
-
const
|
|
279
|
+
const tableNode_2 = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
|
|
228
280
|
const tableRowIndex = $getTableRowIndexFromTableCellNode(tableCellNode);
|
|
229
|
-
const
|
|
230
|
-
|
|
231
|
-
throw new Error('Expected table cell to be inside of table row.');
|
|
232
|
-
}
|
|
233
|
-
const tableRow = tableRows[tableRowIndex];
|
|
234
|
-
if (!$isTableRowNode(tableRow)) {
|
|
235
|
-
throw new Error('Expected table row');
|
|
236
|
-
}
|
|
281
|
+
const [gridMap_0] = $computeTableMapSkipCellCheck(tableNode_2, null, null);
|
|
282
|
+
const rowCells = new Set();
|
|
237
283
|
const newStyle = tableCellNode.getHeaderStyles() ^ TableCellHeaderStates.ROW;
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
284
|
+
if (gridMap_0[tableRowIndex]) {
|
|
285
|
+
for (let col_0 = 0; col_0 < gridMap_0[tableRowIndex].length; col_0++) {
|
|
286
|
+
const mapCell_1 = gridMap_0[tableRowIndex][col_0];
|
|
287
|
+
if (!mapCell_1?.cell) {
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
if (!rowCells.has(mapCell_1.cell)) {
|
|
291
|
+
rowCells.add(mapCell_1.cell);
|
|
292
|
+
mapCell_1.cell.setHeaderStyles(newStyle, TableCellHeaderStates.ROW);
|
|
293
|
+
}
|
|
241
294
|
}
|
|
242
|
-
|
|
243
|
-
});
|
|
295
|
+
}
|
|
244
296
|
clearTableSelection();
|
|
245
297
|
onClose();
|
|
246
298
|
});
|
|
247
299
|
}, [editor, tableCellNode, clearTableSelection, onClose]);
|
|
248
300
|
const toggleTableColumnIsHeader = useCallback(() => {
|
|
249
301
|
editor.update(() => {
|
|
250
|
-
const
|
|
302
|
+
const tableNode_3 = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
|
|
251
303
|
const tableColumnIndex = $getTableColumnIndexFromTableCellNode(tableCellNode);
|
|
252
|
-
const
|
|
253
|
-
const
|
|
254
|
-
if (tableColumnIndex >= maxRowsLength || tableColumnIndex < 0) {
|
|
255
|
-
throw new Error('Expected table cell to be inside of table row.');
|
|
256
|
-
}
|
|
304
|
+
const [gridMap_1] = $computeTableMapSkipCellCheck(tableNode_3, null, null);
|
|
305
|
+
const columnCells = new Set();
|
|
257
306
|
const newStyle_0 = tableCellNode.getHeaderStyles() ^ TableCellHeaderStates.COLUMN;
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
if (!$isTableCellNode(tableCell_0)) {
|
|
269
|
-
throw new Error('Expected table cell');
|
|
307
|
+
if (gridMap_1) {
|
|
308
|
+
for (let row_1 = 0; row_1 < gridMap_1.length; row_1++) {
|
|
309
|
+
const mapCell_2 = gridMap_1?.[row_1]?.[tableColumnIndex];
|
|
310
|
+
if (!mapCell_2?.cell) {
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
if (!columnCells.has(mapCell_2.cell)) {
|
|
314
|
+
columnCells.add(mapCell_2.cell);
|
|
315
|
+
mapCell_2.cell.setHeaderStyles(newStyle_0, TableCellHeaderStates.COLUMN);
|
|
316
|
+
}
|
|
270
317
|
}
|
|
271
|
-
tableCell_0.setHeaderStyles(newStyle_0, TableCellHeaderStates.COLUMN);
|
|
272
318
|
}
|
|
273
319
|
clearTableSelection();
|
|
274
320
|
onClose();
|
|
@@ -277,9 +323,21 @@ function TableActionMenu({
|
|
|
277
323
|
const toggleRowStriping = useCallback(() => {
|
|
278
324
|
editor.update(() => {
|
|
279
325
|
if (tableCellNode.isAttached()) {
|
|
280
|
-
const
|
|
281
|
-
if (
|
|
282
|
-
|
|
326
|
+
const tableNode_4 = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
|
|
327
|
+
if (tableNode_4) {
|
|
328
|
+
tableNode_4.setRowStriping(!tableNode_4.getRowStriping());
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
clearTableSelection();
|
|
332
|
+
onClose();
|
|
333
|
+
});
|
|
334
|
+
}, [editor, tableCellNode, clearTableSelection, onClose]);
|
|
335
|
+
const toggleFirstColumnFreeze = useCallback(() => {
|
|
336
|
+
editor.update(() => {
|
|
337
|
+
if (tableCellNode.isAttached()) {
|
|
338
|
+
const tableNode_5 = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);
|
|
339
|
+
if (tableNode_5) {
|
|
340
|
+
tableNode_5.setFrozenColumns(tableNode_5.getFrozenColumns() === 0 ? 1 : 0);
|
|
283
341
|
}
|
|
284
342
|
}
|
|
285
343
|
clearTableSelection();
|
|
@@ -332,6 +390,15 @@ function TableActionMenu({
|
|
|
332
390
|
className: "text",
|
|
333
391
|
children: "Toggle Row Striping"
|
|
334
392
|
})
|
|
393
|
+
}), /*#__PURE__*/_jsx("button", {
|
|
394
|
+
className: "item",
|
|
395
|
+
"data-test-id": "table-freeze-first-column",
|
|
396
|
+
onClick: () => toggleFirstColumnFreeze(),
|
|
397
|
+
type: "button",
|
|
398
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
399
|
+
className: "text",
|
|
400
|
+
children: "Toggle First Column Freeze"
|
|
401
|
+
})
|
|
335
402
|
}), /*#__PURE__*/_jsx("button", {
|
|
336
403
|
className: "item",
|
|
337
404
|
"data-test-id": "table-insert-row-above",
|
|
@@ -397,6 +464,7 @@ function TableActionMenu({
|
|
|
397
464
|
})
|
|
398
465
|
}), /*#__PURE__*/_jsx("hr", {}), /*#__PURE__*/_jsx("button", {
|
|
399
466
|
className: "item",
|
|
467
|
+
"data-test-id": "table-row-header",
|
|
400
468
|
onClick: () => toggleTableRowIsHeader(),
|
|
401
469
|
type: "button",
|
|
402
470
|
children: /*#__PURE__*/_jsxs("span", {
|