@payloadcms/richtext-slate 3.0.0-canary.e14c80d → 3.0.0-canary.e1fc0e0

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 (84) hide show
  1. package/dist/cell/index.d.ts.map +1 -1
  2. package/dist/cell/index.js +23 -2
  3. package/dist/cell/index.js.map +1 -1
  4. package/dist/data/validation.d.ts.map +1 -1
  5. package/dist/data/validation.js +3 -1
  6. package/dist/data/validation.js.map +1 -1
  7. package/dist/exports/client/index.d.ts +3 -2
  8. package/dist/exports/client/index.d.ts.map +1 -1
  9. package/dist/exports/client/index.js +3 -2
  10. package/dist/exports/client/index.js.map +1 -1
  11. package/dist/field/RichText.d.ts.map +1 -1
  12. package/dist/field/RichText.js +12 -7
  13. package/dist/field/RichText.js.map +1 -1
  14. package/dist/field/buttons.scss +11 -10
  15. package/dist/field/createFeatureMap.d.ts.map +1 -1
  16. package/dist/field/createFeatureMap.js +12 -4
  17. package/dist/field/createFeatureMap.js.map +1 -1
  18. package/dist/field/elements/blockquote/index.scss +7 -5
  19. package/dist/field/elements/h3/Heading3.d.ts.map +1 -1
  20. package/dist/field/elements/h3/Heading3.js.map +1 -1
  21. package/dist/field/elements/h4/Heading4.d.ts.map +1 -1
  22. package/dist/field/elements/h4/Heading4.js.map +1 -1
  23. package/dist/field/elements/h5/Heading5.d.ts.map +1 -1
  24. package/dist/field/elements/h5/Heading5.js.map +1 -1
  25. package/dist/field/elements/h6/Heading6.d.ts.map +1 -1
  26. package/dist/field/elements/h6/Heading6.js.map +1 -1
  27. package/dist/field/elements/isActive.d.ts.map +1 -1
  28. package/dist/field/elements/isActive.js +3 -1
  29. package/dist/field/elements/isActive.js.map +1 -1
  30. package/dist/field/elements/isLastSelectedElementEmpty.d.ts.map +1 -1
  31. package/dist/field/elements/isLastSelectedElementEmpty.js +3 -1
  32. package/dist/field/elements/isLastSelectedElementEmpty.js.map +1 -1
  33. package/dist/field/elements/isListActive.d.ts.map +1 -1
  34. package/dist/field/elements/isListActive.js +6 -2
  35. package/dist/field/elements/isListActive.js.map +1 -1
  36. package/dist/field/elements/link/Button/index.js +1 -1
  37. package/dist/field/elements/link/Button/index.js.map +1 -1
  38. package/dist/field/elements/link/Element/index.d.ts.map +1 -1
  39. package/dist/field/elements/link/Element/index.js +7 -3
  40. package/dist/field/elements/link/Element/index.js.map +1 -1
  41. package/dist/field/elements/link/Element/index.scss +65 -67
  42. package/dist/field/elements/link/LinkDrawer/index.d.ts.map +1 -1
  43. package/dist/field/elements/link/LinkDrawer/index.js +2 -1
  44. package/dist/field/elements/link/LinkDrawer/index.js.map +1 -1
  45. package/dist/field/elements/link/LinkDrawer/index.scss +39 -37
  46. package/dist/field/elements/ol/index.scss +5 -3
  47. package/dist/field/elements/relationship/Button/index.scss +6 -4
  48. package/dist/field/elements/relationship/Element/index.scss +73 -71
  49. package/dist/field/elements/toggleList.d.ts.map +1 -1
  50. package/dist/field/elements/toggleList.js +6 -2
  51. package/dist/field/elements/toggleList.js.map +1 -1
  52. package/dist/field/elements/ul/index.scss +5 -3
  53. package/dist/field/elements/upload/Button/index.scss +6 -4
  54. package/dist/field/elements/upload/Element/UploadDrawer/index.d.ts.map +1 -1
  55. package/dist/field/elements/upload/Element/UploadDrawer/index.js +3 -2
  56. package/dist/field/elements/upload/Element/UploadDrawer/index.js.map +1 -1
  57. package/dist/field/elements/upload/Element/index.d.ts.map +1 -1
  58. package/dist/field/elements/upload/Element/index.js +1 -1
  59. package/dist/field/elements/upload/Element/index.js.map +1 -1
  60. package/dist/field/elements/upload/Element/index.scss +116 -114
  61. package/dist/field/icons/IndentLeft/index.scss +12 -10
  62. package/dist/field/icons/IndentRight/index.scss +12 -10
  63. package/dist/field/icons/Link/index.scss +8 -6
  64. package/dist/field/icons/Relationship/index.scss +9 -7
  65. package/dist/field/icons/Upload/index.scss +8 -6
  66. package/dist/field/index.js +1 -1
  67. package/dist/field/index.js.map +1 -1
  68. package/dist/field/index.scss +169 -151
  69. package/dist/generateComponentMap.d.ts.map +1 -1
  70. package/dist/generateComponentMap.js +3 -1
  71. package/dist/generateComponentMap.js.map +1 -1
  72. package/dist/index.d.ts.map +1 -1
  73. package/dist/index.js +2 -0
  74. package/dist/index.js.map +1 -1
  75. package/dist/scss/app.scss +164 -163
  76. package/dist/scss/colors.scss +256 -254
  77. package/dist/scss/resets.scss +9 -7
  78. package/dist/scss/toastify.scss +42 -41
  79. package/dist/scss/toasts.scss +104 -103
  80. package/dist/scss/type.scss +80 -79
  81. package/dist/types.d.ts +2 -2
  82. package/dist/types.d.ts.map +1 -1
  83. package/dist/types.js.map +1 -1
  84. package/package.json +16 -15
@@ -1,7 +1,9 @@
1
1
  import { Editor, Element } from 'slate';
2
2
  import { nodeIsTextNode } from '../../types.js';
