@uva-glass/component-library 1.62.1 → 1.62.3
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.
- package/dist/{Lexical.prod-qM_1BY0u.js → Lexical.prod-eo-UKDld.js} +23 -23
- package/dist/{Lexical.prod-qM_1BY0u.js.map → Lexical.prod-eo-UKDld.js.map} +1 -1
- package/dist/{LexicalUtils.prod-BFSPHHi1.js → LexicalUtils.prod-DzksRdFe.js} +2 -2
- package/dist/{LexicalUtils.prod-BFSPHHi1.js.map → LexicalUtils.prod-DzksRdFe.js.map} +1 -1
- package/dist/{ListPlugin-D-Ki_zib.js → ListPlugin-Bb5eekAl.js} +3 -3
- package/dist/{ListPlugin-D-Ki_zib.js.map → ListPlugin-Bb5eekAl.js.map} +1 -1
- package/dist/TablePlugin-B-Q_UBXj.js +308 -0
- package/dist/TablePlugin-B-Q_UBXj.js.map +1 -0
- package/dist/assets/EditorHeader.css +1 -1
- package/dist/assets/FormInput.css +1 -1
- package/dist/components/CheckboxTree/CheckboxTree.js +1 -1
- package/dist/components/FormInput/FormInput.js +18 -18
- package/dist/components/FormInput/FormInput.js.map +1 -1
- package/dist/components/FormInput/FormInput.stories.js.map +1 -1
- package/dist/components/InputField/InputField.stories.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.stories.js +1 -1
- package/dist/components/MultiSelect/components/MultiSelectHeader.js +1 -1
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +1 -1
- package/dist/components/RteEditor/EditorHeader/EditorHeader.js +3 -3
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +1 -1
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +2 -2
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkFrom.js +2 -2
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +85 -73
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js.map +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +1 -1
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +2 -2
- package/dist/components/RteEditor/Plugins/ListPlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +3 -3
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +4 -4
- package/dist/components/RteEditor/Plugins/index.js +2 -2
- package/dist/components/RteEditor/RteEditor.js +40 -40
- package/dist/components/RteEditor/hooks/useFlyout.d.ts +1 -1
- package/dist/components/RteEditor/hooks/useFlyout.js +8 -8
- package/dist/components/RteEditor/hooks/useFlyout.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/{helpers-BB6Byf50.js → helpers-BD3Y_bqE.js} +3 -3
- package/dist/{helpers-BB6Byf50.js.map → helpers-BD3Y_bqE.js.map} +1 -1
- package/dist/{helpers-D9T1Tgkj.js → helpers-DONVwywj.js} +3 -3
- package/dist/{helpers-D9T1Tgkj.js.map → helpers-DONVwywj.js.map} +1 -1
- package/dist/index.js +1 -1
- package/package.json +14 -14
- package/dist/TablePlugin-BvwAKpcu.js +0 -295
- package/dist/TablePlugin-BvwAKpcu.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkPlugin.js","sources":["../../../../../src/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.tsx"],"sourcesContent":["import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\nimport clsx from 'clsx';\nimport { $isLinkNode, $toggleLink, TOGGLE_LINK_COMMAND } from '@lexical/link';\nimport { useEffect, useRef, useState } from 'react';\nimport {\n $createTextNode,\n $getSelection,\n $isRangeSelection,\n CLICK_COMMAND,\n COMMAND_PRIORITY_EDITOR,\n KEY_DOWN_COMMAND,\n SELECTION_CHANGE_COMMAND,\n} from 'lexical';\n\nimport type { LinkNode } from '@lexical/link';\nimport type { ElementNode, TextNode } from 'lexical';\nimport type { addLinkFormMethods } from './AddLinkFrom';\n\nimport { AddLinkForm } from './AddLinkFrom';\nimport { ensureHttps } from './helpers';\n\nimport { useFlyout } from 'components/RteEditor/hooks/useFlyout';\nimport { Icon } from 'components';\nimport styles from 'components/RteEditor/RteEditor.module.css';\nimport { useTranslation } from 'components/RteEditor/hooks/useTranslation';\n\nconst PREVENT_OPEN_DELAY = 200;\n\nexport interface LinkType {\n active: boolean;\n url: string;\n linktext: string;\n}\n\nconst getLinkNode = (node: ElementNode | null): ElementNode | null => {\n let currentNode: TextNode | ElementNode | null = node;\n\n while (currentNode) {\n if ($isLinkNode(currentNode)) {\n return currentNode;\n }\n currentNode = currentNode.getParent();\n }\n\n return null;\n};\n\nexport const getLinkNodeTag = (anchorNode: ElementNode | TextNode): boolean | LinkType => {\n let currentNode: TextNode | ElementNode | null = anchorNode;\n\n while (currentNode) {\n if ($isLinkNode(currentNode)) {\n return {\n active: true,\n url: currentNode.getURL(),\n linktext: currentNode.getTextContent(),\n };\n }\n currentNode = currentNode.getParent();\n }\n\n return false;\n};\n\nexport const LinkPlugin = () => {\n const t = useTranslation();\n const [editor] = useLexicalComposerContext();\n const { flyout, showFlyout, closeFlyout, isVisible } = useFlyout();\n const addLinkForm = useRef<addLinkFormMethods>();\n const preventOpen = useRef(false);\n const previousLinkText = useRef('');\n const selectedText = useRef('');\n const [isLink, setIsLink] = useState<LinkType>({ active: false, url: '', linktext: '' });\n\n const openFlyout = () => {\n if (!preventOpen.current) {\n showFlyout(flyoutOptions);\n if (selectedText.current !== '') {\n setTimeout(() => addLinkForm.current?.setDefaults('', selectedText.current), 0);\n }\n }\n };\n\n const insertLink = (url: string, linktext: string) => {\n editor.update(() => {\n const selection = $getSelection();\n\n if ($isRangeSelection(selection)) {\n const anchor = selection.anchor;\n const node = anchor.getNode() as ElementNode;\n const linkNode = getLinkNode(node);\n\n if (linktext && linktext !== '') {\n if (linkNode) {\n const newTextNode = $createTextNode(linktext);\n linkNode.replace(newTextNode);\n newTextNode.select();\n }\n if (linktext !== previousLinkText.current && previousLinkText.current === '') {\n const { anchor, focus } = selection;\n selection.insertText(linktext);\n anchor.offset -= linktext.length;\n focus.offset = anchor.offset + linktext.length;\n }\n }\n $toggleLink(ensureHttps(url), { target: '_blank' });\n }\n\n closeFlyout();\n });\n };\n\n const removeLink = (): void => {\n editor.dispatchCommand(TOGGLE_LINK_COMMAND, null);\n closeFlyout();\n };\n\n const flyoutOptions = {\n children: (\n <AddLinkForm\n isLink={isLink}\n onCloseHandler={closeFlyout}\n onSaveHandler={(url, linktext) => insertLink(url, linktext)}\n onRemoveHandler={removeLink}\n ref={addLinkForm}\n />\n ),\n };\n\n useEffect(() => {\n if (!isVisible) {\n addLinkForm.current?.clearForm();\n previousLinkText.current = selectedText.current = '';\n setTimeout(() => (preventOpen.current = false), PREVENT_OPEN_DELAY);\n } else {\n preventOpen.current = true;\n addLinkForm.current?.focusFirstField();\n }\n }, [addLinkForm, isVisible]);\n\n useEffect(() => {\n const unregisterSelect = editor.registerCommand(\n SELECTION_CHANGE_COMMAND,\n () => {\n const selection = $getSelection();\n selectedText.current = selection?.getTextContent() ?? '';\n return false;\n },\n 0\n );\n\n const unregister = editor.registerCommand(\n CLICK_COMMAND,\n (event) => {\n const selection = $getSelection();\n if ($isRangeSelection(selection)) {\n const node = getLinkNodeTag(selection.anchor.getNode()) as LinkType;\n\n if (node) {\n event.preventDefault();\n event.stopPropagation();\n event.stopImmediatePropagation();\n showFlyout(flyoutOptions);\n previousLinkText.current = node.linktext;\n setTimeout(() => addLinkForm.current?.setDefaults(node.url, node.linktext), 0);\n return true;\n } else if (selection.getTextContent() !== '') {\n selectedText.current = selection.getTextContent();\n return true;\n }\n }\n return false;\n },\n 0\n );\n\n return () => {\n unregister();\n unregisterSelect();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [editor]);\n\n useEffect(() => {\n const removeKeyboardShortcut = editor.registerCommand(\n KEY_DOWN_COMMAND,\n (event: KeyboardEvent) => {\n if (event.ctrlKey && event.shiftKey && event.key === 'U') {\n const selection = $getSelection();\n\n if (!$isRangeSelection(selection)) {\n return false;\n }\n\n const node = getLinkNodeTag(selection.anchor.getNode()) as LinkType;\n\n const openFlyoutWithDefaults = (url = '', linkText = '') => {\n showFlyout(flyoutOptions);\n setTimeout(() => addLinkForm.current?.setDefaults(url, linkText), 0);\n };\n\n if (node) {\n event.preventDefault();\n event.stopPropagation();\n event.stopImmediatePropagation();\n\n previousLinkText.current = node.linktext;\n openFlyoutWithDefaults(node.url, node.linktext);\n\n return true;\n }\n\n const selectedTextContent = selection.getTextContent();\n if (selectedTextContent !== '') {\n selectedText.current = selectedTextContent;\n openFlyoutWithDefaults('', selectedText.current);\n\n return true;\n }\n\n showFlyout(flyoutOptions);\n return true;\n }\n return false;\n },\n COMMAND_PRIORITY_EDITOR\n );\n\n const removeStatusListener = editor.registerUpdateListener(({ editorState }) => {\n setIsLink(\n editorState.read(() => {\n const selection = $getSelection();\n\n if ($isRangeSelection(selection)) {\n const anchorNode = selection.anchor.getNode() as ElementNode;\n const linkNode = getLinkNode(anchorNode) as LinkNode;\n\n if (linkNode) {\n return {\n active: true,\n url: linkNode.getURL(),\n linktext: linkNode.getTextContent(),\n };\n }\n }\n\n return {\n active: false,\n url: '',\n linktext: '',\n };\n })\n );\n });\n\n return () => {\n removeKeyboardShortcut();\n removeStatusListener();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [editor]);\n\n useEffect(() => {\n const removeKeydown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n event.preventDefault();\n closeFlyout();\n }\n };\n\n document.addEventListener('keydown', removeKeydown);\n\n return () => {\n document.removeEventListener('keydown', removeKeydown);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n <div className={styles['editor__toolbar-button-group']}>\n <div className={styles['editor__toolbar-button-flyoutwrapper']}>\n <button\n onClick={openFlyout}\n title={t.links.linkTooltip}\n className={clsx(\n styles['editor__toolbar-button'],\n styles[`editor__toolbar-button--link`],\n isLink.active && styles['editor__toolbar-button--active']\n )}\n aria-label={t.aria.labels.link}\n aria-keyshortcuts={t.aria.keyshortcuts.link}\n type=\"button\"\n >\n <Icon name=\"Link\" size={20} />\n </button>\n {flyout}\n </div>\n </div>\n );\n};\n"],"names":["PREVENT_OPEN_DELAY","getLinkNode","node","currentNode","$isLinkNode","getLinkNodeTag","anchorNode","LinkPlugin","t","useTranslation","editor","useLexicalComposerContext","flyout","showFlyout","closeFlyout","isVisible","useFlyout","addLinkForm","useRef","preventOpen","previousLinkText","selectedText","isLink","setIsLink","useState","openFlyout","flyoutOptions","_a","insertLink","url","linktext","selection","$getSelection","$isRangeSelection","linkNode","newTextNode","$createTextNode","anchor","focus","$toggleLink","ensureHttps","jsx","AddLinkForm","TOGGLE_LINK_COMMAND","useEffect","_b","unregisterSelect","SELECTION_CHANGE_COMMAND","unregister","CLICK_COMMAND","event","removeKeyboardShortcut","KEY_DOWN_COMMAND","openFlyoutWithDefaults","linkText","selectedTextContent","COMMAND_PRIORITY_EDITOR","removeStatusListener","editorState","removeKeydown","styles","jsxs","clsx","Icon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAMA,IAAqB,KAQrBC,IAAc,CAACC,MAAiD;AACpE,MAAIC,IAA6CD;AAEjD,SAAOC,KAAa;AACd,QAAAC,EAAYD,CAAW;AAClB,aAAAA;AAET,IAAAA,IAAcA,EAAY;EAC5B;AAEO,SAAA;AACT,GAEaE,IAAiB,CAACC,MAA2D;AACxF,MAAIH,IAA6CG;AAEjD,SAAOH,KAAa;AACd,QAAAC,EAAYD,CAAW;AAClB,aAAA;AAAA,QACL,QAAQ;AAAA,QAC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,IACCnD;AAAA,EAAA,EACH,CAAA,EACF,CAAA;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"LinkPlugin.js","sources":["../../../../../src/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.tsx"],"sourcesContent":["import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\nimport clsx from 'clsx';\nimport { $isLinkNode, $toggleLink, TOGGLE_LINK_COMMAND } from '@lexical/link';\nimport { useEffect, useRef, useState } from 'react';\nimport {\n $createTextNode,\n $getSelection,\n $isRangeSelection,\n $setSelection,\n CLICK_COMMAND,\n COMMAND_PRIORITY_EDITOR,\n KEY_DOWN_COMMAND,\n SELECTION_CHANGE_COMMAND,\n} from 'lexical';\n\nimport type { LinkNode } from '@lexical/link';\nimport type { ElementNode, TextNode, BaseSelection } from 'lexical';\nimport type { addLinkFormMethods } from './AddLinkFrom';\n\nimport { AddLinkForm } from './AddLinkFrom';\nimport { ensureHttps } from './helpers';\n\nimport { useFlyout } from 'components/RteEditor/hooks/useFlyout';\nimport { Icon } from 'components';\nimport styles from 'components/RteEditor/RteEditor.module.css';\nimport { useTranslation } from 'components/RteEditor/hooks/useTranslation';\n\nconst PREVENT_OPEN_DELAY = 200;\n\nexport interface LinkType {\n active: boolean;\n url: string;\n linktext: string;\n}\n\nconst getLinkNode = (node: ElementNode | null): ElementNode | null => {\n let currentNode: TextNode | ElementNode | null = node;\n\n while (currentNode) {\n if ($isLinkNode(currentNode)) {\n return currentNode;\n }\n currentNode = currentNode.getParent();\n }\n\n return null;\n};\n\nexport const getLinkNodeTag = (anchorNode: ElementNode | TextNode): boolean | LinkType => {\n let currentNode: TextNode | ElementNode | null = anchorNode;\n\n while (currentNode) {\n if ($isLinkNode(currentNode)) {\n return {\n active: true,\n url: currentNode.getURL(),\n linktext: currentNode.getTextContent(),\n };\n }\n currentNode = currentNode.getParent();\n }\n\n return false;\n};\n\nexport const LinkPlugin = () => {\n const t = useTranslation();\n const [editor] = useLexicalComposerContext();\n const { flyout, showFlyout, hideFlyout, isVisible } = useFlyout();\n const addLinkForm = useRef<addLinkFormMethods>();\n const preventOpen = useRef(false);\n const previousLinkText = useRef('');\n const selectedText = useRef('');\n const [isLink, setIsLink] = useState<LinkType>({ active: false, url: '', linktext: '' });\n const storedSelection = useRef<BaseSelection | null>(null);\n\n const storeCursorPosition = () => {\n editor.update(() => {\n const selection = $getSelection();\n storedSelection.current = selection;\n });\n };\n\n const rePositionCursor = () => {\n editor.update(() => {\n if (storedSelection.current) {\n $setSelection(storedSelection.current);\n }\n });\n };\n\n const openFlyout = () => {\n if (!preventOpen.current) {\n storeCursorPosition();\n showFlyout(flyoutOptions);\n if (selectedText.current !== '') {\n setTimeout(() => addLinkForm.current?.setDefaults('', selectedText.current), 0);\n }\n }\n };\n\n const closeFlyout = () => {\n hideFlyout();\n rePositionCursor();\n };\n\n const insertLink = (url: string, linktext: string) => {\n editor.update(() => {\n const selection = $getSelection();\n\n if ($isRangeSelection(selection)) {\n const anchor = selection.anchor;\n const node = anchor.getNode() as ElementNode;\n const linkNode = getLinkNode(node);\n\n if (linktext && linktext !== '') {\n if (linkNode) {\n const newTextNode = $createTextNode(linktext);\n linkNode.replace(newTextNode);\n newTextNode.select();\n }\n if (linktext !== previousLinkText.current && previousLinkText.current === '') {\n const { anchor, focus } = selection;\n selection.insertText(linktext);\n anchor.offset -= linktext.length;\n focus.offset = anchor.offset + linktext.length;\n }\n }\n $toggleLink(ensureHttps(url), { target: '_blank' });\n }\n\n closeFlyout();\n });\n };\n\n const removeLink = (): void => {\n editor.dispatchCommand(TOGGLE_LINK_COMMAND, null);\n closeFlyout();\n };\n\n const flyoutOptions = {\n children: (\n <AddLinkForm\n isLink={isLink}\n onCloseHandler={closeFlyout}\n onSaveHandler={(url, linktext) => insertLink(url, linktext)}\n onRemoveHandler={removeLink}\n ref={addLinkForm}\n />\n ),\n };\n\n useEffect(() => {\n if (!isVisible) {\n addLinkForm.current?.clearForm();\n previousLinkText.current = selectedText.current = '';\n setTimeout(() => (preventOpen.current = false), PREVENT_OPEN_DELAY);\n } else {\n preventOpen.current = true;\n addLinkForm.current?.focusFirstField();\n }\n }, [addLinkForm, isVisible]);\n\n useEffect(() => {\n const unregisterSelect = editor.registerCommand(\n SELECTION_CHANGE_COMMAND,\n () => {\n const selection = $getSelection();\n selectedText.current = selection?.getTextContent() ?? '';\n return false;\n },\n 0\n );\n\n const unregisterClick = editor.registerCommand(\n CLICK_COMMAND,\n (event) => {\n const selection = $getSelection();\n if ($isRangeSelection(selection)) {\n storeCursorPosition();\n const node = getLinkNodeTag(selection.anchor.getNode()) as LinkType;\n\n if (node) {\n event.preventDefault();\n event.stopPropagation();\n event.stopImmediatePropagation();\n showFlyout(flyoutOptions);\n previousLinkText.current = node.linktext;\n setTimeout(() => addLinkForm.current?.setDefaults(node.url, node.linktext), 0);\n return true;\n } else if (selection.getTextContent() !== '') {\n selectedText.current = selection.getTextContent();\n return true;\n }\n }\n return false;\n },\n 0\n );\n\n return () => {\n unregisterClick();\n unregisterSelect();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [editor]);\n\n useEffect(() => {\n const removeKeyboardShortcut = editor.registerCommand(\n KEY_DOWN_COMMAND,\n (event: KeyboardEvent) => {\n if (event.ctrlKey && event.shiftKey && event.key === 'U') {\n const selection = $getSelection();\n storeCursorPosition();\n\n if (!$isRangeSelection(selection)) {\n return false;\n }\n\n const node = getLinkNodeTag(selection.anchor.getNode()) as LinkType;\n\n const openFlyoutWithDefaults = (url = '', linkText = '') => {\n showFlyout(flyoutOptions);\n setTimeout(() => addLinkForm.current?.setDefaults(url, linkText), 0);\n };\n\n if (node) {\n event.preventDefault();\n event.stopPropagation();\n event.stopImmediatePropagation();\n\n previousLinkText.current = node.linktext;\n openFlyoutWithDefaults(node.url, node.linktext);\n\n return true;\n }\n\n const selectedTextContent = selection.getTextContent();\n if (selectedTextContent !== '') {\n selectedText.current = selectedTextContent;\n openFlyoutWithDefaults('', selectedText.current);\n\n return true;\n }\n\n showFlyout(flyoutOptions);\n return true;\n }\n return false;\n },\n COMMAND_PRIORITY_EDITOR\n );\n\n const removeStatusListener = editor.registerUpdateListener(({ editorState }) => {\n setIsLink(\n editorState.read(() => {\n const selection = $getSelection();\n storeCursorPosition();\n\n if ($isRangeSelection(selection)) {\n const anchorNode = selection.anchor.getNode() as ElementNode;\n const linkNode = getLinkNode(anchorNode) as LinkNode;\n\n if (linkNode) {\n return {\n active: true,\n url: linkNode.getURL(),\n linktext: linkNode.getTextContent(),\n };\n }\n }\n\n return {\n active: false,\n url: '',\n linktext: '',\n };\n })\n );\n });\n\n return () => {\n removeKeyboardShortcut();\n removeStatusListener();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [editor]);\n\n useEffect(() => {\n const removeKeydown = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n event.preventDefault();\n event.stopPropagation();\n closeFlyout();\n }\n };\n\n document.addEventListener('keydown', removeKeydown);\n\n return () => {\n document.removeEventListener('keydown', removeKeydown);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return (\n <div className={styles['editor__toolbar-button-group']}>\n <div className={styles['editor__toolbar-button-flyoutwrapper']}>\n <button\n onClick={openFlyout}\n title={t.links.linkTooltip}\n className={clsx(\n styles['editor__toolbar-button'],\n styles[`editor__toolbar-button--link`],\n isLink.active && styles['editor__toolbar-button--active']\n )}\n aria-label={t.aria.labels.link}\n aria-keyshortcuts={t.aria.keyshortcuts.link}\n type=\"button\"\n >\n <Icon name=\"Link\" size={20} />\n </button>\n {flyout}\n </div>\n </div>\n );\n};\n"],"names":["PREVENT_OPEN_DELAY","getLinkNode","node","currentNode","$isLinkNode","getLinkNodeTag","anchorNode","LinkPlugin","t","useTranslation","editor","useLexicalComposerContext","flyout","showFlyout","hideFlyout","isVisible","useFlyout","addLinkForm","useRef","preventOpen","previousLinkText","selectedText","isLink","setIsLink","useState","storedSelection","storeCursorPosition","selection","$getSelection","rePositionCursor","$setSelection","openFlyout","flyoutOptions","_a","closeFlyout","insertLink","url","linktext","$isRangeSelection","linkNode","newTextNode","$createTextNode","anchor","focus","$toggleLink","ensureHttps","jsx","AddLinkForm","TOGGLE_LINK_COMMAND","useEffect","_b","unregisterSelect","SELECTION_CHANGE_COMMAND","unregisterClick","CLICK_COMMAND","event","removeKeyboardShortcut","KEY_DOWN_COMMAND","openFlyoutWithDefaults","linkText","selectedTextContent","COMMAND_PRIORITY_EDITOR","removeStatusListener","editorState","removeKeydown","styles","jsxs","clsx","Icon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAMA,KAAqB,KAQrBC,IAAc,CAACC,MAAiD;AACpE,MAAIC,IAA6CD;AAEjD,SAAOC,KAAa;AACd,QAAAC,EAAYD,CAAW;AAClB,aAAAA;AAET,IAAAA,IAAcA,EAAY;EAC5B;AAEO,SAAA;AACT,GAEaE,IAAiB,CAACC,MAA2D;AACxF,MAAIH,IAA6CG;AAEjD,SAAOH,KAAa;AACd,QAAAC,EAAYD,CAAW;AAClB,aAAA;AAAA,QACL,QAAQ;AAAA,QACR,KAAKA,EAAY,OAAO;AAAA,QACxB,UAAUA,EAAY,eAAe;AAAA,MAAA;AAGzC,IAAAA,IAAcA,EAAY;EAC5B;AAEO,SAAA;AACT,GAEaI,KAAa,MAAM;AAC9B,QAAMC,IAAIC,MACJ,CAACC,CAAM,IAAIC,KACX,EAAE,QAAAC,GAAQ,YAAAC,GAAY,YAAAC,GAAY,WAAAC,EAAA,IAAcC,KAChDC,IAAcC,KACdC,IAAcD,EAAO,EAAK,GAC1BE,IAAmBF,EAAO,EAAE,GAC5BG,IAAeH,EAAO,EAAE,GACxB,CAACI,GAAQC,CAAS,IAAIC,EAAmB,EAAE,QAAQ,IAAO,KAAK,IAAI,UAAU,GAAI,CAAA,GACjFC,IAAkBP,EAA6B,IAAI,GAEnDQ,IAAsB,MAAM;AAChC,IAAAhB,EAAO,OAAO,MAAM;AAClB,YAAMiB,IAAYC;AAClB,MAAAH,EAA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-Dyvim1tK.js";
|
|
3
|
-
import { L as f } from "../../../../ListPlugin-
|
|
3
|
+
import { L as f } from "../../../../ListPlugin-Bb5eekAl.js";
|
|
4
4
|
import "react";
|
|
5
5
|
import "../../../../clsx-OuTLNxxd.js";
|
|
6
|
-
import "../../../../Lexical.prod-
|
|
6
|
+
import "../../../../Lexical.prod-eo-UKDld.js";
|
|
7
7
|
import "../../../Icon/Icon.js";
|
|
8
8
|
import "../../../../RteEditor.module-BwAtWRHo.js";
|
|
9
9
|
import "../../hooks/useTranslation.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
|
-
import { b as v } from "../../../../TablePlugin-
|
|
3
|
+
import { b as v } from "../../../../TablePlugin-B-Q_UBXj.js";
|
|
4
4
|
import "../../../Buttons/Button.js";
|
|
5
5
|
import "../../../Buttons/LinkButton.js";
|
|
6
6
|
import "@react-aria/button";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
2
|
import "../../../../LexicalComposerContext.prod-Dyvim1tK.js";
|
|
3
3
|
import "../../../../clsx-OuTLNxxd.js";
|
|
4
|
-
import "../../../../helpers-
|
|
5
|
-
import "../../../../Lexical.prod-
|
|
4
|
+
import "../../../../helpers-DONVwywj.js";
|
|
5
|
+
import "../../../../Lexical.prod-eo-UKDld.js";
|
|
6
6
|
import "react";
|
|
7
|
-
import { T as B } from "../../../../TablePlugin-
|
|
7
|
+
import { T as B } from "../../../../TablePlugin-B-Q_UBXj.js";
|
|
8
8
|
import "../../hooks/useFlyout.js";
|
|
9
9
|
import "../../../Icon/Icon.js";
|
|
10
10
|
import "../../../Buttons/Button.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsxs as p, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { u as h } from "../../../../LexicalComposerContext.prod-Dyvim1tK.js";
|
|
3
|
-
import { A as d, x as b } from "../../../../Lexical.prod-
|
|
3
|
+
import { A as d, x as b } from "../../../../Lexical.prod-eo-UKDld.js";
|
|
4
4
|
import { useState as P, useRef as x, useCallback as T, useEffect as y } from "react";
|
|
5
|
-
import { g as A } from "../../../../helpers-
|
|
5
|
+
import { g as A } from "../../../../helpers-DONVwywj.js";
|
|
6
6
|
import { BlockFormatPlugin as B } from "../BlockFormatPlugin/BlockFormatPlugin.js";
|
|
7
|
-
import { L as C } from "../../../../ListPlugin-
|
|
7
|
+
import { L as C } from "../../../../ListPlugin-Bb5eekAl.js";
|
|
8
8
|
import { LinkPlugin as L } from "../LinkPlugin/LinkPlugin.js";
|
|
9
9
|
import { HistoryPlugin as N } from "../HistoryPlugin/HistoryPlugin.js";
|
|
10
|
-
import { T as k } from "../../../../TablePlugin-
|
|
10
|
+
import { T as k } from "../../../../TablePlugin-B-Q_UBXj.js";
|
|
11
11
|
import { TableCellContextMenu as j } from "../TablePlugin/TableCellContextMenu/TableCellContextMenu.js";
|
|
12
12
|
import { s as v } from "../../../../RteEditor.module-BwAtWRHo.js";
|
|
13
13
|
const D = ({ editorScrollPosition: u }) => {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ToolBarPlugin as e } from "./ToolbarPlugin/ToolbarPlugin.js";
|
|
2
2
|
import { BlockFormatPlugin as l } from "./BlockFormatPlugin/BlockFormatPlugin.js";
|
|
3
|
-
import { L as n } from "../../../ListPlugin-
|
|
3
|
+
import { L as n } from "../../../ListPlugin-Bb5eekAl.js";
|
|
4
4
|
import { LinkPlugin as m, getLinkNodeTag as x } from "./LinkPlugin/LinkPlugin.js";
|
|
5
5
|
import { HistoryPlugin as f } from "./HistoryPlugin/HistoryPlugin.js";
|
|
6
|
-
import { T as u } from "../../../TablePlugin-
|
|
6
|
+
import { T as u } from "../../../TablePlugin-B-Q_UBXj.js";
|
|
7
7
|
import { TableCellContextMenu as T } from "./TablePlugin/TableCellContextMenu/TableCellContextMenu.js";
|
|
8
8
|
export {
|
|
9
9
|
l as BlockFormatPlugin,
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { jsx as y, jsxs as F, Fragment as Fe } from "react/jsx-runtime";
|
|
2
2
|
import { l as Xe, o as Ye, u as R } from "../../LexicalComposerContext.prod-Dyvim1tK.js";
|
|
3
|
-
import { ak as Ie, w as A, F as fe, A as v, k as q, b as
|
|
3
|
+
import { ak as Ie, w as A, F as fe, A as v, k as q, b as H, D as Ge, c as P, x as C, al as Ke, am as Ze, L as p, a8 as Qe, S as I, G as et, an as tt, ao as nt, ap as rt, R as re, aq as ot, ar as it, af as st, ah as at, E as lt, a2 as ct, as as ut, at as ge, o as he, a7 as dt, a5 as ie, a6 as ft, n as Ae, au as ve, a1 as mt, a0 as pt, V as gt, X as Ce, Y as ht, av as vt, aw as Ct, ax as yt, u as Et, a9 as wt, d as bt, ay as $t, aa as St, a4 as _t, a3 as xt, r as kt, t as Lt, O as ye, az as Nt, j as Dt, K as V, $ as X, aA as Tt, aB as Pt, g as Rt, h as Mt, ae as Ot } from "../../Lexical.prod-eo-UKDld.js";
|
|
4
4
|
import * as se from "react";
|
|
5
|
-
import { useMemo as
|
|
6
|
-
import { L as z, i as K, e as At, t as me, r as zt, u as Ut } from "../../LexicalUtils.prod-
|
|
5
|
+
import { useMemo as W, useLayoutEffect as U, useEffect as k, useRef as Ft, useState as M, Suspense as It, forwardRef as ze, useCallback as Kt } from "react";
|
|
6
|
+
import { L as z, i as K, e as At, t as me, r as zt, u as Ut } from "../../LexicalUtils.prod-DzksRdFe.js";
|
|
7
7
|
import { r as Ee } from "../../index-DsprzSCj.js";
|
|
8
|
-
import { _ as we, O as be, L as $e, $ as Se, u as te, f as ne, h as Ue, K as Bt, n as _e, r as jt, j as qt, k as
|
|
9
|
-
import { J as Be, D as je, Z as Zt } from "../../ListPlugin-
|
|
10
|
-
import { a as qe, U as ke, m as ae, g as
|
|
8
|
+
import { _ as we, O as be, L as $e, $ as Se, u as te, f as ne, h as Ue, K as Bt, n as _e, r as jt, j as qt, k as Ht, l as Wt, F as Jt, m as xe, o as Vt, U as Xt, p as Yt, q as Gt } from "../../helpers-DONVwywj.js";
|
|
9
|
+
import { J as Be, D as je, Z as Zt } from "../../ListPlugin-Bb5eekAl.js";
|
|
10
|
+
import { a as qe, U as ke, m as ae, g as Qt, b as en, F as tn, M as nn, f as rn } from "../../helpers-BD3Y_bqE.js";
|
|
11
11
|
import { c as on } from "../../clsx-OuTLNxxd.js";
|
|
12
12
|
import { s as T } from "../../RteEditor.module-BwAtWRHo.js";
|
|
13
13
|
import { ToolBarPlugin as sn } from "./Plugins/ToolbarPlugin/ToolbarPlugin.js";
|
|
14
14
|
import { Icon as an } from "../Icon/Icon.js";
|
|
15
15
|
import { useTranslation as ln } from "./hooks/useTranslation.js";
|
|
16
|
-
import "../../TablePlugin-
|
|
16
|
+
import "../../TablePlugin-B-Q_UBXj.js";
|
|
17
17
|
import "./hooks/components/Flyout.js";
|
|
18
18
|
import "../Buttons/Button.js";
|
|
19
19
|
import "../Buttons/LinkButton.js";
|
|
@@ -34,9 +34,9 @@ import "../../SortableProvider-BUsvniX7.js";
|
|
|
34
34
|
import { UvaTheme as cn } from "./UvaTheme/UvaTheme.js";
|
|
35
35
|
import { EditorHeader as un } from "./EditorHeader/EditorHeader.js";
|
|
36
36
|
import { useLanguage as dn, LanguageProvider as fn } from "./Providers/LanguageProvider.js";
|
|
37
|
-
const
|
|
37
|
+
const He = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, mn = He ? U : k, Y = { tag: "history-merge" };
|
|
38
38
|
function pn({ initialConfig: e, children: t }) {
|
|
39
|
-
const n =
|
|
39
|
+
const n = W(() => {
|
|
40
40
|
const { theme: r, namespace: i, nodes: o, onError: s, editorState: a, html: l } = e, c = Ye(null, r), u = Ie({ editable: e.editable, html: l, namespace: i, nodes: o, onError: (d) => s(d, u), theme: r });
|
|
41
41
|
return function(d, f) {
|
|
42
42
|
if (f !== null) {
|
|
@@ -45,7 +45,7 @@ function pn({ initialConfig: e, children: t }) {
|
|
|
45
45
|
if (m.isEmpty()) {
|
|
46
46
|
const g = fe();
|
|
47
47
|
m.append(g);
|
|
48
|
-
const h =
|
|
48
|
+
const h = He ? document.activeElement : null;
|
|
49
49
|
(v() !== null || h !== null && h === d.getRootElement()) && g.select();
|
|
50
50
|
}
|
|
51
51
|
}, Y);
|
|
@@ -77,7 +77,7 @@ function hn(e) {
|
|
|
77
77
|
}
|
|
78
78
|
function vn() {
|
|
79
79
|
return function(e) {
|
|
80
|
-
const [t] = R(), n =
|
|
80
|
+
const [t] = R(), n = W(() => e(t), [t, e]), r = Ft(n.initialValueFn()), [i, o] = M(r.current);
|
|
81
81
|
return gn(() => {
|
|
82
82
|
const { initialValueFn: s, subscribe: a } = n, l = s();
|
|
83
83
|
return r.current !== l && (r.current = l, o(l)), a((c) => {
|
|
@@ -101,8 +101,8 @@ function En(e) {
|
|
|
101
101
|
for (let r = 0; r < n; r++) {
|
|
102
102
|
const i = t[r];
|
|
103
103
|
if (q(i)) return !1;
|
|
104
|
-
if (
|
|
105
|
-
if (!
|
|
104
|
+
if (H(i)) {
|
|
105
|
+
if (!Ge(i) || i.__indent !== 0) return !1;
|
|
106
106
|
const o = i.getChildren(), s = o.length;
|
|
107
107
|
for (let a = 0; a < s; a++) {
|
|
108
108
|
const l = o[r];
|
|
@@ -112,7 +112,7 @@ function En(e) {
|
|
|
112
112
|
}
|
|
113
113
|
return !0;
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function We(e) {
|
|
116
116
|
return () => En(e);
|
|
117
117
|
}
|
|
118
118
|
function wn(e) {
|
|
@@ -177,7 +177,7 @@ function Le(e, t) {
|
|
|
177
177
|
return null;
|
|
178
178
|
}
|
|
179
179
|
const B = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0, $n = B && "documentMode" in document ? document.documentMode : null, Sn = !(!B || !("InputEvent" in window) || $n) && "getTargetRanges" in new window.InputEvent("input"), _n = B && /Version\/[\d.]+.*Safari/.test(navigator.userAgent), xn = B && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream, kn = B && /^(?=.*Chrome).*/i.test(navigator.userAgent), Ln = B && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && !kn, Ne = Lt();
|
|
180
|
-
function
|
|
180
|
+
function G(e) {
|
|
181
181
|
let t = null;
|
|
182
182
|
if (K(e, DragEvent) ? t = e.dataTransfer : K(e, ClipboardEvent) && (t = e.clipboardData), t === null) return [!1, [], !1];
|
|
183
183
|
const n = t.types, r = n.includes("Files"), i = n.includes("text/html") || n.includes("text/plain");
|
|
@@ -190,7 +190,7 @@ function De(e) {
|
|
|
190
190
|
for (let i = 0; i < r.length; i++) {
|
|
191
191
|
const o = r[i], s = o.getKey();
|
|
192
192
|
if (n.has(s)) continue;
|
|
193
|
-
const a = me(o, (c) =>
|
|
193
|
+
const a = me(o, (c) => H(c) && !c.isInline());
|
|
194
194
|
if (a === null) continue;
|
|
195
195
|
const l = a.getKey();
|
|
196
196
|
a.canIndent() && !n.has(l) && (n.add(l), e(a));
|
|
@@ -238,7 +238,7 @@ function Nn(e) {
|
|
|
238
238
|
if (!C(n) && !I(n)) return !1;
|
|
239
239
|
const r = n.getNodes();
|
|
240
240
|
for (const i of r) {
|
|
241
|
-
const o = me(i, (s) =>
|
|
241
|
+
const o = me(i, (s) => H(s) && !s.isInline());
|
|
242
242
|
o !== null && o.setFormat(t);
|
|
243
243
|
}
|
|
244
244
|
return !0;
|
|
@@ -322,7 +322,7 @@ function Nn(e) {
|
|
|
322
322
|
const t = v();
|
|
323
323
|
return !!C(t) && (e.blur(), !0);
|
|
324
324
|
}, p), e.registerCommand(it, (t) => {
|
|
325
|
-
const [, n] =
|
|
325
|
+
const [, n] = G(t);
|
|
326
326
|
if (n.length > 0) {
|
|
327
327
|
const i = Le(t.clientX, t.clientY);
|
|
328
328
|
if (i !== null) {
|
|
@@ -344,10 +344,10 @@ function Nn(e) {
|
|
|
344
344
|
const r = v();
|
|
345
345
|
return !!C(r);
|
|
346
346
|
}, p), e.registerCommand(ot, (t) => {
|
|
347
|
-
const [n] =
|
|
347
|
+
const [n] = G(t), r = v();
|
|
348
348
|
return !(n && !C(r));
|
|
349
349
|
}, p), e.registerCommand(rt, (t) => {
|
|
350
|
-
const [n] =
|
|
350
|
+
const [n] = G(t), r = v();
|
|
351
351
|
if (n && !C(r)) return !1;
|
|
352
352
|
const i = Le(t.clientX, t.clientY);
|
|
353
353
|
if (i !== null) {
|
|
@@ -355,13 +355,13 @@ function Nn(e) {
|
|
|
355
355
|
q(o) && t.preventDefault();
|
|
356
356
|
}
|
|
357
357
|
return !0;
|
|
358
|
-
}, p), e.registerCommand(tt, () => (nt(), !0), p), e.registerCommand(et, (t) => (be(e, K(t, ClipboardEvent) ? t : null), !0), p), e.registerCommand(
|
|
358
|
+
}, p), e.registerCommand(tt, () => (nt(), !0), p), e.registerCommand(et, (t) => (be(e, K(t, ClipboardEvent) ? t : null), !0), p), e.registerCommand(Qe, (t) => (async function(n, r) {
|
|
359
359
|
await be(r, K(n, ClipboardEvent) ? n : null), r.update(() => {
|
|
360
360
|
const i = v();
|
|
361
361
|
C(i) ? i.removeText() : I(i) && i.getNodes().forEach((o) => o.remove());
|
|
362
362
|
});
|
|
363
363
|
}(t, e), !0), p), e.registerCommand(Ke, (t) => {
|
|
364
|
-
const [, n, r] =
|
|
364
|
+
const [, n, r] = G(t);
|
|
365
365
|
return n.length > 0 && !r ? (e.dispatchCommand(Ne, n), !0) : Ze(t.target) ? !1 : v() !== null && (function(i, o) {
|
|
366
366
|
i.preventDefault(), o.update(() => {
|
|
367
367
|
const s = v(), a = K(i, InputEvent) || K(i, KeyboardEvent) ? null : i.clipboardData;
|
|
@@ -372,7 +372,7 @@ function Nn(e) {
|
|
|
372
372
|
}
|
|
373
373
|
const le = typeof window < "u" && window.document !== void 0 && window.document.createElement !== void 0 ? U : k;
|
|
374
374
|
function Te(e) {
|
|
375
|
-
return e.getEditorState().read(
|
|
375
|
+
return e.getEditorState().read(We(e.isComposing()));
|
|
376
376
|
}
|
|
377
377
|
function Dn({ contentEditable: e, placeholder: t = null, ErrorBoundary: n }) {
|
|
378
378
|
const [r] = R(), i = function(o, s) {
|
|
@@ -383,7 +383,7 @@ function Dn({ contentEditable: e, placeholder: t = null, ErrorBoundary: n }) {
|
|
|
383
383
|
});
|
|
384
384
|
}), [o]), k(() => {
|
|
385
385
|
l(o.getDecorators());
|
|
386
|
-
}, [o]),
|
|
386
|
+
}, [o]), W(() => {
|
|
387
387
|
const c = [], u = Object.keys(a);
|
|
388
388
|
for (let d = 0; d < u.length; d++) {
|
|
389
389
|
const f = u[d], m = y(s, { onError: (h) => o._onError(h), children: y(It, { fallback: null, children: a[f] }) }), g = o.getElementByKey(f);
|
|
@@ -417,7 +417,7 @@ const Je = typeof window < "u" && window.document !== void 0 && window.document.
|
|
|
417
417
|
function Pn({ editor: e, ariaActiveDescendant: t, ariaAutoComplete: n, ariaControls: r, ariaDescribedBy: i, ariaErrorMessage: o, ariaExpanded: s, ariaInvalid: a, ariaLabel: l, ariaLabelledBy: c, ariaMultiline: u, ariaOwns: d, ariaRequired: f, autoCapitalize: m, className: g, id: h, role: $ = "textbox", spellCheck: E = !0, style: b, tabIndex: w, "data-testid": _, ...L }, x) {
|
|
418
418
|
const [S, N] = M(e.isEditable()), j = Kt((O) => {
|
|
419
419
|
O && O.ownerDocument && O.ownerDocument.defaultView ? e.setRootElement(O) : e.setRootElement(null);
|
|
420
|
-
}, [e]), oe =
|
|
420
|
+
}, [e]), oe = W(() => /* @__PURE__ */ function(...O) {
|
|
421
421
|
return (pe) => {
|
|
422
422
|
O.forEach((J) => {
|
|
423
423
|
typeof J == "function" ? J(pe) : J != null && (J.current = pe);
|
|
@@ -430,7 +430,7 @@ function Pn({ editor: e, ariaActiveDescendant: t, ariaAutoComplete: n, ariaContr
|
|
|
430
430
|
}
|
|
431
431
|
const Rn = ze(Pn);
|
|
432
432
|
function Pe(e) {
|
|
433
|
-
return e.getEditorState().read(
|
|
433
|
+
return e.getEditorState().read(We(e.isComposing()));
|
|
434
434
|
}
|
|
435
435
|
const Mn = ze(On);
|
|
436
436
|
function On(e, t) {
|
|
@@ -535,7 +535,7 @@ function Bn({ validateUrl: e, attributes: t }) {
|
|
|
535
535
|
const o = r;
|
|
536
536
|
if (o.clipboardData === null) return !1;
|
|
537
537
|
const s = o.clipboardData.getData("text");
|
|
538
|
-
return !!e(s) && !i.getNodes().some((a) =>
|
|
538
|
+
return !!e(s) && !i.getNodes().some((a) => H(a)) && (n.dispatchCommand(ke, { ...t, url: s }), r.preventDefault(), !0);
|
|
539
539
|
}, ye) : () => {
|
|
540
540
|
});
|
|
541
541
|
}, [n, e, t]), null;
|
|
@@ -552,8 +552,8 @@ function jn({ newTab: e = !0, disabled: t = !1 }) {
|
|
|
552
552
|
if (a.update(() => {
|
|
553
553
|
const f = re(s);
|
|
554
554
|
if (f !== null) {
|
|
555
|
-
const m = me(f,
|
|
556
|
-
if (!t) if (
|
|
555
|
+
const m = me(f, H);
|
|
556
|
+
if (!t) if (Qt(m)) l = m.sanitizeUrl(m.getURL()), c = m.getTarget();
|
|
557
557
|
else {
|
|
558
558
|
const g = function(h, $) {
|
|
559
559
|
let E = h;
|
|
@@ -579,7 +579,7 @@ function jn({ newTab: e = !0, disabled: t = !1 }) {
|
|
|
579
579
|
});
|
|
580
580
|
}, [n, e, t]), null;
|
|
581
581
|
}
|
|
582
|
-
const
|
|
582
|
+
const Q = 0, ue = 1, de = 2, D = 0, qn = 1, Me = 2, Hn = 3, Wn = 4;
|
|
583
583
|
function Jn(e, t, n, r, i) {
|
|
584
584
|
if (e === null || n.size === 0 && r.size === 0 && !i) return D;
|
|
585
585
|
const o = t._selection, s = e._selection;
|
|
@@ -610,7 +610,7 @@ function Jn(e, t, n, r, i) {
|
|
|
610
610
|
const f = o.anchor, m = s.anchor;
|
|
611
611
|
if (f.key !== m.key || f.type !== "text") return D;
|
|
612
612
|
const g = f.offset, h = m.offset, $ = d.length - u.length;
|
|
613
|
-
return $ === 1 && h === g - 1 ? Me : $ === -1 && h === g + 1 ?
|
|
613
|
+
return $ === 1 && h === g - 1 ? Me : $ === -1 && h === g + 1 ? Hn : $ === -1 && h === g ? Wn : D;
|
|
614
614
|
}
|
|
615
615
|
function Vn(e, t) {
|
|
616
616
|
let n = Date.now(), r = D;
|
|
@@ -619,13 +619,13 @@ function Vn(e, t) {
|
|
|
619
619
|
if (c.has("historic")) return r = D, n = u, de;
|
|
620
620
|
const d = Jn(i, o, a, l, e.isComposing()), f = (() => {
|
|
621
621
|
const m = s === null || s.editor === e, g = c.has("history-push");
|
|
622
|
-
if (!g && m && c.has("history-merge")) return
|
|
622
|
+
if (!g && m && c.has("history-merge")) return Q;
|
|
623
623
|
if (i === null) return ue;
|
|
624
624
|
const h = o._selection;
|
|
625
625
|
return a.size > 0 || l.size > 0 ? g === !1 && d !== D && d === r && u < n + t && m || a.size === 1 && function($, E, b) {
|
|
626
626
|
const w = E._nodeMap.get($), _ = b._nodeMap.get($), L = E._selection, x = b._selection;
|
|
627
627
|
return !(C(L) && C(x) && L.anchor.type === "element" && L.focus.type === "element" && x.anchor.type === "text" && x.focus.type === "text" || !P(w) || !P(_) || w.__parent !== _.__parent) && JSON.stringify(E.read(() => w.exportJSON())) === JSON.stringify(b.read(() => _.exportJSON()));
|
|
628
|
-
}(Array.from(a)[0], i, o) ?
|
|
628
|
+
}(Array.from(a)[0], i, o) ? Q : ue : h !== null ? Q : de;
|
|
629
629
|
})();
|
|
630
630
|
return n = u, r = d, f;
|
|
631
631
|
};
|
|
@@ -661,10 +661,10 @@ function Xn(e, t, n) {
|
|
|
661
661
|
function Yn() {
|
|
662
662
|
return { current: null, redoStack: [], undoStack: [] };
|
|
663
663
|
}
|
|
664
|
-
function
|
|
664
|
+
function Gn({ delay: e, externalHistoryState: t }) {
|
|
665
665
|
const [n] = R();
|
|
666
666
|
return function(r, i, o = 1e3) {
|
|
667
|
-
const s =
|
|
667
|
+
const s = W(() => i || Yn(), [i]);
|
|
668
668
|
k(() => Xn(r, s, o), [o, r, s]);
|
|
669
669
|
}(n, t, e), null;
|
|
670
670
|
}
|
|
@@ -677,7 +677,7 @@ var ee = Zn(function(e) {
|
|
|
677
677
|
for (let n = 1; n < arguments.length; n++) t.append("v", arguments[n]);
|
|
678
678
|
throw Error(`Minified Lexical error #${e}; visit https://lexical.dev/docs/error?${t} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
|
|
679
679
|
});
|
|
680
|
-
function
|
|
680
|
+
function Qn({ hasCellMerge: e = !0, hasCellBackgroundColor: t = !0, hasTabHandler: n = !0 }) {
|
|
681
681
|
const [r] = R();
|
|
682
682
|
return k(() => (r.hasNodes([te, ne, Ue]) || ee(10), z(r.registerCommand(jt, ({ columns: i, rows: o, includeHeaders: s }) => {
|
|
683
683
|
const a = qt(Number(o), Number(i), s);
|
|
@@ -704,7 +704,7 @@ function Gn({ hasCellMerge: e = !0, hasCellBackgroundColor: t = !0, hasTabHandle
|
|
|
704
704
|
const u = i.get(l), d = r.getElementByKey(l);
|
|
705
705
|
u && d === u[1] || (u && (u[0].removeListeners(), i.delete(l)), d !== null && r.getEditorState().read(() => {
|
|
706
706
|
const f = Ot(l);
|
|
707
|
-
|
|
707
|
+
Ht(f) && o(f, l, d);
|
|
708
708
|
}));
|
|
709
709
|
} else if (c === "destroyed") {
|
|
710
710
|
const u = i.get(l);
|
|
@@ -718,7 +718,7 @@ function Gn({ hasCellMerge: e = !0, hasCellBackgroundColor: t = !0, hasTabHandle
|
|
|
718
718
|
}, [r, n]), k(() => {
|
|
719
719
|
if (!e) return r.registerNodeTransform(ne, (i) => {
|
|
720
720
|
if (i.getColSpan() > 1 || i.getRowSpan() > 1) {
|
|
721
|
-
const [, , o] =
|
|
721
|
+
const [, , o] = Wt(i), [s] = Jt(o, i, i), a = s.length, l = s[0].length;
|
|
722
722
|
let c = o.getFirstChild();
|
|
723
723
|
xe(c) || ee(175);
|
|
724
724
|
const u = [];
|
|
@@ -781,7 +781,7 @@ const Ve = 200, er = (e) => /^<(b|i|u|strong|em|mark|small|del|ins|sub|sup|div|p
|
|
|
781
781
|
w.read(() => {
|
|
782
782
|
let L = "";
|
|
783
783
|
const x = A().getTextContent().replace(/\s+/g, " ").trim();
|
|
784
|
-
x.trim().length === 0 ? g(0) : (g(x.split(" ").length), L =
|
|
784
|
+
x.trim().length === 0 ? g(0) : (g(x.split(" ").length), L = Gt(_)), c(L);
|
|
785
785
|
});
|
|
786
786
|
};
|
|
787
787
|
return k(() => {
|
|
@@ -819,8 +819,8 @@ const Ve = 200, er = (e) => /^<(b|i|u|strong|em|mark|small|del|ins|sub|sup|div|p
|
|
|
819
819
|
ErrorBoundary: Kn
|
|
820
820
|
}
|
|
821
821
|
),
|
|
822
|
-
/* @__PURE__ */ y(Gn, {}),
|
|
823
822
|
/* @__PURE__ */ y(Qn, {}),
|
|
823
|
+
/* @__PURE__ */ y(Gn, {}),
|
|
824
824
|
/* @__PURE__ */ y(Un, {}),
|
|
825
825
|
/* @__PURE__ */ y(Bn, { validateUrl: en }),
|
|
826
826
|
/* @__PURE__ */ y(tn, { matchers: nn }),
|
|
@@ -6,7 +6,7 @@ interface FlyoutOptions {
|
|
|
6
6
|
export interface FlyoutHookResult {
|
|
7
7
|
flyout: ReactNode;
|
|
8
8
|
showFlyout: (options: FlyoutOptions) => void;
|
|
9
|
-
|
|
9
|
+
hideFlyout: () => void;
|
|
10
10
|
isVisible: boolean;
|
|
11
11
|
}
|
|
12
12
|
export declare const useFlyout: () => FlyoutHookResult;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useRef as
|
|
1
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as c, useState as n } from "react";
|
|
3
3
|
import { Flyout as m } from "./components/Flyout.js";
|
|
4
4
|
import { useOnClickOutside as p } from "../../hooks/useOnClickOuside.js";
|
|
5
5
|
const b = () => {
|
|
6
|
-
const
|
|
6
|
+
const o = c(null), [s, e] = n(!1), [t, l] = n({
|
|
7
7
|
children: null
|
|
8
8
|
}), r = (u) => {
|
|
9
|
-
e(!0), l({ ...
|
|
9
|
+
e(!0), l({ ...t, ...u });
|
|
10
10
|
}, i = () => {
|
|
11
|
-
e(!1), l({ ...
|
|
11
|
+
e(!1), l({ ...t });
|
|
12
12
|
};
|
|
13
|
-
return p(
|
|
14
|
-
flyout: /* @__PURE__ */
|
|
13
|
+
return p(o, i), {
|
|
14
|
+
flyout: /* @__PURE__ */ f(m, { visible: s, ref: o, children: t.children }),
|
|
15
15
|
showFlyout: r,
|
|
16
|
-
|
|
16
|
+
hideFlyout: i,
|
|
17
17
|
isVisible: s
|
|
18
18
|
};
|
|
19
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFlyout.js","sources":["../../../../src/components/RteEditor/hooks/useFlyout.tsx"],"sourcesContent":["import { useRef, useState } from 'react';\n\nimport type { ReactNode } from 'react';\n\nimport { Flyout } from './components/Flyout';\n\nimport { useOnClickOutside } from 'components/hooks/useOnClickOuside';\n\ninterface FlyoutOptions {\n children?: ReactNode;\n exludeNodeOutside?: HTMLElement;\n}\n\nexport interface FlyoutHookResult {\n flyout: ReactNode;\n showFlyout: (options: FlyoutOptions) => void;\n
|
|
1
|
+
{"version":3,"file":"useFlyout.js","sources":["../../../../src/components/RteEditor/hooks/useFlyout.tsx"],"sourcesContent":["import { useRef, useState } from 'react';\n\nimport type { ReactNode } from 'react';\n\nimport { Flyout } from './components/Flyout';\n\nimport { useOnClickOutside } from 'components/hooks/useOnClickOuside';\n\ninterface FlyoutOptions {\n children?: ReactNode;\n exludeNodeOutside?: HTMLElement;\n}\n\nexport interface FlyoutHookResult {\n flyout: ReactNode;\n showFlyout: (options: FlyoutOptions) => void;\n hideFlyout: () => void;\n isVisible: boolean;\n}\n\nexport const useFlyout = (): FlyoutHookResult => {\n const flyoutRef = useRef<HTMLDivElement>(null);\n const [visible, setVisible] = useState(false);\n const [options, setOptions] = useState<FlyoutOptions>({\n children: null,\n });\n\n const showFlyout = (customOptions: FlyoutOptions): void => {\n setVisible(true);\n setOptions({ ...options, ...customOptions });\n };\n\n const hideFlyout = (): void => {\n setVisible(false);\n setOptions({ ...options });\n };\n\n useOnClickOutside(flyoutRef, hideFlyout);\n\n const flyout = (\n <Flyout visible={visible} ref={flyoutRef}>\n {options.children}\n </Flyout>\n );\n\n return {\n flyout,\n showFlyout,\n hideFlyout,\n isVisible: visible,\n };\n};\n"],"names":["useFlyout","flyoutRef","useRef","visible","setVisible","useState","options","setOptions","showFlyout","customOptions","hideFlyout","useOnClickOutside","jsx","Flyout"],"mappings":";;;;AAoBO,MAAMA,IAAY,MAAwB;AACzC,QAAAC,IAAYC,EAAuB,IAAI,GACvC,CAACC,GAASC,CAAU,IAAIC,EAAS,EAAK,GACtC,CAACC,GAASC,CAAU,IAAIF,EAAwB;AAAA,IACpD,UAAU;AAAA,EAAA,CACX,GAEKG,IAAa,CAACC,MAAuC;AACzD,IAAAL,EAAW,EAAI,GACfG,EAAW,EAAE,GAAGD,GAAS,GAAGG,EAAe,CAAA;AAAA,EAAA,GAGvCC,IAAa,MAAY;AAC7B,IAAAN,EAAW,EAAK,GACLG,EAAA,EAAE,GAAGD,EAAA,CAAS;AAAA,EAAA;AAG3B,SAAAK,EAAkBV,GAAWS,CAAU,GAQhC;AAAA,IACL,QANC,gBAAAE,EAAAC,GAAA,EAAO,SAAAV,GAAkB,KAAKF,GAC5B,YAAQ,SACX,CAAA;AAAA,IAKA,YAAAO;AAAA,IACA,YAAAE;AAAA,IACA,WAAWP;AAAA,EAAA;AAEf;"}
|
package/dist/components/index.js
CHANGED
|
@@ -30,7 +30,7 @@ import { Label as po } from "./Label/Label.js";
|
|
|
30
30
|
import { MenuLink as mo } from "./MenuLink/MenuLink.js";
|
|
31
31
|
import { MetaDataList as io } from "./MetaDataList/MetaDataList.js";
|
|
32
32
|
import { ModalDialog as no } from "./ModalDialog/ModalDialog.js";
|
|
33
|
-
import { M as uo } from "../TablePlugin-
|
|
33
|
+
import { M as uo } from "../TablePlugin-B-Q_UBXj.js";
|
|
34
34
|
import { OverlayCloseButton as so } from "./OverlayCloseButton/OverlayCloseButton.js";
|
|
35
35
|
import { PageOverlay as So } from "./PageOverlay/PageOverlay.js";
|
|
36
36
|
import { Periods as ko } from "./Periods/Periods.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as J, t as j, L as G } from "./LexicalUtils.prod-
|
|
2
|
-
import { y as H, x as L, j as X, f as E, b as S, t as K, A as N, O as q, Z as Q, c as x, l as D, S as V, U as I } from "./Lexical.prod-
|
|
1
|
+
import { $ as J, t as j, L as G } from "./LexicalUtils.prod-DzksRdFe.js";
|
|
2
|
+
import { y as H, x as L, j as X, f as E, b as S, t as K, A as N, O as q, Z as Q, c as x, l as D, S as V, U as I } from "./Lexical.prod-eo-UKDld.js";
|
|
3
3
|
import { u as Y } from "./LexicalComposerContext.prod-Dyvim1tK.js";
|
|
4
4
|
import { useEffect as tt } from "react";
|
|
5
5
|
const et = /* @__PURE__ */ new Set(["http:", "https:", "mailto:", "sms:", "tel:"]);
|
|
@@ -364,4 +364,4 @@ export {
|
|
|
364
364
|
wt as m,
|
|
365
365
|
Tt as v
|
|
366
366
|
};
|
|
367
|
-
//# sourceMappingURL=helpers-
|
|
367
|
+
//# sourceMappingURL=helpers-BD3Y_bqE.js.map
|