@payloadcms/richtext-lexical 3.0.0-beta.40 → 3.0.0-beta.41

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 (23) hide show
  1. package/dist/field/features/debug/testRecorder/plugin/index.js +1 -1
  2. package/dist/field/features/debug/testRecorder/plugin/index.js.map +1 -1
  3. package/dist/field/features/horizontalRule/component/index.d.ts.map +1 -1
  4. package/dist/field/features/horizontalRule/component/index.js +7 -2
  5. package/dist/field/features/horizontalRule/component/index.js.map +1 -1
  6. package/dist/field/features/horizontalRule/nodes/HorizontalRuleNode.d.ts +2 -2
  7. package/dist/field/features/horizontalRule/nodes/HorizontalRuleNode.d.ts.map +1 -1
  8. package/dist/field/features/horizontalRule/nodes/HorizontalRuleNode.js +5 -2
  9. package/dist/field/features/horizontalRule/nodes/HorizontalRuleNode.js.map +1 -1
  10. package/dist/field/features/horizontalRule/plugin/index.scss +3 -3
  11. package/dist/field/features/link/plugins/clickableLink/index.d.ts.map +1 -1
  12. package/dist/field/features/link/plugins/clickableLink/index.js +2 -4
  13. package/dist/field/features/link/plugins/clickableLink/index.js.map +1 -1
  14. package/dist/field/features/upload/nodes/UploadNode.d.ts.map +1 -1
  15. package/dist/field/features/upload/nodes/UploadNode.js +7 -0
  16. package/dist/field/features/upload/nodes/UploadNode.js.map +1 -1
  17. package/dist/field/lexical/LexicalEditor.d.ts.map +1 -1
  18. package/dist/field/lexical/LexicalEditor.js +2 -4
  19. package/dist/field/lexical/LexicalEditor.js.map +1 -1
  20. package/dist/field/lexical/theme/EditorTheme.d.ts.map +1 -1
  21. package/dist/field/lexical/theme/EditorTheme.js +1 -0
  22. package/dist/field/lexical/theme/EditorTheme.js.map +1 -1
  23. package/package.json +33 -33
@@ -90,7 +90,7 @@ const formatStep = (step)=>{
90
90
  }
91
91
  };
92
92
  export function isSelectAll(event) {
93
- return event.code === 'KeyA' && (IS_APPLE ? event.metaKey : event.ctrlKey);
93
+ return event.key.toLowerCase() === 'a' && (IS_APPLE ? event.metaKey : event.ctrlKey);
94
94
  }
95
95
  // stolen from LexicalSelection-test
