@payloadcms/richtext-lexical 3.28.0-internal.c4e1bed → 3.28.0

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.
@@ -8,7 +8,6 @@ export const UploadJSXConverter = {
8
8
  if (typeof uploadNode.value !== 'object') {
9
9
  return null;
10
10
  }
11
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
12
11
  const uploadDoc = uploadNode.value;
13
12
  const url = uploadDoc.url;
14
13
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"upload.js","names":["UploadJSXConverter","upload","node","uploadNode","value","uploadDoc","url","mimeType","startsWith","_jsx","href","rel","filename","sizes","Object","keys","length","alt","height","src","width","pictureJSX","size","imageSize","filesize","imageSizeURL","push","media","srcSet","type"],"sources":["../../../../../../src/features/converters/jsx/converter/converters/upload.tsx"],"sourcesContent":["import type { FileData, FileSizeImproved, TypeWithID } from 'payload'\n\nimport type { SerializedUploadNode } from '../../../../../nodeTypes.js'\nimport type { UploadDataImproved } from '../../../../upload/server/nodes/UploadNode.js'\nimport type { JSXConverters } from '../types.js'\n\nexport const UploadJSXConverter: JSXConverters<SerializedUploadNode> = {\n upload: ({ node }) => {\n // TO-DO (v4): SerializedUploadNode should use UploadData_P4\n const uploadNode = node as UploadDataImproved\n if (typeof uploadNode.value !== 'object') {\n return null\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n const uploadDoc = uploadNode.value as FileData & TypeWithID\n\n const url = uploadDoc.url\n\n /**\n * If the upload is not an image, return a link to the upload\n */\n if (!uploadDoc.mimeType.startsWith('image')) {\n return (\n <a href={url} rel=\"noopener noreferrer\">\n {uploadDoc.filename}\n </a>\n )\n }\n\n /**\n * If the upload is a simple image with no different sizes, return a simple img tag\n */\n if (!uploadDoc.sizes || !Object.keys(uploadDoc.sizes).length) {\n return (\n <img alt={uploadDoc.filename} height={uploadDoc.height} src={url} width={uploadDoc.width} />\n )\n }\n\n /**\n * If the upload is an image with different sizes, return a picture element\n */\n const pictureJSX: React.ReactNode[] = []\n\n // Iterate through each size in the data.sizes object\n for (const size in uploadDoc.sizes) {\n const imageSize = uploadDoc.sizes[size] as FileSizeImproved\n\n // Skip if any property of the size object is null\n if (\n !imageSize ||\n !imageSize.width ||\n !imageSize.height ||\n !imageSize.mimeType ||\n !imageSize.filesize ||\n !imageSize.filename ||\n !imageSize.url\n ) {\n continue\n }\n const imageSizeURL = imageSize?.url\n\n pictureJSX.push(\n <source\n key={size}\n media={`(max-width: ${imageSize.width}px)`}\n srcSet={imageSizeURL}\n type={imageSize.mimeType}\n />,\n )\n }\n\n // Add the default img tag\n pictureJSX.push(\n <img\n alt={uploadDoc?.filename}\n height={uploadDoc?.height}\n key={'image'}\n src={url}\n width={uploadDoc?.width}\n />,\n )\n return <picture>{pictureJSX}</picture>\n },\n}\n"],"mappings":";AAMA,OAAO,MAAMA,kBAAA,GAA0D;EACrEC,MAAA,EAAQA,CAAC;IAAEC;EAAI,CAAE;IACf;IACA,MAAMC,UAAA,GAAaD,IAAA;IACnB,IAAI,OAAOC,UAAA,CAAWC,KAAK,KAAK,UAAU;MACxC,OAAO;IACT;IAEA;IACA,MAAMC,SAAA,GAAYF,UAAA,CAAWC,KAAK;IAElC,MAAME,GAAA,GAAMD,SAAA,CAAUC,GAAG;IAEzB;;;IAGA,IAAI,CAACD,SAAA,CAAUE,QAAQ,CAACC,UAAU,CAAC,UAAU;MAC3C,oBACEC,IAAA,CAAC;QAAEC,IAAA,EAAMJ,GAAA;QAAKK,GAAA,EAAI;kBACfN,SAAA,CAAUO;;IAGjB;IAEA;;;IAGA,IAAI,CAACP,SAAA,CAAUQ,KAAK,IAAI,CAACC,MAAA,CAAOC,IAAI,CAACV,SAAA,CAAUQ,KAAK,EAAEG,MAAM,EAAE;MAC5D,oBACEP,IAAA,CAAC;QAAIQ,GAAA,EAAKZ,SAAA,CAAUO,QAAQ;QAAEM,MAAA,EAAQb,SAAA,CAAUa,MAAM;QAAEC,GAAA,EAAKb,GAAA;QAAKc,KAAA,EAAOf,SAAA,CAAUe;;IAEvF;IAEA;;;IAGA,MAAMC,UAAA,GAAgC,EAAE;IAExC;IACA,KAAK,MAAMC,IAAA,IAAQjB,SAAA,CAAUQ,KAAK,EAAE;MAClC,MAAMU,SAAA,GAAYlB,SAAA,CAAUQ,KAAK,CAACS,IAAA,CAAK;MAEvC;MACA,IACE,CAACC,SAAA,IACD,CAACA,SAAA,CAAUH,KAAK,IAChB,CAACG,SAAA,CAAUL,MAAM,IACjB,CAACK,SAAA,CAAUhB,QAAQ,IACnB,CAACgB,SAAA,CAAUC,QAAQ,IACnB,CAACD,SAAA,CAAUX,QAAQ,IACnB,CAACW,SAAA,CAAUjB,GAAG,EACd;QACA;MACF;MACA,MAAMmB,YAAA,GAAeF,SAAA,EAAWjB,GAAA;MAEhCe,UAAA,CAAWK,IAAI,cACbjB,IAAA,CAAC;QAECkB,KAAA,EAAO,eAAeJ,SAAA,CAAUH,KAAK,KAAK;QAC1CQ,MAAA,EAAQH,YAAA;QACRI,IAAA,EAAMN,SAAA,CAAUhB;SAHXe,IAAA;IAMX;IAEA;IACAD,UAAA,CAAWK,IAAI,cACbjB,IAAA,CAAC;MACCQ,GAAA,EAAKZ,SAAA,EAAWO,QAAA;MAChBM,MAAA,EAAQb,SAAA,EAAWa,MAAA;MAEnBC,GAAA,EAAKb,GAAA;MACLc,KAAA,EAAOf,SAAA,EAAWe;OAFb;IAKT,oBAAOX,IAAA,CAAC;gBAASY;;EACnB;AACF","ignoreList":[]}
1
+ {"version":3,"file":"upload.js","names":["UploadJSXConverter","upload","node","uploadNode","value","uploadDoc","url","mimeType","startsWith","_jsx","href","rel","filename","sizes","Object","keys","length","alt","height","src","width","pictureJSX","size","imageSize","filesize","imageSizeURL","push","media","srcSet","type"],"sources":["../../../../../../src/features/converters/jsx/converter/converters/upload.tsx"],"sourcesContent":["import type { FileData, FileSizeImproved, TypeWithID } from 'payload'\n\nimport type { SerializedUploadNode } from '../../../../../nodeTypes.js'\nimport type { UploadDataImproved } from '../../../../upload/server/nodes/UploadNode.js'\nimport type { JSXConverters } from '../types.js'\n\nexport const UploadJSXConverter: JSXConverters<SerializedUploadNode> = {\n upload: ({ node }) => {\n // TO-DO (v4): SerializedUploadNode should use UploadData_P4\n const uploadNode = node as UploadDataImproved\n if (typeof uploadNode.value !== 'object') {\n return null\n }\n\n \n const uploadDoc = uploadNode.value as FileData & TypeWithID\n\n const url = uploadDoc.url\n\n /**\n * If the upload is not an image, return a link to the upload\n */\n if (!uploadDoc.mimeType.startsWith('image')) {\n return (\n <a href={url} rel=\"noopener noreferrer\">\n {uploadDoc.filename}\n </a>\n )\n }\n\n /**\n * If the upload is a simple image with no different sizes, return a simple img tag\n */\n if (!uploadDoc.sizes || !Object.keys(uploadDoc.sizes).length) {\n return (\n <img alt={uploadDoc.filename} height={uploadDoc.height} src={url} width={uploadDoc.width} />\n )\n }\n\n /**\n * If the upload is an image with different sizes, return a picture element\n */\n const pictureJSX: React.ReactNode[] = []\n\n // Iterate through each size in the data.sizes object\n for (const size in uploadDoc.sizes) {\n const imageSize = uploadDoc.sizes[size] as FileSizeImproved\n\n // Skip if any property of the size object is null\n if (\n !imageSize ||\n !imageSize.width ||\n !imageSize.height ||\n !imageSize.mimeType ||\n !imageSize.filesize ||\n !imageSize.filename ||\n !imageSize.url\n ) {\n continue\n }\n const imageSizeURL = imageSize?.url\n\n pictureJSX.push(\n <source\n key={size}\n media={`(max-width: ${imageSize.width}px)`}\n srcSet={imageSizeURL}\n type={imageSize.mimeType}\n />,\n )\n }\n\n // Add the default img tag\n pictureJSX.push(\n <img\n alt={uploadDoc?.filename}\n height={uploadDoc?.height}\n key={'image'}\n src={url}\n width={uploadDoc?.width}\n />,\n )\n return <picture>{pictureJSX}</picture>\n },\n}\n"],"mappings":";AAMA,OAAO,MAAMA,kBAAA,GAA0D;EACrEC,MAAA,EAAQA,CAAC;IAAEC;EAAI,CAAE;IACf;IACA,MAAMC,UAAA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;QACRI,IAAA,EAAMN,SAAA,CAAUhB;SAHXe,IAAA;IAMX;IAEA;IACAD,UAAA,CAAWK,IAAI,cACbjB,IAAA,CAAC;MACCQ,GAAA,EAAKZ,SAAA,EAAWO,QAAA;MAChBM,MAAA,EAAQb,SAAA,EAAWa,MAAA;MAEnBC,GAAA,EAAKb,GAAA;MACLc,KAAA,EAAOf,SAAA,EAAWe;OAFb;IAKT,oBAAOX,IAAA,CAAC;gBAASY;;EACnB;AACF","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ import type { PluginComponent } from '../../typesClient.js';
2
+ import type { IndentFeatureProps } from '../server/index.js';
3
+ export declare const IndentPlugin: PluginComponent<IndentFeatureProps>;
4
+ //# sourceMappingURL=IndentPlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IndentPlugin.d.ts","sourceRoot":"","sources":["../../../../src/features/indent/client/IndentPlugin.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAE5D,eAAO,MAAM,YAAY,EAAE,eAAe,CAAC,kBAAkB,CAyB5D,CAAA"}
@@ -0,0 +1,52 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
3
+ import { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin';
4
+ import { $findMatchingParent, mergeRegister } from '@lexical/utils';
5
+ import { $getSelection, $isElementNode, $isRangeSelection, COMMAND_PRIORITY_LOW, INDENT_CONTENT_COMMAND } from 'lexical';
6
+ import { useEffect } from 'react';
7
+ export const IndentPlugin = props => {
8
+ const [editor] = useLexicalComposerContext();
9
+ const {
10
+ disabledNodes
11
+ } = props.clientProps;
12
+ useEffect(() => {
13
+ if (!editor || !disabledNodes?.length) {
14
+ return;
15
+ }
16
+ return mergeRegister(editor.registerCommand(INDENT_CONTENT_COMMAND, () => {
17
+ return $handleIndentAndOutdent(block => {
18
+ if (!disabledNodes.includes(block.getType())) {
19
+ const indent = block.getIndent();
20
+ block.setIndent(indent + 1);
21
+ }
22
+ });
23
+ }, COMMAND_PRIORITY_LOW));
24
+ }, [editor, disabledNodes]);
25
+ return /*#__PURE__*/_jsx(TabIndentationPlugin, {});
26
+ };
27
+ function $handleIndentAndOutdent(indentOrOutdent) {
28
+ const selection = $getSelection();
29
+ if (!$isRangeSelection(selection)) {
30
+ return false;
31
+ }
32
+ const alreadyHandled = new Set();
33
+ const nodes = selection.getNodes();
34
+ for (let i = 0; i < nodes.length; i++) {
35
+ const node = nodes[i];
36
+ const key = node.getKey();
37
+ if (alreadyHandled.has(key)) {
38
+ continue;
39
+ }
40
+ const parentBlock = $findMatchingParent(node, parentNode => $isElementNode(parentNode) && !parentNode.isInline());
41
+ if (parentBlock === null) {
42
+ continue;
43
+ }
44
+ const parentKey = parentBlock.getKey();
45
+ if (parentBlock.canIndent() && !alreadyHandled.has(parentKey)) {
46
+ alreadyHandled.add(parentKey);
47
+ indentOrOutdent(parentBlock);
48
+ }
49
+ }
50
+ return alreadyHandled.size > 0;
51
+ }
52
+ //# sourceMappingURL=IndentPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IndentPlugin.js","names":["useLexicalComposerContext","TabIndentationPlugin","$findMatchingParent","mergeRegister","$getSelection","$isElementNode","$isRangeSelection","COMMAND_PRIORITY_LOW","INDENT_CONTENT_COMMAND","useEffect","IndentPlugin","props","editor","disabledNodes","clientProps","length","registerCommand","$handleIndentAndOutdent","block","includes","getType","indent","getIndent","setIndent","_jsx","indentOrOutdent","selection","alreadyHandled","Set","nodes","getNodes","i","node","key","getKey","has","parentBlock","parentNode","isInline","parentKey","canIndent","add","size"],"sources":["../../../../src/features/indent/client/IndentPlugin.tsx"],"sourcesContent":["import type { ElementNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin'\nimport { $findMatchingParent, mergeRegister } from '@lexical/utils'\nimport {\n $getSelection,\n $isElementNode,\n $isRangeSelection,\n COMMAND_PRIORITY_LOW,\n INDENT_CONTENT_COMMAND,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { PluginComponent } from '../../typesClient.js'\nimport type { IndentFeatureProps } from '../server/index.js'\n\nexport const IndentPlugin: PluginComponent<IndentFeatureProps> = (props) => {\n const [editor] = useLexicalComposerContext()\n const { disabledNodes } = props.clientProps\n\n useEffect(() => {\n if (!editor || !disabledNodes?.length) {\n return\n }\n return mergeRegister(\n editor.registerCommand(\n INDENT_CONTENT_COMMAND,\n () => {\n return $handleIndentAndOutdent((block) => {\n if (!disabledNodes.includes(block.getType())) {\n const indent = block.getIndent()\n block.setIndent(indent + 1)\n }\n })\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor, disabledNodes])\n\n return <TabIndentationPlugin />\n}\n\nfunction $handleIndentAndOutdent(indentOrOutdent: (block: ElementNode) => void): boolean {\n const selection = $getSelection()\n if (!$isRangeSelection(selection)) {\n return false\n }\n const alreadyHandled = new Set()\n const nodes = selection.getNodes()\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i]!\n const key = node.getKey()\n if (alreadyHandled.has(key)) {\n continue\n }\n const parentBlock = $findMatchingParent(\n node,\n (parentNode): parentNode is ElementNode =>\n $isElementNode(parentNode) && !parentNode.isInline(),\n )\n if (parentBlock === null) {\n continue\n }\n const parentKey = parentBlock.getKey()\n if (parentBlock.canIndent() && !alreadyHandled.has(parentKey)) {\n alreadyHandled.add(parentKey)\n indentOrOutdent(parentBlock)\n }\n }\n return alreadyHandled.size > 0\n}\n"],"mappings":";AAEA,SAASA,yBAAyB,QAAQ;AAC1C,SAASC,oBAAoB,QAAQ;AACrC,SAASC,mBAAmB,EAAEC,aAAa,QAAQ;AACnD,SACEC,aAAa,EACbC,cAAc,EACdC,iBAAiB,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ACA,UAAA,CAAWC,QAAQ;IAEtD,IAAIF,WAAA,KAAgB,MAAM;MACxB;IACF;IACA,MAAMG,SAAA,GAAYH,WAAA,CAAYF,MAAM;IACpC,IAAIE,WAAA,CAAYI,SAAS,MAAM,CAACb,cAAA,CAAeQ,GAAG,CAACI,SAAA,GAAY;MAC7DZ,cAAA,CAAec,GAAG,CAACF,SAAA;MACnBd,eAAA,CAAgBW,WAAA;IAClB;EACF;EACA,OAAOT,cAAA,CAAee,IAAI,GAAG;AAC/B","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- export declare const IndentFeatureClient: import("../../typesClient.js").FeatureProviderProviderClient<undefined, any>;
1
+ export declare const IndentFeatureClient: import("../../typesClient.js").FeatureProviderProviderClient<undefined, import("../server/index.js").IndentFeatureProps>;
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/indent/client/index.tsx"],"names":[],"mappings":"AAmFA,eAAO,MAAM,mBAAmB,8EAa9B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/indent/client/index.tsx"],"names":[],"mappings":"AAkFA,eAAO,MAAM,mBAAmB,0HAa9B,CAAA"}
@@ -1,11 +1,11 @@
1
1
  'use client';
2
2
 
3
- import { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin';
4
3
  import { $findMatchingParent } from '@lexical/utils';
5
4
  import { $isElementNode, $isRangeSelection, INDENT_CONTENT_COMMAND, OUTDENT_CONTENT_COMMAND } from 'lexical';
6
5
  import { IndentDecreaseIcon } from '../../../lexical/ui/icons/IndentDecrease/index.js';
7
6
  import { IndentIncreaseIcon } from '../../../lexical/ui/icons/IndentIncrease/index.js';
8
7
  import { createClientFeature } from '../../../utilities/createClientFeature.js';
8
+ import { IndentPlugin } from './IndentPlugin.js';
9
9
  import { toolbarIndentGroupWithItems } from './toolbarIndentGroup.js';
10
10
  const toolbarGroups = [toolbarIndentGroupWithItems([{
11
11
  ChildComponent: IndentDecreaseIcon,
@@ -70,7 +70,7 @@ const toolbarGroups = [toolbarIndentGroupWithItems([{
70
70
  }])];
71
71
  export const IndentFeatureClient = createClientFeature({
72
72
  plugins: [{
73
- Component: TabIndentationPlugin,
73
+ Component: IndentPlugin,
74
74
  position: 'normal'
75
75
  }],
76
76
  toolbarFixed: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["TabIndentationPlugin","$findMatchingParent","$isElementNode","$isRangeSelection","INDENT_CONTENT_COMMAND","OUTDENT_CONTENT_COMMAND","IndentDecreaseIcon","IndentIncreaseIcon","createClientFeature","toolbarIndentGroupWithItems","toolbarGroups","ChildComponent","isActive","isEnabled","selection","nodes","getNodes","length","atLeastOneNodeCanOutdent","isIndentable","node","canIndent","getIndent","anchorNode","anchor","getNode","focusNode","focus","key","label","i18n","t","onSelect","editor","dispatchCommand","undefined","order","IndentFeatureClient","plugins","Component","position","toolbarFixed","groups","toolbarInline"],"sources":["../../../../src/features/indent/client/index.tsx"],"sourcesContent":["'use client'\n\nimport type { ElementNode, LexicalNode } from 'lexical'\n\nimport { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin'\nimport { $findMatchingParent } from '@lexical/utils'\nimport {\n $isElementNode,\n $isRangeSelection,\n INDENT_CONTENT_COMMAND,\n OUTDENT_CONTENT_COMMAND,\n} from 'lexical'\n\nimport type { ToolbarGroup } from '../../toolbars/types.js'\nimport type { PluginComponent } from '../../typesClient.js'\n\nimport { IndentDecreaseIcon } from '../../../lexical/ui/icons/IndentDecrease/index.js'\nimport { IndentIncreaseIcon } from '../../../lexical/ui/icons/IndentIncrease/index.js'\nimport { createClientFeature } from '../../../utilities/createClientFeature.js'\nimport { toolbarIndentGroupWithItems } from './toolbarIndentGroup.js'\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarIndentGroupWithItems([\n {\n ChildComponent: IndentDecreaseIcon,\n isActive: () => false,\n isEnabled: ({ selection }) => {\n const nodes = selection?.getNodes()\n if (!nodes?.length) {\n return false\n }\n let atLeastOneNodeCanOutdent = false\n const isIndentable = (node: LexicalNode): node is ElementNode =>\n $isElementNode(node) && node.canIndent()\n for (const node of nodes) {\n if (isIndentable(node)) {\n if (node.getIndent() <= 0) {\n return false\n } else {\n atLeastOneNodeCanOutdent = true\n }\n }\n }\n if (!atLeastOneNodeCanOutdent && $isRangeSelection(selection)) {\n const anchorNode = selection.anchor.getNode()\n if (\n $findMatchingParent(anchorNode, (node) => isIndentable(node) && node.getIndent() > 0)\n ) {\n return true\n }\n const focusNode = selection.focus.getNode()\n if (\n $findMatchingParent(focusNode, (node) => isIndentable(node) && node.getIndent() > 0)\n ) {\n return true\n }\n }\n return atLeastOneNodeCanOutdent\n },\n key: 'indentDecrease',\n label: ({ i18n }) => {\n return i18n.t('lexical:indent:decreaseLabel')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(OUTDENT_CONTENT_COMMAND, undefined)\n },\n order: 1,\n },\n {\n ChildComponent: IndentIncreaseIcon,\n isActive: () => false,\n key: 'indentIncrease',\n label: ({ i18n }) => {\n return i18n.t('lexical:indent:increaseLabel')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INDENT_CONTENT_COMMAND, undefined)\n },\n order: 2,\n },\n ]),\n]\n\nexport const IndentFeatureClient = createClientFeature({\n plugins: [\n {\n Component: TabIndentationPlugin as PluginComponent,\n position: 'normal',\n },\n ],\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n})\n"],"mappings":"AAAA;;AAIA,SAASA,oBAAoB,QAAQ;AACrC,SAASC,mBAAmB,QAAQ;AACpC,SACEC,cAAc,EACdC,iBAAiB,EACjBC,sBAAsB,EACtBC,uBAAuB,QAClB;AAKP,SAASC,kBAAkB,QAAQ;AACnC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,mBAAmB,QAAQ;AACpC,SAASC,2BAA2B,QAAQ;AAE5C,MAAMC,aAA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C,KAAA,EAAO;AACT,GACA;EACEzB,cAAA,EAAgBJ,kBAAA;EAChBK,QAAA,EAAUA,CAAA,KAAM;EAChBgB,GAAA,EAAK;EACLC,KAAA,EAAOA,CAAC;IAAEC;EAAI,CAAE;IACd,OAAOA,IAAA,CAAKC,CAAC,CAAC;EAChB;EACAC,QAAA,EAAUA,CAAC;IAAEC;EAAM,CAAE;IACnBA,MAAA,CAAOC,eAAe,CAAC9B,sBAAA,EAAwB+B,SAAA;EACjD;EACAC,KAAA,EAAO;AACT,EACD,EACF;AAED,OAAO,MAAMC,mBAAA,GAAsB7B,mBAAA,CAAoB;EACrD8B,OAAA,EAAS,CACP;IACEC,SAAA,EAAWvC,oBAAA;IACXwC,QAAA,EAAU;EACZ,EACD;EACDC,YAAA,EAAc;IACZC,MAAA,EAAQhC;EACV;EACAiC,aAAA,EAAe;IACbD,MAAA,EAAQhC;EACV;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["$findMatchingParent","$isElementNode","$isRangeSelection","INDENT_CONTENT_COMMAND","OUTDENT_CONTENT_COMMAND","IndentDecreaseIcon","IndentIncreaseIcon","createClientFeature","IndentPlugin","toolbarIndentGroupWithItems","toolbarGroups","ChildComponent","isActive","isEnabled","selection","nodes","getNodes","length","atLeastOneNodeCanOutdent","isIndentable","node","canIndent","getIndent","anchorNode","anchor","getNode","focusNode","focus","key","label","i18n","t","onSelect","editor","dispatchCommand","undefined","order","IndentFeatureClient","plugins","Component","position","toolbarFixed","groups","toolbarInline"],"sources":["../../../../src/features/indent/client/index.tsx"],"sourcesContent":["'use client'\n\nimport type { ElementNode, LexicalNode } from 'lexical'\n\nimport { $findMatchingParent } from '@lexical/utils'\nimport {\n $isElementNode,\n $isRangeSelection,\n INDENT_CONTENT_COMMAND,\n OUTDENT_CONTENT_COMMAND,\n} from 'lexical'\n\nimport type { ToolbarGroup } from '../../toolbars/types.js'\n\nimport { IndentDecreaseIcon } from '../../../lexical/ui/icons/IndentDecrease/index.js'\nimport { IndentIncreaseIcon } from '../../../lexical/ui/icons/IndentIncrease/index.js'\nimport { createClientFeature } from '../../../utilities/createClientFeature.js'\nimport { IndentPlugin } from './IndentPlugin.js'\nimport { toolbarIndentGroupWithItems } from './toolbarIndentGroup.js'\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarIndentGroupWithItems([\n {\n ChildComponent: IndentDecreaseIcon,\n isActive: () => false,\n isEnabled: ({ selection }) => {\n const nodes = selection?.getNodes()\n if (!nodes?.length) {\n return false\n }\n let atLeastOneNodeCanOutdent = false\n const isIndentable = (node: LexicalNode): node is ElementNode =>\n $isElementNode(node) && node.canIndent()\n for (const node of nodes) {\n if (isIndentable(node)) {\n if (node.getIndent() <= 0) {\n return false\n } else {\n atLeastOneNodeCanOutdent = true\n }\n }\n }\n if (!atLeastOneNodeCanOutdent && $isRangeSelection(selection)) {\n const anchorNode = selection.anchor.getNode()\n if (\n $findMatchingParent(anchorNode, (node) => isIndentable(node) && node.getIndent() > 0)\n ) {\n return true\n }\n const focusNode = selection.focus.getNode()\n if (\n $findMatchingParent(focusNode, (node) => isIndentable(node) && node.getIndent() > 0)\n ) {\n return true\n }\n }\n return atLeastOneNodeCanOutdent\n },\n key: 'indentDecrease',\n label: ({ i18n }) => {\n return i18n.t('lexical:indent:decreaseLabel')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(OUTDENT_CONTENT_COMMAND, undefined)\n },\n order: 1,\n },\n {\n ChildComponent: IndentIncreaseIcon,\n isActive: () => false,\n key: 'indentIncrease',\n label: ({ i18n }) => {\n return i18n.t('lexical:indent:increaseLabel')\n },\n onSelect: ({ editor }) => {\n editor.dispatchCommand(INDENT_CONTENT_COMMAND, undefined)\n },\n order: 2,\n },\n ]),\n]\n\nexport const IndentFeatureClient = createClientFeature({\n plugins: [\n {\n Component: IndentPlugin,\n position: 'normal',\n },\n ],\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n})\n"],"mappings":"A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ACA,OAAO;MACT;IACF;IACA,OAAOJ,wBAAA;EACT;EACAU,GAAA,EAAK;EACLC,KAAA,EAAOA,CAAC;IAAEC;EAAI,CAAE;IACd,OAAOA,IAAA,CAAKC,CAAC,CAAC;EAChB;EACAC,QAAA,EAAUA,CAAC;IAAEC;EAAM,CAAE;IACnBA,MAAA,CAAOC,eAAe,CAAC9B,uBAAA,EAAyB+B,SAAA;EAClD;EACAC,KAAA,EAAO;AACT,GACA;EACEzB,cAAA,EAAgBL,kBAAA;EAChBM,QAAA,EAAUA,CAAA,KAAM;EAChBgB,GAAA,EAAK;EACLC,KAAA,EAAOA,CAAC;IAAEC;EAAI,CAAE;IACd,OAAOA,IAAA,CAAKC,CAAC,CAAC;EAChB;EACAC,QAAA,EAAUA,CAAC;IAAEC;EAAM,CAAE;IACnBA,MAAA,CAAOC,eAAe,CAAC/B,sBAAA,EAAwBgC,SAAA;EACjD;EACAC,KAAA,EAAO;AACT,EACD,EACF;AAED,OAAO,MAAMC,mBAAA,GAAsB9B,mBAAA,CAAoB;EACrD+B,OAAA,EAAS,CACP;IACEC,SAAA,EAAW/B,YAAA;IACXgC,QAAA,EAAU;EACZ,EACD;EACDC,YAAA,EAAc;IACZC,MAAA,EAAQhC;EACV;EACAiC,aAAA,EAAe;IACbD,MAAA,EAAQhC;EACV;AACF","ignoreList":[]}
@@ -1,2 +1,9 @@
1
- export declare const IndentFeature: import("../../typesServer.js").FeatureProviderProviderServer<undefined, undefined, undefined>;
1
+ export type IndentFeatureProps = {
2
+ /**
3
+ * The nodes that should not be indented. "type" property of the nodes you don't want to be indented.
4
+ * These can be: "paragraph", "heading", "listitem", "quote" or other indentable nodes if they exist.
5
+ */
6
+ disabledNodes?: string[];
7
+ };
8
+ export declare const IndentFeature: import("../../typesServer.js").FeatureProviderProviderServer<IndentFeatureProps, IndentFeatureProps, IndentFeatureProps>;
2
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/indent/server/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,+FAMxB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/indent/server/index.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,aAAa,0HAaxB,CAAA"}
@@ -1,9 +1,14 @@
1
1
  import { createServerFeature } from '../../../utilities/createServerFeature.js';
2
2
  import { i18n } from './i18n.js';
3
3
  export const IndentFeature = createServerFeature({
4
- feature: {
5
- ClientFeature: '@payloadcms/richtext-lexical/client#IndentFeatureClient',
6
- i18n
4
+ feature: ({
5
+ props
6
+ }) => {
7
+ return {
8
+ ClientFeature: '@payloadcms/richtext-lexical/client#IndentFeatureClient',
9
+ clientFeatureProps: props,
10
+ i18n
11
+ };
7
12
  },
8
13
  key: 'indent'
9
14
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["createServerFeature","i18n","IndentFeature","feature","ClientFeature","key"],"sources":["../../../../src/features/indent/server/index.ts"],"sourcesContent":["import { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { i18n } from './i18n.js'\n\nexport const IndentFeature = createServerFeature({\n feature: {\n ClientFeature: '@payloadcms/richtext-lexical/client#IndentFeatureClient',\n i18n,\n },\n key: 'indent',\n})\n"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ;AACpC,SAASC,IAAI,QAAQ;AAErB,OAAO,MAAMC,aAAA,GAAgBF,mBAAA,CAAoB;EAC/CG,OAAA,EAAS;IACPC,aAAA,EAAe;IACfH;EACF;EACAI,GAAA,EAAK;AACP","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["createServerFeature","i18n","IndentFeature","feature","props","ClientFeature","clientFeatureProps","key"],"sources":["../../../../src/features/indent/server/index.ts"],"sourcesContent":["import { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { i18n } from './i18n.js'\n\nexport type IndentFeatureProps = {\n /**\n * The nodes that should not be indented. \"type\" property of the nodes you don't want to be indented.\n * These can be: \"paragraph\", \"heading\", \"listitem\", \"quote\" or other indentable nodes if they exist.\n */\n disabledNodes?: string[]\n}\n\nexport const IndentFeature = createServerFeature<\n IndentFeatureProps,\n IndentFeatureProps,\n IndentFeatureProps\n>({\n feature: ({ props }) => {\n return {\n ClientFeature: '@payloadcms/richtext-lexical/client#IndentFeatureClient',\n clientFeatureProps: props,\n i18n,\n }\n },\n key: 'indent',\n})\n"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ;AACpC,SAASC,IAAI,QAAQ;AAUrB,OAAO,MAAMC,aAAA,GAAgBF,mBAAA,CAI3B;EACAG,OAAA,EAASA,CAAC;IAAEC;EAAK,CAAE;IACjB,OAAO;MACLC,aAAA,EAAe;MACfC,kBAAA,EAAoBF,KAAA;MACpBH;IACF;EACF;EACAM,GAAA,EAAK;AACP","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/richtext-lexical",
3
- "version": "3.28.0-internal.c4e1bed",
3
+ "version": "3.28.0",
4
4
  "description": "The officially supported Lexical richtext adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -359,8 +359,8 @@
359
359
  "react-error-boundary": "4.1.2",
360
360
  "ts-essentials": "10.0.3",
361
361
  "uuid": "10.0.0",
362
- "@payloadcms/translations": "3.28.0-internal.c4e1bed",
363
- "@payloadcms/ui": "3.28.0-internal.c4e1bed"
362
+ "@payloadcms/translations": "3.28.0",
363
+ "@payloadcms/ui": "3.28.0"
364
364
  },
365
365
  "devDependencies": {
366
366
  "@babel/cli": "7.26.4",
@@ -381,15 +381,15 @@
381
381
  "eslint-plugin-react-compiler": "19.0.0-beta-714736e-20250131",
382
382
  "swc-plugin-transform-remove-imports": "3.1.0",
383
383
  "@payloadcms/eslint-config": "3.9.0",
384
- "payload": "3.28.0-internal.c4e1bed"
384
+ "payload": "3.28.0"
385
385
  },
386
386
  "peerDependencies": {
387
387
  "@faceless-ui/modal": "3.0.0-beta.2",
388
388
  "@faceless-ui/scroll-info": "2.0.0",
389
389
  "react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
390
390
  "react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
391
- "@payloadcms/next": "3.28.0-internal.c4e1bed",
392
- "payload": "3.28.0-internal.c4e1bed"
391
+ "@payloadcms/next": "3.28.0",
392
+ "payload": "3.28.0"
393
393
  },
394
394
  "engines": {
395
395
  "node": "^18.20.2 || >=20.9.0"