@payloadcms/richtext-lexical 3.69.0-internal.5029b68 → 3.70.0-canary.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.
Files changed (36) hide show
  1. package/dist/dependencyChecker.spec.js +1 -0
  2. package/dist/dependencyChecker.spec.js.map +1 -1
  3. package/dist/exports/client/RelationshipComponent-BG3DPV3T.js +2 -0
  4. package/dist/exports/client/RelationshipComponent-BG3DPV3T.js.map +7 -0
  5. package/dist/exports/client/bundled.css +1 -1
  6. package/dist/exports/client/component-YQ22OGQW.js +2 -0
  7. package/dist/exports/client/component-YQ22OGQW.js.map +7 -0
  8. package/dist/exports/client/index.js +7 -7
  9. package/dist/exports/client/index.js.map +3 -3
  10. package/dist/features/blocks/server/index.d.ts.map +1 -1
  11. package/dist/features/blocks/server/index.js +11 -2
  12. package/dist/features/blocks/server/index.js.map +1 -1
  13. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js +1 -0
  14. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js.map +1 -1
  15. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  16. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +6 -1
  17. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  18. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  19. package/dist/features/relationship/client/components/RelationshipComponent.js +6 -1
  20. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  21. package/dist/features/upload/client/component/index.js +6 -2
  22. package/dist/features/upload/client/component/index.js.map +1 -1
  23. package/dist/field/bundled.css +1 -1
  24. package/dist/lexical/utils/url.spec.js +1 -0
  25. package/dist/lexical/utils/url.spec.js.map +1 -1
  26. package/dist/utilities/applyBaseFilterToFields.d.ts +10 -0
  27. package/dist/utilities/applyBaseFilterToFields.d.ts.map +1 -0
  28. package/dist/utilities/applyBaseFilterToFields.js +97 -0
  29. package/dist/utilities/applyBaseFilterToFields.js.map +1 -0
  30. package/dist/utilities/jsx/jsx.spec.js +1 -0
  31. package/dist/utilities/jsx/jsx.spec.js.map +1 -1
  32. package/package.json +7 -7
  33. package/dist/exports/client/RelationshipComponent-UCIWIEVD.js +0 -2
  34. package/dist/exports/client/RelationshipComponent-UCIWIEVD.js.map +0 -7
  35. package/dist/exports/client/component-5IW2M4GH.js +0 -2
  36. package/dist/exports/client/component-5IW2M4GH.js.map +0 -7
@@ -2,6 +2,7 @@ import { lexicalTargetVersion } from './index';
2
2
  import { fileURLToPath } from 'url';
3
3
  import path from 'path';
4
4
  import fs from 'fs/promises';
5
+ import { describe, it, expect } from 'vitest';
5
6
  const filename = fileURLToPath(import.meta.url);
6
7
  const dirname = path.dirname(filename);