96
96
  function sanitizeSelection(selection) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/field/features/debug/testRecorder/plugin/index.tsx"],"sourcesContent":["'use client'\nimport type { BaseSelection, LexicalEditor } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $createParagraphNode, $createTextNode, $getRoot } from 'lexical'\nimport * as React from 'react'\nimport { type JSX, useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'\n\nimport type { PluginComponent } from '../../../types.js'\n\nimport { IS_APPLE } from '../../../../lexical/utils/environment.js'\nimport './index.scss'\n\nconst copy = (text: null | string) => {\n const textArea = document.createElement('textarea')\n textArea.value = text || ''\n textArea.style.position = 'absolute'\n textArea.style.opacity = '0'\n document.body?.appendChild(textArea)\n textArea.focus()\n textArea.select()\n try {\n const result = document.execCommand('copy')\n // eslint-disable-next-line no-console\n console.log(result)\n } catch (error) {\n console.error(error)\n }\n document.body?.removeChild(textArea)\n}\n\nconst download = (filename: string, text: null | string) => {\n const a = document.createElement('a')\n a.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text || ''))\n a.setAttribute('download', filename)\n a.style.display = 'none'\n document.body?.appendChild(a)\n a.click()\n document.body?.removeChild(a)\n}\n\nconst formatStep = (step: Step) => {\n const formatOneStep = (name: string, value: Step['value']) => {\n switch (name) {\n case 'click': {\n return ` await page.mouse.click(${value.x}, ${value.y});`\n }\n case 'press': {\n return ` await page.keyboard.press('${value}');`\n }\n case 'keydown': {\n return ` await page.keyboard.keydown('${value}');`\n }\n case 'keyup': {\n return ` await page.keyboard.keyup('${value}');`\n }\n case 'type': {\n return ` await page.keyboard.type('${value}');`\n }\n case 'selectAll': {\n return ` await selectAll(page);`\n }\n case 'snapshot': {\n return ` await assertHTMLSnapshot(page);\n await assertSelection(page, {\n anchorPath: [${value.anchorPath.toString()}],\n anchorOffset: ${value.anchorOffset},\n focusPath: [${value.focusPath.toString()}],\n focusOffset: ${value.focusOffset},\n });\n`\n }\n default:\n return ``\n }\n }\n const formattedStep = formatOneStep(step.name, step.value)\n switch (step.count) {\n case 1:\n return formattedStep\n case 2:\n return [formattedStep, formattedStep].join(`\\n`)\n default:\n return ` await repeat(${step.count}, async () => {\n ${formattedStep}\n );`\n }\n}\n\nexport function isSelectAll(event: KeyboardEvent): boolean {\n return event.code === 'KeyA' && (IS_APPLE ? event.metaKey : event.ctrlKey)\n}\n\n// stolen from LexicalSelection-test\nfunction sanitizeSelection(selection: Selection) {\n const { anchorNode, focusNode } = selection\n let { anchorOffset, focusOffset } = selection\n if (anchorOffset !== 0) {\n anchorOffset--\n }\n if (focusOffset !== 0) {\n focusOffset--\n }\n return { anchorNode, anchorOffset, focusNode, focusOffset }\n}\n\nfunction getPathFromNodeToEditor(node: Node, rootElement: HTMLElement | null) {\n let currentNode: Node | null | undefined = node\n const path = []\n while (currentNode !== rootElement) {\n if (currentNode !== null && currentNode !== undefined) {\n path.unshift(\n Array.from(currentNode?.parentNode?.childNodes ?? []).indexOf(currentNode as ChildNode),\n )\n }\n currentNode = currentNode?.parentNode\n }\n return path\n}\n\nconst keyPresses = new Set([\n 'Enter',\n 'Backspace',\n 'Delete',\n 'Escape',\n 'ArrowLeft',\n 'ArrowRight',\n 'ArrowUp',\n 'ArrowDown',\n])\n\ntype Step = {\n count: number\n name: string\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value: any\n}\n\ntype Steps = Step[]\n\nfunction useTestRecorder(editor: LexicalEditor): [JSX.Element, JSX.Element | null] {\n const [steps, setSteps] = useState<Steps>([])\n const [isRecording, setIsRecording] = useState(false)\n const [, setCurrentInnerHTML] = useState('')\n const [templatedTest, setTemplatedTest] = useState('')\n const previousSelectionRef = useRef<BaseSelection | null>(null)\n const skipNextSelectionChangeRef = useRef(false)\n const preRef = useRef<HTMLPreElement>(null)\n\n const getCurrentEditor = useCallback(() => {\n return editor\n }, [editor])\n\n const generateTestContent = useCallback(() => {\n const rootElement = editor.getRootElement()\n const browserSelection = window.getSelection()\n\n if (\n rootElement == null ||\n browserSelection == null ||\n browserSelection.anchorNode == null ||\n browserSelection.focusNode == null ||\n !rootElement.contains(browserSelection.anchorNode) ||\n !rootElement.contains(browserSelection.focusNode)\n ) {\n return null\n }\n\n return `\nimport {\n initializeE2E,\n assertHTMLSnapshot,\n assertSelection,\n repeat,\n} from '../utils';\nimport {selectAll} from '../keyboardShortcuts';\nimport { RangeSelection } from 'lexical';\nimport { NodeSelection } from 'lexical';\n\ndescribe('Test case', () => {\n initializeE2E((e2e) => {\n it('Should pass this test', async () => {\n const {page} = e2e;\n\n await page.focus('div[contenteditable=\"true\"]');\n${steps.map(formatStep).join(`\\n`)}\n });\n});\n `\n }, [editor, steps])\n\n // just a wrapper around inserting new actions so that we can\n // coalesce some actions like insertText/moveNativeSelection\n const pushStep = useCallback(\n (name: string, value: Step['value']) => {\n setSteps((currentSteps) => {\n // trying to group steps\n const currentIndex = steps.length - 1\n const lastStep = steps[currentIndex]\n if (lastStep) {\n if (lastStep.name === name) {\n if (name === 'type') {\n // for typing events we just append the text\n return [\n ...steps.slice(0, currentIndex),\n { ...lastStep, value: lastStep.value + value },\n ]\n } else {\n // for other events we bump the counter if their values are the same\n if (lastStep.value === value) {\n return [...steps.slice(0, currentIndex), { ...lastStep, count: lastStep.count + 1 }]\n }\n }\n }\n }\n // could not group, just append a new one\n return [...currentSteps, { name, count: 1, value }]\n })\n },\n [steps, setSteps],\n )\n\n useLayoutEffect(() => {\n const onKeyDown = (event: KeyboardEvent) => {\n if (!isRecording) {\n return\n }\n const key = event.key\n if (isSelectAll(event)) {\n pushStep('selectAll', '')\n } else if (keyPresses.has(key)) {\n pushStep('press', event.key)\n } else if ([...key].length > 1) {\n pushStep('keydown', event.key)\n } else {\n pushStep('type', event.key)\n }\n }\n\n const onKeyUp = (event: KeyboardEvent) => {\n if (!isRecording) {\n return\n }\n const key = event.key\n if (!keyPresses.has(key) && [...key].length > 1) {\n pushStep('keyup', event.key)\n }\n }\n\n return editor.registerRootListener(\n (rootElement: HTMLElement | null, prevRootElement: HTMLElement | null) => {\n if (prevRootElement !== null) {\n prevRootElement.removeEventListener('keydown', onKeyDown)\n prevRootElement.removeEventListener('keyup', onKeyUp)\n }\n if (rootElement !== null) {\n rootElement.addEventListener('keydown', onKeyDown)\n rootElement.addEventListener('keyup', onKeyUp)\n }\n },\n )\n }, [editor, isRecording, pushStep])\n\n useLayoutEffect(() => {\n if (preRef.current) {\n preRef.current.scrollTo(0, preRef.current.scrollHeight)\n }\n }, [generateTestContent])\n\n useEffect(() => {\n if (steps) {\n const testContent = generateTestContent()\n if (testContent !== null) {\n setTemplatedTest(testContent)\n }\n if (preRef.current) {\n preRef.current.scrollTo(0, preRef.current.scrollHeight)\n }\n }\n }, [generateTestContent, steps])\n\n useEffect(() => {\n const removeUpdateListener = editor.registerUpdateListener(\n ({ dirtyElements, dirtyLeaves, editorState }) => {\n if (!isRecording) {\n return\n }\n const currentSelection = editorState._selection\n const previousSelection = previousSelectionRef.current\n const skipNextSelectionChange = skipNextSelectionChangeRef.current\n if (previousSelection !== currentSelection) {\n if (dirtyLeaves.size === 0 && dirtyElements.size === 0 && !skipNextSelectionChange) {\n const browserSelection = window.getSelection()\n if (\n browserSelection &&\n (browserSelection.anchorNode == null || browserSelection.focusNode == null)\n ) {\n return\n }\n }\n previousSelectionRef.current = currentSelection\n }\n skipNextSelectionChangeRef.current = false\n const testContent = generateTestContent()\n if (testContent !== null) {\n setTemplatedTest(testContent)\n }\n },\n )\n return removeUpdateListener\n }, [editor, generateTestContent, isRecording, pushStep])\n\n // save innerHTML\n useEffect(() => {\n if (!isRecording) {\n return\n }\n const removeUpdateListener = editor.registerUpdateListener(() => {\n const rootElement = editor.getRootElement()\n if (rootElement !== null) {\n setCurrentInnerHTML(rootElement?.innerHTML)\n }\n })\n return removeUpdateListener\n }, [editor, isRecording])\n\n // clear editor and start recording\n const toggleEditorSelection = useCallback(\n (currentEditor: LexicalEditor) => {\n if (!isRecording) {\n currentEditor.update(() => {\n const root = $getRoot()\n root.clear()\n const text = $createTextNode()\n root.append($createParagraphNode().append(text))\n text.select()\n })\n setSteps([])\n }\n setIsRecording((currentIsRecording) => !currentIsRecording)\n },\n [isRecording],\n )\n\n const onSnapshotClick = useCallback(() => {\n if (!isRecording) {\n return\n }\n const browserSelection = window.getSelection()\n if (\n browserSelection === null ||\n browserSelection.anchorNode == null ||\n browserSelection.focusNode == null\n ) {\n return\n }\n const { anchorNode, anchorOffset, focusNode, focusOffset } = sanitizeSelection(browserSelection)\n const rootElement = getCurrentEditor().getRootElement()\n let anchorPath\n if (anchorNode !== null) {\n anchorPath = getPathFromNodeToEditor(anchorNode, rootElement)\n }\n let focusPath\n if (focusNode !== null) {\n focusPath = getPathFromNodeToEditor(focusNode, rootElement)\n }\n pushStep('snapshot', {\n anchorNode,\n anchorOffset,\n anchorPath,\n focusNode,\n focusOffset,\n focusPath,\n })\n }, [pushStep, isRecording, getCurrentEditor])\n\n const onCopyClick = useCallback(() => {\n copy(generateTestContent())\n }, [generateTestContent])\n\n const onDownloadClick = useCallback(() => {\n download('test.js', generateTestContent())\n }, [generateTestContent])\n\n const button = (\n <button\n className={`editor-dev-button ${isRecording ? 'active' : ''}`}\n id=\"test-recorder-button\"\n onClick={(e) => {\n toggleEditorSelection(getCurrentEditor())\n e.preventDefault()\n }}\n title={isRecording ? 'Disable test recorder' : 'Enable test recorder'}\n type=\"button\"\n >\n {isRecording ? 'Disable test recorder' : 'Enable test recorder'}\n </button>\n )\n const output = isRecording ? (\n <div className=\"test-recorder-output\">\n <div className=\"test-recorder-toolbar\">\n <button\n className=\"test-recorder-button\"\n id=\"test-recorder-button-snapshot\"\n onClick={(e) => {\n onSnapshotClick()\n e.preventDefault()\n }}\n title=\"Insert snapshot\"\n type=\"button\"\n >\n Insert Snapshot\n </button>\n <button\n className=\"test-recorder-button\"\n id=\"test-recorder-button-copy\"\n onClick={(e) => {\n onCopyClick()\n e.preventDefault()\n }}\n title=\"Copy to clipboard\"\n type=\"button\"\n >\n Copy\n </button>\n <button\n className=\"test-recorder-button\"\n id=\"test-recorder-button-download\"\n onClick={(e) => {\n onDownloadClick()\n e.preventDefault()\n }}\n title=\"Download as a file\"\n type=\"button\"\n >\n Download\n </button>\n </div>\n <pre id=\"test-recorder\" ref={preRef}>\n {templatedTest}\n </pre>\n </div>\n ) : null\n\n return [button, output]\n}\nexport const TestRecorderPlugin: PluginComponent<undefined> = () => {\n const [editor] = useLexicalComposerContext()\n const [testRecorderButton, testRecorderOutput] = useTestRecorder(editor)\n\n return (\n <React.Fragment>\n <p>HI</p>\n {testRecorderButton}\n {testRecorderOutput}\n <p>DONE</p>\n </React.Fragment>\n )\n}\n"],"names":["useLexicalComposerContext","$createParagraphNode","$createTextNode","$getRoot","React","useCallback","useEffect","useLayoutEffect","useRef","useState","IS_APPLE","copy","text","textArea","document","createElement","value","style","position","opacity","body","appendChild","focus","select","result","execCommand","console","log","error","removeChild","download","filename","a","setAttribute","encodeURIComponent","display","click","formatStep","step","formatOneStep","name","x","y","anchorPath","toString","anchorOffset","focusPath","focusOffset","formattedStep","count","join","isSelectAll","event","code","metaKey","ctrlKey","sanitizeSelection","selection","anchorNode","focusNode","getPathFromNodeToEditor","node","rootElement","currentNode","path","undefined","unshift","Array","from","parentNode","childNodes","indexOf","keyPresses","Set","useTestRecorder","editor","steps","setSteps","isRecording","setIsRecording","setCurrentInnerHTML","templatedTest","setTemplatedTest","previousSelectionRef","skipNextSelectionChangeRef","preRef","getCurrentEditor","generateTestContent","getRootElement","browserSelection","window","getSelection","contains","map","pushStep","currentSteps","currentIndex","length","lastStep","slice","onKeyDown","key","has","onKeyUp","registerRootListener","prevRootElement","removeEventListener","addEventListener","current","scrollTo","scrollHeight","testContent","removeUpdateListener","registerUpdateListener","dirtyElements","dirtyLeaves","editorState","currentSelection","_selection","previousSelection","skipNextSelectionChange","size","innerHTML","toggleEditorSelection","currentEditor","update","root","clear","append","currentIsRecording","onSnapshotClick","onCopyClick","onDownloadClick","button","className","id","onClick","e","preventDefault","title","type","output","div","pre","ref","TestRecorderPlugin","testRecorderButton","testRecorderOutput","Fragment","p"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AAGA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,oBAAoB,EAAEC,eAAe,EAAEC,QAAQ,QAAQ,UAAS;AACzE,YAAYC,WAAW,QAAO;AAC9B,SAAmBC,WAAW,EAAEC,SAAS,EAAEC,eAAe,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AAI3F,SAASC,QAAQ,QAAQ,2CAA0C;AACnE,OAAO,eAAc;AAErB,MAAMC,OAAO,CAACC;IACZ,MAAMC,WAAWC,SAASC,aAAa,CAAC;IACxCF,SAASG,KAAK,GAAGJ,QAAQ;IACzBC,SAASI,KAAK,CAACC,QAAQ,GAAG;IAC1BL,SAASI,KAAK,CAACE,OAAO,GAAG;IACzBL,SAASM,IAAI,EAAEC,YAAYR;IAC3B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AE;;;;AAGT,EAAC"}
1
+ {"version":3,"sources":["../../../../../../src/field/features/debug/testRecorder/plugin/index.tsx"],"sourcesContent":["'use client'\nimport type { BaseSelection, LexicalEditor } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $createParagraphNode, $createTextNode, $getRoot } from 'lexical'\nimport * as React from 'react'\nimport { type JSX, useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react'\n\nimport type { PluginComponent } from '../../../types.js'\n\nimport { IS_APPLE } from '../../../../lexical/utils/environment.js'\nimport './index.scss'\n\nconst copy = (text: null | string) => {\n const textArea = document.createElement('textarea')\n textArea.value = text || ''\n textArea.style.position = 'absolute'\n textArea.style.opacity = '0'\n document.body?.appendChild(textArea)\n textArea.focus()\n textArea.select()\n try {\n const result = document.execCommand('copy')\n // eslint-disable-next-line no-console\n console.log(result)\n } catch (error) {\n console.error(error)\n }\n document.body?.removeChild(textArea)\n}\n\nconst download = (filename: string, text: null | string) => {\n const a = document.createElement('a')\n a.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text || ''))\n a.setAttribute('download', filename)\n a.style.display = 'none'\n document.body?.appendChild(a)\n a.click()\n document.body?.removeChild(a)\n}\n\nconst formatStep = (step: Step) => {\n const formatOneStep = (name: string, value: Step['value']) => {\n switch (name) {\n case 'click': {\n return ` await page.mouse.click(${value.x}, ${value.y});`\n }\n case 'press': {\n return ` await page.keyboard.press('${value}');`\n }\n case 'keydown': {\n return ` await page.keyboard.keydown('${value}');`\n }\n case 'keyup': {\n return ` await page.keyboard.keyup('${value}');`\n }\n case 'type': {\n return ` await page.keyboard.type('${value}');`\n }\n case 'selectAll': {\n return ` await selectAll(page);`\n }\n case 'snapshot': {\n return ` await assertHTMLSnapshot(page);\n await assertSelection(page, {\n anchorPath: [${value.anchorPath.toString()}],\n anchorOffset: ${value.anchorOffset},\n focusPath: [${value.focusPath.toString()}],\n focusOffset: ${value.focusOffset},\n });\n`\n }\n default:\n return ``\n }\n }\n const formattedStep = formatOneStep(step.name, step.value)\n switch (step.count) {\n case 1:\n return formattedStep\n case 2:\n return [formattedStep, formattedStep].join(`\\n`)\n default:\n return ` await repeat(${step.count}, async () => {\n ${formattedStep}\n );`\n }\n}\n\nexport function isSelectAll(event: KeyboardEvent): boolean {\n return event.key.toLowerCase() === 'a' && (IS_APPLE ? event.metaKey : event.ctrlKey)\n}\n\n// stolen from LexicalSelection-test\nfunction sanitizeSelection(selection: Selection) {\n const { anchorNode, focusNode } = selection\n let { anchorOffset, focusOffset } = selection\n if (anchorOffset !== 0) {\n anchorOffset--\n }\n if (focusOffset !== 0) {\n focusOffset--\n }\n return { anchorNode, anchorOffset, focusNode, focusOffset }\n}\n\nfunction getPathFromNodeToEditor(node: Node, rootElement: HTMLElement | null) {\n let currentNode: Node | null | undefined = node\n const path = []\n while (currentNode !== rootElement) {\n if (currentNode !== null && currentNode !== undefined) {\n path.unshift(\n Array.from(currentNode?.parentNode?.childNodes ?? []).indexOf(currentNode as ChildNode),\n )\n }\n currentNode = currentNode?.parentNode\n }\n return path\n}\n\nconst keyPresses = new Set([\n 'Enter',\n 'Backspace',\n 'Delete',\n 'Escape',\n 'ArrowLeft',\n 'ArrowRight',\n 'ArrowUp',\n 'ArrowDown',\n])\n\ntype Step = {\n count: number\n name: string\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value: any\n}\n\ntype Steps = Step[]\n\nfunction useTestRecorder(editor: LexicalEditor): [JSX.Element, JSX.Element | null] {\n const [steps, setSteps] = useState<Steps>([])\n const [isRecording, setIsRecording] = useState(false)\n const [, setCurrentInnerHTML] = useState('')\n const [templatedTest, setTemplatedTest] = useState('')\n const previousSelectionRef = useRef<BaseSelection | null>(null)\n const skipNextSelectionChangeRef = useRef(false)\n const preRef = useRef<HTMLPreElement>(null)\n\n const getCurrentEditor = useCallback(() => {\n return editor\n }, [editor])\n\n const generateTestContent = useCallback(() => {\n const rootElement = editor.getRootElement()\n const browserSelection = window.getSelection()\n\n if (\n rootElement == null ||\n browserSelection == null ||\n browserSelection.anchorNode == null ||\n browserSelection.focusNode == null ||\n !rootElement.contains(browserSelection.anchorNode) ||\n !rootElement.contains(browserSelection.focusNode)\n ) {\n return null\n }\n\n return `\nimport {\n initializeE2E,\n assertHTMLSnapshot,\n assertSelection,\n repeat,\n} from '../utils';\nimport {selectAll} from '../keyboardShortcuts';\nimport { RangeSelection } from 'lexical';\nimport { NodeSelection } from 'lexical';\n\ndescribe('Test case', () => {\n initializeE2E((e2e) => {\n it('Should pass this test', async () => {\n const {page} = e2e;\n\n await page.focus('div[contenteditable=\"true\"]');\n${steps.map(formatStep).join(`\\n`)}\n });\n});\n `\n }, [editor, steps])\n\n // just a wrapper around inserting new actions so that we can\n // coalesce some actions like insertText/moveNativeSelection\n const pushStep = useCallback(\n (name: string, value: Step['value']) => {\n setSteps((currentSteps) => {\n // trying to group steps\n const currentIndex = steps.length - 1\n const lastStep = steps[currentIndex]\n if (lastStep) {\n if (lastStep.name === name) {\n if (name === 'type') {\n // for typing events we just append the text\n return [\n ...steps.slice(0, currentIndex),\n { ...lastStep, value: lastStep.value + value },\n ]\n } else {\n // for other events we bump the counter if their values are the same\n if (lastStep.value === value) {\n return [...steps.slice(0, currentIndex), { ...lastStep, count: lastStep.count + 1 }]\n }\n }\n }\n }\n // could not group, just append a new one\n return [...currentSteps, { name, count: 1, value }]\n })\n },\n [steps, setSteps],\n )\n\n useLayoutEffect(() => {\n const onKeyDown = (event: KeyboardEvent) => {\n if (!isRecording) {\n return\n }\n const key = event.key\n if (isSelectAll(event)) {\n pushStep('selectAll', '')\n } else if (keyPresses.has(key)) {\n pushStep('press', event.key)\n } else if ([...key].length > 1) {\n pushStep('keydown', event.key)\n } else {\n pushStep('type', event.key)\n }\n }\n\n const onKeyUp = (event: KeyboardEvent) => {\n if (!isRecording) {\n return\n }\n const key = event.key\n if (!keyPresses.has(key) && [...key].length > 1) {\n pushStep('keyup', event.key)\n }\n }\n\n return editor.registerRootListener(\n (rootElement: HTMLElement | null, prevRootElement: HTMLElement | null) => {\n if (prevRootElement !== null) {\n prevRootElement.removeEventListener('keydown', onKeyDown)\n prevRootElement.removeEventListener('keyup', onKeyUp)\n }\n if (rootElement !== null) {\n rootElement.addEventListener('keydown', onKeyDown)\n rootElement.addEventListener('keyup', onKeyUp)\n }\n },\n )\n }, [editor, isRecording, pushStep])\n\n useLayoutEffect(() => {\n if (preRef.current) {\n preRef.current.scrollTo(0, preRef.current.scrollHeight)\n }\n }, [generateTestContent])\n\n useEffect(() => {\n if (steps) {\n const testContent = generateTestContent()\n if (testContent !== null) {\n setTemplatedTest(testContent)\n }\n if (preRef.current) {\n preRef.current.scrollTo(0, preRef.current.scrollHeight)\n }\n }\n }, [generateTestContent, steps])\n\n useEffect(() => {\n const removeUpdateListener = editor.registerUpdateListener(\n ({ dirtyElements, dirtyLeaves, editorState }) => {\n if (!isRecording) {\n return\n }\n const currentSelection = editorState._selection\n const previousSelection = previousSelectionRef.current\n const skipNextSelectionChange = skipNextSelectionChangeRef.current\n if (previousSelection !== currentSelection) {\n if (dirtyLeaves.size === 0 && dirtyElements.size === 0 && !skipNextSelectionChange) {\n const browserSelection = window.getSelection()\n if (\n browserSelection &&\n (browserSelection.anchorNode == null || browserSelection.focusNode == null)\n ) {\n return\n }\n }\n previousSelectionRef.current = currentSelection\n }\n skipNextSelectionChangeRef.current = false\n const testContent = generateTestContent()\n if (testContent !== null) {\n setTemplatedTest(testContent)\n }\n },\n )\n return removeUpdateListener\n }, [editor, generateTestContent, isRecording, pushStep])\n\n // save innerHTML\n useEffect(() => {\n if (!isRecording) {\n return\n }\n const removeUpdateListener = editor.registerUpdateListener(() => {\n const rootElement = editor.getRootElement()\n if (rootElement !== null) {\n setCurrentInnerHTML(rootElement?.innerHTML)\n }\n })\n return removeUpdateListener\n }, [editor, isRecording])\n\n // clear editor and start recording\n const toggleEditorSelection = useCallback(\n (currentEditor: LexicalEditor) => {\n if (!isRecording) {\n currentEditor.update(() => {\n const root = $getRoot()\n root.clear()\n const text = $createTextNode()\n root.append($createParagraphNode().append(text))\n text.select()\n })\n setSteps([])\n }\n setIsRecording((currentIsRecording) => !currentIsRecording)\n },\n [isRecording],\n )\n\n const onSnapshotClick = useCallback(() => {\n if (!isRecording) {\n return\n }\n const browserSelection = window.getSelection()\n if (\n browserSelection === null ||\n browserSelection.anchorNode == null ||\n browserSelection.focusNode == null\n ) {\n return\n }\n const { anchorNode, anchorOffset, focusNode, focusOffset } = sanitizeSelection(browserSelection)\n const rootElement = getCurrentEditor().getRootElement()\n let anchorPath\n if (anchorNode !== null) {\n anchorPath = getPathFromNodeToEditor(anchorNode, rootElement)\n }\n let focusPath\n if (focusNode !== null) {\n focusPath = getPathFromNodeToEditor(focusNode, rootElement)\n }\n pushStep('snapshot', {\n anchorNode,\n anchorOffset,\n anchorPath,\n focusNode,\n focusOffset,\n focusPath,\n })\n }, [pushStep, isRecording, getCurrentEditor])\n\n const onCopyClick = useCallback(() => {\n copy(generateTestContent())\n }, [generateTestContent])\n\n const onDownloadClick = useCallback(() => {\n download('test.js', generateTestContent())\n }, [generateTestContent])\n\n const button = (\n <button\n className={`editor-dev-button ${isRecording ? 'active' : ''}`}\n id=\"test-recorder-button\"\n onClick={(e) => {\n toggleEditorSelection(getCurrentEditor())\n e.preventDefault()\n }}\n title={isRecording ? 'Disable test recorder' : 'Enable test recorder'}\n type=\"button\"\n >\n {isRecording ? 'Disable test recorder' : 'Enable test recorder'}\n </button>\n )\n const output = isRecording ? (\n <div className=\"test-recorder-output\">\n <div className=\"test-recorder-toolbar\">\n <button\n className=\"test-recorder-button\"\n id=\"test-recorder-button-snapshot\"\n onClick={(e) => {\n onSnapshotClick()\n e.preventDefault()\n }}\n title=\"Insert snapshot\"\n type=\"button\"\n >\n Insert Snapshot\n </button>\n <button\n className=\"test-recorder-button\"\n id=\"test-recorder-button-copy\"\n onClick={(e) => {\n onCopyClick()\n e.preventDefault()\n }}\n title=\"Copy to clipboard\"\n type=\"button\"\n >\n Copy\n </button>\n <button\n className=\"test-recorder-button\"\n id=\"test-recorder-button-download\"\n onClick={(e) => {\n onDownloadClick()\n e.preventDefault()\n }}\n title=\"Download as a file\"\n type=\"button\"\n >\n Download\n </button>\n </div>\n <pre id=\"test-recorder\" ref={preRef}>\n {templatedTest}\n </pre>\n </div>\n ) : null\n\n return [button, output]\n}\nexport const TestRecorderPlugin: PluginComponent<undefined> = () => {\n const [editor] = useLexicalComposerContext()\n const [testRecorderButton, testRecorderOutput] = useTestRecorder(editor)\n\n return (\n <React.Fragment>\n <p>HI</p>\n {testRecorderButton}\n {testRecorderOutput}\n <p>DONE</p>\n </React.Fragment>\n )\n}\n"],"names":["useLexicalComposerContext","$createParagraphNode","$createTextNode","$getRoot","React","useCallback","useEffect","useLayoutEffect","useRef","useState","IS_APPLE","copy","text","textArea","document","createElement","value","style","position","opacity","body","appendChild","focus","select","result","execCommand","console","log","error","removeChild","download","filename","a","setAttribute","encodeURIComponent","display","click","formatStep","step","formatOneStep","name","x","y","anchorPath","toString","anchorOffset","focusPath","focusOffset","formattedStep","count","join","isSelectAll","event","key","toLowerCase","metaKey","ctrlKey","sanitizeSelection","selection","anchorNode","focusNode","getPathFromNodeToEditor","node","rootElement","currentNode","path","undefined","unshift","Array","from","parentNode","childNodes","indexOf","keyPresses","Set","useTestRecorder","editor","steps","setSteps","isRecording","setIsRecording","setCurrentInnerHTML","templatedTest","setTemplatedTest","previousSelectionRef","skipNextSelectionChangeRef","preRef","getCurrentEditor","generateTestContent","getRootElement","browserSelection","window","getSelection","contains","map","pushStep","currentSteps","currentIndex","length","lastStep","slice","onKeyDown","has","onKeyUp","registerRootListener","prevRootElement","removeEventListener","addEventListener","current","scrollTo","scrollHeight","testContent","removeUpdateListener","registerUpdateListener","dirtyElements","dirtyLeaves","editorState","currentSelection","_selection","previousSelection","skipNextSelectionChange","size","innerHTML","toggleEditorSelection","currentEditor","update","root","clear","append","currentIsRecording","onSnapshotClick","onCopyClick","onDownloadClick","button","className","id","onClick","e","preventDefault","title","type","output","div","pre","ref","TestRecorderPlugin","testRecorderButton","testRecorderOutput","Fragment","p"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AAGA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,oBAAoB,EAAEC,eAAe,EAAEC,QAAQ,QAAQ,UAAS;AACzE,YAAYC,WAAW,QAAO;AAC9B,SAAmBC,WAAW,EAAEC,SAAS,EAAEC,eAAe,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AAI3F,SAASC,QAAQ,QAAQ,2CAA0C;AACnE,OAAO,eAAc;AAErB,MAAMC,OAAO,CAACC;IACZ,MAAMC,WAAWC,SAASC,aAAa,CAAC;IACxCF,SAASG,KAAK,GAAGJ,QAAQ;IACzBC,SAASI,KAAK,CAACC,QAAQ,GAAG;IAC1BL,SAASI,KAAK,CAACE,OAAO,GAAG;IACzBL,SAASM,IAAI,EAAEC,YAAYR;IAC3BA,SAASS,KAAK;IACdT,SAASU,MAAM;IACf,IAAI;QACF,MAAMC,SAASV,SAASW,WAAW,CAAC;QACp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["../../../../../src/field/features/horizontalRule/component/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAkBtC;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,OAmDxE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/horizontalRule/component/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAoBtC;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,OAuDxE"}
@@ -1,10 +1,11 @@
1
1
  'use client';
2
2
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
3
3
  import { useLexicalNodeSelection } from '@lexical/react/useLexicalNodeSelection.js';
4
- import { mergeRegister } from '@lexical/utils';
4
+ import { addClassNamesToElement, mergeRegister, removeClassNamesFromElement } from '@lexical/utils';
5
5
  import { $getNodeByKey, $getSelection, $isNodeSelection, CLICK_COMMAND, COMMAND_PRIORITY_LOW, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND } from 'lexical';
6
6
  import { useCallback, useEffect } from 'react';
7
7
  import { $isHorizontalRuleNode } from '../nodes/HorizontalRuleNode.js';
8
+ const isSelectedClassName = 'selected';
8
9
  /**
9
10
  * React component rendered in the lexical editor, WITHIN the hr element created by createDOM of the HorizontalRuleNode.
10
11
  *
@@ -49,7 +50,11 @@ import { $isHorizontalRuleNode } from '../nodes/HorizontalRuleNode.js';
49
50
  useEffect(()=>{
50
51
  const hrElem = editor.getElementByKey(nodeKey);
51
52
  if (hrElem !== null) {
52
- hrElem.className = isSelected ? 'selected' : '';
53
+ if (isSelected) {
54
+ addClassNamesToElement(hrElem, isSelectedClassName);
55
+ } else {
56
+ removeClassNamesFromElement(hrElem, isSelectedClassName);
57
+ }
53
58
  }
54
59
  }, [
55
60
  editor,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/features/horizontalRule/component/index.tsx"],"sourcesContent":["'use client'\n\nimport type { NodeKey } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useLexicalNodeSelection } from '@lexical/react/useLexicalNodeSelection.js'\nimport { mergeRegister } from '@lexical/utils'\nimport {\n $getNodeByKey,\n $getSelection,\n $isNodeSelection,\n CLICK_COMMAND,\n COMMAND_PRIORITY_LOW,\n KEY_BACKSPACE_COMMAND,\n KEY_DELETE_COMMAND,\n} from 'lexical'\nimport { useCallback, useEffect } from 'react'\n\nimport { $isHorizontalRuleNode } from '../nodes/HorizontalRuleNode.js'\n\n/**\n * React component rendered in the lexical editor, WITHIN the hr element created by createDOM of the HorizontalRuleNode.\n *\n * @param nodeKey every node has a unique key (this key is not saved to the database and thus may differ between sessions). It's useful for working with the CURRENT lexical editor state\n */\nexport function HorizontalRuleComponent({ nodeKey }: { nodeKey: NodeKey }) {\n const [editor] = useLexicalComposerContext()\n const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey)\n\n const $onDelete = useCallback(\n (event: KeyboardEvent) => {\n if (isSelected && $isNodeSelection($getSelection())) {\n event.preventDefault()\n const node = $getNodeByKey(nodeKey)\n if ($isHorizontalRuleNode(node)) {\n node.remove()\n return true\n }\n }\n return false\n },\n [isSelected, nodeKey],\n )\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n CLICK_COMMAND,\n (event: MouseEvent) => {\n const hrElem = editor.getElementByKey(nodeKey)\n\n if (event.target === hrElem) {\n if (!event.shiftKey) {\n clearSelection()\n }\n setSelected(!isSelected)\n return true\n }\n\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(KEY_DELETE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n editor.registerCommand(KEY_BACKSPACE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n )\n }, [clearSelection, editor, isSelected, nodeKey, $onDelete, setSelected])\n\n useEffect(() => {\n const hrElem = editor.getElementByKey(nodeKey)\n if (hrElem !== null) {\n hrElem.className = isSelected ? 'selected' : ''\n }\n }, [editor, isSelected, nodeKey])\n\n return null\n}\n"],"names":["useLexicalComposerContext","useLexicalNodeSelection","mergeRegister","$getNodeByKey","$getSelection","$isNodeSelection","CLICK_COMMAND","COMMAND_PRIORITY_LOW","KEY_BACKSPACE_COMMAND","KEY_DELETE_COMMAND","useCallback","useEffect","$isHorizontalRuleNode","HorizontalRuleComponent","nodeKey","editor","isSelected","setSelected","clearSelection","$onDelete","event","preventDefault","node","remove","registerCommand","hrElem","getElementByKey","target","shiftKey","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,uBAAuB,QAAQ,4CAA2C;AACnF,SAASC,aAAa,QAAQ,iBAAgB;AAC9C,SACEC,aAAa,EACbC,aAAa,EACbC,gBAAgB,EAChBC,aAAa,EACbC,oBAAoB,EACpBC,qBAAqB,EACrBC,kBAAkB,QACb,UAAS;AAChB,SAASC,WAAW,EAAEC,SAAS,QAAQ,QAAO;AAE9C,SAASC,qBAAqB,QAAQ,iCAAgC;AAEtE;;;;CAIC,GACD,OAAO,SAASC,wBAAwB,EAAEC,OAAO,EAAwB;IACvE,MAAM,CAACC,OAAO,GAAGf;IACjB,MAAM,CAACgB,YAAYC,aAAaC,eAAe,GAAGjB,wBAAwBa;IAE1E,MAAMK,YAAYT,YAChB,CAACU;QACC,IAAIJ,cAAcX,iBAAiBD,kBAAkB;YACnDgB,MAAMC,cAAc;YACpB,MAAMC,OAAOnB,cAAcW;YAC3B,IAAIF,sBAAsBU,OAAO;gBAC/BA,KAAKC,MAAM;gBACX,OAAO;YACT;QACF;QACA,OAAO;IACT,GACA;QAACP;QAAYF;KAAQ;IAGvBH,UAAU;QACR,OAAOT,cACLa,OAAOS,eAAe,CACpBlB,eACA,CAACc;YACC,MAAMK,SAASV,OAAOW,eAAe,CAACZ;YAEtC,IAAIM,MAAMO,MAAM,KAAKF,QAAQ;gBAC3B,IAAI,CAACL,MAAMQ,QAAQ,EAAE;oBACnBV;gBACF;gBACAD,YAAY,CAACD;gBACb,OAAO;YACT;YAEA,OAAO;QACT,GACAT,uBAEFQ,OAAOS,eAAe,CAACf,oBAAoBU,WAAWZ,uBACtDQ,OAAOS,eAAe,CAAChB,uBAAuBW,WAAWZ;IAE7D,GAAG;QAACW;QAAgBH;QAAQC;QAAYF;QAASK;QAAWF;KAAY;IAExEN,UAAU;QACR,MAAMc,SAASV,OAAOW,eAAe,CAACZ;QACtC,IAAIW,WAAW,MAAM;YACnBA,OAAOI,SAAS,GAAGb,aAAa,aAAa;QAC/C;IACF,GAAG;QAACD;QAAQC;QAAYF;KAAQ;IAEhC,OAAO;AACT"}
1
+ {"version":3,"sources":["../../../../../src/field/features/horizontalRule/component/index.tsx"],"sourcesContent":["'use client'\n\nimport type { NodeKey } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useLexicalNodeSelection } from '@lexical/react/useLexicalNodeSelection.js'\nimport { addClassNamesToElement, mergeRegister, removeClassNamesFromElement } from '@lexical/utils'\nimport {\n $getNodeByKey,\n $getSelection,\n $isNodeSelection,\n CLICK_COMMAND,\n COMMAND_PRIORITY_LOW,\n KEY_BACKSPACE_COMMAND,\n KEY_DELETE_COMMAND,\n} from 'lexical'\nimport { useCallback, useEffect } from 'react'\n\nimport { $isHorizontalRuleNode } from '../nodes/HorizontalRuleNode.js'\n\nconst isSelectedClassName = 'selected'\n\n/**\n * React component rendered in the lexical editor, WITHIN the hr element created by createDOM of the HorizontalRuleNode.\n *\n * @param nodeKey every node has a unique key (this key is not saved to the database and thus may differ between sessions). It's useful for working with the CURRENT lexical editor state\n */\nexport function HorizontalRuleComponent({ nodeKey }: { nodeKey: NodeKey }) {\n const [editor] = useLexicalComposerContext()\n const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey)\n\n const $onDelete = useCallback(\n (event: KeyboardEvent) => {\n if (isSelected && $isNodeSelection($getSelection())) {\n event.preventDefault()\n const node = $getNodeByKey(nodeKey)\n if ($isHorizontalRuleNode(node)) {\n node.remove()\n return true\n }\n }\n return false\n },\n [isSelected, nodeKey],\n )\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n CLICK_COMMAND,\n (event: MouseEvent) => {\n const hrElem = editor.getElementByKey(nodeKey)\n\n if (event.target === hrElem) {\n if (!event.shiftKey) {\n clearSelection()\n }\n setSelected(!isSelected)\n return true\n }\n\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(KEY_DELETE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n editor.registerCommand(KEY_BACKSPACE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n )\n }, [clearSelection, editor, isSelected, nodeKey, $onDelete, setSelected])\n\n useEffect(() => {\n const hrElem = editor.getElementByKey(nodeKey)\n if (hrElem !== null) {\n if (isSelected) {\n addClassNamesToElement(hrElem, isSelectedClassName)\n } else {\n removeClassNamesFromElement(hrElem, isSelectedClassName)\n }\n }\n }, [editor, isSelected, nodeKey])\n\n return null\n}\n"],"names":["useLexicalComposerContext","useLexicalNodeSelection","addClassNamesToElement","mergeRegister","removeClassNamesFromElement","$getNodeByKey","$getSelection","$isNodeSelection","CLICK_COMMAND","COMMAND_PRIORITY_LOW","KEY_BACKSPACE_COMMAND","KEY_DELETE_COMMAND","useCallback","useEffect","$isHorizontalRuleNode","isSelectedClassName","HorizontalRuleComponent","nodeKey","editor","isSelected","setSelected","clearSelection","$onDelete","event","preventDefault","node","remove","registerCommand","hrElem","getElementByKey","target","shiftKey"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAMe,SAASV,OAAOW,eAAe,CAACZ;QACtC,IAAIW,WAAW,MAAM;YACnB,IAAIT,YAAY;gBACdjB,uBAAuB0B,QAAQb;YACjC,OAAO;gBACLX,4BAA4BwB,QAAQb;YACtC;QACF;IACF,GAAG;QAACG;QAAQC;QAAYF;KAAQ;IAEhC,OAAO;AACT"}
@@ -1,4 +1,4 @@
1
- import type { DOMConversionMap, DOMExportOutput, LexicalCommand, LexicalNode, SerializedLexicalNode } from 'lexical';
1
+ import type { DOMConversionMap, DOMExportOutput, EditorConfig, LexicalCommand, LexicalNode, SerializedLexicalNode } from 'lexical';
2
2
  import { DecoratorNode } from 'lexical';
3
3
  import * as React from 'react';
4
4
  /**
@@ -29,7 +29,7 @@ export declare class HorizontalRuleNode extends DecoratorNode<React.ReactElement
29
29
  /**
30
30
  * Determines how the hr element is rendered in the lexical editor. This is only the "initial" / "outer" HTML element.
31
31
  */
32
- createDOM(): HTMLElement;
32
+ createDOM(config: EditorConfig): HTMLElement;
33
33
  /**
34
34
  * Allows you to render a React component within whatever createDOM returns.
35
35
  */
@@ -1 +1 @@
1
- {"version":3,"file":"HorizontalRuleNode.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/horizontalRule/nodes/HorizontalRuleNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAEhB,eAAe,EACf,cAAc,EACd,WAAW,EACX,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAyB,aAAa,EAAiB,MAAM,SAAS,CAAA;AAC7E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,qBAAqB,CAAA;AAEhE,eAAO,MAAM,8BAA8B,EAAE,cAAc,CAAC,IAAI,CAE/D,CAAA;AAED;;;;;;GAMG;AACH,qBAAa,kBAAmB,SAAQ,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC;IACvE,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,kBAAkB,GAAG,kBAAkB;IAI1D,MAAM,CAAC,OAAO,IAAI,MAAM;IAIxB;;;;OAIG;IACH,MAAM,CAAC,SAAS,IAAI,gBAAgB,GAAG,IAAI;IAS3C;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,4BAA4B,GAAG,kBAAkB;IAInF;;OAEG;IACH,SAAS,IAAI,WAAW;IAIxB;;OAEG;IACH,QAAQ,IAAI,KAAK,CAAC,YAAY;IAI9B;;;;OAIG;IACH,SAAS,IAAI,eAAe;IAG5B;;OAEG;IACH,UAAU,IAAI,qBAAqB;IAOnC,cAAc,IAAI,MAAM;IAIxB,QAAQ,IAAI,KAAK;IAIjB,SAAS,IAAI,OAAO;CAGrB;AAMD,wBAAgB,yBAAyB,IAAI,kBAAkB,CAE9D;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GACnC,IAAI,IAAI,kBAAkB,CAE5B"}
1
+ {"version":3,"file":"HorizontalRuleNode.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/horizontalRule/nodes/HorizontalRuleNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAEhB,eAAe,EACf,YAAY,EACZ,cAAc,EACd,WAAW,EACX,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAGhB,OAAO,EAAyB,aAAa,EAAiB,MAAM,SAAS,CAAA;AAC7E,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,qBAAqB,CAAA;AAEhE,eAAO,MAAM,8BAA8B,EAAE,cAAc,CAAC,IAAI,CAE/D,CAAA;AAED;;;;;;GAMG;AACH,qBAAa,kBAAmB,SAAQ,aAAa,CAAC,KAAK,CAAC,YAAY,CAAC;IACvE,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,kBAAkB,GAAG,kBAAkB;IAI1D,MAAM,CAAC,OAAO,IAAI,MAAM;IAIxB;;;;OAIG;IACH,MAAM,CAAC,SAAS,IAAI,gBAAgB,GAAG,IAAI;IAS3C;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,4BAA4B,GAAG,kBAAkB;IAInF;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,WAAW;IAM5C;;OAEG;IACH,QAAQ,IAAI,KAAK,CAAC,YAAY;IAI9B;;;;OAIG;IACH,SAAS,IAAI,eAAe;IAG5B;;OAEG;IACH,UAAU,IAAI,qBAAqB;IAOnC,cAAc,IAAI,MAAM;IAIxB,QAAQ,IAAI,KAAK;IAIjB,SAAS,IAAI,OAAO;CAGrB;AAMD,wBAAgB,yBAAyB,IAAI,kBAAkB,CAE9D;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GACnC,IAAI,IAAI,kBAAkB,CAE5B"}
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { addClassNamesToElement } from '@lexical/utils';
2
3
  import { $applyNodeReplacement, DecoratorNode, createCommand } from 'lexical';
3
4
  import * as React from 'react';
4
5
  const HorizontalRuleComponent = /*#__PURE__*/ React.lazy(()=>import('../component/index.js').then((module)=>({
@@ -37,8 +38,10 @@ export const INSERT_HORIZONTAL_RULE_COMMAND = createCommand('INSERT_HORIZONTAL_R
37
38
  }
38
39
  /**
39
40
  * Determines how the hr element is rendered in the lexical editor. This is only the "initial" / "outer" HTML element.
40
- */ createDOM() {
41
- return document.createElement('hr');
41
+ */ createDOM(config) {
42
+ const element = document.createElement('hr');
43
+ addClassNamesToElement(element, config.theme.hr);
44
+ return element;
42
45
  }
43
46
  /**
44
47
  * Allows you to render a React component within whatever createDOM returns.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/features/horizontalRule/nodes/HorizontalRuleNode.tsx"],"sourcesContent":["import type {\n DOMConversionMap,\n DOMConversionOutput,\n DOMExportOutput,\n LexicalCommand,\n LexicalNode,\n SerializedLexicalNode,\n} from 'lexical'\n\nimport { $applyNodeReplacement, DecoratorNode, createCommand } from 'lexical'\nimport * as React from 'react'\n\nconst HorizontalRuleComponent = React.lazy(() =>\n import('../component/index.js').then((module) => ({\n default: module.HorizontalRuleComponent,\n })),\n)\n\n/**\n * Serialized representation of a horizontal rule node. Serialized = converted to JSON. This is what is stored in the database / in the lexical editor state.\n */\nexport type SerializedHorizontalRuleNode = SerializedLexicalNode\n\nexport const INSERT_HORIZONTAL_RULE_COMMAND: LexicalCommand<void> = createCommand(\n 'INSERT_HORIZONTAL_RULE_COMMAND',\n)\n\n/**\n * This node is a DecoratorNode. DecoratorNodes allow you to render React components in the editor.\n *\n * They need both createDom and decorate functions. createDom => outside of the html. decorate => React Component inside of the html.\n *\n * If we used DecoratorBlockNode instead, we would only need a decorate method\n */\nexport class HorizontalRuleNode extends DecoratorNode<React.ReactElement> {\n static clone(node: HorizontalRuleNode): HorizontalRuleNode {\n return new HorizontalRuleNode(node.__key)\n }\n\n static getType(): string {\n return 'horizontalrule'\n }\n\n /**\n * Defines what happens if you copy an hr element from another page and paste it into the lexical editor\n *\n * This also determines the behavior of lexical's internal HTML -> Lexical converter\n */\n static importDOM(): DOMConversionMap | null {\n return {\n hr: () => ({\n conversion: $convertHorizontalRuleElement,\n priority: 0,\n }),\n }\n }\n\n /**\n * The data for this node is stored serialized as JSON. This is the \"load function\" of that node: it takes the saved data and converts it into a node.\n */\n static importJSON(serializedNode: SerializedHorizontalRuleNode): HorizontalRuleNode {\n return $createHorizontalRuleNode()\n }\n\n /**\n * Determines how the hr element is rendered in the lexical editor. This is only the \"initial\" / \"outer\" HTML element.\n */\n createDOM(): HTMLElement {\n return document.createElement('hr')\n }\n\n /**\n * Allows you to render a React component within whatever createDOM returns.\n */\n decorate(): React.ReactElement {\n return <HorizontalRuleComponent nodeKey={this.__key} />\n }\n\n /**\n * Opposite of importDOM, this function defines what happens when you copy an hr element from the lexical editor and paste it into another page.\n *\n * This also determines the behavior of lexical's internal Lexical -> HTML converter\n */\n exportDOM(): DOMExportOutput {\n return { element: document.createElement('hr') }\n }\n /**\n * Opposite of importJSON. This determines what data is saved in the database / in the lexical editor state.\n */\n exportJSON(): SerializedLexicalNode {\n return {\n type: 'horizontalrule',\n version: 1,\n }\n }\n\n getTextContent(): string {\n return '\\n'\n }\n\n isInline(): false {\n return false\n }\n\n updateDOM(): boolean {\n return false\n }\n}\n\nfunction $convertHorizontalRuleElement(): DOMConversionOutput {\n return { node: $createHorizontalRuleNode() }\n}\n\nexport function $createHorizontalRuleNode(): HorizontalRuleNode {\n return $applyNodeReplacement(new HorizontalRuleNode())\n}\n\nexport function $isHorizontalRuleNode(\n node: LexicalNode | null | undefined,\n): node is HorizontalRuleNode {\n return node instanceof HorizontalRuleNode\n}\n"],"names":["$applyNodeReplacement","DecoratorNode","createCommand","React","HorizontalRuleComponent","lazy","then","module","default","INSERT_HORIZONTAL_RULE_COMMAND","HorizontalRuleNode","clone","node","__key","getType","importDOM","hr","conversion","$convertHorizontalRuleElement","priority","importJSON","serializedNode","$createHorizontalRuleNode","createDOM","document","createElement","decorate","nodeKey","exportDOM","element","exportJSON","type","version","getTextContent","isInline","updateDOM","$isHorizontalRuleNode"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AASA,SAASA,qBAAqB,EAAEC,aAAa,EAAEC,aAAa,QAAQ,UAAS;AAC7E,YAAYC,WAAW,QAAO;AAE9B,MAAMC,wCAA0BD,MAAME,IAAI,CAAC,IACzC,MAAM,CAAC,yBAAyBC,IAAI,CAAC,CAACC,SAAY,CAAA;YAChDC,SAASD,OAAOH,uBAAuB;QACzC,CAAA;AAQF,OAAO,MAAMK,iCAAuDP,cAClE,kCACD;AAED;;;;;;CAMC,GACD,OAAO,MAAMQ,2BAA2BT;IACtC,OAAOU,MAAMC,IAAwB,EAAsB;QACzD,OAAO,IAAIF,mBAAmBE,KAAKC,KAAK;IAC1C;IAEA,OAAOC,UAAkB;QACvB,OAAO;IACT;IAEA;;;;GAIC,GACD,OAAOC,YAAqC;QAC1C,OAAO;YACLC,IAAI,IAAO,CAAA;oBACTC,YAAYC;oBACZC,UAAU;gBACZ,CAAA;QACF;IACF;IAEA;;GAEC,GACD,OAAOC,WAAWC,cAA4C,EAAsB;QAClF,OAAOC;IACT;IAEA;;GAEC,GACDC,YAAyB;QACvB,OAAOC,SAASC,aAAa,CAAC;IAChC;IAEA;;GAEC,GACDC,WAA+B;QAC7B,qBAAO,KAACtB;YAAwBuB,SAAS,IAAI,CAACd,KAAK;;IACrD;IAEA;;;;GAIC,GACDe,YAA6B;QAC3B,OAAO;YAAEC,SAASL,SAASC,aAAa,CAAC;QAAM;IACjD;IACA;;GAEC,GACDK,aAAoC;QAClC,OAAO;YACLC,MAAM;YACNC,SAAS;QACX;IACF;IAEAC,iBAAyB;QACvB,OAAO;IACT;IAEAC,WAAkB;QAChB,OAAO;IACT;IAEAC,YAAqB;QACnB,OAAO;IACT;AACF;AAEA,SAASjB;IACP,OAAO;QAAEN,MAAMU;IAA4B;AAC7C;AAEA,OAAO,SAASA;IACd,OAAOtB,sBAAsB,IAAIU;AACnC;AAEA,OAAO,SAAS0B,sBACdxB,IAAoC;IAEpC,OAAOA,gBAAgBF;AACzB"}
1
+ {"version":3,"sources":["../../../../../src/field/features/horizontalRule/nodes/HorizontalRuleNode.tsx"],"sourcesContent":["import type {\n DOMConversionMap,\n DOMConversionOutput,\n DOMExportOutput,\n EditorConfig,\n LexicalCommand,\n LexicalNode,\n SerializedLexicalNode,\n} from 'lexical'\n\nimport { addClassNamesToElement } from '@lexical/utils'\nimport { $applyNodeReplacement, DecoratorNode, createCommand } from 'lexical'\nimport * as React from 'react'\n\nconst HorizontalRuleComponent = React.lazy(() =>\n import('../component/index.js').then((module) => ({\n default: module.HorizontalRuleComponent,\n })),\n)\n\n/**\n * Serialized representation of a horizontal rule node. Serialized = converted to JSON. This is what is stored in the database / in the lexical editor state.\n */\nexport type SerializedHorizontalRuleNode = SerializedLexicalNode\n\nexport const INSERT_HORIZONTAL_RULE_COMMAND: LexicalCommand<void> = createCommand(\n 'INSERT_HORIZONTAL_RULE_COMMAND',\n)\n\n/**\n * This node is a DecoratorNode. DecoratorNodes allow you to render React components in the editor.\n *\n * They need both createDom and decorate functions. createDom => outside of the html. decorate => React Component inside of the html.\n *\n * If we used DecoratorBlockNode instead, we would only need a decorate method\n */\nexport class HorizontalRuleNode extends DecoratorNode<React.ReactElement> {\n static clone(node: HorizontalRuleNode): HorizontalRuleNode {\n return new HorizontalRuleNode(node.__key)\n }\n\n static getType(): string {\n return 'horizontalrule'\n }\n\n /**\n * Defines what happens if you copy an hr element from another page and paste it into the lexical editor\n *\n * This also determines the behavior of lexical's internal HTML -> Lexical converter\n */\n static importDOM(): DOMConversionMap | null {\n return {\n hr: () => ({\n conversion: $convertHorizontalRuleElement,\n priority: 0,\n }),\n }\n }\n\n /**\n * The data for this node is stored serialized as JSON. This is the \"load function\" of that node: it takes the saved data and converts it into a node.\n */\n static importJSON(serializedNode: SerializedHorizontalRuleNode): HorizontalRuleNode {\n return $createHorizontalRuleNode()\n }\n\n /**\n * Determines how the hr element is rendered in the lexical editor. This is only the \"initial\" / \"outer\" HTML element.\n */\n createDOM(config: EditorConfig): HTMLElement {\n const element = document.createElement('hr')\n addClassNamesToElement(element, config.theme.hr)\n return element\n }\n\n /**\n * Allows you to render a React component within whatever createDOM returns.\n */\n decorate(): React.ReactElement {\n return <HorizontalRuleComponent nodeKey={this.__key} />\n }\n\n /**\n * Opposite of importDOM, this function defines what happens when you copy an hr element from the lexical editor and paste it into another page.\n *\n * This also determines the behavior of lexical's internal Lexical -> HTML converter\n */\n exportDOM(): DOMExportOutput {\n return { element: document.createElement('hr') }\n }\n /**\n * Opposite of importJSON. This determines what data is saved in the database / in the lexical editor state.\n */\n exportJSON(): SerializedLexicalNode {\n return {\n type: 'horizontalrule',\n version: 1,\n }\n }\n\n getTextContent(): string {\n return '\\n'\n }\n\n isInline(): false {\n return false\n }\n\n updateDOM(): boolean {\n return false\n }\n}\n\nfunction $convertHorizontalRuleElement(): DOMConversionOutput {\n return { node: $createHorizontalRuleNode() }\n}\n\nexport function $createHorizontalRuleNode(): HorizontalRuleNode {\n return $applyNodeReplacement(new HorizontalRuleNode())\n}\n\nexport function $isHorizontalRuleNode(\n node: LexicalNode | null | undefined,\n): node is HorizontalRuleNode {\n return node instanceof HorizontalRuleNode\n}\n"],"names":["addClassNamesToElement","$applyNodeReplacement","DecoratorNode","createCommand","React","HorizontalRuleComponent","lazy","then","module","default","INSERT_HORIZONTAL_RULE_COMMAND","HorizontalRuleNode","clone","node","__key","getType","importDOM","hr","conversion","$convertHorizontalRuleElement","priority","importJSON","serializedNode","$createHorizontalRuleNode","createDOM","config","element","document","createElement","theme","decorate","nodeKey","exportDOM","exportJSON","type","version","getTextContent","isInline","updateDOM","$isHorizontalRuleNode"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAUA,SAASA,sBAAsB,QAAQ,iBAAgB;AACvD,SAASC,qBAAqB,EAAEC,aAAa,EAAEC,aAAa,QAAQ,UAAS;AAC7E,YAAYC,WAAW,QAAO;AAE9B,MAAMC,wCAA0BD,MAAME,IAAI,CAAC,IACzC,MAAM,CAAC,yBAAyBC,IAAI,CAAC,CAACC,SAAY,CAAA;YAChDC,SAASD,OAAOH,uBAAuB;QACzC,CAAA;AAQF,OAAO,MAAMK,iCAAuDP,cAClE,kCACD;AAED;;;;;;CAMC,GACD,OAAO,MAAMQ,2BAA2BT;IACtC,OAAOU,MAAMC,IAAwB,EAAsB;QACzD,OAAO,IAAIF,mBAAmBE,KAAKC,KAAK;IAC1C;IAEA,OAAOC,UAAkB;QACvB,OAAO;IACT;IAEA;;;;GAIC,GACD,OAAOC,YAAqC;QAC1C,OAAO;YACLC,IAAI,IAAO,CAAA;oBACTC,YAAYC;oBACZC,UAAU;gBACZ,CAAA;QACF;IACF;IAEA;;GAEC,GACD,OAAOC,WAAWC,cAA4C,EAAsB;QAClF,OAAOC;IACT;IAEA;;GAEC,GACDC,UAAUC,MAAoB,EAAe;QAC3C,MAAMC,UAAUC,SAASC,aAAa,CAAC;QACvC5B,uBAAuB0B,SAASD,OAAOI,KAAK,CAACZ,EAAE;QAC/C,OAAOS;IACT;IAEA;;GAEC,GACDI,WAA+B;QAC7B,qBAAO,KAACzB;YAAwB0B,SAAS,IAAI,CAACjB,KAAK;;IACrD;IAEA;;;;GAIC,GACDkB,YAA6B;QAC3B,OAAO;YAAEN,SAASC,SAASC,aAAa,CAAC;QAAM;IACjD;IACA;;GAEC,GACDK,aAAoC;QAClC,OAAO;YACLC,MAAM;YACNC,SAAS;QACX;IACF;IAEAC,iBAAyB;QACvB,OAAO;IACT;IAEAC,WAAkB;QAChB,OAAO;IACT;IAEAC,YAAqB;QACnB,OAAO;IACT;AACF;AAEA,SAASnB;IACP,OAAO;QAAEN,MAAMU;IAA4B;AAC7C;AAEA,OAAO,SAASA;IACd,OAAOtB,sBAAsB,IAAIU;AACnC;AAEA,OAAO,SAAS4B,sBACd1B,IAAoC;IAEpC,OAAOA,gBAAgBF;AACzB"}
@@ -1,20 +1,20 @@
1
1
  @import '../../../../scss/styles.scss';
2
2
 
3
- hr {
3
+ .LexicalEditorTheme__hr {
4
4
  padding: 2px 2px;
5
5
  border: none;
6
6
  margin: 1rem 0;
7
7
  cursor: pointer;
8
8
  }
9
9
 
10
- hr:after {
10
+ .LexicalEditorTheme__hr:after {
11
11
  content: '';
12
12
  display: block;
13
13
  height: 2px;
14
14
  background-color: var(--theme-elevation-250);
15
15
  }
16
16
 
17
- hr.selected {
17
+ .LexicalEditorTheme__hr.selected {
18
18
  outline: 2px solid var(--theme-success-500);
19
19
  user-select: none;
20
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/field/features/link/plugins/clickableLink/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAE1D,eAAO,MAAM,mBAAmB,EAAE,eAAe,CAAC,WAAW,CAI5D,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/field/features/link/plugins/clickableLink/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAE1D,eAAO,MAAM,mBAAmB,EAAE,eAAe,CAAC,WAAW,CAE5D,CAAA"}
@@ -1,11 +1,9 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import LexicalClickableLinkPlugin from '@lexical/react/LexicalClickableLinkPlugin.js';
3
+ import { ClickableLinkPlugin as LexicalClickableLinkPlugin } from '@lexical/react/LexicalClickableLinkPlugin.js';
4
4
  import React from 'react';
5
5
  export const ClickableLinkPlugin = ()=>{
6
- const Component = LexicalClickableLinkPlugin.default || LexicalClickableLinkPlugin;
7
- //@ts-expect-error ts being dumb
8
- return /*#__PURE__*/ _jsx(Component, {});
6
+ return /*#__PURE__*/ _jsx(LexicalClickableLinkPlugin, {});
9
7
  };
10
8
 
11
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/field/features/link/plugins/clickableLink/index.tsx"],"sourcesContent":["'use client'\nimport LexicalClickableLinkPlugin from '@lexical/react/LexicalClickableLinkPlugin.js'\nimport React from 'react'\n\nimport type { PluginComponent } from '../../../types.js'\nimport type { ClientProps } from '../../feature.client.js'\n\nexport const ClickableLinkPlugin: PluginComponent<ClientProps> = () => {\n const Component = LexicalClickableLinkPlugin.default || LexicalClickableLinkPlugin\n //@ts-expect-error ts being dumb\n return <Component />\n}\n"],"names":["LexicalClickableLinkPlugin","React","ClickableLinkPlugin","Component","default"],"rangeMappings":";;;;;;;;","mappings":"AAAA;;AACA,OAAOA,gCAAgC,+CAA8C;AACrF,OAAOC,WAAW,QAAO;AAKzB,OAAO,MAAMC,sBAAoD;IAC/D,MAAMC,YAAYH,2BAA2BI,OAAO,IAAIJ;IACxD,gCAAgC;IAChC,qBAAO,KAACG;AACV,EAAC"}
1
+ {"version":3,"sources":["../../../../../../src/field/features/link/plugins/clickableLink/index.tsx"],"sourcesContent":["'use client'\nimport { ClickableLinkPlugin as LexicalClickableLinkPlugin } from '@lexical/react/LexicalClickableLinkPlugin.js'\nimport React from 'react'\n\nimport type { PluginComponent } from '../../../types.js'\nimport type { ClientProps } from '../../feature.client.js'\n\nexport const ClickableLinkPlugin: PluginComponent<ClientProps> = () => {\n return <LexicalClickableLinkPlugin />\n}\n"],"names":["ClickableLinkPlugin","LexicalClickableLinkPlugin","React"],"rangeMappings":";;;;;;","mappings":"AAAA;;AACA,SAASA,uBAAuBC,0BAA0B,QAAQ,+CAA8C;AAChH,OAAOC,WAAW,QAAO;AAKzB,OAAO,MAAMF,sBAAoD;IAC/D,qBAAO,KAACC;AACV,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"UploadNode.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/upload/nodes/UploadNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAA;AAC/F,OAAO,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACzD,OAAO,KAAK,EACV,gBAAgB,EAEhB,eAAe,EACf,WAAW,EACX,MAAM,EACP,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAEhC,O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BAAoB;IASlC,OAAO,IAAI,UAAU;IAIrB,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI;IAM/B,SAAS,IAAI,KAAK;CAGnB;AAED,wBAAgB,iBAAiB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GAAG,UAAU,CAE5E;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,IAAI,UAAU,CAEtF"}
@@ -5,6 +5,9 @@ import * as React from 'react';
5
5
  const RawUploadComponent = /*#__PURE__*/ React.lazy(()=>import('../component/index.js').then((module)=>({
6
6
  default: module.UploadComponent
7
7
  })));
8
+ function isGoogleDocCheckboxImg(img) {
9
+ return img.parentElement != null && img.parentElement.tagName === 'LI' && img.previousSibling === null && img.getAttribute('aria-roledescription') === 'checkbox';
10
+ }
8
11
  function $convertUploadElement(domNode) {
9
12
  if (domNode.hasAttribute('data-lexical-upload-relation-to') && domNode.hasAttribute('data-lexical-upload-id')) {
10
13
  const id = domNode.getAttribute('data-lexical-upload-id');
@@ -22,6 +25,10 @@ function $convertUploadElement(domNode) {
22
25
  };
23
26
  }
24
27
  }
28
+ const img = domNode;
29
+ if (img.src.startsWith('file:///') || isGoogleDocCheckboxImg(img)) {
30
+ return null;
31
+ }
25
32
  // TODO: Auto-upload functionality here!
26
33
  //}
27
34
  return null;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/features/upload/nodes/UploadNode.tsx"],"sourcesContent":["import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type { ElementFormatType, NodeKey } from 'lexical'\nimport type {\n DOMConversionMap,\n DOMConversionOutput,\n DOMExportOutput,\n LexicalNode,\n Spread,\n} from 'lexical'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport { $applyNodeReplacement } from 'lexical'\nimport * as React from 'react'\n\nconst RawUploadComponent = React.lazy(() =>\n import('../component/index.js').then((module) => ({ default: module.UploadComponent })),\n)\n\nexport type UploadData = {\n fields: {\n // unknown, custom fields:\n [key: string]: unknown\n }\n relationTo: string\n value: number | string\n}\n\nfunction $convertUploadElement(domNode: HTMLImageElement): DOMConversionOutput | null {\n if (\n domNode.hasAttribute('data-lexical-upload-relation-to') &&\n domNode.hasAttribute('data-lexical-upload-id')\n ) {\n const id = domNode.getAttribute('data-lexical-upload-id')\n const relationTo = domNode.getAttribute('data-lexical-upload-relation-to')\n\n if (id != null && relationTo != null) {\n const node = $createUploadNode({\n data: {\n fields: {},\n relationTo,\n value: id,\n },\n })\n return { node }\n }\n }\n // TODO: Auto-upload functionality here!\n //}\n return null\n}\n\nexport type SerializedUploadNode = Spread<UploadData, SerializedDecoratorBlockNode>\n\nexport class UploadNode extends DecoratorBlockNode {\n __data: UploadData\n\n constructor({\n data,\n format,\n key,\n }: {\n data: UploadData\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__data = data\n }\n\n static clone(node: UploadNode): UploadNode {\n return new UploadNode({\n data: node.__data,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static getType(): string {\n return 'upload'\n }\n\n static importDOM(): DOMConversionMap | null {\n return {\n img: (node: HTMLImageElement) => ({\n conversion: $convertUploadElement,\n priority: 0,\n }),\n }\n }\n\n static importJSON(serializedNode: SerializedUploadNode): UploadNode {\n if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {\n serializedNode.value = (serializedNode.value as unknown as { id: string }).id\n }\n\n const importedData: UploadData = {\n fields: serializedNode.fields,\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n\n const node = $createUploadNode({ data: importedData })\n node.setFormat(serializedNode.format)\n\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n decorate(): JSX.Element {\n // @ts-expect-error\n return <RawUploadComponent data={this.__data} format={this.__format} nodeKey={this.getKey()} />\n }\n\n exportDOM(): DOMExportOutput {\n const element = document.createElement('img')\n element.setAttribute('data-lexical-upload-id', String(this.__data?.value))\n element.setAttribute('data-lexical-upload-relation-to', this.__data?.relationTo)\n\n return { element }\n }\n\n exportJSON(): SerializedUploadNode {\n return {\n ...super.exportJSON(),\n ...this.getData(),\n type: this.getType(),\n version: 2,\n }\n }\n\n getData(): UploadData {\n return this.getLatest().__data\n }\n\n setData(data: UploadData): void {\n const writable = this.getWritable()\n writable.__data = data\n }\n\n // eslint-disable-next-line class-methods-use-this\n updateDOM(): false {\n return false\n }\n}\n\nexport function $createUploadNode({ data }: { data: UploadData }): UploadNode {\n return $applyNodeReplacement(new UploadNode({ data }))\n}\n\nexport function $isUploadNode(node: LexicalNode | null | undefined): node is UploadNode {\n return node instanceof UploadNode\n}\n"],"names":["DecoratorBlockNode","$applyNodeReplacement","React","RawUploadComponent","lazy","then","module","default","UploadComponent","$convertUploadElement","domNode","hasAttribute","id","getAttribute","relationTo","node","$createUploadNode","data","fields","value","UploadNode","__data","constructor","format","key","clone","__format","__key","getType","importDOM","img","conversion","priority","importJSON","serializedNode","version","importedData","setFormat","isInline","decorate","nodeKey","getKey","exportDOM","element","document","createElement","setAttribute","String","exportJSON","getData","type","getLatest","setData","writable","getWritable","updateDOM","$isUploadNode"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAWA,SAASA,kBAAkB,QAAQ,8CAA6C;AAChF,SAASC,qBAAqB,QAAQ,UAAS;AAC/C,YAAYC,WAAW,QAAO;AAE9B,MAAMC,mCAAqBD,MAAME,IAAI,CAAC,IACpC,MAAM,CAAC,yBAAyBC,IAAI,CAAC,CAACC,SAAY,CAAA;YAAEC,SAASD,OAAOE,eAAe;QAAC,CAAA;AAYtF,SAASC,sBAAsBC,OAAyB;IACtD,IACEA,QAAQC,YAAY,CAAC,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B,OAAO;IACT;IAEAC,WAAwB;QACtB,mBAAmB;QACnB,qBAAO,KAACpC;YAAmBc,MAAM,IAAI,CAACI,MAAM;YAAEE,QAAQ,IAAI,CAACG,QAAQ;YAAEc,SAAS,IAAI,CAACC,MAAM;;IAC3F;IAEAC,YAA6B;QAC3B,MAAMC,UAAUC,SAASC,aAAa,CAAC;QACvCF,QAAQG,YAAY,CAAC,0BAA0BC,OAAO,IAAI,CAAC1B,MAAM,EAAEF;QACnEwB,QAAQG,YAAY,CAAC,mCAAmC,IAAI,CAACzB,MAAM,EAAEP;QAErE,OAAO;YAAE6B;QAAQ;IACnB;IAEAK,aAAmC;QACjC,OAAO;YACL,GAAG,KAAK,CAACA,YAAY;YACrB,GAAG,IAAI,CAACC,OAAO,EAAE;YACjBC,MAAM,IAAI,CAACtB,OAAO;YAClBO,SAAS;QACX;IACF;IAEAc,UAAsB;QACpB,OAAO,IAAI,CAACE,SAAS,GAAG9B,MAAM;IAChC;IAEA+B,QAAQnC,IAAgB,EAAQ;QAC9B,MAAMoC,WAAW,IAAI,CAACC,WAAW;QACjCD,SAAShC,MAAM,GAAGJ;IACpB;IAEA,kDAAkD;IAClDsC,YAAmB;QACjB,OAAO;IACT;AACF;AAEA,OAAO,SAASvC,kBAAkB,EAAEC,IAAI,EAAwB;IAC9D,OAAOhB,sBAAsB,IAAImB,WAAW;QAAEH;IAAK;AACrD;AAEA,OAAO,SAASuC,cAAczC,IAAoC;IAChE,OAAOA,gBAAgBK;AACzB"}
1
+ {"version":3,"sources":["../../../../../src/field/features/upload/nodes/UploadNode.tsx"],"sourcesContent":["import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type { ElementFormatType, NodeKey } from 'lexical'\nimport type {\n DOMConversionMap,\n DOMConversionOutput,\n DOMExportOutput,\n LexicalNode,\n Spread,\n} from 'lexical'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport { $applyNodeReplacement } from 'lexical'\nimport * as React from 'react'\n\nconst RawUploadComponent = React.lazy(() =>\n import('../component/index.js').then((module) => ({ default: module.UploadComponent })),\n)\n\nexport type UploadData = {\n fields: {\n // unknown, custom fields:\n [key: string]: unknown\n }\n relationTo: string\n value: number | string\n}\n\nfunction isGoogleDocCheckboxImg(img: HTMLImageElement): boolean {\n return (\n img.parentElement != null &&\n img.parentElement.tagName === 'LI' &&\n img.previousSibling === null &&\n img.getAttribute('aria-roledescription') === 'checkbox'\n )\n}\n\nfunction $convertUploadElement(domNode: HTMLImageElement): DOMConversionOutput | null {\n if (\n domNode.hasAttribute('data-lexical-upload-relation-to') &&\n domNode.hasAttribute('data-lexical-upload-id')\n ) {\n const id = domNode.getAttribute('data-lexical-upload-id')\n const relationTo = domNode.getAttribute('data-lexical-upload-relation-to')\n\n if (id != null && relationTo != null) {\n const node = $createUploadNode({\n data: {\n fields: {},\n relationTo,\n value: id,\n },\n })\n return { node }\n }\n }\n const img = domNode\n if (img.src.startsWith('file:///') || isGoogleDocCheckboxImg(img)) {\n return null\n }\n // TODO: Auto-upload functionality here!\n //}\n return null\n}\n\nexport type SerializedUploadNode = Spread<UploadData, SerializedDecoratorBlockNode>\n\nexport class UploadNode extends DecoratorBlockNode {\n __data: UploadData\n\n constructor({\n data,\n format,\n key,\n }: {\n data: UploadData\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__data = data\n }\n\n static clone(node: UploadNode): UploadNode {\n return new UploadNode({\n data: node.__data,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static getType(): string {\n return 'upload'\n }\n\n static importDOM(): DOMConversionMap | null {\n return {\n img: (node: HTMLImageElement) => ({\n conversion: $convertUploadElement,\n priority: 0,\n }),\n }\n }\n\n static importJSON(serializedNode: SerializedUploadNode): UploadNode {\n if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {\n serializedNode.value = (serializedNode.value as unknown as { id: string }).id\n }\n\n const importedData: UploadData = {\n fields: serializedNode.fields,\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n\n const node = $createUploadNode({ data: importedData })\n node.setFormat(serializedNode.format)\n\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n decorate(): JSX.Element {\n // @ts-expect-error\n return <RawUploadComponent data={this.__data} format={this.__format} nodeKey={this.getKey()} />\n }\n\n exportDOM(): DOMExportOutput {\n const element = document.createElement('img')\n element.setAttribute('data-lexical-upload-id', String(this.__data?.value))\n element.setAttribute('data-lexical-upload-relation-to', this.__data?.relationTo)\n\n return { element }\n }\n\n exportJSON(): SerializedUploadNode {\n return {\n ...super.exportJSON(),\n ...this.getData(),\n type: this.getType(),\n version: 2,\n }\n }\n\n getData(): UploadData {\n return this.getLatest().__data\n }\n\n setData(data: UploadData): void {\n const writable = this.getWritable()\n writable.__data = data\n }\n\n // eslint-disable-next-line class-methods-use-this\n updateDOM(): false {\n return false\n }\n}\n\nexport function $createUploadNode({ data }: { data: UploadData }): UploadNode {\n return $applyNodeReplacement(new UploadNode({ data }))\n}\n\nexport function $isUploadNode(node: LexicalNode | null | undefined): node is UploadNode {\n return node instanceof UploadNode\n}\n"],"names":["DecoratorBlockNode","$applyNodeReplacement","React","RawUploadComponent","lazy","then","module","default","UploadComponent","isGoogleDocCheckboxImg","img","parentElement","tagName","previousSibling","getAttribute","$convertUploadElement","domNode","hasAttribute","id","relationTo","node","$createUploadNode","data","fields","value","src","startsWith","UploadNode","__data","constructor","format","key","clone","__format","__key","getType","importDOM","conversion","priority","importJSON","serializedNode","version","importedData","setFormat","isInline","decorate","nodeKey","getKey","exportDOM","element","document","createElement","setAttribute","String","exportJSON","getData","type","getLatest","setData","writable","getWritable","updateDOM","$isUploadNode"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAWA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AACC,WAAW;QACjCD,SAAS/B,MAAM,GAAGN;IACpB;IAEA,kDAAkD;IAClDuC,YAAmB;QACjB,OAAO;IACT;AACF;AAEA,OAAO,SAASxC,kBAAkB,EAAEC,IAAI,EAAwB;IAC9D,OAAOrB,sBAAsB,IAAI0B,WAAW;QAAEL;IAAK;AACrD;AAEA,OAAO,SAASwC,cAAc1C,IAAoC;IAChE,OAAOA,gBAAgBO;AACzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"LexicalEditor.d.ts","sourceRoot":"","sources":["../../../src/field/lexical/LexicalEditor.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAGhE,OAAO,sBAAsB,CAAA;AAQ7B,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAClC,IAAI,CAAC,oBAAoB,EAAE,cAAc,GAAG,UAAU,CAAC,GAAG;IACxD,kBAAkB,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAA;CACpD,CA+KF,CAAA"}
1
+ {"version":3,"file":"LexicalEditor.d.ts","sourceRoot":"","sources":["../../../src/field/lexical/LexicalEditor.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAGhE,OAAO,sBAAsB,CAAA;AAQ7B,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAClC,IAAI,CAAC,oBAAoB,EAAE,cAAc,GAAG,UAAU,CAAC,GAAG;IACxD,kBAAkB,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAA;CACpD,CA4KF,CAAA"}
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
4
- import LexicalErrorBoundary from '@lexical/react/LexicalErrorBoundary.js';
4
+ import { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary.js';
5
5
  import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js';
6
6
  import { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js';
7
7
  import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js';
@@ -76,7 +76,6 @@ export const LexicalEditor = (props)=>{
76
76
  }, [
77
77
  isSmallWidthViewport
78
78
  ]);
79
- const ErrorBoundaryComponent = LexicalErrorBoundary.default || LexicalErrorBoundary;
80
79
  return /*#__PURE__*/ _jsxs(React.Fragment, {
81
80
  children: [
82
81
  editorConfig.features.plugins.map((plugin)=>{
@@ -100,8 +99,7 @@ export const LexicalEditor = (props)=>{
100
99
  }
101
100
  }),
102
101
  /*#__PURE__*/ _jsx(RichTextPlugin, {
103
- //@ts-expect-error ts being dumb
104
- ErrorBoundary: ErrorBoundaryComponent,
102
+ ErrorBoundary: LexicalErrorBoundary,
105
103
  contentEditable: /*#__PURE__*/ _jsx("div", {
106
104
  className: "editor-scroller",
107
105
  children: /*#__PURE__*/ _jsx("div", {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/field/lexical/LexicalEditor.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport LexicalErrorBoundary from '@lexical/react/LexicalErrorBoundary.js'\nimport { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js'\nimport { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js'\nimport { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js'\nimport { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin.js'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useState } from 'react'\n\nimport type { LexicalProviderProps } from './LexicalProvider.js'\n\nimport { EditorPlugin } from './EditorPlugin.js'\nimport './LexicalEditor.scss'\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js'\nimport { SlashMenuPlugin } from './plugins/SlashMenu/index.js'\nimport { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/index.js'\nimport { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js'\nimport { LexicalContentEditable } from './ui/ContentEditable.js'\n\nexport const LexicalEditor: React.FC<\n Pick<LexicalProviderProps, 'editorConfig' | 'onChange'> & {\n editorContainerRef: React.RefObject<HTMLDivElement>\n }\n> = (props) => {\n const { editorConfig, editorContainerRef, onChange } = props\n const editorConfigContext = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n const { t } = useTranslation<{}, string>()\n\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLDivElement | null>(null)\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem)\n }\n }\n\n useEffect(() => {\n if (!editorConfigContext?.uuid) {\n console.error('Lexical Editor must be used within an EditorConfigProvider')\n return\n }\n if (editorConfigContext?.parentEditor?.uuid) {\n editorConfigContext.parentEditor?.registerChild(editorConfigContext.uuid, editorConfigContext)\n }\n\n const handleFocus = () => {\n editorConfigContext.focusEditor(editorConfigContext)\n }\n\n const handleBlur = () => {\n editorConfigContext.blurEditor(editorConfigContext)\n }\n\n const unregisterFocus = editor.registerCommand<MouseEvent>(\n FOCUS_COMMAND,\n () => {\n handleFocus()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n const unregisterBlur = editor.registerCommand<MouseEvent>(\n BLUR_COMMAND,\n () => {\n handleBlur()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n return () => {\n unregisterFocus()\n unregisterBlur()\n editorConfigContext.parentEditor?.unregisterChild?.(editorConfigContext.uuid)\n }\n }, [editor, editorConfigContext])\n\n const [isSmallWidthViewport, setIsSmallWidthViewport] = useState<boolean>(false)\n\n useEffect(() => {\n const updateViewPortWidth = () => {\n const isNextSmallWidthViewport = window.matchMedia('(max-width: 768px)').matches\n\n if (isNextSmallWidthViewport !== isSmallWidthViewport) {\n setIsSmallWidthViewport(isNextSmallWidthViewport)\n }\n }\n updateViewPortWidth()\n window.addEventListener('resize', updateViewPortWidth)\n\n return () => {\n window.removeEventListener('resize', updateViewPortWidth)\n }\n }, [isSmallWidthViewport])\n\n const ErrorBoundaryComponent = LexicalErrorBoundary.default || LexicalErrorBoundary\n\n return (\n <React.Fragment>\n {editorConfig.features.plugins.map((plugin) => {\n if (plugin.position === 'aboveContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n <div className=\"editor-container\" ref={editorContainerRef}>\n {editorConfig.features.plugins.map((plugin) => {\n if (plugin.position === 'top') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n <RichTextPlugin\n //@ts-expect-error ts being dumb\n ErrorBoundary={ErrorBoundaryComponent}\n contentEditable={\n <div className=\"editor-scroller\">\n <div className=\"editor\" ref={onRef}>\n <LexicalContentEditable />\n </div>\n </div>\n }\n placeholder={<p className=\"editor-placeholder\">{t('lexical:general:placeholder')}</p>}\n />\n <OnChangePlugin\n // Selection changes can be ignored here, reducing the\n // frequency that the FieldComponent and Payload receive updates.\n // Selection changes are only needed if you are saving selection state\n ignoreSelectionChange\n onChange={(editorState, editor, tags) => {\n // Ignore any onChange event triggered by focus only\n if (!tags.has('focus') || tags.size > 1) {\n if (onChange != null) onChange(editorState, editor, tags)\n }\n }}\n />\n {floatingAnchorElem && (\n <React.Fragment>\n {!isSmallWidthViewport && editor.isEditable() && (\n <React.Fragment>\n <DraggableBlockPlugin anchorElem={floatingAnchorElem} />\n <AddBlockHandlePlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n {editorConfig.features.plugins.map((plugin) => {\n if (\n plugin.position === 'floatingAnchorElem' &&\n !(plugin.desktopOnly === true && isSmallWidthViewport)\n ) {\n return (\n <EditorPlugin\n anchorElem={floatingAnchorElem}\n clientProps={plugin.clientProps}\n key={plugin.key}\n plugin={plugin}\n />\n )\n }\n })}\n {editor.isEditable() && (\n <React.Fragment>\n <SlashMenuPlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n </React.Fragment>\n )}\n {editor.isEditable() && (\n <React.Fragment>\n <HistoryPlugin />\n {editorConfig?.features?.markdownTransformers?.length > 0 && <MarkdownShortcutPlugin />}\n </React.Fragment>\n )}\n\n <TabIndentationPlugin />\n {editorConfig.features.plugins.map((plugin) => {\n if (plugin.position === 'normal') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n {editorConfig.features.plugins.map((plugin) => {\n if (plugin.position === 'bottom') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n </div>\n {editorConfig.features.plugins.map((plugin) => {\n if (plugin.position === 'belowContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n </React.Fragment>\n )\n}\n"],"names":["useLexicalComposerContext","LexicalErrorBoundary","HistoryPlugin","OnChangePlugin","RichTextPlugin","TabIndentationPlugin","useTranslation","BLUR_COMMAND","COMMAND_PRIORITY_LOW","FOCUS_COMMAND","React","useEffect","useState","EditorPlugin","useEditorConfigContext","MarkdownShortcutPlugin","SlashMenuPlugin","AddBlockHandlePlugin","DraggableBlockPlugin","LexicalContentEditable","LexicalEditor","props","editorConfig","editorContainerRef","onChange","editorConfigContext","editor","t","floatingAnchorElem","setFloatingAnchorElem","onRef","_floatingAnchorElem","uuid","console","error","parentEditor","registerChild","handleFocus","focusEditor","handleBlur","blurEditor","unregisterFocus","registerCommand","unregisterBlur","unregisterChild","isSmallWidthViewport","setIsSmallWidthViewport","updateViewPortWidth","isNextSmallWidthViewport","window","matchMedia","matches","addEventListener","removeEventListener","ErrorBoundaryComponent","default","Fragment","features","plugins","map","plugin","position","clientProps","key","div","className","ref","ErrorBoundary","contentEditable","placeholder","p","ignoreSelectionChange","editorState","tags","has","size","isEditable","anchorElem","desktopOnly","markdownTransformers","length"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AACA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,OAAOC,0BAA0B,yCAAwC;AACzE,SAASC,aAAa,QAAQ,yCAAwC;AACtE,SAASC,cAAc,QAAQ,0CAAyC;AACxE,SAASC,cAAc,QAAQ,0CAAyC;AACxE,SAASC,oBAAoB,QAAQ,gDAA+C;AACpF,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,YAAY,EAAEC,oBAAoB,EAAEC,aAAa,QAAQ,UAAS;AAC3E,YAAYC,WAAW,QAAO;AAC9B,SAASC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAI3C,SAASC,YAAY,QAAQ,oBAAmB;AAChD,OAAO,uBAAsB;AAC7B,SAASC,sBAAsB,QAAQ,0CAAyC;AAChF,SAASC,sBAAsB,QAAQ,sCAAqC;AAC5E,SAASC,eAAe,QAAQ,+BAA8B;AAC9D,SAASC,oBAAoB,QAAQ,kDAAiD;AACtF,SAASC,oBAAoB,QAAQ,kDAAiD;AACtF,SAASC,sBAAsB,QAAQ,0BAAyB;AAEhE,OAAO,MAAMC,gBAIT,CAACC;IACH,MAAM,EAAEC,YAAY,EAAEC,kBAAkB,EAAEC,QAAQ,EAA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AA,OAAOkB,WAAW,KAAK,QAAQjC,oBAAmB,GACpD;oCACA,qBACE,KAAChC;wCACCgE,YAAYjD;wCACZkC,aAAaF,OAAOE,WAAW;wCAE/BF,QAAQA;uCADHA,OAAOG,GAAG;gCAIrB;4BACF;4BACCrC,OAAOkD,UAAU,oBAChB,KAAClE,MAAM8C,QAAQ;0CACb,cAAA,KAACxC;oCAAgB6D,YAAYjD;;;;;oBAKpCF,OAAOkD,UAAU,oBAChB,MAAClE,MAAM8C,QAAQ;;0CACb,KAACtD;4BACAoB,cAAcmC,UAAUsB,sBAAsBC,SAAS,mBAAK,KAACjE;;;kCAIlE,KAACV;oBACAiB,aAAamC,QAAQ,CAACC,OAAO,CAACC,GAAG,CAAC,CAACC;wBAClC,IAAIA,OAAOC,QAAQ,KAAK,UAAU;4BAChC,qBACE,KAAChD;gCAAaiD,aAAaF,OAAOE,WAAW;gCAAmBF,QAAQA;+BAApBA,OAAOG,GAAG;wBAElE;oBACF;oBACCzC,aAAamC,QAAQ,CAACC,OAAO,CAACC,GAAG,CAAC,CAACC;wBAClC,IAAIA,OAAOC,QAAQ,KAAK,UAAU;4BAChC,qBACE,KAAChD;gCAAaiD,aAAaF,OAAOE,WAAW;gCAAmBF,QAAQA;+BAApBA,OAAOG,GAAG;wBAElE;oBACF;;;YAEDzC,aAAamC,QAAQ,CAACC,OAAO,CAACC,GAAG,CAAC,CAACC;gBAClC,IAAIA,OAAOC,QAAQ,KAAK,kBAAkB;oBACxC,qBAAO,KAAChD;wBAAaiD,aAAaF,OAAOE,WAAW;wBAAmBF,QAAQA;uBAApBA,OAAOG,GAAG;gBACvE;YACF;;;AAGN,EAAC"}
1
+ {"version":3,"sources":["../../../src/field/lexical/LexicalEditor.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary.js'\nimport { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js'\nimport { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js'\nimport { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js'\nimport { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin.js'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useState } from 'react'\n\nimport type { LexicalProviderProps } from './LexicalProvider.js'\n\nimport { EditorPlugin } from './EditorPlugin.js'\nimport './LexicalEditor.scss'\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js'\nimport { SlashMenuPlugin } from './plugins/SlashMenu/index.js'\nimport { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/index.js'\nimport { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js'\nimport { LexicalContentEditable } from './ui/ContentEditable.js'\n\nexport const LexicalEditor: React.FC<\n Pick<LexicalProviderProps, 'editorConfig' | 'onChange'> & {\n editorContainerRef: React.RefObject<HTMLDivElement>\n }\n> = (props) => {\n const { editorConfig, editorContainerRef, onChange } = props\n const editorConfigContext = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n const { t } = useTranslation<{}, string>()\n\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLDivElement | null>(null)\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem)\n }\n }\n\n useEffect(() => {\n if (!editorConfigContext?.uuid) {\n console.error('Lexical Editor must be used within an EditorConfigProvider')\n return\n }\n if (editorConfigContext?.parentEditor?.uuid) {\n editorConfigContext.parentEditor?.registerChild(editorConfigContext.uuid, editorConfigContext)\n }\n\n const handleFocus = () => {\n editorConfigContext.focusEditor(editorConfigContext)\n }\n\n const handleBlur = () => {\n editorConfigContext.blurEditor(editorConfigContext)\n }\n\n const unregisterFocus = editor.registerCommand<MouseEvent>(\n FOCUS_COMMAND,\n () => {\n handleFocus()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n const unregisterBlur = editor.registerCommand<MouseEvent>(\n BLUR_COMMAND,\n () => {\n handleBlur()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n return () => {\n unregisterFocus()\n unregisterBlur()\n editorConfigContext.parentEditor?.unregisterChild?.(editorConfigContext.uuid)\n }\n }, [editor, editorConfigContext])\n\n const [isSmallWidthViewport, setIsSmallWidthViewport] = useState<boolean>(false)\n\n useEffect(() => {\n const updateViewPortWidth = () => {\n const isNextSmallWidthViewport = window.matchMedia('(max-width: 768px)').matches\n\n if (isNextSmallWidthViewport !== isSmallWidthViewport) {\n setIsSmallWidthViewport(isNextSmallWidthViewport)\n }\n }\n updateViewPortWidth()\n window.addEventListener('resize', updateViewPortWidth)\n\n return () => {\n window.removeEventListener('resize', updateViewPortWidth)\n }\n }, [isSmallWidthViewport])\n\n return (\n <React.Fragment>\n {editorConfig.features.plugins.map((plugin) => {\n if (plugin.position === 'aboveContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n <div className=\"editor-container\" ref={editorContainerRef}>\n {editorConfig.features.plugins.map((plugin) => {\n if (plugin.position === 'top') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n <RichTextPlugin\n ErrorBoundary={LexicalErrorBoundary}\n contentEditable={\n <div className=\"editor-scroller\">\n <div className=\"editor\" ref={onRef}>\n <LexicalContentEditable />\n </div>\n </div>\n }\n placeholder={<p className=\"editor-placeholder\">{t('lexical:general:placeholder')}</p>}\n />\n <OnChangePlugin\n // Selection changes can be ignored here, reducing the\n // frequency that the FieldComponent and Payload receive updates.\n // Selection changes are only needed if you are saving selection state\n ignoreSelectionChange\n onChange={(editorState, editor, tags) => {\n // Ignore any onChange event triggered by focus only\n if (!tags.has('focus') || tags.size > 1) {\n if (onChange != null) onChange(editorState, editor, tags)\n }\n }}\n />\n {floatingAnchorElem && (\n <React.Fragment>\n {!isSmallWidthViewport && editor.isEditable() && (\n <React.Fragment>\n <DraggableBlockPlugin anchorElem={floatingAnchorElem} />\n <AddBlockHandlePlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n {editorConfig.features.plugins.map((plugin) => {\n if (\n plugin.position === 'floatingAnchorElem' &&\n !(plugin.desktopOnly === true && isSmallWidthViewport)\n ) {\n return (\n <EditorPlugin\n anchorElem={floatingAnchorElem}\n clientProps={plugin.clientProps}\n key={plugin.key}\n plugin={plugin}\n />\n )\n }\n })}\n {editor.isEditable() && (\n <React.Fragment>\n <SlashMenuPlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n </React.Fragment>\n )}\n {editor.isEditable() && (\n <React.Fragment>\n <HistoryPlugin />\n {editorConfig?.features?.markdownTransformers?.length > 0 && <MarkdownShortcutPlugin />}\n </React.Fragment>\n )}\n\n <TabIndentationPlugin />\n {editorConfig.features.plugins.map((plugin) => {\n if (plugin.position === 'normal') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n {editorConfig.features.plugins.map((plugin) => {\n if (plugin.position === 'bottom') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n </div>\n {editorConfig.features.plugins.map((plugin) => {\n if (plugin.position === 'belowContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n </React.Fragment>\n )\n}\n"],"names":["useLexicalComposerContext","LexicalErrorBoundary","HistoryPlugin","OnChangePlugin","RichTextPlugin","TabIndentationPlugin","useTranslation","BLUR_COMMAND","COMMAND_PRIORITY_LOW","FOCUS_COMMAND","React","useEffect","useState","EditorPlugin","useEditorConfigContext","MarkdownShortcutPlugin","SlashMenuPlugin","AddBlockHandlePlugin","DraggableBlockPlugin","LexicalContentEditable","LexicalEditor","props","editorConfig","editorContainerRef","onChange","editorConfigContext","editor","t","floatingAnchorElem","setFloatingAnchorElem","onRef","_floatingAnchorElem","uuid","console","error","parentEditor","registerChild","handleFocus","focusEditor","handleBlur","blurEditor","unregisterFocus","registerCommand","unregisterBlur","unregisterChild","isSmallWidthViewport","setIsSmallWidthViewport","updateViewPortWidth","isNextSmallWidthViewport","window","matchMedia","matches","addEventListener","removeEventListener","Fragment","features","plugins","map","plugin","position","clientProps","key","div","className","ref","ErrorBoundary","contentEditable","placeholder","p","ignoreSelectionChange","editorState","tags","has","size","isEditable","anchorElem","desktopOnly","markdownTransformers","length"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AACA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,oBAAoB,QAAQ,yCAAwC;AAC7E,SAASC,aAAa,QAAQ,yCAAwC;AACtE,SAASC,cAAc,QAAQ,0CAAyC;AACxE,SAASC,cAAc,QAAQ,0CAAyC;AACxE,SAASC,oBAAoB,QAAQ,gDAA+C;AACpF,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,YAAY,EAAEC,oBAAoB,EAAEC,aAAa,QAAQ,UAAS;AAC3E,YAAYC,WAAW,QAAO;AAC9B,SAASC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAI3C,SAASC,YAAY,QAAQ,oBAAmB;AAChD,OAAO,uBAAsB;AAC7B,SAASC,sBAAsB,QAAQ,0CAAyC;AAChF,SAASC,sBAAsB,QAAQ,sCAAqC;AAC5E,SAASC,eAAe,QAAQ,+BAA8B;AAC9D,SAASC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../../../src/field/lexical/theme/EditorTheme.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAEjD,OAAO,oBAAoB,CAAA;AAE3B,eAAO,MAAM,kBAAkB,EAAE,kBAsGhC,CAAA"}
1
+ {"version":3,"file":"EditorTheme.d.ts","sourceRoot":"","sources":["../../../../src/field/lexical/theme/EditorTheme.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAEjD,OAAO,oBAAoB,CAAA;AAE3B,eAAO,MAAM,kBAAkB,EAAE,kBAuGhC,CAAA"}
@@ -49,6 +49,7 @@ export const LexicalEditorTheme = {
49
49
  h5: 'LexicalEditorTheme__h5',
50
50
  h6: 'LexicalEditorTheme__h6'
51
51
  },
52
+ hr: 'LexicalEditorTheme__hr',
52
53
  indent: 'LexicalEditorTheme__indent',
53
54
  inlineImage: 'LexicalEditor__inline-image',
54
55
  link: 'LexicalEditorTheme__link',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/lexical/theme/EditorTheme.tsx"],"sourcesContent":["import type { EditorThemeClasses } from 'lexical'\n\nimport './EditorTheme.scss'\n\nexport const LexicalEditorTheme: EditorThemeClasses = {\n block: 'LexicalEditorTheme__block',\n blockCursor: 'LexicalEditorTheme__blockCursor',\n characterLimit: 'LexicalEditorTheme__characterLimit',\n code: 'LexicalEditorTheme__code',\n codeHighlight: {\n atrule: 'LexicalEditorTheme__tokenAttr',\n attr: 'LexicalEditorTheme__tokenAttr',\n boolean: 'LexicalEditorTheme__tokenProperty',\n builtin: 'LexicalEditorTheme__tokenSelector',\n cdata: 'LexicalEditorTheme__tokenComment',\n char: 'LexicalEditorTheme__tokenSelector',\n class: 'LexicalEditorTheme__tokenFunction',\n 'class-name': 'LexicalEditorTheme__tokenFunction',\n comment: 'LexicalEditorTheme__tokenComment',\n constant: 'LexicalEditorTheme__tokenProperty',\n deleted: 'LexicalEditorTheme__tokenProperty',\n doctype: 'LexicalEditorTheme__tokenComment',\n entity: 'LexicalEditorTheme__tokenOperator',\n function: 'LexicalEditorTheme__tokenFunction',\n important: 'LexicalEditorTheme__tokenVariable',\n inserted: 'LexicalEditorTheme__tokenSelector',\n keyword: 'LexicalEditorTheme__tokenAttr',\n namespace: 'LexicalEditorTheme__tokenVariable',\n number: 'LexicalEditorTheme__tokenProperty',\n operator: 'LexicalEditorTheme__tokenOperator',\n prolog: 'LexicalEditorTheme__tokenComment',\n property: 'LexicalEditorTheme__tokenProperty',\n punctuation: 'LexicalEditorTheme__tokenPunctuation',\n regex: 'LexicalEditorTheme__tokenVariable',\n selector: 'LexicalEditorTheme__tokenSelector',\n string: 'LexicalEditorTheme__tokenSelector',\n symbol: 'LexicalEditorTheme__tokenProperty',\n tag: 'LexicalEditorTheme__tokenProperty',\n url: 'LexicalEditorTheme__tokenOperator',\n variable: 'LexicalEditorTheme__tokenVariable',\n },\n embedBlock: {\n base: 'LexicalEditorTheme__embedBlock',\n focus: 'LexicalEditorTheme__embedBlockFocus',\n },\n hashtag: 'LexicalEditorTheme__hashtag',\n heading: {\n h1: 'LexicalEditorTheme__h1',\n h2: 'LexicalEditorTheme__h2',\n h3: 'LexicalEditorTheme__h3',\n h4: 'LexicalEditorTheme__h4',\n h5: 'LexicalEditorTheme__h5',\n h6: 'LexicalEditorTheme__h6',\n },\n indent: 'LexicalEditorTheme__indent',\n inlineImage: 'LexicalEditor__inline-image',\n link: 'LexicalEditorTheme__link',\n list: {\n checklist: 'LexicalEditorTheme__checklist',\n listitem: 'LexicalEditorTheme__listItem',\n listitemChecked: 'LexicalEditorTheme__listItemChecked',\n listitemUnchecked: 'LexicalEditorTheme__listItemUnchecked',\n nested: {\n listitem: 'LexicalEditorTheme__nestedListItem',\n },\n olDepth: [\n 'LexicalEditorTheme__ol1',\n 'LexicalEditorTheme__ol2',\n 'LexicalEditorTheme__ol3',\n 'LexicalEditorTheme__ol4',\n 'LexicalEditorTheme__ol5',\n ],\n ul: 'LexicalEditorTheme__ul',\n },\n ltr: 'LexicalEditorTheme__ltr',\n mark: 'LexicalEditorTheme__mark',\n markOverlap: 'LexicalEditorTheme__markOverlap',\n paragraph: 'LexicalEditorTheme__paragraph',\n quote: 'LexicalEditorTheme__quote',\n relationship: 'LexicalEditorTheme__relationship',\n rtl: 'LexicalEditorTheme__rtl',\n table: 'LexicalEditorTheme__table',\n tableAddColumns: 'LexicalEditorTheme__tableAddColumns',\n tableAddRows: 'LexicalEditorTheme__tableAddRows',\n tableCell: 'LexicalEditorTheme__tableCell',\n tableCellActionButton: 'LexicalEditorTheme__tableCellActionButton',\n tableCellActionButtonContainer: 'LexicalEditorTheme__tableCellActionButtonContainer',\n tableCellEditing: 'LexicalEditorTheme__tableCellEditing',\n tableCellHeader: 'LexicalEditorTheme__tableCellHeader',\n tableCellPrimarySelected: 'LexicalEditorTheme__tableCellPrimarySelected',\n tableCellResizer: 'LexicalEditorTheme__tableCellResizer',\n tableCellSelected: 'LexicalEditorTheme__tableCellSelected',\n tableCellSortedIndicator: 'LexicalEditorTheme__tableCellSortedIndicator',\n tableResizeRuler: 'LexicalEditorTheme__tableCellResizeRuler',\n tableSelected: 'LexicalEditorTheme__tableSelected',\n text: {\n bold: 'LexicalEditorTheme__textBold',\n code: 'LexicalEditorTheme__textCode',\n italic: 'LexicalEditorTheme__textItalic',\n strikethrough: 'LexicalEditorTheme__textStrikethrough',\n subscript: 'LexicalEditorTheme__textSubscript',\n superscript: 'LexicalEditorTheme__textSuperscript',\n underline: 'LexicalEditorTheme__textUnderline',\n underlineStrikethrough: 'LexicalEditorTheme__textUnderlineStrikethrough',\n },\n upload: 'editor-upload',\n}\n"],"names":["LexicalEditorTheme","block","blockCursor","characterLimit","code","codeHighlight","atrule","attr","boolean","builtin","cdata","char","class","comment","constant","deleted","doctype","entity","function","important","inserted","keyword","namespace","number","operator","prolog","property","punctuation","regex","selector","string","symbol","tag","url","variable","embedBlock","base","focus","hashtag","heading","h1","h2","h3","h4","h5","h6","indent","inlineImage","link","list","checklist","listitem","listitemChecked","listitemUnchecked","nested","olDepth","ul","ltr","mark","markOverlap","paragraph","quote","relationship","rtl","table","tableAddColumns","tableAddRows","tableCell","tableCellActionButton","tableCellActionButtonContainer","tableCellEditing","tableCellHeader","tableCellPrimarySelected","tableCellResizer","tableCellSelected","tableCellSortedIndicator","tableResizeRuler","tableSelected","text","bold","italic","strikethrough","subscript","superscript","underline","underlineStrikethrough","upload"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,OAAO,qBAAoB;AAE3B,OAAO,MAAMA,qBAAyC;IACpDC,OAAO;IACPC,aAAa;IACbC,gBAAgB;IAChBC,MAAM;IACNC,eAAe;QACbC,QAAQ;QACRC,MAAM;QACNC,SAAS;QACTC,SAAS;QACTC,OAAO;QACPC,MAAM;QACNC,OAAO;QACP,cAAc;QACdC,SAAS;QACTC,UAAU;QACVC,SAAS;QACTC,SAAS;QACTC,QAAQ;QACRC,UAAU;QACVC,WAAW;QACXC,UAAU;QACVC,SAAS;QACTC,WAAW;QACXC,QAAQ;QACRC,UAAU;QACVC,QAAQ;QACRC,UAAU;QACVC,aAAa;QACbC,OAAO;QACPC,UAAU;QACVC,QAAQ;QACRC,QAAQ;QACRC,KAAK;QACLC,KAAK;QACLC,UAAU;IACZ;IACAC,YAAY;QACVC,MAAM;QACNC,OAAO;IACT;IACAC,SAAS;IACTC,SAAS;QACPC,IAAI;QACJC,IAAI;QACJC,IAAI;QACJC,IAAI;QACJC,IAAI;QACJC,IAAI;IACN;IACAC,QAAQ;IACRC,aAAa;IACbC,MAAM;IACNC,MAAM;QACJC,WAAW;QACXC,UAAU;QACVC,iBAAiB;QACjBC,mBAAmB;QACnBC,QAAQ;YACNH,UAAU;QACZ;QACAI,SAAS;YACP;YACA;YACA;YACA;YACA;SACD;QACDC,IAAI;IACN;IACAC,KAAK;IACLC,MAAM;IACNC,aAAa;IACbC,WAAW;IACXC,OAAO;IACPC,cAAc;IACdC,KAAK;IACLC,OAAO;IACPC,iBAAiB;IACjBC,cAAc;IACdC,WAAW;IACXC,uBAAuB;IACvBC,gCAAgC;IAChCC,kBAAkB;IAClBC,iBAAiB;IACjBC,0BAA0B;IAC1BC,kBAAkB;IAClBC,mBAAmB;IACnBC,0BAA0B;IAC1BC,kBAAkB;IAClBC,eAAe;IACfC,MAAM;QACJC,MAAM;QACN3E,MAAM;QACN4E,QAAQ;QACRC,eAAe;QACfC,WAAW;QACXC,aAAa;QACbC,WAAW;QACXC,wBAAwB;IAC1B;IACAC,QAAQ;AACV,EAAC"}
1
+ {"version":3,"sources":["../../../../src/field/lexical/theme/EditorTheme.tsx"],"sourcesContent":["import type { EditorThemeClasses } from 'lexical'\n\nimport './EditorTheme.scss'\n\nexport const LexicalEditorTheme: EditorThemeClasses = {\n block: 'LexicalEditorTheme__block',\n blockCursor: 'LexicalEditorTheme__blockCursor',\n characterLimit: 'LexicalEditorTheme__characterLimit',\n code: 'LexicalEditorTheme__code',\n codeHighlight: {\n atrule: 'LexicalEditorTheme__tokenAttr',\n attr: 'LexicalEditorTheme__tokenAttr',\n boolean: 'LexicalEditorTheme__tokenProperty',\n builtin: 'LexicalEditorTheme__tokenSelector',\n cdata: 'LexicalEditorTheme__tokenComment',\n char: 'LexicalEditorTheme__tokenSelector',\n class: 'LexicalEditorTheme__tokenFunction',\n 'class-name': 'LexicalEditorTheme__tokenFunction',\n comment: 'LexicalEditorTheme__tokenComment',\n constant: 'LexicalEditorTheme__tokenProperty',\n deleted: 'LexicalEditorTheme__tokenProperty',\n doctype: 'LexicalEditorTheme__tokenComment',\n entity: 'LexicalEditorTheme__tokenOperator',\n function: 'LexicalEditorTheme__tokenFunction',\n important: 'LexicalEditorTheme__tokenVariable',\n inserted: 'LexicalEditorTheme__tokenSelector',\n keyword: 'LexicalEditorTheme__tokenAttr',\n namespace: 'LexicalEditorTheme__tokenVariable',\n number: 'LexicalEditorTheme__tokenProperty',\n operator: 'LexicalEditorTheme__tokenOperator',\n prolog: 'LexicalEditorTheme__tokenComment',\n property: 'LexicalEditorTheme__tokenProperty',\n punctuation: 'LexicalEditorTheme__tokenPunctuation',\n regex: 'LexicalEditorTheme__tokenVariable',\n selector: 'LexicalEditorTheme__tokenSelector',\n string: 'LexicalEditorTheme__tokenSelector',\n symbol: 'LexicalEditorTheme__tokenProperty',\n tag: 'LexicalEditorTheme__tokenProperty',\n url: 'LexicalEditorTheme__tokenOperator',\n variable: 'LexicalEditorTheme__tokenVariable',\n },\n embedBlock: {\n base: 'LexicalEditorTheme__embedBlock',\n focus: 'LexicalEditorTheme__embedBlockFocus',\n },\n hashtag: 'LexicalEditorTheme__hashtag',\n heading: {\n h1: 'LexicalEditorTheme__h1',\n h2: 'LexicalEditorTheme__h2',\n h3: 'LexicalEditorTheme__h3',\n h4: 'LexicalEditorTheme__h4',\n h5: 'LexicalEditorTheme__h5',\n h6: 'LexicalEditorTheme__h6',\n },\n hr: 'LexicalEditorTheme__hr',\n indent: 'LexicalEditorTheme__indent',\n inlineImage: 'LexicalEditor__inline-image',\n link: 'LexicalEditorTheme__link',\n list: {\n checklist: 'LexicalEditorTheme__checklist',\n listitem: 'LexicalEditorTheme__listItem',\n listitemChecked: 'LexicalEditorTheme__listItemChecked',\n listitemUnchecked: 'LexicalEditorTheme__listItemUnchecked',\n nested: {\n listitem: 'LexicalEditorTheme__nestedListItem',\n },\n olDepth: [\n 'LexicalEditorTheme__ol1',\n 'LexicalEditorTheme__ol2',\n 'LexicalEditorTheme__ol3',\n 'LexicalEditorTheme__ol4',\n 'LexicalEditorTheme__ol5',\n ],\n ul: 'LexicalEditorTheme__ul',\n },\n ltr: 'LexicalEditorTheme__ltr',\n mark: 'LexicalEditorTheme__mark',\n markOverlap: 'LexicalEditorTheme__markOverlap',\n paragraph: 'LexicalEditorTheme__paragraph',\n quote: 'LexicalEditorTheme__quote',\n relationship: 'LexicalEditorTheme__relationship',\n rtl: 'LexicalEditorTheme__rtl',\n table: 'LexicalEditorTheme__table',\n tableAddColumns: 'LexicalEditorTheme__tableAddColumns',\n tableAddRows: 'LexicalEditorTheme__tableAddRows',\n tableCell: 'LexicalEditorTheme__tableCell',\n tableCellActionButton: 'LexicalEditorTheme__tableCellActionButton',\n tableCellActionButtonContainer: 'LexicalEditorTheme__tableCellActionButtonContainer',\n tableCellEditing: 'LexicalEditorTheme__tableCellEditing',\n tableCellHeader: 'LexicalEditorTheme__tableCellHeader',\n tableCellPrimarySelected: 'LexicalEditorTheme__tableCellPrimarySelected',\n tableCellResizer: 'LexicalEditorTheme__tableCellResizer',\n tableCellSelected: 'LexicalEditorTheme__tableCellSelected',\n tableCellSortedIndicator: 'LexicalEditorTheme__tableCellSortedIndicator',\n tableResizeRuler: 'LexicalEditorTheme__tableCellResizeRuler',\n tableSelected: 'LexicalEditorTheme__tableSelected',\n text: {\n bold: 'LexicalEditorTheme__textBold',\n code: 'LexicalEditorTheme__textCode',\n italic: 'LexicalEditorTheme__textItalic',\n strikethrough: 'LexicalEditorTheme__textStrikethrough',\n subscript: 'LexicalEditorTheme__textSubscript',\n superscript: 'LexicalEditorTheme__textSuperscript',\n underline: 'LexicalEditorTheme__textUnderline',\n underlineStrikethrough: 'LexicalEditorTheme__textUnderlineStrikethrough',\n },\n upload: 'editor-upload',\n}\n"],"names":["LexicalEditorTheme","block","blockCursor","characterLimit","code","codeHighlight","atrule","attr","boolean","builtin","cdata","char","class","comment","constant","deleted","doctype","entity","function","important","inserted","keyword","namespace","number","operator","prolog","property","punctuation","regex","selector","string","symbol","tag","url","variable","embedBlock","base","focus","hashtag","heading","h1","h2","h3","h4","h5","h6","hr","indent","inlineImage","link","list","checklist","listitem","listitemChecked","listitemUnchecked","nested","olDepth","ul","ltr","mark","markOverlap","paragraph","quote","relationship","rtl","table","tableAddColumns","tableAddRows","tableCell","tableCellActionButton","tableCellActionButtonContainer","tableCellEditing","tableCellHeader","tableCellPrimarySelected","tableCellResizer","tableCellSelected","tableCellSortedIndicator","tableResizeRuler","tableSelected","text","bold","italic","strikethrough","subscript","superscript","underline","underlineStrikethrough","upload"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,OAAO,qBAAoB;AAE3B,OAAO,MAAMA,qBAAyC;IACpDC,OAAO;IACPC,aAAa;IACbC,gBAAgB;IAChBC,MAAM;IACNC,eAAe;QACbC,QAAQ;QACRC,MAAM;QACNC,SAAS;QACTC,SAAS;QACTC,OAAO;QACPC,MAAM;QACNC,OAAO;QACP,cAAc;QACdC,SAAS;QACTC,UAAU;QACVC,SAAS;QACTC,SAAS;QACTC,QAAQ;QACRC,UAAU;QACVC,WAAW;QACXC,UAAU;QACVC,SAAS;QACTC,WAAW;QACXC,QAAQ;QACRC,UAAU;QACVC,QAAQ;QACRC,UAAU;QACVC,aAAa;QACbC,OAAO;QACPC,UAAU;QACVC,QAAQ;QACRC,QAAQ;QACRC,KAAK;QACLC,KAAK;QACLC,UAAU;IACZ;IACAC,YAAY;QACVC,MAAM;QACNC,OAAO;IACT;IACAC,SAAS;IACTC,SAAS;QACPC,IAAI;QACJC,IAAI;QACJC,IAAI;QACJC,IAAI;QACJC,IAAI;QACJC,IAAI;IACN;IACAC,IAAI;IACJC,QAAQ;IACRC,aAAa;IACbC,MAAM;IACNC,MAAM;QACJC,WAAW;QACXC,UAAU;QACVC,iBAAiB;QACjBC,mBAAmB;QACnBC,QAAQ;YACNH,UAAU;QACZ;QACAI,SAAS;YACP;YACA;YACA;YACA;YACA;SACD;QACDC,IAAI;IACN;IACAC,KAAK;IACLC,MAAM;IACNC,aAAa;IACbC,WAAW;IACXC,OAAO;IACPC,cAAc;IACdC,KAAK;IACLC,OAAO;IACPC,iBAAiB;IACjBC,cAAc;IACdC,WAAW;IACXC,uBAAuB;IACvBC,gCAAgC;IAChCC,kBAAkB;IAClBC,iBAAiB;IACjBC,0BAA0B;IAC1BC,kBAAkB;IAClBC,mBAAmB;IACnBC,0BAA0B;IAC1BC,kBAAkB;IAClBC,eAAe;IACfC,MAAM;QACJC,MAAM;QACN5E,MAAM;QACN6E,QAAQ;QACRC,eAAe;QACfC,WAAW;QACXC,aAAa;QACbC,WAAW;QACXC,wBAAwB;IAC1B;IACAC,QAAQ;AACV,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/richtext-lexical",
3
- "version": "3.0.0-beta.40",
3
+ "version": "3.0.0-beta.41",
4
4
  "description": "The officially supported Lexical richtext adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -31,23 +31,23 @@
31
31
  "components.d.ts"
32
32
  ],
33
33
  "dependencies": {
34
- "@faceless-ui/modal": "2.0.2",
35
- "@faceless-ui/scroll-info": "1.3.0",
36
- "@lexical/headless": "0.15.0",
37
- "@lexical/link": "0.15.0",
38
- "@lexical/list": "0.15.0",
39
- "@lexical/mark": "0.15.0",
40
- "@lexical/markdown": "0.15.0",
41
- "@lexical/react": "0.15.0",
42
- "@lexical/rich-text": "0.15.0",
43
- "@lexical/selection": "0.15.0",
44
- "@lexical/utils": "0.15.0",
34
+ "@faceless-ui/modal": "2.1.0-rc.0",
35
+ "@faceless-ui/scroll-info": "1.4.0-rc.0",
36
+ "@lexical/headless": "0.16.0",
37
+ "@lexical/link": "0.16.0",
38
+ "@lexical/list": "0.16.0",
39
+ "@lexical/mark": "0.16.0",
40
+ "@lexical/markdown": "0.16.0",
41
+ "@lexical/react": "0.16.0",
42
+ "@lexical/rich-text": "0.16.0",
43
+ "@lexical/selection": "0.16.0",
44
+ "@lexical/utils": "0.16.0",
45
45
  "@types/uuid": "^9.0.8",
46
46
  "bson-objectid": "2.0.4",
47
47
  "classnames": "^2.3.2",
48
48
  "deep-equal": "2.2.3",
49
49
  "json-schema": "^0.4.0",
50
- "lexical": "0.15.0",
50
+ "lexical": "0.16.0",
51
51
  "lodash": "4.17.21",
52
52
  "react-error-boundary": "4.0.13",
53
53
  "uuid": "^9.0.1"
@@ -59,30 +59,30 @@
59
59
  "@types/react": "npm:types-react@19.0.0-beta.2",
60
60
  "@types/react-dom": "npm:types-react-dom@19.0.0-beta.2",
61
61
  "@payloadcms/eslint-config": "1.1.1",
62
- "@payloadcms/ui": "3.0.0-beta.40",
63
- "@payloadcms/next": "3.0.0-beta.40",
64
- "@payloadcms/translations": "3.0.0-beta.40",
65
- "payload": "3.0.0-beta.40"
62
+ "@payloadcms/next": "3.0.0-beta.41",
63
+ "@payloadcms/translations": "3.0.0-beta.41",
64
+ "@payloadcms/ui": "3.0.0-beta.41",
65
+ "payload": "3.0.0-beta.41"
66
66
  },
67
67
  "peerDependencies": {
68
- "@faceless-ui/modal": "2.0.2",
69
- "@faceless-ui/scroll-info": "1.3.0",
70
- "@lexical/headless": "0.15.0",
71
- "@lexical/link": "0.15.0",
72
- "@lexical/list": "0.15.0",
73
- "@lexical/mark": "0.15.0",
74
- "@lexical/markdown": "0.15.0",
75
- "@lexical/react": "0.15.0",
76
- "@lexical/rich-text": "0.15.0",
77
- "@lexical/selection": "0.15.0",
78
- "@lexical/utils": "0.15.0",
79
- "lexical": "0.15.0",
68
+ "@faceless-ui/modal": "2.1.0-rc.0",
69
+ "@faceless-ui/scroll-info": "1.4.0-rc.0",
70
+ "@lexical/headless": "0.16.0",
71
+ "@lexical/link": "0.16.0",
72
+ "@lexical/list": "0.16.0",
73
+ "@lexical/mark": "0.16.0",
74
+ "@lexical/markdown": "0.16.0",
75
+ "@lexical/react": "0.16.0",
76
+ "@lexical/rich-text": "0.16.0",
77
+ "@lexical/selection": "0.16.0",
78
+ "@lexical/utils": "0.16.0",
79
+ "lexical": "0.16.0",
80
80
  "react": "^19.0.0 || ^19.0.0-rc-f994737d14-20240522",
81
81
  "react-dom": "^19.0.0 || ^19.0.0-rc-f994737d14-20240522",
82
- "@payloadcms/next": "3.0.0-beta.40",
83
- "@payloadcms/translations": "3.0.0-beta.40",
84
- "@payloadcms/ui": "3.0.0-beta.40",
85
- "payload": "3.0.0-beta.40"
82
+ "@payloadcms/next": "3.0.0-beta.41",
83
+ "@payloadcms/translations": "3.0.0-beta.41",
84
+ "@payloadcms/ui": "3.0.0-beta.41",
85
+ "payload": "3.0.0-beta.41"
86
86
  },
87
87
  "engines": {
88
88
  "node": ">=18.20.2"