@payloadcms/richtext-lexical 3.8.0 → 3.9.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.
@@ -1,4 +1,4 @@
1
- import { type SanitizedClientFeatures } from 'packages/richtext-lexical/src/features/typesClient.js';
1
+ import type { SanitizedClientFeatures } from '../../../features/typesClient.js';
2
2
  export declare function TextPlugin({ features }: {
3
3
  features: SanitizedClientFeatures;
4
4
  }): null;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lexical/plugins/TextPlugin/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,uBAAuB,EAAE,MAAM,uDAAuD,CAAA;AAGpG,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,uBAAuB,CAAA;CAAE,QAuB7E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lexical/plugins/TextPlugin/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;AAE/E,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,uBAAuB,CAAA;CAAE,QAuB7E"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","TEXT_TYPE_TO_FORMAT","TextNode","useEffect","TextPlugin","t0","$","features","editor","t1","enabledFormats","disabledFormats","getDisabledFormats","length","registerNodeTransform","textNode","forEach","disabledFormat","hasFormat","toggleFormat","t2","highlight","allFormats","Object","keys","enabledSet","Set","filter","format","has"],"sources":["../../../../src/lexical/plugins/TextPlugin/index.tsx"],"sourcesContent":["'use client'\nimport type { TextFormatType } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { TEXT_TYPE_TO_FORMAT, TextNode } from 'lexical'\nimport { type SanitizedClientFeatures } from 'packages/richtext-lexical/src/features/typesClient.js'\nimport { useEffect } from 'react'\n\nexport function TextPlugin({ features }: { features: SanitizedClientFeatures }) {\n const [editor] = useLexicalComposerContext()\n\n useEffect(() => {\n const disabledFormats = getDisabledFormats(features.enabledFormats as TextFormatType[])\n if (disabledFormats.length === 0) {\n return\n }\n // Ideally override the TextNode with our own TextNode (changing its setFormat or toggleFormat methods),\n // would be more performant. If we find a noticeable perf regression we can switch to that option.\n // Overriding the FORMAT_TEXT_COMMAND and PASTE_COMMAND commands is not an option I considered because\n // there might be other forms of mutation that we might not be considering. For example:\n // browser extensions or Payload/Lexical plugins that have their own commands.\n return editor.registerNodeTransform(TextNode, (textNode) => {\n disabledFormats.forEach((disabledFormat) => {\n if (textNode.hasFormat(disabledFormat)) {\n textNode.toggleFormat(disabledFormat)\n }\n })\n })\n }, [editor, features])\n\n return null\n}\n\nfunction getDisabledFormats(enabledFormats: TextFormatType[]): TextFormatType[] {\n // not sure why Lexical added highlight as TextNode format.\n // see https://github.com/facebook/lexical/pull/3583\n // We are going to implement it in other way to support multiple colors\n delete TEXT_TYPE_TO_FORMAT.highlight\n const allFormats = Object.keys(TEXT_TYPE_TO_FORMAT) as TextFormatType[]\n const enabledSet = new Set(enabledFormats)\n\n return allFormats.filter((format) => !enabledSet.has(format))\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAGA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,mBAAmB,EAAEC,QAAQ,QAAQ;AAE9C,SAASC,SAAS,QAAQ;AAE1B,OAAO,SAAAC,WAAAC,EAAA;EAAA,MAAAC,CAAA,GAAAP,EAAA;EAAoB;IAAAQ;EAAA,IAAAF,EAAmD;EAC5E,OAAAG,MAAA,IAAiBR,yBAAA;EAAA,IAAAS,EAAA;EAAA,IAAAH,CAAA,QAAAE,MAAA,IAAAF,CAAA,QAAAC,QAAA,CAAAG,cAAA;IAEPD,EAAA,GAAAA,CAAA;MACR,MAAAE,eAAA,GAAwBC,kBAAA,CAAmBL,QAAA,CAAAG,cAAuB;MAAA,IAC9DC,eAAA,CAAAE,MAAA,MAA2B;QAAA;MAAA;MAAA,OAQxBL,MAAA,CAAAM,qBAAA,CAAAZ,QAAA,EAAAa,QAAA;QACLJ,eAAA,CAAAK,OAAA,CAAAC,cAAA;UAAA,IACMF,QAAA,CAAAG,SAAA,CAAmBD,cAAA;YACrBF,QAAA,CAAAI,YAAA,CAAsBF,cAAA;UAAA;QAAA,CAE1B;MAAA,CACF;IAAA;IACFX,CAAA,MAAAE,MAAA;IAAAF,CAAA,MAAAC,QAAA,CAAAG,cAAA;IAAAJ,CAAA,MAAAG,EAAA;EAAA;IAAAA,EAAA,GAAAH,CAAA;EAAA;EAAA,IAAAc,EAAA;EAAA,IAAAd,CAAA,QAAAE,MAAA,IAAAF,CAAA,QAAAC,QAAA;IAAGa,EAAA,IAACZ,MAAA,EAAQD,QAAA;IAASD,CAAA,MAAAE,MAAA;IAAAF,CAAA,MAAAC,QAAA;IAAAD,CAAA,MAAAc,EAAA;EAAA;IAAAA,EAAA,GAAAd,CAAA;EAAA;EAjBrBH,SAAA,CAAUM,EAiBV,EAAGW,EAAkB;EAAA;AAAA;AAKvB,SAASR,mBAAmBF,cAAgC;EAC1D;EACA;EACA;EACA,OAAOT,mBAAA,CAAoBoB,SAAS;EACpC,MAAMC,UAAA,GAAaC,MAAA,CAAOC,IAAI,CAACvB,mBAAA;EAC/B,MAAMwB,UAAA,GAAa,IAAIC,GAAA,CAAIhB,cAAA;EAE3B,OAAOY,UAAA,CAAWK,MAAM,CAAEC,MAAA,IAAW,CAACH,UAAA,CAAWI,GAAG,CAACD,MAAA;AACvD","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","TEXT_TYPE_TO_FORMAT","TextNode","useEffect","TextPlugin","t0","$","features","editor","t1","enabledFormats","disabledFormats","getDisabledFormats","length","registerNodeTransform","textNode","forEach","disabledFormat","hasFormat","toggleFormat","t2","highlight","allFormats","Object","keys","enabledSet","Set","filter","format","has"],"sources":["../../../../src/lexical/plugins/TextPlugin/index.tsx"],"sourcesContent":["'use client'\nimport type { TextFormatType } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { TEXT_TYPE_TO_FORMAT, TextNode } from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { SanitizedClientFeatures } from '../../../features/typesClient.js'\n\nexport function TextPlugin({ features }: { features: SanitizedClientFeatures }) {\n const [editor] = useLexicalComposerContext()\n\n useEffect(() => {\n const disabledFormats = getDisabledFormats(features.enabledFormats as TextFormatType[])\n if (disabledFormats.length === 0) {\n return\n }\n // Ideally override the TextNode with our own TextNode (changing its setFormat or toggleFormat methods),\n // would be more performant. If we find a noticeable perf regression we can switch to that option.\n // Overriding the FORMAT_TEXT_COMMAND and PASTE_COMMAND commands is not an option I considered because\n // there might be other forms of mutation that we might not be considering. For example:\n // browser extensions or Payload/Lexical plugins that have their own commands.\n return editor.registerNodeTransform(TextNode, (textNode) => {\n disabledFormats.forEach((disabledFormat) => {\n if (textNode.hasFormat(disabledFormat)) {\n textNode.toggleFormat(disabledFormat)\n }\n })\n })\n }, [editor, features])\n\n return null\n}\n\nfunction getDisabledFormats(enabledFormats: TextFormatType[]): TextFormatType[] {\n // not sure why Lexical added highlight as TextNode format.\n // see https://github.com/facebook/lexical/pull/3583\n // We are going to implement it in other way to support multiple colors\n delete TEXT_TYPE_TO_FORMAT.highlight\n const allFormats = Object.keys(TEXT_TYPE_TO_FORMAT) as TextFormatType[]\n const enabledSet = new Set(enabledFormats)\n\n return allFormats.filter((format) => !enabledSet.has(format))\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAGA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,mBAAmB,EAAEC,QAAQ,QAAQ;AAC9C,SAASC,SAAS,QAAQ;AAI1B,OAAO,SAAAC,WAAAC,EAAA;EAAA,MAAAC,CAAA,GAAAP,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G,CAACD,MAAA;AACvD","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/richtext-lexical",
3
- "version": "3.8.0",
3
+ "version": "3.9.0",
4
4
  "description": "The officially supported Lexical richtext adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -351,8 +351,8 @@
351
351
  "react-error-boundary": "4.1.2",
352
352
  "ts-essentials": "10.0.3",
353
353
  "uuid": "10.0.0",
354
- "@payloadcms/translations": "3.8.0",
355
- "@payloadcms/ui": "3.8.0"
354
+ "@payloadcms/translations": "3.9.0",
355
+ "@payloadcms/ui": "3.9.0"
356
356
  },
357
357
  "devDependencies": {
358
358
  "@babel/cli": "7.25.9",
@@ -373,7 +373,7 @@
373
373
  "eslint-plugin-react-compiler": "19.0.0-beta-df7b47d-20241124",
374
374
  "swc-plugin-transform-remove-imports": "2.0.0",
375
375
  "@payloadcms/eslint-config": "3.0.0",
376
- "payload": "3.8.0"
376
+ "payload": "3.9.0"
377
377
  },
378
378
  "peerDependencies": {
379
379
  "@faceless-ui/modal": "3.0.0-beta.2",
@@ -391,8 +391,8 @@
391
391
  "lexical": "0.20.0",
392
392
  "react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
393
393
  "react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
394
- "@payloadcms/next": "3.8.0",
395
- "payload": "3.8.0"
394
+ "@payloadcms/next": "3.9.0",
395
+ "payload": "3.9.0"
396
396
  },
397
397
  "engines": {
398
398
  "node": "^18.20.2 || >=20.9.0"
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=jsx.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jsx.spec.d.ts","sourceRoot":"","sources":["../../../src/utilities/jsx/jsx.spec.ts"],"names":[],"mappings":""}