7
8
  describe('Lexical dependency checker', () => {
@@ -1 +1 @@
1
- {"version":3,"file":"dependencyChecker.spec.js","names":["lexicalTargetVersion","fileURLToPath","path","fs","filename","import","meta","url","dirname","describe","it","packageJsonString","readFile","resolve","packageJson","JSON","parse","packageJsonLexicalVersion","dependencies","expect","toBe"],"sources":["../src/dependencyChecker.spec.ts"],"sourcesContent":["import { jest } from '@jest/globals'\nimport { lexicalTargetVersion } from './index'\nimport { fileURLToPath } from 'url'\nimport path from 'path'\nimport fs from 'fs/promises'\n\nconst filename = fileURLToPath(import.meta.url)\nconst dirname = path.dirname(filename)\n\ndescribe('Lexical dependency checker', () => {\n it('ensure lexical version installed in package.json matches dependency checker version', async () => {\n const packageJsonString = await fs.readFile(path.resolve(dirname, '../package.json'), 'utf-8')\n const packageJson = JSON.parse(packageJsonString)\n const packageJsonLexicalVersion = packageJson.dependencies['lexical']\n\n expect(packageJsonLexicalVersion).toBe(lexicalTargetVersion)\n })\n})\n"],"mappings":"AACA,SAASA,oBAAoB,QAAQ;AACrC,SAASC,aAAa,QAAQ;AAC9B,OAAOC,IAAA,MAAU;AACjB,OAAOC,EAAA,MAAQ;AAEf,MAAMC,QAAA,GAAWH,aAAA,CAAcI,MAAA,CAAAC,IAAA,CAAYC,GAAG;AAC9C,MAAMC,OAAA,GAAUN,IAAA,CAAKM,OAAO,CAACJ,QAAA;AAE7BK,QAAA,CAAS,8BAA8B;EACrCC,EAAA,CAAG,uFAAuF;IACxF,MAAMC,iBAAA,GAAoB,MAAMR,EAAA,CAAGS,QAAQ,CAACV,IAAA,CAAKW,OAAO,CAACL,OAAA,EAAS,oBAAoB;IACtF,MAAMM,WAAA,GAAcC,IAAA,CAAKC,KAAK,CAACL,iBAAA;IAC/B,MAAMM,yBAAA,GAA4BH,WAAA,CAAYI,YAAY,CAAC,UAAU;IAErEC,MAAA,CAAOF,yBAAA,EAA2BG,IAAI,CAACpB,oBAAA;EACzC;AACF","ignoreList":[]}
1
+ {"version":3,"file":"dependencyChecker.spec.js","names":["lexicalTargetVersion","fileURLToPath","path","fs","describe","it","expect","filename","import","meta","url","dirname","packageJsonString","readFile","resolve","packageJson","JSON","parse","packageJsonLexicalVersion","dependencies","toBe"],"sources":["../src/dependencyChecker.spec.ts"],"sourcesContent":["import { lexicalTargetVersion } from './index'\nimport { fileURLToPath } from 'url'\nimport path from 'path'\nimport fs from 'fs/promises'\nimport { describe, it, expect } from 'vitest'\n\nconst filename = fileURLToPath(import.meta.url)\nconst dirname = path.dirname(filename)\n\ndescribe('Lexical dependency checker', () => {\n it('ensure lexical version installed in package.json matches dependency checker version', async () => {\n const packageJsonString = await fs.readFile(path.resolve(dirname, '../package.json'), 'utf-8')\n const packageJson = JSON.parse(packageJsonString)\n const packageJsonLexicalVersion = packageJson.dependencies['lexical']\n\n expect(packageJsonLexicalVersion).toBe(lexicalTargetVersion)\n })\n})\n"],"mappings":"AAAA,SAASA,oBAAoB,QAAQ;AACrC,SAASC,aAAa,QAAQ;AAC9B,OAAOC,IAAA,MAAU;AACjB,OAAOC,EAAA,MAAQ;AACf,SAASC,QAAQ,EAAEC,EAAE,EAAEC,MAAM,QAAQ;AAErC,MAAMC,QAAA,GAAWN,aAAA,CAAcO,MAAA,CAAAC,IAAA,CAAYC,GAAG;AAC9C,MAAMC,OAAA,GAAUT,IAAA,CAAKS,OAAO,CAACJ,QAAA;AAE7BH,QAAA,CAAS,8BAA8B;EACrCC,EAAA,CAAG,uFAAuF;IACxF,MAAMO,iBAAA,GAAoB,MAAMT,EAAA,CAAGU,QAAQ,CAACX,IAAA,CAAKY,OAAO,CAACH,OAAA,EAAS,oBAAoB;IACtF,MAAMI,WAAA,GAAcC,IAAA,CAAKC,KAAK,CAACL,iBAAA;IAC/B,MAAMM,yBAAA,GAA4BH,WAAA,CAAYI,YAAY,CAAC,UAAU;IAErEb,MAAA,CAAOY,yBAAA,EAA2BE,IAAI,CAACpB,oBAAA;EACzC;AACF","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ "use client";import{a as h}from"./chunk-DBWINSQN.js";import{a as f}from"./chunk-F26IQ5RE.js";import{jsx as o,jsxs as c}from"react/jsx-runtime";import{useLexicalComposerContext as S}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as L}from"@lexical/react/useLexicalEditable";import{getTranslation as j}from"@payloadcms/translations";import{Button as b,useConfig as A,usePayloadAPI as B,useTranslation as I}from"@payloadcms/ui";import{$getNodeByKey as P}from"lexical";import{formatAdminURL as k}from"payload/shared";import H,{useCallback as K,useReducer as M,useRef as O,useState as U}from"react";var _={depth:0},Z=R=>{let{className:e,data:{relationTo:g,value:a},nodeKey:s}=R;if(typeof a=="object")throw new Error("Relationship value should be a string or number. The Lexical Relationship component should not receive the populated value object.");let v=O(null),[l]=S(),i=L(),{config:{routes:{api:C},serverURL:N},getEntityConfig:w}=A(),[t]=U(()=>w({collectionSlug:g})),{i18n:x,t:n}=I(),[u,D]=M(r=>r+1,0),[{data:m},{setParams:d}]=B(k({apiRoute:C,path:`/${t.slug}/${a}`,serverURL:N}),{initialParams:_}),{closeDocumentDrawer:p,DocumentDrawer:$,DocumentDrawerToggler:E}=f({id:a,collectionSlug:t.slug}),T=K(()=>{l.update(()=>{P(s)?.remove()})},[l,s]),y=H.useCallback(()=>{d({..._,cacheBust:u}),p(),D()},[u,d,p]);return c("div",{className:`${e}__contents`,contentEditable:!1,ref:v,children:[c("div",{className:`${e}__wrap`,children:[o("p",{className:`${e}__label`,children:n("fields:labelRelationship",{label:t.labels?.singular?j(t.labels?.singular,x):t.slug})}),o(E,{className:`${e}__doc-drawer-toggler`,children:o("p",{className:`${e}__title`,children:m?m[t?.admin?.useAsTitle||"id"]:a})})]}),i&&c("div",{className:`${e}__actions`,children:[o(b,{buttonStyle:"icon-label",className:`${e}__swapButton`,disabled:!i,el:"button",icon:"swap",onClick:()=>{s&&l.dispatchCommand(h,{replace:{nodeKey:s}})},round:!0,tooltip:n("fields:swapRelationship")}),o(b,{buttonStyle:"icon-label",className:`${e}__removeButton`,disabled:!i,icon:"x",onClick:r=>{r.preventDefault(),T()},round:!0,tooltip:n("fields:removeRelationship")})]}),!!a&&o($,{onSave:y})]})};export{Z as RelationshipComponent};
2
+ //# sourceMappingURL=RelationshipComponent-BG3DPV3T.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/features/relationship/client/components/RelationshipComponent.tsx"],
4
+ "sourcesContent": ["'use client'\nimport type { ElementFormatType } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport { Button, useConfig, usePayloadAPI, useTranslation } from '@payloadcms/ui'\nimport { $getNodeByKey } from 'lexical'\nimport { formatAdminURL } from 'payload/shared'\nimport React, { useCallback, useReducer, useRef, useState } from 'react'\n\nimport type { RelationshipData } from '../../server/nodes/RelationshipNode.js'\n\nimport './index.scss'\nimport { useLexicalDocumentDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDocumentDrawer.js'\nimport { INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND } from '../drawer/commands.js'\n\nconst initialParams = {\n depth: 0,\n}\n\ntype Props = {\n className: string\n data: RelationshipData\n format?: ElementFormatType\n nodeKey?: string\n}\n\nexport const RelationshipComponent: React.FC<Props> = (props) => {\n const {\n className: baseClass,\n data: { relationTo, value },\n nodeKey,\n } = props\n\n if (typeof value === 'object') {\n throw new Error(\n 'Relationship value should be a string or number. The Lexical Relationship component should not receive the populated value object.',\n )\n }\n\n const relationshipElemRef = useRef<HTMLDivElement | null>(null)\n\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n const {\n config: {\n routes: { api },\n serverURL,\n },\n getEntityConfig,\n } = useConfig()\n\n const [relatedCollection] = useState(() => getEntityConfig({ collectionSlug: relationTo }))\n\n const { i18n, t } = useTranslation()\n const [cacheBust, dispatchCacheBust] = useReducer((state) => state + 1, 0)\n const [{ data }, { setParams }] = usePayloadAPI(\n formatAdminURL({ apiRoute: api, path: `/${relatedCollection.slug}/${value}`, serverURL }),\n { initialParams },\n )\n\n const { closeDocumentDrawer, DocumentDrawer, DocumentDrawerToggler } = useLexicalDocumentDrawer({\n id: value,\n collectionSlug: relatedCollection.slug,\n })\n\n const removeRelationship = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey!)?.remove()\n })\n }, [editor, nodeKey])\n\n const updateRelationship = React.useCallback(() => {\n setParams({\n ...initialParams,\n cacheBust, // do this to get the usePayloadAPI to re-fetch the data even though the URL string hasn't changed\n })\n\n closeDocumentDrawer()\n dispatchCacheBust()\n }, [cacheBust, setParams, closeDocumentDrawer])\n\n return (\n <div className={`${baseClass}__contents`} contentEditable={false} ref={relationshipElemRef}>\n <div className={`${baseClass}__wrap`}>\n <p className={`${baseClass}__label`}>\n {t('fields:labelRelationship', {\n label: relatedCollection.labels?.singular\n ? getTranslation(relatedCollection.labels?.singular, i18n)\n : relatedCollection.slug,\n })}\n </p>\n <DocumentDrawerToggler className={`${baseClass}__doc-drawer-toggler`}>\n <p className={`${baseClass}__title`}>\n {data ? data[relatedCollection?.admin?.useAsTitle || 'id'] : value}\n </p>\n </DocumentDrawerToggler>\n </div>\n {isEditable && (\n <div className={`${baseClass}__actions`}>\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__swapButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"swap\"\n onClick={() => {\n if (nodeKey) {\n editor.dispatchCommand(INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND, {\n replace: { nodeKey },\n })\n }\n }}\n round\n tooltip={t('fields:swapRelationship')}\n />\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeRelationship()\n }}\n round\n tooltip={t('fields:removeRelationship')}\n />\n </div>\n )}\n\n {!!value && <DocumentDrawer onSave={updateRelationship} />}\n </div>\n )\n}\n"],
5
+ "mappings": "+IAGA,OAASA,6BAAAA,MAAiC,2CAC1C,OAASC,sBAAAA,MAA0B,oCACnC,OAASC,kBAAAA,MAAsB,2BAC/B,OAASC,UAAAA,EAAQC,aAAAA,EAAWC,iBAAAA,EAAeC,kBAAAA,MAAsB,iBACjE,OAASC,iBAAAA,MAAqB,UAC9B,OAASC,kBAAAA,MAAsB,iBAC/B,OAAOC,GAASC,eAAAA,EAAaC,cAAAA,EAAYC,UAAAA,EAAQC,YAAAA,MAAgB,QAQjE,IAAMC,EAAgB,CACpBC,MAAO,CACT,EASaC,EAA0CC,GAAA,CACrD,GAAM,CACJC,UAAWC,EACXC,KAAM,CAAEC,WAAAA,EAAYC,MAAAA,CAAK,EACzBC,QAAAA,CAAO,EACLN,EAEJ,GAAI,OAAOK,GAAU,SACnB,MAAM,IAAIE,MACR,oIAAA,EAIJ,IAAMC,EAAsBC,EAA8B,IAAA,EAEpD,CAACC,CAAA,EAAUC,EAAA,EACXC,EAAaC,EAAA,EACb,CACJC,OAAQ,CACNC,OAAQ,CAAEC,IAAAA,CAAG,EACbC,UAAAA,CAAS,EAEXC,gBAAAA,CAAe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EAAC,IAAA,CAAElD,UAAW,GAAGC,CAAA,mBACdC,EAAOA,EAAKiB,GAAmBoC,OAAOC,YAAc,IAAA,EAAQpD,SAIlEO,GACCoC,EAAC,MAAA,CAAI/C,UAAW,GAAGC,CAAA,sBACjBiD,EAACO,EAAA,CACCC,YAAY,aACZ1D,UAAW,GAAGC,CAAA,eACd0D,SAAU,CAAChD,EACXiD,GAAG,SACHC,KAAK,OACLC,QAASA,IAAA,CACHzD,GACFI,EAAOsD,gBAAgBC,EAAyC,CAC9DC,QAAS,CAAE5D,QAAAA,CAAQ,CACrB,CAAA,CAEJ,EACA6D,MAAK,GACLC,QAAS5C,EAAE,yBAAA,IAEb2B,EAACO,EAAA,CACCC,YAAY,aACZ1D,UAAW,GAAGC,CAAA,iBACd0D,SAAU,CAAChD,EACXkD,KAAK,IACLC,QAAUM,GAAA,CACRA,EAAEC,eAAc,EAChB7B,EAAA,CACF,EACA0B,MAAK,GACLC,QAAS5C,EAAE,2BAAA,OAKhB,CAAC,CAACnB,GAAS8C,EAACd,EAAA,CAAekC,OAAQzB,MAG1C",
6
+ "names": ["useLexicalComposerContext", "useLexicalEditable", "getTranslation", "Button", "useConfig", "usePayloadAPI", "useTranslation", "$getNodeByKey", "formatAdminURL", "React", "useCallback", "useReducer", "useRef", "useState", "initialParams", "depth", "RelationshipComponent", "props", "className", "baseClass", "data", "relationTo", "value", "nodeKey", "Error", "relationshipElemRef", "useRef", "editor", "useLexicalComposerContext", "isEditable", "useLexicalEditable", "config", "routes", "api", "serverURL", "getEntityConfig", "useConfig", "relatedCollection", "useState", "collectionSlug", "i18n", "t", "useTranslation", "cacheBust", "dispatchCacheBust", "useReducer", "state", "setParams", "usePayloadAPI", "formatAdminURL", "apiRoute", "path", "slug", "closeDocumentDrawer", "DocumentDrawer", "DocumentDrawerToggler", "useLexicalDocumentDrawer", "id", "removeRelationship", "useCallback", "update", "$getNodeByKey", "remove", "updateRelationship", "React", "_jsxs", "contentEditable", "ref", "_jsx", "label", "labels", "singular", "getTranslation", "admin", "useAsTitle", "Button", "buttonStyle", "disabled", "el", "icon", "onClick", "dispatchCommand", "INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND", "replace", "round", "tooltip", "e", "preventDefault", "onSave"]
7
+ }