3
3
  export const isLastSelectedElementEmpty = (editor)=>{
4
- if (!editor.selection) return false;
4
+ if (!editor.selection) {
5
+ return false;
6
+ }
5
7
  const currentlySelectedNodes = Array.from(Editor.nodes(editor, {
6
8
  at: Editor.unhangRange(editor, editor.selection),
7
9
  match: (n)=>!Editor.isEditor(n) && Element.isElement(n) && (!n.type || n.type === 'p')
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/field/elements/isLastSelectedElementEmpty.ts"],"sourcesContent":["import { Editor, Element } from 'slate'\n\nimport { nodeIsTextNode } from '../../types.js'\n\nexport const isLastSelectedElementEmpty = (editor: Editor): boolean => {\n if (!editor.selection) return false\n\n const currentlySelectedNodes = Array.from(\n Editor.nodes(editor, {\n at: Editor.unhangRange(editor, editor.selection),\n match: (n) => !Editor.isEditor(n) && Element.isElement(n) && (!n.type || n.type === 'p'),\n }),\n )\n\n const lastSelectedNode = currentlySelectedNodes?.[currentlySelectedNodes?.length - 1]\n\n return (\n lastSelectedNode &&\n Element.isElement(lastSelectedNode[0]) &&\n (!lastSelectedNode[0].type || lastSelectedNode[0].type === 'p') &&\n nodeIsTextNode(lastSelectedNode[0].children?.[0]) &&\n lastSelectedNode[0].children?.[0].text === ''\n )\n}\n"],"names":["Editor","Element","nodeIsTextNode","isLastSelectedElementEmpty","editor","selection","currentlySelectedNodes","Array","from","nodes","at","unhangRange","match","n","isEditor","isElement","type","lastSelectedNode","length","children","text"],"mappings":"AAAA,SAASA,MAAM,EAAEC,OAAO,QAAQ,QAAO;AAEvC,SAASC,cAAc,QAAQ,iBAAgB;AAE/C,OAAO,MAAMC,6BAA6B,CAACC;IACzC,IAAI,CAACA,OAAOC,SAAS,EAAE,OAAO;IAE9B,MAAMC,yBAAyBC,MAAMC,IAAI,CACvCR,OAAOS,KAAK,CAACL,QAAQ;QACnBM,IAAIV,OAAOW,WAAW,CAACP,QAAQA,OAAOC,SAAS;QAC/CO,OAAO,CAACC,IAAM,CAACb,OAAOc,QAAQ,CAACD,MAAMZ,QAAQc,SAAS,CAACF,MAAO,CAAA,CAACA,EAAEG,IAAI,IAAIH,EAAEG,IAAI,KAAK,GAAE;IACxF;IAGF,MAAMC,mBAAmBX,wBAAwB,CAACA,wBAAwBY,SAAS,EAAE;IAErF,OACED,oBACAhB,QAAQc,SAAS,CAACE,gBAAgB,CAAC,EAAE,KACpC,CAAA,CAACA,gBAAgB,CAAC,EAAE,CAACD,IAAI,IAAIC,gBAAgB,CAAC,EAAE,CAACD,IAAI,KAAK,GAAE,KAC7Dd,eAAee,gBAAgB,CAAC,EAAE,CAACE,QAAQ,EAAE,CAAC,EAAE,KAChDF,gBAAgB,CAAC,EAAE,CAACE,QAAQ,EAAE,CAAC,EAAE,CAACC,SAAS;AAE/C,EAAC"}
1
+ {"version":3,"sources":["../../../src/field/elements/isLastSelectedElementEmpty.ts"],"sourcesContent":["import { Editor, Element } from 'slate'\n\nimport { nodeIsTextNode } from '../../types.js'\n\nexport const isLastSelectedElementEmpty = (editor: Editor): boolean => {\n if (!editor.selection) {\n return false\n }\n\n const currentlySelectedNodes = Array.from(\n Editor.nodes(editor, {\n at: Editor.unhangRange(editor, editor.selection),\n match: (n) => !Editor.isEditor(n) && Element.isElement(n) && (!n.type || n.type === 'p'),\n }),\n )\n\n const lastSelectedNode = currentlySelectedNodes?.[currentlySelectedNodes?.length - 1]\n\n return (\n lastSelectedNode &&\n Element.isElement(lastSelectedNode[0]) &&\n (!lastSelectedNode[0].type || lastSelectedNode[0].type === 'p') &&\n nodeIsTextNode(lastSelectedNode[0].children?.[0]) &&\n lastSelectedNode[0].children?.[0].text === ''\n )\n}\n"],"names":["Editor","Element","nodeIsTextNode","isLastSelectedElementEmpty","editor","selection","currentlySelectedNodes","Array","from","nodes","at","unhangRange","match","n","isEditor","isElement","type","lastSelectedNode","length","children","text"],"mappings":"AAAA,SAASA,MAAM,EAAEC,OAAO,QAAQ,QAAO;AAEvC,SAASC,cAAc,QAAQ,iBAAgB;AAE/C,OAAO,MAAMC,6BAA6B,CAACC;IACzC,IAAI,CAACA,OAAOC,SAAS,EAAE;QACrB,OAAO;IACT;IAEA,MAAMC,yBAAyBC,MAAMC,IAAI,CACvCR,OAAOS,KAAK,CAACL,QAAQ;QACnBM,IAAIV,OAAOW,WAAW,CAACP,QAAQA,OAAOC,SAAS;QAC/CO,OAAO,CAACC,IAAM,CAACb,OAAOc,QAAQ,CAACD,MAAMZ,QAAQc,SAAS,CAACF,MAAO,CAAA,CAACA,EAAEG,IAAI,IAAIH,EAAEG,IAAI,KAAK,GAAE;IACxF;IAGF,MAAMC,mBAAmBX,wBAAwB,CAACA,wBAAwBY,SAAS,EAAE;IAErF,OACED,oBACAhB,QAAQc,SAAS,CAACE,gBAAgB,CAAC,EAAE,KACpC,CAAA,CAACA,gBAAgB,CAAC,EAAE,CAACD,IAAI,IAAIC,gBAAgB,CAAC,EAAE,CAACD,IAAI,KAAK,GAAE,KAC7Dd,eAAee,gBAAgB,CAAC,EAAE,CAACE,QAAQ,EAAE,CAAC,EAAE,KAChDF,gBAAgB,CAAC,EAAE,CAACE,QAAQ,EAAE,CAAC,EAAE,CAACC,SAAS;AAE/C,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"isListActive.d.ts","sourceRoot":"","sources":["../../../src/field/elements/isListActive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAW,MAAM,OAAO,CAAA;AAIvC,eAAO,MAAM,YAAY,WAAY,MAAM,UAAU,MAAM,KAAG,OAsB7D,CAAA"}
1
+ {"version":3,"file":"isListActive.d.ts","sourceRoot":"","sources":["../../../src/field/elements/isListActive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAW,MAAM,OAAO,CAAA;AAIvC,eAAO,MAAM,YAAY,WAAY,MAAM,UAAU,MAAM,KAAG,OA0B7D,CAAA"}
@@ -1,9 +1,13 @@
1
1
  import { Editor, Element } from 'slate';
2
2
  import { getCommonBlock } from './getCommonBlock.js';
3
3
  export const isListActive = (editor, format)=>{
4
- if (!editor.selection) return false;
4
+ if (!editor.selection) {
5
+ return false;
6
+ }
5
7
  const [topmostSelectedNode, topmostSelectedNodePath] = getCommonBlock(editor);
6
- if (Editor.isEditor(topmostSelectedNode)) return false;
8
+ if (Editor.isEditor(topmostSelectedNode)) {
9
+ return false;
10
+ }
7
11
  const [match] = Array.from(Editor.nodes(editor, {
8
12
  at: topmostSelectedNodePath,
9
13
  match: (node, path)=>{
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/field/elements/isListActive.ts"],"sourcesContent":["import { Editor, Element } from 'slate'\n\nimport { getCommonBlock } from './getCommonBlock.js'\n\nexport const isListActive = (editor: Editor, format: string): boolean => {\n if (!editor.selection) return false\n const [topmostSelectedNode, topmostSelectedNodePath] = getCommonBlock(editor)\n\n if (Editor.isEditor(topmostSelectedNode)) return false\n\n const [match] = Array.from(\n Editor.nodes(editor, {\n at: topmostSelectedNodePath,\n match: (node, path) => {\n return (\n !Editor.isEditor(node) &&\n Element.isElement(node) &&\n node.type === format &&\n path.length >= topmostSelectedNodePath.length - 2\n )\n },\n mode: 'lowest',\n }),\n )\n\n return !!match\n}\n"],"names":["Editor","Element","getCommonBlock","isListActive","editor","format","selection","topmostSelectedNode","topmostSelectedNodePath","isEditor","match","Array","from","nodes","at","node","path","isElement","type","length","mode"],"mappings":"AAAA,SAASA,MAAM,EAAEC,OAAO,QAAQ,QAAO;AAEvC,SAASC,cAAc,QAAQ,sBAAqB;AAEpD,OAAO,MAAMC,eAAe,CAACC,QAAgBC;IAC3C,IAAI,CAACD,OAAOE,SAAS,EAAE,OAAO;IAC9B,MAAM,CAACC,qBAAqBC,wBAAwB,GAAGN,eAAeE;IAEtE,IAAIJ,OAAOS,QAAQ,CAACF,sBAAsB,OAAO;IAEjD,MAAM,CAACG,MAAM,GAAGC,MAAMC,IAAI,CACxBZ,OAAOa,KAAK,CAACT,QAAQ;QACnBU,IAAIN;QACJE,OAAO,CAACK,MAAMC;YACZ,OACE,CAAChB,OAAOS,QAAQ,CAACM,SACjBd,QAAQgB,SAAS,CAACF,SAClBA,KAAKG,IAAI,KAAKb,UACdW,KAAKG,MAAM,IAAIX,wBAAwBW,MAAM,GAAG;QAEpD;QACAC,MAAM;IACR;IAGF,OAAO,CAAC,CAACV;AACX,EAAC"}
1
+ {"version":3,"sources":["../../../src/field/elements/isListActive.ts"],"sourcesContent":["import { Editor, Element } from 'slate'\n\nimport { getCommonBlock } from './getCommonBlock.js'\n\nexport const isListActive = (editor: Editor, format: string): boolean => {\n if (!editor.selection) {\n return false\n }\n const [topmostSelectedNode, topmostSelectedNodePath] = getCommonBlock(editor)\n\n if (Editor.isEditor(topmostSelectedNode)) {\n return false\n }\n\n const [match] = Array.from(\n Editor.nodes(editor, {\n at: topmostSelectedNodePath,\n match: (node, path) => {\n return (\n !Editor.isEditor(node) &&\n Element.isElement(node) &&\n node.type === format &&\n path.length >= topmostSelectedNodePath.length - 2\n )\n },\n mode: 'lowest',\n }),\n )\n\n return !!match\n}\n"],"names":["Editor","Element","getCommonBlock","isListActive","editor","format","selection","topmostSelectedNode","topmostSelectedNodePath","isEditor","match","Array","from","nodes","at","node","path","isElement","type","length","mode"],"mappings":"AAAA,SAASA,MAAM,EAAEC,OAAO,QAAQ,QAAO;AAEvC,SAASC,cAAc,QAAQ,sBAAqB;AAEpD,OAAO,MAAMC,eAAe,CAACC,QAAgBC;IAC3C,IAAI,CAACD,OAAOE,SAAS,EAAE;QACrB,OAAO;IACT;IACA,MAAM,CAACC,qBAAqBC,wBAAwB,GAAGN,eAAeE;IAEtE,IAAIJ,OAAOS,QAAQ,CAACF,sBAAsB;QACxC,OAAO;IACT;IAEA,MAAM,CAACG,MAAM,GAAGC,MAAMC,IAAI,CACxBZ,OAAOa,KAAK,CAACT,QAAQ;QACnBU,IAAIN;QACJE,OAAO,CAACK,MAAMC;YACZ,OACE,CAAChB,OAAOS,QAAQ,CAACM,SACjBd,QAAQgB,SAAS,CAACF,SAClBA,KAAKG,IAAI,KAAKb,UACdW,KAAKG,MAAM,IAAIX,wBAAwBW,MAAM,GAAG;QAEpD;QACAC,MAAM;IACR;IAGF,OAAO,CAAC,CAACV;AACX,EAAC"}
@@ -86,7 +86,7 @@ export const LinkButton = ()=>{
86
86
  const data = {
87
87
  text: editor.selection ? Editor.string(editor, editor.selection) : ''
88
88
  };
89
- const state = await getFormState({
89
+ const { state } = await getFormState({
90
90
  apiRoute: config.routes.api,
91
91
  body: {
92
92
  data,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/elements/link/Button/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FormState } from 'payload'\n\nimport { useConfig, useDrawerSlug, useFieldProps, useModal, useTranslation } from '@payloadcms/ui'\nimport { getFormState } from '@payloadcms/ui/shared'\nimport { reduceFieldsToValues } from 'payload/shared'\nimport React, { Fragment, useState } from 'react'\nimport { Editor, Range, Transforms } from 'slate'\nimport { ReactEditor, useSlate } from 'slate-react'\n\nimport { LinkIcon } from '../../../icons/Link/index.js'\nimport { useElementButton } from '../../../providers/ElementButtonProvider.js'\nimport { ElementButton } from '../../Button.js'\nimport { isElementActive } from '../../isActive.js'\nimport { LinkDrawer } from '../LinkDrawer/index.js'\nimport { linkFieldsSchemaPath } from '../shared.js'\nimport { unwrapLink } from '../utilities.js'\n\n/**\n * This function is called when a new link is created - not when an existing link is edited.\n */\nconst insertLink = (editor, fields) => {\n const isCollapsed = editor.selection && Range.isCollapsed(editor.selection)\n const data = reduceFieldsToValues(fields, true)\n\n const newLink = {\n type: 'link',\n children: [],\n doc: data.doc,\n fields: data.fields, // Any custom user-added fields are part of data.fields\n linkType: data.linkType,\n newTab: data.newTab,\n url: data.url,\n }\n\n if (isCollapsed || !editor.selection) {\n // If selection anchor and focus are the same,\n // Just inject a new node with children already set\n Transforms.insertNodes(editor, {\n ...newLink,\n children: [{ text: String(data.text) }],\n })\n } else if (editor.selection) {\n // Otherwise we need to wrap the selected node in a link,\n // Delete its old text,\n // Move the selection one position forward into the link,\n // And insert the text back into the new link\n Transforms.wrapNodes(editor, newLink, { split: true })\n Transforms.delete(editor, { at: editor.selection.focus.path, unit: 'word' })\n Transforms.move(editor, { distance: 1, unit: 'offset' })\n Transforms.insertText(editor, String(data.text), { at: editor.selection.focus.path })\n }\n\n ReactEditor.focus(editor)\n}\n\nexport const LinkButton: React.FC = () => {\n const { fieldProps } = useElementButton()\n const [initialState, setInitialState] = useState<FormState>({})\n\n const { t } = useTranslation()\n const editor = useSlate()\n const { config } = useConfig()\n\n const { closeModal, openModal } = useModal()\n const drawerSlug = useDrawerSlug('rich-text-link')\n const { schemaPath } = useFieldProps()\n\n const {\n field: { richTextComponentMap },\n } = fieldProps\n\n const fields = richTextComponentMap.get(linkFieldsSchemaPath)\n\n return (\n <Fragment>\n <ElementButton\n className=\"link\"\n format=\"link\"\n onClick={async () => {\n if (isElementActive(editor, 'link')) {\n unwrapLink(editor)\n } else {\n openModal(drawerSlug)\n const isCollapsed = editor.selection && Range.isCollapsed(editor.selection)\n\n if (!isCollapsed) {\n const data = {\n text: editor.selection ? Editor.string(editor, editor.selection) : '',\n }\n\n const state = await getFormState({\n apiRoute: config.routes.api,\n body: {\n data,\n operation: 'update',\n schemaPath: `${schemaPath}.${linkFieldsSchemaPath}`,\n },\n serverURL: config.serverURL,\n })\n\n setInitialState(state)\n }\n }\n }}\n tooltip={t('fields:addLink')}\n >\n <LinkIcon />\n </ElementButton>\n <LinkDrawer\n drawerSlug={drawerSlug}\n fields={Array.isArray(fields) ? fields : []}\n handleClose={() => {\n closeModal(drawerSlug)\n }}\n handleModalSubmit={(fields) => {\n insertLink(editor, fields)\n closeModal(drawerSlug)\n }}\n initialState={initialState}\n />\n </Fragment>\n )\n}\n"],"names":["useConfig","useDrawerSlug","useFieldProps","useModal","useTranslation","getFormState","reduceFieldsToValues","React","Fragment","useState","Editor","Range","Transforms","ReactEditor","useSlate","LinkIcon","useElementButton","ElementButton","isElementActive","LinkDrawer","linkFieldsSchemaPath","unwrapLink","insertLink","editor","fields","isCollapsed","selection","data","newLink","type","children","doc","linkType","newTab","url","insertNodes","text","String","wrapNodes","split","delete","at","focus","path","unit","move","distance","insertText","LinkButton","fieldProps","initialState","setInitialState","t","config","closeModal","openModal","drawerSlug","schemaPath","field","richTextComponentMap","get","className","format","onClick","string","state","apiRoute","routes","api","body","operation","serverURL","tooltip","Array","isArray","handleClose","handleModalSubmit"],"mappings":"AAAA;;AAIA,SAASA,SAAS,EAAEC,aAAa,EAAEC,aAAa,EAAEC,QAAQ,EAAEC,cAAc,QAAQ,iBAAgB;AAClG,SAASC,YAAY,QAAQ,wBAAuB;AACpD,SAASC,oBAAoB,QAAQ,iBAAgB;AACrD,OAAOC,SAASC,QAAQ,EAAEC,QAAQ,QAAQ,QAAO;AACjD,SAASC,MAAM,EAAEC,KAAK,EAAEC,UAAU,QAAQ,QAAO;AACjD,SAASC,WAAW,EAAEC,QAAQ,QAAQ,cAAa;AAEnD,SAASC,QAAQ,QAAQ,+BAA8B;AACvD,SAASC,gBAAgB,QAAQ,8CAA6C;AAC9E,SAASC,aAAa,QAAQ,kBAAiB;AAC/C,SAASC,eAAe,QAAQ,oBAAmB;AACnD,SAASC,UAAU,QAAQ,yBAAwB;AACnD,SAASC,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;;AAItB,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/field/elements/link/Button/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FormState } from 'payload'\n\nimport { useConfig, useDrawerSlug, useFieldProps, useModal, useTranslation } from '@payloadcms/ui'\nimport { getFormState } from '@payloadcms/ui/shared'\nimport { reduceFieldsToValues } from 'payload/shared'\nimport React, { Fragment, useState } from 'react'\nimport { Editor, Range, Transforms } from 'slate'\nimport { ReactEditor, useSlate } from 'slate-react'\n\nimport { LinkIcon } from '../../../icons/Link/index.js'\nimport { useElementButton } from '../../../providers/ElementButtonProvider.js'\nimport { ElementButton } from '../../Button.js'\nimport { isElementActive } from '../../isActive.js'\nimport { LinkDrawer } from '../LinkDrawer/index.js'\nimport { linkFieldsSchemaPath } from '../shared.js'\nimport { unwrapLink } from '../utilities.js'\n\n/**\n * This function is called when a new link is created - not when an existing link is edited.\n */\nconst insertLink = (editor, fields) => {\n const isCollapsed = editor.selection && Range.isCollapsed(editor.selection)\n const data = reduceFieldsToValues(fields, true)\n\n const newLink = {\n type: 'link',\n children: [],\n doc: data.doc,\n fields: data.fields, // Any custom user-added fields are part of data.fields\n linkType: data.linkType,\n newTab: data.newTab,\n url: data.url,\n }\n\n if (isCollapsed || !editor.selection) {\n // If selection anchor and focus are the same,\n // Just inject a new node with children already set\n Transforms.insertNodes(editor, {\n ...newLink,\n children: [{ text: String(data.text) }],\n })\n } else if (editor.selection) {\n // Otherwise we need to wrap the selected node in a link,\n // Delete its old text,\n // Move the selection one position forward into the link,\n // And insert the text back into the new link\n Transforms.wrapNodes(editor, newLink, { split: true })\n Transforms.delete(editor, { at: editor.selection.focus.path, unit: 'word' })\n Transforms.move(editor, { distance: 1, unit: 'offset' })\n Transforms.insertText(editor, String(data.text), { at: editor.selection.focus.path })\n }\n\n ReactEditor.focus(editor)\n}\n\nexport const LinkButton: React.FC = () => {\n const { fieldProps } = useElementButton()\n const [initialState, setInitialState] = useState<FormState>({})\n\n const { t } = useTranslation()\n const editor = useSlate()\n const { config } = useConfig()\n\n const { closeModal, openModal } = useModal()\n const drawerSlug = useDrawerSlug('rich-text-link')\n const { schemaPath } = useFieldProps()\n\n const {\n field: { richTextComponentMap },\n } = fieldProps\n\n const fields = richTextComponentMap.get(linkFieldsSchemaPath)\n\n return (\n <Fragment>\n <ElementButton\n className=\"link\"\n format=\"link\"\n onClick={async () => {\n if (isElementActive(editor, 'link')) {\n unwrapLink(editor)\n } else {\n openModal(drawerSlug)\n const isCollapsed = editor.selection && Range.isCollapsed(editor.selection)\n\n if (!isCollapsed) {\n const data = {\n text: editor.selection ? Editor.string(editor, editor.selection) : '',\n }\n\n const { state } = await getFormState({\n apiRoute: config.routes.api,\n body: {\n data,\n operation: 'update',\n schemaPath: `${schemaPath}.${linkFieldsSchemaPath}`,\n },\n serverURL: config.serverURL,\n })\n\n setInitialState(state)\n }\n }\n }}\n tooltip={t('fields:addLink')}\n >\n <LinkIcon />\n </ElementButton>\n <LinkDrawer\n drawerSlug={drawerSlug}\n fields={Array.isArray(fields) ? fields : []}\n handleClose={() => {\n closeModal(drawerSlug)\n }}\n handleModalSubmit={(fields) => {\n insertLink(editor, fields)\n closeModal(drawerSlug)\n }}\n initialState={initialState}\n />\n </Fragment>\n )\n}\n"],"names":["useConfig","useDrawerSlug","useFieldProps","useModal","useTranslation","getFormState","reduceFieldsToValues","React","Fragment","useState","Editor","Range","Transforms","ReactEditor","useSlate","LinkIcon","useElementButton","ElementButton","isElementActive","LinkDrawer","linkFieldsSchemaPath","unwrapLink","insertLink","editor","fields","isCollapsed","selection","data","newLink","type","children","doc","linkType","newTab","url","insertNodes","text","String","wrapNodes","split","delete","at","focus","path","unit","move","distance","insertText","LinkButton","fieldProps","initialState","setInitialState","t","config","closeModal","openModal","drawerSlug","schemaPath","field","richTextComponentMap","get","className","format","onClick","string","state","apiRoute","routes","api","body","operation","serverURL","tooltip","Array","isArray","handleClose","handleModalSubmit"],"mappings":"AAAA;;AAIA,SAASA,SAAS,EAAEC,a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MAAM5D,aAAa;gCACnC6D,UAAUb,OAAOc,MAAM,CAACC,GAAG;gCAC3BC,MAAM;oCACJ1C;oCACA2C,WAAW;oCACXb,YAAY,CAAC,EAAEA,WAAW,CAAC,EAAErC,qBAAqB,CAAC;gCACrD;gCACAmD,WAAWlB,OAAOkB,SAAS;4BAC7B;4BAEApB,gBAAgBc;wBAClB;oBACF;gBACF;gBACAO,SAASpB,EAAE;0BAEX,cAAA,KAACrC;;0BAEH,KAACI;gBACCqC,YAAYA;gBACZhC,QAAQiD,MAAMC,OAAO,CAAClD,UAAUA,SAAS,EAAE;gBAC3CmD,aAAa;oBACXrB,WAAWE;gBACb;gBACAoB,mBAAmB,CAACpD;oBAClBF,WAAWC,QAAQC;oBACnB8B,WAAWE;gBACb;gBACAN,cAAcA;;;;AAItB,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/elements/link/Element/index.tsx"],"names":[],"mappings":"AA4BA,OAAO,cAAc,CAAA;AA+BrB,eAAO,MAAM,WAAW,+CAsKvB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/elements/link/Element/index.tsx"],"names":[],"mappings":"AA4BA,OAAO,cAAc,CAAA;AAiCrB,eAAO,MAAM,WAAW,+CAwKvB,CAAA"}
@@ -25,7 +25,9 @@ const baseClass = 'rich-text-link';
25
25
  newTab: data.newTab,
26
26
  url: data.url
27
27
  };
28
- if (data.fields) newNode.fields = data.fields;
28
+ if (data.fields) {
29
+ newNode.fields = data.fields;
30
+ }
29
31
  Transforms.setNodes(editor, newNode, {
30
32
  at: parentPath
31
33
  });
@@ -73,7 +75,7 @@ export const LinkElement = ()=>{
73
75
  text: Node.string(element),
74
76
  url: element.url
75
77
  };
76
- const state = await getFormState({
78
+ const { state } = await getFormState({
77
79
  apiRoute: config.routes.api,
78
80
  body: {
79
81
  data,
@@ -193,7 +195,9 @@ export const LinkElement = ()=>{
193
195
  ].filter(Boolean).join(' '),
194
196
  onClick: ()=>setRenderPopup(true),
195
197
  onKeyDown: (e)=>{
196
- if (e.key === 'Enter') setRenderPopup(true);
198
+ if (e.key === 'Enter') {
199
+ setRenderPopup(true);
200
+ }
197
201
  },
198
202
  role: "button",
199
203
  tabIndex: 0,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/elements/link/Element/index.tsx"],"sourcesContent":["'use client'\nimport type { FormState } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Popup,\n Translation,\n useAuth,\n useConfig,\n useDocumentInfo,\n useDrawerSlug,\n useLocale,\n useModal,\n useTranslation,\n} from '@payloadcms/ui'\nimport { getFormState } from '@payloadcms/ui/shared'\nimport { deepCopyObject, reduceFieldsToValues } from 'payload/shared'\nimport React, { useCallback, useEffect, useState } from 'react'\nimport { Editor, Node, Transforms } from 'slate'\nimport { ReactEditor, useSlate } from 'slate-react'\n\nimport type { LinkElementType } from '../types.js'\n\nimport { useElement } from '../../../providers/ElementProvider.js'\nimport { LinkDrawer } from '../LinkDrawer/index.js'\nimport { linkFieldsSchemaPath } from '../shared.js'\nimport { unwrapLink } from '../utilities.js'\nimport './index.scss'\n\nconst baseClass = 'rich-text-link'\n\n/**\n * This function is called when an existing link is edited.\n * When a link is first created, another function is called: {@link ../Button/index.tsx#insertLink}\n */\nconst insertChange = (editor, fields) => {\n const data = reduceFieldsToValues(fields, true)\n\n const [, parentPath] = Editor.above(editor)\n\n const newNode: Record<string, unknown> = {\n doc: data.doc,\n linkType: data.linkType,\n newTab: data.newTab,\n url: data.url,\n }\n\n if (data.fields) newNode.fields = data.fields\n\n Transforms.setNodes(editor, newNode, { at: parentPath })\n\n Transforms.delete(editor, { at: editor.selection.focus.path, unit: 'block' })\n Transforms.move(editor, { distance: 1, unit: 'offset' })\n Transforms.insertText(editor, String(data.text), { at: editor.selection.focus.path })\n\n ReactEditor.focus(editor)\n}\n\nexport const LinkElement = () => {\n const { attributes, children, editorRef, element, fieldProps, schemaPath } =\n useElement<LinkElementType>()\n\n const fieldMapPath = `${schemaPath}.${linkFieldsSchemaPath}`\n\n const {\n field: { richTextComponentMap },\n } = fieldProps\n const fields = richTextComponentMap.get(linkFieldsSchemaPath)\n\n const editor = useSlate()\n const { config } = useConfig()\n const { user } = useAuth()\n const { code: locale } = useLocale()\n const { i18n, t } = useTranslation()\n const { closeModal, openModal, toggleModal } = useModal()\n const [renderModal, setRenderModal] = useState(false)\n const [renderPopup, setRenderPopup] = useState(false)\n const [initialState, setInitialState] = useState<FormState>({})\n const { id, collectionSlug } = useDocumentInfo()\n\n const drawerSlug = useDrawerSlug('rich-text-link')\n\n const handleTogglePopup = useCallback((render) => {\n if (!render) {\n setRenderPopup(render)\n }\n }, [])\n\n useEffect(() => {\n const awaitInitialState = async () => {\n const data = {\n doc: element.doc,\n fields: deepCopyObject(element.fields),\n linkType: element.linkType,\n newTab: element.newTab,\n text: Node.string(element),\n url: element.url,\n }\n\n const state = await getFormState({\n apiRoute: config.routes.api,\n body: {\n data,\n operation: 'update',\n schemaPath: fieldMapPath,\n },\n serverURL: config.serverURL,\n })\n\n setInitialState(state)\n }\n\n if (renderModal) {\n void awaitInitialState()\n }\n }, [renderModal, element, user, locale, t, collectionSlug, config, id, fieldMapPath])\n\n return (\n <span className={baseClass} {...attributes}>\n <span contentEditable={false} style={{ userSelect: 'none' }}>\n {renderModal && (\n <LinkDrawer\n drawerSlug={drawerSlug}\n fields={Array.isArray(fields) ? fields : []}\n handleClose={() => {\n toggleModal(drawerSlug)\n setRenderModal(false)\n }}\n handleModalSubmit={(fields) => {\n insertChange(editor, fields)\n closeModal(drawerSlug)\n setRenderModal(false)\n }}\n initialState={initialState}\n />\n )}\n <Popup\n boundingRef={editorRef}\n buttonType=\"none\"\n forceOpen={renderPopup}\n horizontalAlign=\"left\"\n onToggleOpen={handleTogglePopup}\n render={() => (\n <div className={`${baseClass}__popup`}>\n {element.linkType === 'internal' && element.doc?.relationTo && element.doc?.value && (\n <Translation\n elements={{\n '0': ({ children }) => (\n <a\n className={`${baseClass}__link-label`}\n href={`${config.routes.admin}/collections/${element.doc.relationTo}/${element.doc.value}`}\n rel=\"noreferrer\"\n target=\"_blank\"\n title={`${config.routes.admin}/collections/${element.doc.relationTo}/${element.doc.value}`}\n >\n {children}\n </a>\n ),\n }}\n i18nKey=\"fields:linkedTo\"\n t={t}\n variables={{\n label: getTranslation(\n config.collections.find(({ slug }) => slug === element.doc.relationTo)?.labels\n ?.singular,\n i18n,\n ),\n }}\n />\n )}\n {(element.linkType === 'custom' || !element.linkType) && (\n <a\n className={`${baseClass}__link-label`}\n href={element.url}\n rel=\"noreferrer\"\n target=\"_blank\"\n title={element.url}\n >\n {element.url}\n </a>\n )}\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__link-edit`}\n icon=\"edit\"\n onClick={(e) => {\n e.preventDefault()\n setRenderPopup(false)\n openModal(drawerSlug)\n setRenderModal(true)\n }}\n round\n tooltip={t('general:edit')}\n />\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__link-close`}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n unwrapLink(editor)\n }}\n round\n tooltip={t('general:remove')}\n />\n </div>\n )}\n size=\"fit-content\"\n verticalAlign=\"bottom\"\n />\n </span>\n <span\n className={[`${baseClass}__popup-toggler`].filter(Boolean).join(' ')}\n onClick={() => setRenderPopup(true)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') setRenderPopup(true)\n }}\n role=\"button\"\n tabIndex={0}\n >\n {children}\n </span>\n </span>\n )\n}\n"],"names":["getTranslation","Button","Popup","Translation","useAuth","useConfig","useDocumentInfo","useDrawerSlug","useLocale","useModal","useTranslation","getFormState","deepCopyObject","reduceFieldsToValues","React","useCallback","useEffect","useState","Editor","Node","Transforms","ReactEditor","useSlate","useElement","LinkDrawer","linkFieldsSchemaPath","unwrapLink","baseClass","insertChange","editor","fields","data","parentPath","above","newNode","doc","linkType","newTab","url","setNodes","at","delete","selection","focus","path","unit","move","distance","insertText","String","text","LinkElement","attributes","children","editorRef","element","fieldProps","schemaPath","fieldMapPath","field","richTextComponentMap","get","config","user","code","locale","i18n","t","closeModal","openModal","toggleModal","renderModal","setRenderModal","renderPopup","setRenderPopup","initialState","setInitialState","id","collectionSlug","drawerSlug","handleTogglePopup","render","awaitInitialState","string","state","apiRoute","routes","api","body","operation","serverURL","span","className","contentEditable","style","userSelect","Array","isArray","handleClose","handleModalSubmit","boundingRef","buttonType","forceOpen","horizontalAlign","onToggleOpen","div","relationTo","value","elements","a","href","admin","rel","target","title","i18nKey","variables","label","collections","find","slug","labels","singular","buttonStyle","icon","onClick","e","preventDefault","round","tooltip","size","verticalAlign","filter","Boolean","join","onKeyDown","key","role","tabIndex"],"mappings":"AAAA;;AAGA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,SACEC,MAAM,EACNC,KAAK,EACLC,WAAW,EACXC,OAAO,EACPC,SAAS,EACTC,eAAe,EACfC,aAAa,EACbC,SAAS,EACTC,QAAQ,EACRC,cAAc,QACT,iBAAgB;AACvB,SAASC,YAAY,QAAQ,wBAAuB;AACpD,SAASC,cAAc,EAAEC,oBAAoB,QAAQ,iBAAgB;AACrE,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAC/D,SAASC,MAAM,EAAEC,IAAI,EAAEC,UAAU,QAAQ,QAAO;AAChD,SAASC,WAAW,EAAEC,QAAQ,QAAQ,cAAa;AAInD,SAASC,UAAU,QAAQ,wCAAuC;AAClE,SAASC,UAAU,QAAQ,yBAAwB;AACnD,SAASC,oBAAoB,QAAQ,eAAc;AACnD,SAASC,UAAU,QAAQ,kBAAiB;AAC5C,OAAO,eAAc;AAErB,MAAMC,YAAY;AAElB;;;CAGC,GACD,MAAMC,eAAe,CAACC,QAAQC;IAC5B,MAAMC,OAAOlB,qBAAqBiB,QAAQ;IAE1C,MAAM,GAAGE,WAAW,GAAGd,OAAOe,KAAK,CAACJ;IAEpC,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BiB,QAAQjB,GAAG;;kDAGhB,KAACrC;wCACC0H,aAAY;wCACZ/B,WAAW,CAAC,EAAEjE,UAAU,WAAW,CAAC;wCACpCiG,MAAK;wCACLC,SAAS,CAACC;4CACRA,EAAEC,cAAc;4CAChBrD,eAAe;4CACfL,UAAUU;4CACVP,eAAe;wCACjB;wCACAwD,KAAK;wCACLC,SAAS9D,EAAE;;kDAEb,KAAClE;wCACC0H,aAAY;wCACZ/B,WAAW,CAAC,EAAEjE,UAAU,YAAY,CAAC;wCACrCiG,MAAK;wCACLC,SAAS,CAACC;4CACRA,EAAEC,cAAc;4CAChBrG,WAAWG;wCACb;wCACAmG,KAAK;wCACLC,SAAS9D,EAAE;;;;wBAIjB+D,MAAK;wBACLC,eAAc;;;;0BAGlB,KAACxC;gBACCC,WAAW;oBAAC,CAAC,EAAEjE,UAAU,eAAe,CAAC;iBAAC,CAACyG,MAAM,CAACC,SAASC,IAAI,CAAC;gBAChET,SAAS,IAAMnD,eAAe;gBAC9B6D,WAAW,CAACT;oBACV,IAAIA,EAAEU,GAAG,KAAK,SAAS9D,eAAe;gBACxC;gBACA+D,MAAK;gBACLC,UAAU;0BAETrF;;;;AAIT,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/field/elements/link/Element/index.tsx"],"sourcesContent":["'use client'\nimport type { FormState } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Popup,\n Translation,\n useAuth,\n useConfig,\n useDocumentInfo,\n useDrawerSlug,\n useLocale,\n useModal,\n useTranslation,\n} from '@payloadcms/ui'\nimport { getFormState } from '@payloadcms/ui/shared'\nimport { deepCopyObject, reduceFieldsToValues } from 'payload/shared'\nimport React, { useCallback, useEffect, useState } from 'react'\nimport { Editor, Node, Transforms } from 'slate'\nimport { ReactEditor, useSlate } from 'slate-react'\n\nimport type { LinkElementType } from '../types.js'\n\nimport { useElement } from '../../../providers/ElementProvider.js'\nimport { LinkDrawer } from '../LinkDrawer/index.js'\nimport { linkFieldsSchemaPath } from '../shared.js'\nimport { unwrapLink } from '../utilities.js'\nimport './index.scss'\n\nconst baseClass = 'rich-text-link'\n\n/**\n * This function is called when an existing link is edited.\n * When a link is first created, another function is called: {@link ../Button/index.tsx#insertLink}\n */\nconst insertChange = (editor, fields) => {\n const data = reduceFieldsToValues(fields, true)\n\n const [, parentPath] = Editor.above(editor)\n\n const newNode: Record<string, unknown> = {\n doc: data.doc,\n linkType: data.linkType,\n newTab: data.newTab,\n url: data.url,\n }\n\n if (data.fields) {\n newNode.fields = data.fields\n }\n\n Transforms.setNodes(editor, newNode, { at: parentPath })\n\n Transforms.delete(editor, { at: editor.selection.focus.path, unit: 'block' })\n Transforms.move(editor, { distance: 1, unit: 'offset' })\n Transforms.insertText(editor, String(data.text), { at: editor.selection.focus.path })\n\n ReactEditor.focus(editor)\n}\n\nexport const LinkElement = () => {\n const { attributes, children, editorRef, element, fieldProps, schemaPath } =\n useElement<LinkElementType>()\n\n const fieldMapPath = `${schemaPath}.${linkFieldsSchemaPath}`\n\n const {\n field: { richTextComponentMap },\n } = fieldProps\n const fields = richTextComponentMap.get(linkFieldsSchemaPath)\n\n const editor = useSlate()\n const { config } = useConfig()\n const { user } = useAuth()\n const { code: locale } = useLocale()\n const { i18n, t } = useTranslation()\n const { closeModal, openModal, toggleModal } = useModal()\n const [renderModal, setRenderModal] = useState(false)\n const [renderPopup, setRenderPopup] = useState(false)\n const [initialState, setInitialState] = useState<FormState>({})\n const { id, collectionSlug } = useDocumentInfo()\n\n const drawerSlug = useDrawerSlug('rich-text-link')\n\n const handleTogglePopup = useCallback((render) => {\n if (!render) {\n setRenderPopup(render)\n }\n }, [])\n\n useEffect(() => {\n const awaitInitialState = async () => {\n const data = {\n doc: element.doc,\n fields: deepCopyObject(element.fields),\n linkType: element.linkType,\n newTab: element.newTab,\n text: Node.string(element),\n url: element.url,\n }\n\n const { state } = await getFormState({\n apiRoute: config.routes.api,\n body: {\n data,\n operation: 'update',\n schemaPath: fieldMapPath,\n },\n serverURL: config.serverURL,\n })\n\n setInitialState(state)\n }\n\n if (renderModal) {\n void awaitInitialState()\n }\n }, [renderModal, element, user, locale, t, collectionSlug, config, id, fieldMapPath])\n\n return (\n <span className={baseClass} {...attributes}>\n <span contentEditable={false} style={{ userSelect: 'none' }}>\n {renderModal && (\n <LinkDrawer\n drawerSlug={drawerSlug}\n fields={Array.isArray(fields) ? fields : []}\n handleClose={() => {\n toggleModal(drawerSlug)\n setRenderModal(false)\n }}\n handleModalSubmit={(fields) => {\n insertChange(editor, fields)\n closeModal(drawerSlug)\n setRenderModal(false)\n }}\n initialState={initialState}\n />\n )}\n <Popup\n boundingRef={editorRef}\n buttonType=\"none\"\n forceOpen={renderPopup}\n horizontalAlign=\"left\"\n onToggleOpen={handleTogglePopup}\n render={() => (\n <div className={`${baseClass}__popup`}>\n {element.linkType === 'internal' && element.doc?.relationTo && element.doc?.value && (\n <Translation\n elements={{\n '0': ({ children }) => (\n <a\n className={`${baseClass}__link-label`}\n href={`${config.routes.admin}/collections/${element.doc.relationTo}/${element.doc.value}`}\n rel=\"noreferrer\"\n target=\"_blank\"\n title={`${config.routes.admin}/collections/${element.doc.relationTo}/${element.doc.value}`}\n >\n {children}\n </a>\n ),\n }}\n i18nKey=\"fields:linkedTo\"\n t={t}\n variables={{\n label: getTranslation(\n config.collections.find(({ slug }) => slug === element.doc.relationTo)?.labels\n ?.singular,\n i18n,\n ),\n }}\n />\n )}\n {(element.linkType === 'custom' || !element.linkType) && (\n <a\n className={`${baseClass}__link-label`}\n href={element.url}\n rel=\"noreferrer\"\n target=\"_blank\"\n title={element.url}\n >\n {element.url}\n </a>\n )}\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__link-edit`}\n icon=\"edit\"\n onClick={(e) => {\n e.preventDefault()\n setRenderPopup(false)\n openModal(drawerSlug)\n setRenderModal(true)\n }}\n round\n tooltip={t('general:edit')}\n />\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__link-close`}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n unwrapLink(editor)\n }}\n round\n tooltip={t('general:remove')}\n />\n </div>\n )}\n size=\"fit-content\"\n verticalAlign=\"bottom\"\n />\n </span>\n <span\n className={[`${baseClass}__popup-toggler`].filter(Boolean).join(' ')}\n onClick={() => setRenderPopup(true)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n setRenderPopup(true)\n }\n }}\n role=\"button\"\n tabIndex={0}\n >\n {children}\n </span>\n </span>\n )\n}\n"],"names":["getTranslation","Button","Popup","Translation","useAuth","useConfig","useDocumentInfo","useDrawerSlug","useLocale","useModal","useTranslation","getFormState","deepCopyObject","reduceFieldsToValues","React","useCallback","useEffect","useState","Editor","Node","Transforms","ReactEditor","useSlate","useElement","LinkDrawer","linkFieldsSchemaPath","unwrapLink","baseClass","insertChange","editor","fields","data","parentPath","above","newNode","doc","linkType","newTab","url","setNodes","at","delete","selection","focus","path","unit","move","distance","insertText","String","text","LinkElement","attributes","children","editorRef","element","fieldProps","schemaPath","fieldMapPath","field","richTextComponentMap","get","config","user","code","locale","i18n","t","closeModal","openModal","toggleModal","renderModal","setRenderModal","renderPopup","setRenderPopup","initialState","setInitialState","id","collectionSlug","drawerSlug","handleTogglePopup","render","awaitInitialState","string","state","apiRoute","routes","api","body","operation","serverURL","span","className","contentEditable","style","userSelect","Array","isArray","handleClose","handleModalSubmit","boundingRef","buttonType","forceOpen","horizontalAlign","onToggleOpen","div","relationTo","value","elements","a","href","admin","rel","target","title","i18nKey","variables","label","collections","find","slug","labels","singular","buttonStyle","icon","onClick","e","preventDefault","round","tooltip","size","verticalAlign","filter","Boolean","join","onKeyDown","key","role","tabIndex"],"mappings":"AAAA;;AAGA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,SACEC,MAAM,EACNC,KAAK,EACLC,WAAW,EACXC,OAAO,EACPC,SAAS,EACTC,eAAe,EACfC,aAAa,EACbC,SAAS,EACTC,QAAQ,EACRC,cAAc,QACT,iBAAgB;AACvB,SAASC,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AIA,EAAEU,GAAG,KAAK,SAAS;wBACrB9D,eAAe;oBACjB;gBACF;gBACA+D,MAAK;gBACLC,UAAU;0BAETrF;;;;AAIT,EAAC"}
@@ -1,92 +1,90 @@
1
1
  @import '../../../../scss/styles.scss';
2
2
 
3
- .rich-text-link {
4
- position: relative;
5
- text-decoration: underline;
3
+ @layer payload-default {
4
+ .rich-text-link {
5
+ position: relative;
6
6
 
7
- .popup {
8
- position: absolute;
9
- top: 0;
10
- right: 0;
11
- bottom: 0;
12
- left: 0;
7
+ .popup {
8
+ position: absolute;
9
+ top: 0;
10
+ right: 0;
11
+ bottom: 0;
12
+ left: 0;
13
13
 
14
- .popup__hide-scrollbar,
15
- .popup__scroll-container {
16
- overflow: visible;
17
- }
14
+ .popup__hide-scrollbar,
15
+ .popup__scroll-container {
16
+ overflow: visible;
17
+ }
18
18
 
19
- .popup__scroll-content {
20
- white-space: pre;
19
+ .popup__scroll-content {
20
+ white-space: pre;
21
+ }
21
22
  }
22
- }
23
-
24
- .icon--x line {
25
- stroke-width: 2px;
26
- }
27
23
 
28
- &__popup {
29
- @extend %body;
30
- font-family: var(--font-body);
31
- display: flex;
24
+ .icon--x line {
25
+ stroke-width: 2px;
26
+ }
32
27
 
33
- button {
34
- @extend %btn-reset;
35
- font-weight: 600;
36
- cursor: pointer;
37
- margin: 0;
28
+ &__popup {
29
+ @extend %body;
30
+ font-family: var(--font-body);
31
+ display: flex;
38
32
 
39
- &:hover,
40
- &:focus-visible {
41
- text-decoration: underline;
33
+ button {
34
+ @extend %btn-reset;
35
+ font-weight: 600;
36
+ cursor: pointer;
37
+ margin: 0;
42
38
  }
43
39
  }
44
- }
45
40
 
46
- &__link-label {
47
- max-width: base(8);
48
- overflow: hidden;
49
- text-overflow: ellipsis;
50
- border-radius: 2px;
41
+ &__link-label {
42
+ max-width: base(8);
43
+ overflow: hidden;
44
+ text-overflow: ellipsis;
45
+ border-radius: 2px;
51
46
 
52
- &:hover {
53
- background-color: var(--popup-button-highlight);
47
+ &:hover {
48
+ background-color: var(--popup-button-highlight);
49
+ }
54
50
  }
55
51
  }
56
- }
57
52
 
58
- .rich-text-link__popup {
59
- display: flex;
60
- gap: calc(var(--base) * 0.25);
61
- button {
62
- &:hover {
63
- .btn__icon {
64
- background-color: var(--popup-button-highlight);
65
- .fill {
66
- fill: var(--theme-text);
67
- }
68
- .stroke {
69
- stroke: var(--theme-text);
53
+ .rich-text-link__popup {
54
+ display: flex;
55
+ gap: calc(var(--base) * 0.25);
56
+ button {
57
+ &:hover {
58
+ .btn__icon {
59
+ background-color: var(--popup-button-highlight);
60
+ .fill {
61
+ fill: var(--theme-text);
62
+ }
63
+ .stroke {
64
+ stroke: var(--theme-text);
65
+ }
70
66
  }
71
67
  }
72
68
  }
73
69
  }
74
- }
75
70
 
76
- .rich-text-link__popup-toggler {
77
- position: relative;
78
- border: 0;
79
- background-color: transparent;
80
- padding: 0;
81
- text-decoration: underline;
82
- cursor: text;
71
+ .rich-text-link__popup-toggler {
72
+ position: relative;
73
+ border: 0;
74
+ background-color: transparent;
75
+ padding: 0;
76
+ color: var(--theme-success-600);
77
+ text-decoration: none;
78
+ border-bottom: 1px dotted;
79
+ cursor: text;
83
80
 
84
- &:focus,
85
- &:focus-within {
86
- outline: none;
87
- }
81
+ &:focus,
82
+ &:focus-within {
83
+ outline: none;
84
+ }
88
85
 
89
- &--open {
90
- z-index: var(--z-popup);
86
+ &--open {
87
+ z-index: var(--z-popup);
88
+ }
91
89
  }
92
90
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/elements/link/LinkDrawer/index.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAA8B,MAAM,OAAO,CAAA;AAElD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAGvC,OAAO,cAAc,CAAA;AAIrB,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA2CtC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/elements/link/LinkDrawer/index.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAA8B,MAAM,OAAO,CAAA;AAElD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAGvC,OAAO,cAAc,CAAA;AAIrB,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA6CtC,CAAA"}
@@ -13,7 +13,7 @@ export const LinkDrawer = ({ drawerSlug, fields, handleModalSubmit, initialState
13
13
  const { id } = useDocumentInfo();
14
14
  const { config } = useConfig();
15
15
  const onChange = useCallback(async ({ formState: prevFormState })=>{
16
- return await getFormState({
16
+ const { state } = await getFormState({
17
17
  apiRoute: config.routes.api,
18
18
  body: {
19
19
  id,
@@ -23,6 +23,7 @@ export const LinkDrawer = ({ drawerSlug, fields, handleModalSubmit, initialState
23
23
  },
24
24
  serverURL: config.serverURL
25
25
  });
26
+ return state;
26
27
  }, [
27
28
  config.routes.api,
28
29
  config.serverURL,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/elements/link/LinkDrawer/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FormProps } from '@payloadcms/ui'\n\nimport {\n Drawer,\n Form,\n FormSubmit,\n RenderFields,\n useConfig,\n useDocumentInfo,\n useEditDepth,\n useFieldProps,\n useHotkey,\n useTranslation,\n} from '@payloadcms/ui'\nimport { getFormState } from '@payloadcms/ui/shared'\nimport React, { useCallback, useRef } from 'react'\n\nimport type { Props } from './types.js'\n\nimport { linkFieldsSchemaPath } from '../shared.js'\nimport './index.scss'\n\nconst baseClass = 'rich-text-link-edit-modal'\n\nexport const LinkDrawer: React.FC<Props> = ({\n drawerSlug,\n fields,\n handleModalSubmit,\n initialState,\n}) => {\n const { t } = useTranslation()\n const { schemaPath } = useFieldProps()\n const fieldMapPath = `${schemaPath}.${linkFieldsSchemaPath}`\n const { id } = useDocumentInfo()\n const { config } = useConfig()\n\n const onChange: FormProps['onChange'][0] = useCallback(\n async ({ formState: prevFormState }) => {\n return await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n formState: prevFormState,\n operation: 'update',\n schemaPath: fieldMapPath,\n },\n serverURL: config.serverURL,\n })\n },\n\n [config.routes.api, config.serverURL, fieldMapPath, id],\n )\n\n return (\n <Drawer className={baseClass} slug={drawerSlug} title={t('fields:editLink')}>\n <Form\n beforeSubmit={[onChange]}\n disableValidationOnSubmit\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={handleModalSubmit}\n >\n <RenderFields fields={fields} forceRender path=\"\" readOnly={false} schemaPath=\"\" />\n <LinkSubmit />\n </Form>\n </Drawer>\n )\n}\n\nconst LinkSubmit: React.FC = () => {\n const { t } = useTranslation()\n const ref = useRef<HTMLButtonElement>(null)\n const editDepth = useEditDepth()\n\n useHotkey({ cmdCtrlKey: true, editDepth, keyCodes: ['s'] }, (e) => {\n e.preventDefault()\n e.stopPropagation()\n if (ref?.current) {\n ref.current.click()\n }\n })\n\n return <FormSubmit ref={ref}>{t('general:submit')}</FormSubmit>\n}\n"],"names":["Drawer","Form","FormSubmit","RenderFields","useConfig","useDocumentInfo","useEditDepth","useFieldProps","useHotkey","useTranslation","getFormState","React","useCallback","useRef","linkFieldsSchemaPath","baseClass","LinkDrawer","drawerSlug","fields","handleModalSubmit","initialState","t","schemaPath","fieldMapPath","id","config","onChange","formState","prevFormState","apiRoute","routes","api","body","operation","serverURL","className","slug","title","beforeSubmit","disableValidationOnSubmit","onSubmit","forceRender","path","readOnly","LinkSubmit","ref","editDepth","cmdCtrlKey","keyCodes","e","preventDefault","stopPropagation","current","click"],"mappings":"AAAA;;AAIA,SACEA,MAAM,EACNC,IAAI,EACJC,UAAU,EACVC,YAAY,EACZC,SAAS,EACTC,eAAe,EACfC,YAAY,EACZC,aAAa,EACbC,SAAS,EACTC,cAAc,QACT,iBAAgB;AACvB,SAASC,YAAY,QAAQ,wBAAuB;AACpD,OAAOC,SAASC,WAAW,EAA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C;QAC3DA,EAAEC,cAAc;QAChBD,EAAEE,eAAe;QACjB,IAAIN,KAAKO,SAAS;YAChBP,IAAIO,OAAO,CAACC,KAAK;QACnB;IACF;IAEA,qBAAO,KAACnD;QAAW2C,KAAKA;kBAAMxB,EAAE;;AAClC"}
1
+ {"version":3,"sources":["../../../../../src/field/elements/link/LinkDrawer/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FormProps } from '@payloadcms/ui'\n\nimport {\n Drawer,\n Form,\n FormSubmit,\n RenderFields,\n useConfig,\n useDocumentInfo,\n useEditDepth,\n useFieldProps,\n useHotkey,\n useTranslation,\n} from '@payloadcms/ui'\nimport { getFormState } from '@payloadcms/ui/shared'\nimport React, { useCallback, useRef } from 'react'\n\nimport type { Props } from './types.js'\n\nimport { linkFieldsSchemaPath } from '../shared.js'\nimport './index.scss'\n\nconst baseClass = 'rich-text-link-edit-modal'\n\nexport const LinkDrawer: React.FC<Props> = ({\n drawerSlug,\n fields,\n handleModalSubmit,\n initialState,\n}) => {\n const { t } = useTranslation()\n const { schemaPath } = useFieldProps()\n const fieldMapPath = `${schemaPath}.${linkFieldsSchemaPath}`\n const { id } = useDocumentInfo()\n const { config } = useConfig()\n\n const onChange: FormProps['onChange'][0] = useCallback(\n async ({ formState: prevFormState }) => {\n const { state } = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n formState: prevFormState,\n operation: 'update',\n schemaPath: fieldMapPath,\n },\n serverURL: config.serverURL,\n })\n\n return state\n },\n\n [config.routes.api, config.serverURL, fieldMapPath, id],\n )\n\n return (\n <Drawer className={baseClass} slug={drawerSlug} title={t('fields:editLink')}>\n <Form\n beforeSubmit={[onChange]}\n disableValidationOnSubmit\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={handleModalSubmit}\n >\n <RenderFields fields={fields} forceRender path=\"\" readOnly={false} schemaPath=\"\" />\n <LinkSubmit />\n </Form>\n </Drawer>\n )\n}\n\nconst LinkSubmit: React.FC = () => {\n const { t } = useTranslation()\n const ref = useRef<HTMLButtonElement>(null)\n const editDepth = useEditDepth()\n\n useHotkey({ cmdCtrlKey: true, editDepth, keyCodes: ['s'] }, (e) => {\n e.preventDefault()\n e.stopPropagation()\n if (ref?.current) {\n ref.current.click()\n }\n })\n\n return <FormSubmit ref={ref}>{t('general:submit')}</FormSubmit>\n}\n"],"names":["Drawer","Form","FormSubmit","RenderFields","useConfig","useDocumentInfo","useEditDepth","useFieldProps","useHotkey","useTranslation","getFormState","React","useCallback","useRef","linkFieldsSchemaPath","baseClass","LinkDrawer","drawerSlug","fields","handleModalSubmit","initialState","t","schemaPath","fieldMapPath","id","config","onChange","formState","prevFormState","state","apiRoute","routes","api","body","operation","serverURL","className","slug","title","beforeSubmit","disableValidationOnSubmit","onSubmit","forceRender","path","readOnly","LinkSubmit","ref","editDepth","cmdCtrlKey","keyCodes","e","preventDefault","stopPropagation","current","click"],"mappings":"AAAA;;AAIA,SACEA,MAAM,EACNC,IAAI,EACJC,UAAU,EACVC,YAAY,EACZC,SAAS,EACTC,eAAe,EACfC,YAAY,EACZC,aAAa,EACbC,SAAS,EACTC,cAAc,QACT,iBAAgB;AACvB,SAASC,YAAY,QAAQ,wBAAuB;AACpD,OAAOC,SAASC,WAAW,EAAEC,MAAM,QAAQ,QAAO;AAIlD,SAASC,oBAAoB,QAAQ,eAAc;AACnD,OAAO,eAAc;AAErB,MAAMC,YAAY;AAElB,OAAO,MAAMC,aAA8B,CAAC,EAC1CC,UAAU,EACVC,MAAM,EACNC,iBAAiB,EACjBC,YAAY,EACb;IACC,MAAM,EAAEC,CAAC,EAAE,GAAGZ;IACd,MAAM,EAAEa,UAAU,EAAE,GAAGf;IACvB,MAAMgB,eAAe,CAAC,EAAED,WAAW,CAAC,EAAER,qBAAqB,CAAC;IAC5D,MAAM,EAAEU,EAAE,EAAE,GAAGnB;IACf,MAAM,EAAEoB,MAAM,EAAE,GAAGrB;IAEnB,MAAMsB,WAAqCd,YACzC,OAAO,EAAEe,WAAWC,aAAa,EAAE;QACjC,MAAM,EAAEC,KAAK,EAAE,GAAG,MAAMnB,aAAa;YACnCoB,UAAUL,OAAOM,MAAM,CAACC,GAAG;YAC3BC,MAAM;gBACJT;gBACAG,WAAWC;gBACXM,WAAW;gBACXZ,YAAYC;YACd;YACAY,WAAWV,OAAOU,SAAS;QAC7B;QAEA,OAAON;IACT,GAEA;QAACJ,OAAOM,MAAM,CAACC,GAAG;QAAEP,OAAOU,SAAS;QAAEZ;QAAcC;KAAG;IAGzD,qBACE,KAACxB;QAAOoC,WAAWrB;QAAWsB,MAAMpB;QAAYqB,OAAOjB,EAAE;kBACvD,cAAA,MAACpB;YACCsC,cAAc;gBAACb;aAAS;YACxBc,yBAAyB;YACzBpB,cAAcA;YACdM,UAAU;gBAACA;aAAS;YACpBe,UAAUtB;;8BAEV,KAAChB;oBAAae,QAAQA;oBAAQwB,WAAW;oBAACC,MAAK;oBAAGC,UAAU;oBAAOtB,YAAW;;8BAC9E,KAACuB;;;;AAIT,EAAC;AAED,MAAMA,aAAuB;IAC3B,MAAM,EAAExB,CAAC,EAAE,GAAGZ;IACd,MAAMqC,MAAMjC,OAA0B;IACtC,MAAMkC,YAAYzC;IAElBE,UAAU;QAAEwC,YAAY;QAAMD;QAAWE,UAAU;YAAC;SAAI;IAAC,GAAG,CAACC;QAC3DA,EAAEC,cAAc;QAChBD,EAAEE,eAAe;QACjB,IAAIN,KAAKO,SAAS;YAChBP,IAAIO,OAAO,CAACC,KAAK;QACnB;IACF;IAEA,qBAAO,KAACpD;QAAW4C,KAAKA;kBAAMzB,EAAE;;AAClC"}
@@ -1,49 +1,51 @@
1
1
  @import '../../../../scss/styles.scss';
2
2
 
3
- .rich-text-link-edit-modal {
4
- &__template {
5
- position: relative;
6
- z-index: 1;
7
- padding-top: base(1);
8
- padding-bottom: base(2);
9
- }
3
+ @layer payload-default {
4
+ .rich-text-link-edit-modal {
5
+ &__template {
6
+ position: relative;
7
+ z-index: 1;
8
+ padding-top: base(1);
9
+ padding-bottom: base(2);
10
+ }
10
11
 
11
- &__header {
12
- width: 100%;
13
- margin-bottom: $baseline;
14
- display: flex;
15
- justify-content: space-between;
16
- margin-top: base(2.5);
17
- margin-bottom: base(1);
12
+ &__header {
13
+ width: 100%;
14
+ margin-bottom: $baseline;
15
+ display: flex;
16
+ justify-content: space-between;
17
+ margin-top: base(2.5);
18
+ margin-bottom: base(1);
18
19
 
19
- @include mid-break {
20
- margin-top: base(1.5);
20
+ @include mid-break {
21
+ margin-top: base(1.5);
22
+ }
21
23
  }
22
- }
23
24
 
24
- &__header-text {
25
- margin: 0;
26
- }
25
+ &__header-text {
26
+ margin: 0;
27
+ }
27
28
 
28
- &__header-close {
29
- border: 0;
30
- background-color: transparent;
31
- padding: 0;
32
- cursor: pointer;
33
- overflow: hidden;
34
- width: base(1);
35
- height: base(1);
29
+ &__header-close {
30
+ border: 0;
31
+ background-color: transparent;
32
+ padding: 0;
33
+ cursor: pointer;
34
+ overflow: hidden;
35
+ width: base(1);
36
+ height: base(1);
36
37
 
37
- svg {
38
- width: base(2);
39
- height: base(2);
40
- position: relative;
41
- inset-inline-start: base(-0.5);
42
- top: base(-0.5);
38
+ svg {
39
+ width: base(2);
40
+ height: base(2);
41
+ position: relative;
42
+ inset-inline-start: base(-0.5);
43
+ top: base(-0.5);
43
44
 
44
- .stroke {
45
- stroke-width: 2px;
46
- vector-effect: non-scaling-stroke;
45
+ .stroke {
46
+ stroke-width: 2px;
47
+ vector-effect: non-scaling-stroke;
48
+ }
47
49
  }
48
50
  }
49
51
  }
@@ -1,7 +1,9 @@
1
1
  @import '../../../scss/styles.scss';
2
2
 
3
- .rich-text-ol {
4
- &[data-slate-node='element'] {
5
- margin: base(0.625) 0;
3
+ @layer payload-default {
4
+ .rich-text-ol {
5
+ &[data-slate-node='element'] {
6
+ margin: base(0.625) 0;
7
+ }
6
8
  }
7
9
  }
@@ -1,7 +1,9 @@
1
1
  @import '../../../../scss/styles.scss';
2
2
 
3
- .relationship-rich-text-button {
4
- display: flex;
5
- align-items: center;
6
- height: 100%;
3
+ @layer payload-default {
4
+ .relationship-rich-text-button {
5
+ display: flex;
6
+ align-items: center;
7
+ height: 100%;
8
+ }
7
9
  }