@uva-glass/component-library 3.55.2 → 3.55.4
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-DCGjHGxG.js → Lexical.prod-DIglXatJ.js} +958 -947
- package/dist/Lexical.prod-DIglXatJ.js.map +1 -0
- package/dist/LexicalClipboard.prod-Bnzu0sh_.js +248 -0
- package/dist/{LexicalClipboard.prod-CGG14aoP.js.map → LexicalClipboard.prod-Bnzu0sh_.js.map} +1 -1
- package/dist/{LexicalExtension.prod-DWt1IjPF.js → LexicalExtension.prod-COPHoPpX.js} +320 -288
- package/dist/LexicalExtension.prod-COPHoPpX.js.map +1 -0
- package/dist/{LexicalLink.prod-Dy1gE75H.js → LexicalLink.prod-Bf9JUdMv.js} +216 -198
- package/dist/LexicalLink.prod-Bf9JUdMv.js.map +1 -0
- package/dist/{LexicalList.prod-D9R0L7cu.js → LexicalList.prod-DRz8vsM9.js} +247 -241
- package/dist/LexicalList.prod-DRz8vsM9.js.map +1 -0
- package/dist/{LexicalTable.prod-C2FP47Lm.js → LexicalTable.prod-D16GW-aZ.js} +741 -729
- package/dist/LexicalTable.prod-D16GW-aZ.js.map +1 -0
- package/dist/LexicalUtils.prod-BBTLliac.js +360 -0
- package/dist/LexicalUtils.prod-BBTLliac.js.map +1 -0
- package/dist/{LinkContextMenu-DZlKfbg1.js → LinkContextMenu-m_CGQEiX.js} +2 -2
- package/dist/{LinkContextMenu-DZlKfbg1.js.map → LinkContextMenu-m_CGQEiX.js.map} +1 -1
- package/dist/{PasteHandlerPlugin-DUdocSHB.js → PasteHandlerPlugin-DjD1wryY.js} +4 -4
- package/dist/{PasteHandlerPlugin-DUdocSHB.js.map → PasteHandlerPlugin-DjD1wryY.js.map} +1 -1
- package/dist/{TableCellResizerPlugin-BGolbi44.js → TableCellResizerPlugin-CgYsYsuY.js} +41 -41
- package/dist/{TableCellResizerPlugin-BGolbi44.js.map → TableCellResizerPlugin-CgYsYsuY.js.map} +1 -1
- package/dist/{chunk-OPOZOKLO-CXKdjnjn.js → chunk-SZQXB3JV-D0XG4Tlp.js} +5 -5
- package/dist/chunk-SZQXB3JV-D0XG4Tlp.js.map +1 -0
- package/dist/{client-C0JVBgoR.js → client-UU-mS47K.js} +6 -6
- package/dist/{client-C0JVBgoR.js.map → client-UU-mS47K.js.map} +1 -1
- package/dist/components/Accordion/Accordion.test.js +4 -4
- package/dist/components/AccordionCard/AccordionCard.test.js +4 -4
- package/dist/components/ActionList/ActionList.test.js +4 -4
- package/dist/components/AppStatusBar/AppStatusBar.test.js +3 -3
- package/dist/components/Attention/Attention.test.js +3 -3
- package/dist/components/Backdrop/Backdrop.test.js +3 -3
- package/dist/components/Buttons/Button.stories.js +1 -1
- package/dist/components/Buttons/Button.test.js +3 -3
- package/dist/components/Buttons/LinkButton.stories.js +1 -1
- package/dist/components/Buttons/LinkButton.test.js +3 -3
- package/dist/components/Buttons/MenuButton.stories.js +1 -1
- package/dist/components/Buttons/MenuButton.test.js +3 -3
- package/dist/components/Card/Card.test.js +3 -3
- package/dist/components/Checkbox/Checkbox.stories.js +1 -1
- package/dist/components/Checkbox/Checkbox.test.js +4 -4
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.stories.js +1 -1
- package/dist/components/CheckboxButtonBar/CheckboxButtonBar.test.js +3 -3
- package/dist/components/CheckboxTree/CheckboxTree.js +2 -2
- package/dist/components/CheckboxTree/CheckboxTree.stories.js +4 -4
- package/dist/components/CheckboxTree/index.js +2 -2
- package/dist/components/Chip/Chip.stories.js +1 -1
- package/dist/components/ControlsButton/ControlsButton.stories.js +1 -1
- package/dist/components/Drawer/Drawer.stories.js +1 -1
- package/dist/components/FeedbackBar/FeedbackBar.test.js +3 -3
- package/dist/components/FormInput/FormInput.js +2 -2
- package/dist/components/FormInput/FormInput.stories.js +3 -3
- package/dist/components/FormInput/index.js +2 -2
- package/dist/components/IconButton/IconButton.stories.js +1 -1
- package/dist/components/InputField/InputField.stories.js +3 -3
- package/dist/components/Label/Label.test.js +3 -3
- package/dist/components/MetaDataBar/MetaDataBar.test.js +2 -2
- package/dist/components/ModalDialog/ModalDialog.stories.js +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +2 -2
- package/dist/components/MultiSelect/MultiSelect.stories.js +3 -3
- package/dist/components/MultiSelect/components/MultiSelectHeader.js +2 -2
- package/dist/components/MultiSelect/index.js +2 -2
- package/dist/components/MultiSelectBox/MultiSelectBox.stories.js +1 -1
- package/dist/components/MultiSelectBox/MultiSelectBox.test.js +3 -3
- package/dist/components/Notification/Notification.stories.js +1 -1
- package/dist/components/Notification/Notification.test.js +3 -3
- package/dist/components/OverlayCloseButton/OverlayCloseButton.stories.js +1 -1
- package/dist/components/PeriodSelector/PeriodSelector.js +2 -2
- package/dist/components/PeriodSelector/PeriodSelector.stories.js +3 -3
- package/dist/components/PeriodSelector/index.js +2 -2
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +2 -2
- package/dist/components/RadioGroup/RadioGroup.stories.js +1 -1
- package/dist/components/RadioGroup/Radiogroup.test.js +3 -3
- package/dist/components/RadioTabSelector/RadioTabSelector.js +2 -2
- package/dist/components/RadioTabSelector/RadioTabSelector.stories.js +3 -3
- package/dist/components/RadioTabSelector/index.js +2 -2
- package/dist/components/RteEditor/EditorHeader/EditorHeader.js +2 -2
- package/dist/components/RteEditor/EditorHeader/index.js +2 -2
- package/dist/components/RteEditor/Plugins/BlockFormatPlugin/BlockFormatPlugin.js +3 -3
- package/dist/components/RteEditor/Plugins/CourseCataloguePlugin/CourseCataloguePlugin.js +32 -32
- package/dist/components/RteEditor/Plugins/HistoryPlugin/HistoryPlugin.js +2 -2
- package/dist/components/RteEditor/Plugins/HistoryPlugin/index.js +2 -2
- package/dist/components/RteEditor/Plugins/LinkPlugin/AddLinkForm/AddLinkFrom.js +2 -2
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkContextMenu/LinkContextMenu.js +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/LinkPlugin.js +2 -2
- package/dist/components/RteEditor/Plugins/LinkPlugin/helpers.js +1 -1
- package/dist/components/RteEditor/Plugins/LinkPlugin/index.js +2 -2
- package/dist/components/RteEditor/Plugins/ListPlugin/ListPlugin.js +15 -15
- package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.js +1 -1
- package/dist/components/RteEditor/Plugins/PasteHandlerPlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.js +1 -1
- package/dist/components/RteEditor/Plugins/TableCellResizerPlugin/index.js +1 -1
- package/dist/components/RteEditor/Plugins/TablePlugin/AddTableFrom.js +2 -2
- package/dist/components/RteEditor/Plugins/TablePlugin/TablePlugin.js +2 -2
- package/dist/components/RteEditor/Plugins/TablePlugin/helpers.js +32 -32
- package/dist/components/RteEditor/Plugins/TablePlugin/index.js +2 -2
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/ToolbarPlugin.js +2 -2
- package/dist/components/RteEditor/Plugins/ToolbarPlugin/index.js +2 -2
- package/dist/components/RteEditor/Plugins/index.js +3 -3
- package/dist/components/RteEditor/RteEditor.js +2 -2
- package/dist/components/RteEditor/RteEditor.stories.js +2 -2
- package/dist/components/RteEditor/helpers.js +4 -4
- package/dist/components/RteEditor/index.js +2 -2
- package/dist/components/RteEditor/nodes/CourseCatalogueNode/CourseCatalogueNode.js +17 -17
- package/dist/components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.js +13 -13
- package/dist/components/SelectListbox/SelectListBox.stories.js +1 -1
- package/dist/components/Sortable/Sortable.stories.js +1 -1
- package/dist/components/StatusBadge/StatusBadge.test.js +3 -3
- package/dist/components/TextArea/TextArea.stories.js +1 -1
- package/dist/components/TextArea/TextArea.test.js +4 -4
- package/dist/components/ToggleSwitch/ToggleSwitch.stories.js +1 -1
- package/dist/components/VarIndicator/VarIndicator.stories.js +1 -1
- package/dist/components/VarIndicator/VarIndicator.test.js +4 -4
- package/dist/components/index.js +2 -2
- package/dist/{components-DVUYdcHS.js → components-MNvdQLv1.js} +457 -454
- package/dist/components-MNvdQLv1.js.map +1 -0
- package/dist/{dist-D6qYwmKD.js → dist-2TKCXdYZ.js} +315 -315
- package/dist/{dist-D6qYwmKD.js.map → dist-2TKCXdYZ.js.map} +1 -1
- package/dist/{esm-Cmy7DlsJ.js → esm-UNe_gmRA.js} +2 -2
- package/dist/{esm-Cmy7DlsJ.js.map → esm-UNe_gmRA.js.map} +1 -1
- package/dist/{helpers-DcFTH1J1.js → helpers-BBSxTGRl.js} +7 -7
- package/dist/{helpers-DcFTH1J1.js.map → helpers-BBSxTGRl.js.map} +1 -1
- package/dist/index.js +2 -2
- package/dist/{react-18-PI4Gvl2f.js → react-18-CRbkdI-3.js} +2 -2
- package/dist/{react-18-PI4Gvl2f.js.map → react-18-CRbkdI-3.js.map} +1 -1
- package/dist/{react.esm-Cev8dB-E.js → react.esm-CzIhAqlo.js} +479 -479
- package/dist/{react.esm-Cev8dB-E.js.map → react.esm-CzIhAqlo.js.map} +1 -1
- package/dist/setupTests.js +1 -1
- package/dist/storybook__react.d.js +3 -3
- package/dist/{test-CPFNM-bL.js → test-DQruvi8i.js} +3704 -5824
- package/dist/test-DQruvi8i.js.map +1 -0
- package/package.json +17 -17
- package/dist/Lexical.prod-DCGjHGxG.js.map +0 -1
- package/dist/LexicalClipboard.prod-CGG14aoP.js +0 -248
- package/dist/LexicalExtension.prod-DWt1IjPF.js.map +0 -1
- package/dist/LexicalLink.prod-Dy1gE75H.js.map +0 -1
- package/dist/LexicalList.prod-D9R0L7cu.js.map +0 -1
- package/dist/LexicalTable.prod-C2FP47Lm.js.map +0 -1
- package/dist/LexicalUtils.prod-BzrjMu6t.js +0 -242
- package/dist/LexicalUtils.prod-BzrjMu6t.js.map +0 -1
- package/dist/chunk-OPOZOKLO-CXKdjnjn.js.map +0 -1
- package/dist/components-DVUYdcHS.js.map +0 -1
- package/dist/test-CPFNM-bL.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasteHandlerPlugin-DUdocSHB.js","names":[],"sources":["../node_modules/@staartwind.nl/lexical-paste-from-word/dist/normalizer.js","../node_modules/@staartwind.nl/lexical-paste-from-word/dist/index.js","../src/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.tsx"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.normalizeSpacerunSpans = exports.normalizeSpacing = exports.parseHtml = exports.MSWordNormalizer = void 0;\nconst MS_WORD_MATCHES = [\n /<meta\\s*name=\"?generator\"?\\s*content=\"?microsoft\\s*word\\s*\\d+\"?\\/?>/i,\n /xmlns:o=\"urn:schemas-microsoft-com/i\n];\nclass MSWordNormalizer {\n isActive(htmlString) {\n return MS_WORD_MATCHES.some(regex => regex.test(htmlString));\n }\n normalize(htmlString) {\n const { bodyString, stylesString } = parseHtml(htmlString);\n const doc = new DOMParser().parseFromString(bodyString, 'text/html');\n this.transformListItemLikeLElementsIntoLists(doc, stylesString);\n this.removeMSAttributes(doc);\n return doc.body.innerHTML;\n }\n findAllItemLikeElements(doc) {\n const items = doc.querySelectorAll('*');\n const res = [];\n for (const item of items) {\n const tagName = item.tagName.toLowerCase();\n // Find all the possible list items\n if (!['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'li', 'div'].includes(tagName) || !(item instanceof HTMLElement)) {\n continue;\n }\n const style = convertStyleToObject(item.getAttribute('style') || '');\n // Keep items that are part of a list.\n if ('mso-list' in style) {\n if (!item.parentElement)\n continue;\n if (isList(item.parentElement))\n continue;\n const itemData = getListItemData(style);\n res.push(Object.assign(Object.assign({}, itemData), { element: item }));\n }\n }\n return res;\n }\n transformListItemLikeLElementsIntoLists(doc, stylesString) {\n var _a, _b, _c, _d, _e, _f, _g;\n const itemLikeElements = this.findAllItemLikeElements(doc);\n if (!itemLikeElements.length) {\n return;\n }\n const encounteredLists = {};\n const stack = [];\n for (const itemLikeElement of itemLikeElements) {\n if (itemLikeElement.indent != null) {\n // Reset the current stack if the previous used list does not continue with itemLikeElement\n if (!isListContinuation(itemLikeElement)) {\n stack.length = 0;\n }\n // Combined list ID for addressing encounter lists counters.\n const originalListId = `${itemLikeElement.id}:${itemLikeElement.indent}`;\n // Normalized list item indentation.\n const indent = Math.min(itemLikeElement.indent - 1, stack.length);\n // Trimming of the list stack on list ID change.\n if (indent < stack.length && ((_a = stack[indent]) === null || _a === void 0 ? void 0 : _a.id) !== itemLikeElement.id) {\n stack.length = indent;\n }\n // Trimming of the list stack on lower indent list encountered.\n if (indent < stack.length - 1) {\n stack.length = indent + 1;\n }\n else {\n const listStyle = detectListStyle(itemLikeElement, stylesString);\n // Create a new OL/UL if required (greater indent or different list type).\n if (indent > stack.length - 1 || ((_b = stack[indent]) === null || _b === void 0 ? void 0 : _b.listElement.tagName.toLowerCase()) != listStyle.type) {\n if (indent == 0 &&\n listStyle.type == 'ol' &&\n itemLikeElement.id !== undefined &&\n encounteredLists[originalListId]) {\n listStyle.startIndex = (_c = encounteredLists[originalListId]) !== null && _c !== void 0 ? _c : null;\n }\n const listElement = createNewEmptyList(listStyle, false);\n // Insert the new OL/UL.\n if (stack.length == 0) {\n const parent = itemLikeElement.element.parentNode;\n const index = Array.from(parent.children).indexOf(itemLikeElement.element) + 1;\n if (index === parent.children.length) {\n parent.appendChild(listElement);\n }\n else {\n parent.insertBefore(listElement, itemLikeElement.element);\n }\n }\n else {\n const parentListItems = (_d = stack[indent - 1]) === null || _d === void 0 ? void 0 : _d.listItemElements;\n if (parentListItems) {\n (_e = parentListItems[parentListItems.length - 1]) === null || _e === void 0 ? void 0 : _e.appendChild(listElement);\n }\n }\n // Update the list stack for other items to reference.\n stack[indent] = Object.assign(Object.assign({}, itemLikeElement), { listElement, listItemElements: [] });\n // Prepare list counter for start index.\n if (indent == 0 && itemLikeElement.id !== undefined) {\n encounteredLists[originalListId] = listStyle.startIndex || 1;\n }\n }\n }\n // Use LI if it is already it or create a new LI element.\n const listItem = itemLikeElement.element.tagName.toLowerCase() == 'li' ? itemLikeElement.element : document.createElement('li');\n // Append the LI to OL/UL.\n (_f = stack[indent]) === null || _f === void 0 ? void 0 : _f.listElement.appendChild(listItem);\n (_g = stack[indent]) === null || _g === void 0 ? void 0 : _g.listItemElements.push(listItem);\n // Increment list counter.\n if (indent == 0 && itemLikeElement.id !== undefined) {\n encounteredLists[originalListId]++;\n }\n // Append list block to LI.\n if (itemLikeElement.element != listItem) {\n listItem.appendChild(itemLikeElement.element);\n }\n // Clean list block.\n removeMsoListIgnoreSpans(itemLikeElement.element);\n }\n }\n }\n removeMSAttributes(doc) {\n const items = doc.querySelectorAll('*');\n const elementsToUnwrap = [];\n for (const item of items) {\n // Eliminate all classes that include mso.\n for (const className of item.classList) {\n if (/\\bmso/gi.exec(className)) {\n item.classList.remove(className);\n }\n }\n // Eliminate all useless mso styling\n if (item instanceof HTMLElement) {\n removeMSOStyles(item);\n }\n // Push word specific elements to an array\n if (item.tagName === 'W:SDT' || item.tagName === 'W:SDTPR' && isElementEmpty(item) || item.tagName === 'O:P' && isElementEmpty(item)) {\n elementsToUnwrap.push(item);\n }\n }\n // Eliminate word specific elements\n for (const item of elementsToUnwrap) {\n const itemParent = item.parentNode;\n itemParent.removeChild(item);\n }\n }\n}\nexports.MSWordNormalizer = MSWordNormalizer;\nfunction parseHtml(htmlString) {\n const domParser = new DOMParser();\n // Remove Word specific \"if comments\" so content inside is not omitted by the parser.\n htmlString = htmlString.replace(/<!--\\[if gte vml 1]>/g, '');\n // Clean the <head> section of MS Windows specific tags. See https://github.com/ckeditor/ckeditor5/issues/15333.\n // The regular expression matches the <o:SmartTagType> tag with optional attributes (with or without values).\n htmlString = htmlString.replace(/<o:SmartTagType(?:\\s+[^\\s>=]+(?:=\"[^\"]*\")?)*\\s*\\/?>/gi, '');\n const normalizedHtml = normalizeSpacing(cleanContentAfterBody(htmlString));\n // Parse htmlString as native Document object.\n const htmlDocument = domParser.parseFromString(normalizedHtml, 'text/html');\n normalizeSpacerunSpans(htmlDocument);\n // Get `innerHTML` first as transforming to View modifies the source document.\n const bodyString = htmlDocument.body.innerHTML;\n const stylesString = extractStyles(htmlDocument);\n return {\n bodyString,\n stylesString\n };\n}\nexports.parseHtml = parseHtml;\nfunction extractStyles(htmlDocument) {\n const styles = [];\n const stylesString = [];\n const styleTags = Array.from(htmlDocument.getElementsByTagName('style'));\n for (const style of styleTags) {\n if (style.sheet && style.sheet.cssRules && style.sheet.cssRules.length) {\n styles.push(style.sheet);\n stylesString.push(style.innerHTML);\n }\n }\n return stylesString.join(' ');\n}\nfunction normalizeSpacing(htmlString) {\n // Run normalizeSafariSpaceSpans() two times to cover nested spans.\n return normalizeSafariSpaceSpans(normalizeSafariSpaceSpans(htmlString))\n // Remove all \\r\\n from \"spacerun spans\" so the last replace line doesn't strip all whitespaces.\n .replace(/(<span\\s+style=['\"]mso-spacerun:yes['\"]>[^\\S\\r\\n]*?)[\\r\\n]+([^\\S\\r\\n]*<\\/span>)/g, '$1$2')\n .replace(/<span\\s+style=['\"]mso-spacerun:yes['\"]><\\/span>/g, '')\n .replace(/(<span\\s+style=['\"]letter-spacing:[^'\"]+?['\"]>)[\\r\\n]+(<\\/span>)/g, '$1 $2')\n .replace(/ <\\//g, '\\u00A0</')\n .replace(/ <o:p><\\/o:p>/g, '\\u00A0<o:p></o:p>')\n // Remove <o:p> block filler from empty paragraph. Safari uses \\u00A0 instead of .\n .replace(/<o:p>( |\\u00A0)<\\/o:p>/g, '')\n // Remove all whitespaces when they contain any \\r or \\n.\n .replace(/>([^\\S\\r\\n]*[\\r\\n]\\s*)</g, '><');\n}\nexports.normalizeSpacing = normalizeSpacing;\nfunction normalizeSafariSpaceSpans(htmlString) {\n return htmlString.replace(/<span(?: class=\"Apple-converted-space\"|)>(\\s+)<\\/span>/g, (fullMatch, spaces) => {\n return spaces.length === 1 ? ' ' : Array(spaces.length + 1).join('\\u00A0 ').substring(0, spaces.length);\n });\n}\nfunction normalizeSpacerunSpans(htmlDocument) {\n htmlDocument.querySelectorAll('span[style*=spacerun]').forEach(el => {\n const htmlElement = el;\n const innerTextLength = htmlElement.innerText.length || 0;\n htmlElement.innerText = Array(innerTextLength + 1).join('\\u00A0 ').substring(0, innerTextLength);\n });\n}\nexports.normalizeSpacerunSpans = normalizeSpacerunSpans;\nfunction cleanContentAfterBody(htmlString) {\n const bodyCloseTag = '</body>';\n const htmlCloseTag = '</html>';\n const bodyCloseIndex = htmlString.indexOf(bodyCloseTag);\n if (bodyCloseIndex < 0) {\n return htmlString;\n }\n const htmlCloseIndex = htmlString.indexOf(htmlCloseTag, bodyCloseIndex + bodyCloseTag.length);\n return htmlString.substring(0, bodyCloseIndex + bodyCloseTag.length) +\n (htmlCloseIndex >= 0 ? htmlString.substring(htmlCloseIndex) : '');\n}\nfunction convertStyleToObject(styleString) {\n const styleObject = {};\n if (!styleString) {\n return styleObject;\n }\n // Split the style string into individual declarations\n const declarations = styleString.split(';').map(declaration => declaration.trim());\n // Iterate over each declaration and split it into property and value\n declarations.forEach(declaration => {\n const [property, value] = declaration.split(':').map(part => part.trim());\n if (property && value) {\n // Add the property and value to the style object\n styleObject[property] = value;\n }\n });\n return styleObject;\n}\nfunction isElementEmpty(element) {\n return !element.textContent && !element.innerHTML.trim();\n}\nfunction removeMSOStyles(element) {\n // Get the current style string of the paragraph node\n const currentStyle = element.getAttribute('style') || '';\n // Parse the style string to extract individual style properties\n const styleProperties = currentStyle.split(';').map(property => property.trim());\n // Remove the 'mso-bidi-font-family' property from the list of style properties\n const filteredProperties = styleProperties.filter(property => {\n var _a;\n const [key] = property.split(':');\n return !(/\\bmso/gi.exec((_a = key === null || key === void 0 ? void 0 : key.toLowerCase()) !== null && _a !== void 0 ? _a : ''));\n });\n // Reconstruct the style string without the removed property\n const updatedStyle = filteredProperties.join(';');\n // Set the updated style string back to the paragraph node\n element.setAttribute('style', updatedStyle);\n}\nfunction getListItemData(styles) {\n var _a;\n const listStyle = styles['mso-list'];\n if (listStyle === undefined) {\n return {};\n }\n const idMatch = listStyle.match(/(^|\\s{1,100})l(\\d+)/i);\n const orderMatch = listStyle.match(/\\s{0,100}lfo(\\d+)/i);\n const indentMatch = listStyle.match(/\\s{0,100}level(\\d+)/i);\n if (idMatch && orderMatch && indentMatch) {\n return {\n id: idMatch[2],\n order: orderMatch[1],\n indent: parseInt((_a = indentMatch[1]) !== null && _a !== void 0 ? _a : '')\n };\n }\n return {\n indent: 1\n };\n}\nfunction detectListStyle(listLikeItem, stylesString) {\n const listStyleRegexp = new RegExp(`@list l${listLikeItem.id}:level${listLikeItem.indent}\\\\s*({[^}]*)`, 'gi');\n const listStyleTypeRegex = /mso-level-number-format:([^;]{0,100});/gi;\n const listStartIndexRegex = /mso-level-start-at:\\s{0,100}([0-9]{0,10})\\s{0,100};/gi;\n const legalStyleListRegex = new RegExp(`@list\\\\s+l${listLikeItem.id}:level\\\\d\\\\s*{[^{]*mso-level-text:\"%\\\\d\\\\\\\\.`, 'gi');\n const multiLevelNumberFormatTypeRegex = new RegExp(`@list l${listLikeItem.id}:level\\\\d\\\\s*{[^{]*mso-level-number-format:`, 'gi');\n const legalStyleListMatch = legalStyleListRegex.exec(stylesString);\n const multiLevelNumberFormatMatch = multiLevelNumberFormatTypeRegex.exec(stylesString);\n // Multi level lists in Word have mso-level-number-format attribute except legal lists,\n // so we used that. If list has legal list match and doesn't has mso-level-number-format\n // then this is legal-list.\n const islegalStyleList = legalStyleListMatch && !multiLevelNumberFormatMatch;\n const listStyleMatch = listStyleRegexp.exec(stylesString);\n let listStyleType = 'decimal'; // Decimal is default one.\n let type = 'ol'; // <ol> is default list.\n let startIndex = null;\n if (listStyleMatch && listStyleMatch[1]) {\n const listStyleTypeMatch = listStyleTypeRegex.exec(listStyleMatch[1]);\n if (listStyleTypeMatch && listStyleTypeMatch[1]) {\n listStyleType = listStyleTypeMatch[1].trim();\n type = listStyleType !== 'bullet' && listStyleType !== 'image' ? 'ol' : 'ul';\n }\n // Styles for the numbered lists are always defined in the Word CSS stylesheet.\n // Unordered lists MAY contain a value for the Word CSS definition `mso-level-text` but sometimes\n // this tag is missing. And because of that, we cannot depend on that. We need to predict the list style value\n // based on the list style marker element.\n if (listStyleType === 'bullet') {\n const bulletedStyle = findBulletedListStyle(listLikeItem.element);\n if (bulletedStyle) {\n listStyleType = bulletedStyle;\n }\n }\n else {\n const listStartIndexMatch = listStartIndexRegex.exec(listStyleMatch[1]);\n if (listStartIndexMatch && listStartIndexMatch[1]) {\n startIndex = parseInt(listStartIndexMatch[1]);\n }\n }\n if (islegalStyleList) {\n type = 'ol';\n }\n }\n return {\n type,\n startIndex,\n style: mapListStyleDefinition(listStyleType),\n isLegalStyleList: islegalStyleList\n };\n}\nfunction findBulletedListStyle(element) {\n // https://github.com/ckeditor/ckeditor5/issues/15964\n if (element.tagName.toLowerCase() == 'li' && element.parentElement.tagName.toLowerCase() == 'ul' && element.parentElement.hasAttribute('type')) {\n return element.parentElement.getAttribute('type');\n }\n const listMarkerElement = findListMarkerNode(element);\n if (!listMarkerElement) {\n return null;\n }\n const listMarker = listMarkerElement.textContent;\n if (listMarker === 'o') {\n return 'circle';\n }\n else if ((listMarker !== null && listMarker !== void 0 ? listMarker : '').charCodeAt(0) === 183) {\n return 'disc';\n }\n // Word returns '§' instead of '■' for the square list style.\n else if (listMarker === '§') {\n return 'square';\n }\n return null;\n}\nfunction findListMarkerNode(element) {\n var _a;\n // If the first child is a text node, it is the data for the element.\n // The list-style marker is not present here.\n if (((_a = Array.from(element.children)[0]) === null || _a === void 0 ? void 0 : _a.tagName.toLowerCase()) === '#text') {\n return null;\n }\n for (const childNode of Array.from(element.children)) {\n // The list-style marker will be inside the `<span>` element. Let's ignore all non-span elements.\n // It may happen that the `<a>` element is added as the first child. Most probably, it's an anchor element.\n if (!['element', 'span'].includes(childNode.tagName.toLowerCase())) {\n continue;\n }\n return childNode;\n }\n return null;\n}\nfunction mapListStyleDefinition(value) {\n if (value.startsWith('arabic-leading-zero')) {\n return 'decimal-leading-zero';\n }\n switch (value) {\n case 'alpha-upper':\n return 'upper-alpha';\n case 'alpha-lower':\n return 'lower-alpha';\n case 'roman-upper':\n return 'upper-roman';\n case 'roman-lower':\n return 'lower-roman';\n case 'circle':\n case 'disc':\n case 'square':\n return value;\n default:\n return null;\n }\n}\nfunction createNewEmptyList(listStyle, hasMultiLevelListPlugin) {\n const list = document.createElement(listStyle.type);\n // We do not support modifying the marker for a particular list item.\n // Set the value for the `list-style-type` property directly to the list container.\n if (listStyle.style) {\n list.style.setProperty('list-style-type', listStyle.style);\n }\n if (listStyle.startIndex && listStyle.startIndex > 1) {\n list.setAttribute('start', listStyle.startIndex.toString());\n }\n if (listStyle.isLegalStyleList && hasMultiLevelListPlugin) {\n list.classList.add('legal-list');\n }\n return list;\n}\nfunction removeMsoListIgnoreSpans(parentElement) {\n // Get all <span> elements inside the parentElement\n const spans = parentElement.querySelectorAll('span');\n // Iterate over each <span> element\n spans.forEach(span => {\n var _a;\n // Get the value of the 'style' attribute\n const style = span.getAttribute('style');\n // Check if the 'style' attribute contains 'mso-list: Ignore'\n if (style && style.includes('mso-list:Ignore')) {\n // Remove the <span> element\n (_a = span.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(span);\n }\n });\n}\nfunction isListContinuation(currentItem) {\n const previousSibling = currentItem.element.previousSibling;\n if (!previousSibling) {\n // If it's a li inside ul or ol like in here: https://github.com/ckeditor/ckeditor5/issues/15964.\n return isList(currentItem.element.parentElement);\n }\n // Even with the same id the list does not have to be continuous (#43).\n // @ts-expect-error\n return isList(previousSibling);\n}\nconst isList = (element) => ['ul', 'ol'].includes(element.tagName.toLowerCase());\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MSWordNormalizer = void 0;\nconst normalizer_1 = require(\"./normalizer\");\nObject.defineProperty(exports, \"MSWordNormalizer\", { enumerable: true, get: function () { return normalizer_1.MSWordNormalizer; } });\n","import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\nimport { useEffect } from 'react';\nimport { $getSelection, COMMAND_PRIORITY_CRITICAL, type CommandPayloadType, PASTE_COMMAND } from 'lexical';\nimport { objectKlassEquals } from '@lexical/utils';\nimport { $insertDataTransferForRichText } from '@lexical/clipboard';\nimport { MSWordNormalizer } from '@staartwind.nl/lexical-paste-from-word';\n\nexport const PasteHandlerPlugin = () => {\n const [editor] = useLexicalComposerContext();\n\n const handlePaste = (event: CommandPayloadType<typeof PASTE_COMMAND>) => {\n event.preventDefault();\n editor.update(() => {\n const selection = $getSelection();\n const clipboardData =\n objectKlassEquals(event, InputEvent) || objectKlassEquals(event, KeyboardEvent) ? null : event.clipboardData;\n if (clipboardData != null && selection !== null) {\n const content = clipboardData.getData('text/html') || clipboardData.getData('text/plain');\n const newData = new DataTransfer();\n const wordNormalizer = new MSWordNormalizer();\n newData.setData('text/html', content);\n if (wordNormalizer.isActive(content)) {\n newData.setData('text/html', wordNormalizer.normalize(content));\n }\n $insertDataTransferForRichText(newData, selection, editor);\n }\n });\n };\n\n useEffect(() => {\n const removePasteListener = editor.registerCommand(\n PASTE_COMMAND,\n (event) => {\n if (event instanceof ClipboardEvent) {\n handlePaste(event);\n return true;\n }\n return false;\n },\n COMMAND_PRIORITY_CRITICAL\n );\n\n return () => {\n removePasteListener();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [editor]);\n\n return null;\n};\n"],"x_google_ignoreList":[0,1],"mappings":";;;;;;;;AAEA,CADA,OAAO,eAAe,GAAS,cAAc,EAAE,OAAO,IAAM,CAAC,EAC7D,EAAQ,yBAAyB,EAAQ,mBAAmB,EAAQ,YAAY,EAAQ,mBAAmB,KAAK;CAChH,IAAM,IAAkB,CACpB,wEACA,sCACH;AA4ID,GAAQ,mBA3IR,MAAuB;EACnB,SAAS,GAAY;AACjB,UAAO,EAAgB,MAAK,MAAS,EAAM,KAAK,EAAW,CAAC;;EAEhE,UAAU,GAAY;GAClB,IAAM,EAAE,eAAY,oBAAiB,EAAU,EAAW,EACpD,I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,CAAC,EAAO,CAAC,EAEL"}
|
|
1
|
+
{"version":3,"file":"PasteHandlerPlugin-DjD1wryY.js","names":[],"sources":["../node_modules/@staartwind.nl/lexical-paste-from-word/dist/normalizer.js","../node_modules/@staartwind.nl/lexical-paste-from-word/dist/index.js","../src/components/RteEditor/Plugins/PasteHandlerPlugin/PasteHandlerPlugin.tsx"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.normalizeSpacerunSpans = exports.normalizeSpacing = exports.parseHtml = exports.MSWordNormalizer = void 0;\nconst MS_WORD_MATCHES = [\n /<meta\\s*name=\"?generator\"?\\s*content=\"?microsoft\\s*word\\s*\\d+\"?\\/?>/i,\n /xmlns:o=\"urn:schemas-microsoft-com/i\n];\nclass MSWordNormalizer {\n isActive(htmlString) {\n return MS_WORD_MATCHES.some(regex => regex.test(htmlString));\n }\n normalize(htmlString) {\n const { bodyString, stylesString } = parseHtml(htmlString);\n const doc = new DOMParser().parseFromString(bodyString, 'text/html');\n this.transformListItemLikeLElementsIntoLists(doc, stylesString);\n this.removeMSAttributes(doc);\n return doc.body.innerHTML;\n }\n findAllItemLikeElements(doc) {\n const items = doc.querySelectorAll('*');\n const res = [];\n for (const item of items) {\n const tagName = item.tagName.toLowerCase();\n // Find all the possible list items\n if (!['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'li', 'div'].includes(tagName) || !(item instanceof HTMLElement)) {\n continue;\n }\n const style = convertStyleToObject(item.getAttribute('style') || '');\n // Keep items that are part of a list.\n if ('mso-list' in style) {\n if (!item.parentElement)\n continue;\n if (isList(item.parentElement))\n continue;\n const itemData = getListItemData(style);\n res.push(Object.assign(Object.assign({}, itemData), { element: item }));\n }\n }\n return res;\n }\n transformListItemLikeLElementsIntoLists(doc, stylesString) {\n var _a, _b, _c, _d, _e, _f, _g;\n const itemLikeElements = this.findAllItemLikeElements(doc);\n if (!itemLikeElements.length) {\n return;\n }\n const encounteredLists = {};\n const stack = [];\n for (const itemLikeElement of itemLikeElements) {\n if (itemLikeElement.indent != null) {\n // Reset the current stack if the previous used list does not continue with itemLikeElement\n if (!isListContinuation(itemLikeElement)) {\n stack.length = 0;\n }\n // Combined list ID for addressing encounter lists counters.\n const originalListId = `${itemLikeElement.id}:${itemLikeElement.indent}`;\n // Normalized list item indentation.\n const indent = Math.min(itemLikeElement.indent - 1, stack.length);\n // Trimming of the list stack on list ID change.\n if (indent < stack.length && ((_a = stack[indent]) === null || _a === void 0 ? void 0 : _a.id) !== itemLikeElement.id) {\n stack.length = indent;\n }\n // Trimming of the list stack on lower indent list encountered.\n if (indent < stack.length - 1) {\n stack.length = indent + 1;\n }\n else {\n const listStyle = detectListStyle(itemLikeElement, stylesString);\n // Create a new OL/UL if required (greater indent or different list type).\n if (indent > stack.length - 1 || ((_b = stack[indent]) === null || _b === void 0 ? void 0 : _b.listElement.tagName.toLowerCase()) != listStyle.type) {\n if (indent == 0 &&\n listStyle.type == 'ol' &&\n itemLikeElement.id !== undefined &&\n encounteredLists[originalListId]) {\n listStyle.startIndex = (_c = encounteredLists[originalListId]) !== null && _c !== void 0 ? _c : null;\n }\n const listElement = createNewEmptyList(listStyle, false);\n // Insert the new OL/UL.\n if (stack.length == 0) {\n const parent = itemLikeElement.element.parentNode;\n const index = Array.from(parent.children).indexOf(itemLikeElement.element) + 1;\n if (index === parent.children.length) {\n parent.appendChild(listElement);\n }\n else {\n parent.insertBefore(listElement, itemLikeElement.element);\n }\n }\n else {\n const parentListItems = (_d = stack[indent - 1]) === null || _d === void 0 ? void 0 : _d.listItemElements;\n if (parentListItems) {\n (_e = parentListItems[parentListItems.length - 1]) === null || _e === void 0 ? void 0 : _e.appendChild(listElement);\n }\n }\n // Update the list stack for other items to reference.\n stack[indent] = Object.assign(Object.assign({}, itemLikeElement), { listElement, listItemElements: [] });\n // Prepare list counter for start index.\n if (indent == 0 && itemLikeElement.id !== undefined) {\n encounteredLists[originalListId] = listStyle.startIndex || 1;\n }\n }\n }\n // Use LI if it is already it or create a new LI element.\n const listItem = itemLikeElement.element.tagName.toLowerCase() == 'li' ? itemLikeElement.element : document.createElement('li');\n // Append the LI to OL/UL.\n (_f = stack[indent]) === null || _f === void 0 ? void 0 : _f.listElement.appendChild(listItem);\n (_g = stack[indent]) === null || _g === void 0 ? void 0 : _g.listItemElements.push(listItem);\n // Increment list counter.\n if (indent == 0 && itemLikeElement.id !== undefined) {\n encounteredLists[originalListId]++;\n }\n // Append list block to LI.\n if (itemLikeElement.element != listItem) {\n listItem.appendChild(itemLikeElement.element);\n }\n // Clean list block.\n removeMsoListIgnoreSpans(itemLikeElement.element);\n }\n }\n }\n removeMSAttributes(doc) {\n const items = doc.querySelectorAll('*');\n const elementsToUnwrap = [];\n for (const item of items) {\n // Eliminate all classes that include mso.\n for (const className of item.classList) {\n if (/\\bmso/gi.exec(className)) {\n item.classList.remove(className);\n }\n }\n // Eliminate all useless mso styling\n if (item instanceof HTMLElement) {\n removeMSOStyles(item);\n }\n // Push word specific elements to an array\n if (item.tagName === 'W:SDT' || item.tagName === 'W:SDTPR' && isElementEmpty(item) || item.tagName === 'O:P' && isElementEmpty(item)) {\n elementsToUnwrap.push(item);\n }\n }\n // Eliminate word specific elements\n for (const item of elementsToUnwrap) {\n const itemParent = item.parentNode;\n itemParent.removeChild(item);\n }\n }\n}\nexports.MSWordNormalizer = MSWordNormalizer;\nfunction parseHtml(htmlString) {\n const domParser = new DOMParser();\n // Remove Word specific \"if comments\" so content inside is not omitted by the parser.\n htmlString = htmlString.replace(/<!--\\[if gte vml 1]>/g, '');\n // Clean the <head> section of MS Windows specific tags. See https://github.com/ckeditor/ckeditor5/issues/15333.\n // The regular expression matches the <o:SmartTagType> tag with optional attributes (with or without values).\n htmlString = htmlString.replace(/<o:SmartTagType(?:\\s+[^\\s>=]+(?:=\"[^\"]*\")?)*\\s*\\/?>/gi, '');\n const normalizedHtml = normalizeSpacing(cleanContentAfterBody(htmlString));\n // Parse htmlString as native Document object.\n const htmlDocument = domParser.parseFromString(normalizedHtml, 'text/html');\n normalizeSpacerunSpans(htmlDocument);\n // Get `innerHTML` first as transforming to View modifies the source document.\n const bodyString = htmlDocument.body.innerHTML;\n const stylesString = extractStyles(htmlDocument);\n return {\n bodyString,\n stylesString\n };\n}\nexports.parseHtml = parseHtml;\nfunction extractStyles(htmlDocument) {\n const styles = [];\n const stylesString = [];\n const styleTags = Array.from(htmlDocument.getElementsByTagName('style'));\n for (const style of styleTags) {\n if (style.sheet && style.sheet.cssRules && style.sheet.cssRules.length) {\n styles.push(style.sheet);\n stylesString.push(style.innerHTML);\n }\n }\n return stylesString.join(' ');\n}\nfunction normalizeSpacing(htmlString) {\n // Run normalizeSafariSpaceSpans() two times to cover nested spans.\n return normalizeSafariSpaceSpans(normalizeSafariSpaceSpans(htmlString))\n // Remove all \\r\\n from \"spacerun spans\" so the last replace line doesn't strip all whitespaces.\n .replace(/(<span\\s+style=['\"]mso-spacerun:yes['\"]>[^\\S\\r\\n]*?)[\\r\\n]+([^\\S\\r\\n]*<\\/span>)/g, '$1$2')\n .replace(/<span\\s+style=['\"]mso-spacerun:yes['\"]><\\/span>/g, '')\n .replace(/(<span\\s+style=['\"]letter-spacing:[^'\"]+?['\"]>)[\\r\\n]+(<\\/span>)/g, '$1 $2')\n .replace(/ <\\//g, '\\u00A0</')\n .replace(/ <o:p><\\/o:p>/g, '\\u00A0<o:p></o:p>')\n // Remove <o:p> block filler from empty paragraph. Safari uses \\u00A0 instead of .\n .replace(/<o:p>( |\\u00A0)<\\/o:p>/g, '')\n // Remove all whitespaces when they contain any \\r or \\n.\n .replace(/>([^\\S\\r\\n]*[\\r\\n]\\s*)</g, '><');\n}\nexports.normalizeSpacing = normalizeSpacing;\nfunction normalizeSafariSpaceSpans(htmlString) {\n return htmlString.replace(/<span(?: class=\"Apple-converted-space\"|)>(\\s+)<\\/span>/g, (fullMatch, spaces) => {\n return spaces.length === 1 ? ' ' : Array(spaces.length + 1).join('\\u00A0 ').substring(0, spaces.length);\n });\n}\nfunction normalizeSpacerunSpans(htmlDocument) {\n htmlDocument.querySelectorAll('span[style*=spacerun]').forEach(el => {\n const htmlElement = el;\n const innerTextLength = htmlElement.innerText.length || 0;\n htmlElement.innerText = Array(innerTextLength + 1).join('\\u00A0 ').substring(0, innerTextLength);\n });\n}\nexports.normalizeSpacerunSpans = normalizeSpacerunSpans;\nfunction cleanContentAfterBody(htmlString) {\n const bodyCloseTag = '</body>';\n const htmlCloseTag = '</html>';\n const bodyCloseIndex = htmlString.indexOf(bodyCloseTag);\n if (bodyCloseIndex < 0) {\n return htmlString;\n }\n const htmlCloseIndex = htmlString.indexOf(htmlCloseTag, bodyCloseIndex + bodyCloseTag.length);\n return htmlString.substring(0, bodyCloseIndex + bodyCloseTag.length) +\n (htmlCloseIndex >= 0 ? htmlString.substring(htmlCloseIndex) : '');\n}\nfunction convertStyleToObject(styleString) {\n const styleObject = {};\n if (!styleString) {\n return styleObject;\n }\n // Split the style string into individual declarations\n const declarations = styleString.split(';').map(declaration => declaration.trim());\n // Iterate over each declaration and split it into property and value\n declarations.forEach(declaration => {\n const [property, value] = declaration.split(':').map(part => part.trim());\n if (property && value) {\n // Add the property and value to the style object\n styleObject[property] = value;\n }\n });\n return styleObject;\n}\nfunction isElementEmpty(element) {\n return !element.textContent && !element.innerHTML.trim();\n}\nfunction removeMSOStyles(element) {\n // Get the current style string of the paragraph node\n const currentStyle = element.getAttribute('style') || '';\n // Parse the style string to extract individual style properties\n const styleProperties = currentStyle.split(';').map(property => property.trim());\n // Remove the 'mso-bidi-font-family' property from the list of style properties\n const filteredProperties = styleProperties.filter(property => {\n var _a;\n const [key] = property.split(':');\n return !(/\\bmso/gi.exec((_a = key === null || key === void 0 ? void 0 : key.toLowerCase()) !== null && _a !== void 0 ? _a : ''));\n });\n // Reconstruct the style string without the removed property\n const updatedStyle = filteredProperties.join(';');\n // Set the updated style string back to the paragraph node\n element.setAttribute('style', updatedStyle);\n}\nfunction getListItemData(styles) {\n var _a;\n const listStyle = styles['mso-list'];\n if (listStyle === undefined) {\n return {};\n }\n const idMatch = listStyle.match(/(^|\\s{1,100})l(\\d+)/i);\n const orderMatch = listStyle.match(/\\s{0,100}lfo(\\d+)/i);\n const indentMatch = listStyle.match(/\\s{0,100}level(\\d+)/i);\n if (idMatch && orderMatch && indentMatch) {\n return {\n id: idMatch[2],\n order: orderMatch[1],\n indent: parseInt((_a = indentMatch[1]) !== null && _a !== void 0 ? _a : '')\n };\n }\n return {\n indent: 1\n };\n}\nfunction detectListStyle(listLikeItem, stylesString) {\n const listStyleRegexp = new RegExp(`@list l${listLikeItem.id}:level${listLikeItem.indent}\\\\s*({[^}]*)`, 'gi');\n const listStyleTypeRegex = /mso-level-number-format:([^;]{0,100});/gi;\n const listStartIndexRegex = /mso-level-start-at:\\s{0,100}([0-9]{0,10})\\s{0,100};/gi;\n const legalStyleListRegex = new RegExp(`@list\\\\s+l${listLikeItem.id}:level\\\\d\\\\s*{[^{]*mso-level-text:\"%\\\\d\\\\\\\\.`, 'gi');\n const multiLevelNumberFormatTypeRegex = new RegExp(`@list l${listLikeItem.id}:level\\\\d\\\\s*{[^{]*mso-level-number-format:`, 'gi');\n const legalStyleListMatch = legalStyleListRegex.exec(stylesString);\n const multiLevelNumberFormatMatch = multiLevelNumberFormatTypeRegex.exec(stylesString);\n // Multi level lists in Word have mso-level-number-format attribute except legal lists,\n // so we used that. If list has legal list match and doesn't has mso-level-number-format\n // then this is legal-list.\n const islegalStyleList = legalStyleListMatch && !multiLevelNumberFormatMatch;\n const listStyleMatch = listStyleRegexp.exec(stylesString);\n let listStyleType = 'decimal'; // Decimal is default one.\n let type = 'ol'; // <ol> is default list.\n let startIndex = null;\n if (listStyleMatch && listStyleMatch[1]) {\n const listStyleTypeMatch = listStyleTypeRegex.exec(listStyleMatch[1]);\n if (listStyleTypeMatch && listStyleTypeMatch[1]) {\n listStyleType = listStyleTypeMatch[1].trim();\n type = listStyleType !== 'bullet' && listStyleType !== 'image' ? 'ol' : 'ul';\n }\n // Styles for the numbered lists are always defined in the Word CSS stylesheet.\n // Unordered lists MAY contain a value for the Word CSS definition `mso-level-text` but sometimes\n // this tag is missing. And because of that, we cannot depend on that. We need to predict the list style value\n // based on the list style marker element.\n if (listStyleType === 'bullet') {\n const bulletedStyle = findBulletedListStyle(listLikeItem.element);\n if (bulletedStyle) {\n listStyleType = bulletedStyle;\n }\n }\n else {\n const listStartIndexMatch = listStartIndexRegex.exec(listStyleMatch[1]);\n if (listStartIndexMatch && listStartIndexMatch[1]) {\n startIndex = parseInt(listStartIndexMatch[1]);\n }\n }\n if (islegalStyleList) {\n type = 'ol';\n }\n }\n return {\n type,\n startIndex,\n style: mapListStyleDefinition(listStyleType),\n isLegalStyleList: islegalStyleList\n };\n}\nfunction findBulletedListStyle(element) {\n // https://github.com/ckeditor/ckeditor5/issues/15964\n if (element.tagName.toLowerCase() == 'li' && element.parentElement.tagName.toLowerCase() == 'ul' && element.parentElement.hasAttribute('type')) {\n return element.parentElement.getAttribute('type');\n }\n const listMarkerElement = findListMarkerNode(element);\n if (!listMarkerElement) {\n return null;\n }\n const listMarker = listMarkerElement.textContent;\n if (listMarker === 'o') {\n return 'circle';\n }\n else if ((listMarker !== null && listMarker !== void 0 ? listMarker : '').charCodeAt(0) === 183) {\n return 'disc';\n }\n // Word returns '§' instead of '■' for the square list style.\n else if (listMarker === '§') {\n return 'square';\n }\n return null;\n}\nfunction findListMarkerNode(element) {\n var _a;\n // If the first child is a text node, it is the data for the element.\n // The list-style marker is not present here.\n if (((_a = Array.from(element.children)[0]) === null || _a === void 0 ? void 0 : _a.tagName.toLowerCase()) === '#text') {\n return null;\n }\n for (const childNode of Array.from(element.children)) {\n // The list-style marker will be inside the `<span>` element. Let's ignore all non-span elements.\n // It may happen that the `<a>` element is added as the first child. Most probably, it's an anchor element.\n if (!['element', 'span'].includes(childNode.tagName.toLowerCase())) {\n continue;\n }\n return childNode;\n }\n return null;\n}\nfunction mapListStyleDefinition(value) {\n if (value.startsWith('arabic-leading-zero')) {\n return 'decimal-leading-zero';\n }\n switch (value) {\n case 'alpha-upper':\n return 'upper-alpha';\n case 'alpha-lower':\n return 'lower-alpha';\n case 'roman-upper':\n return 'upper-roman';\n case 'roman-lower':\n return 'lower-roman';\n case 'circle':\n case 'disc':\n case 'square':\n return value;\n default:\n return null;\n }\n}\nfunction createNewEmptyList(listStyle, hasMultiLevelListPlugin) {\n const list = document.createElement(listStyle.type);\n // We do not support modifying the marker for a particular list item.\n // Set the value for the `list-style-type` property directly to the list container.\n if (listStyle.style) {\n list.style.setProperty('list-style-type', listStyle.style);\n }\n if (listStyle.startIndex && listStyle.startIndex > 1) {\n list.setAttribute('start', listStyle.startIndex.toString());\n }\n if (listStyle.isLegalStyleList && hasMultiLevelListPlugin) {\n list.classList.add('legal-list');\n }\n return list;\n}\nfunction removeMsoListIgnoreSpans(parentElement) {\n // Get all <span> elements inside the parentElement\n const spans = parentElement.querySelectorAll('span');\n // Iterate over each <span> element\n spans.forEach(span => {\n var _a;\n // Get the value of the 'style' attribute\n const style = span.getAttribute('style');\n // Check if the 'style' attribute contains 'mso-list: Ignore'\n if (style && style.includes('mso-list:Ignore')) {\n // Remove the <span> element\n (_a = span.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(span);\n }\n });\n}\nfunction isListContinuation(currentItem) {\n const previousSibling = currentItem.element.previousSibling;\n if (!previousSibling) {\n // If it's a li inside ul or ol like in here: https://github.com/ckeditor/ckeditor5/issues/15964.\n return isList(currentItem.element.parentElement);\n }\n // Even with the same id the list does not have to be continuous (#43).\n // @ts-expect-error\n return isList(previousSibling);\n}\nconst isList = (element) => ['ul', 'ol'].includes(element.tagName.toLowerCase());\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MSWordNormalizer = void 0;\nconst normalizer_1 = require(\"./normalizer\");\nObject.defineProperty(exports, \"MSWordNormalizer\", { enumerable: true, get: function () { return normalizer_1.MSWordNormalizer; } });\n","import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\nimport { useEffect } from 'react';\nimport { $getSelection, COMMAND_PRIORITY_CRITICAL, type CommandPayloadType, PASTE_COMMAND } from 'lexical';\nimport { objectKlassEquals } from '@lexical/utils';\nimport { $insertDataTransferForRichText } from '@lexical/clipboard';\nimport { MSWordNormalizer } from '@staartwind.nl/lexical-paste-from-word';\n\nexport const PasteHandlerPlugin = () => {\n const [editor] = useLexicalComposerContext();\n\n const handlePaste = (event: CommandPayloadType<typeof PASTE_COMMAND>) => {\n event.preventDefault();\n editor.update(() => {\n const selection = $getSelection();\n const clipboardData =\n objectKlassEquals(event, InputEvent) || objectKlassEquals(event, KeyboardEvent) ? null : event.clipboardData;\n if (clipboardData != null && selection !== null) {\n const content = clipboardData.getData('text/html') || clipboardData.getData('text/plain');\n const newData = new DataTransfer();\n const wordNormalizer = new MSWordNormalizer();\n newData.setData('text/html', content);\n if (wordNormalizer.isActive(content)) {\n newData.setData('text/html', wordNormalizer.normalize(content));\n }\n $insertDataTransferForRichText(newData, selection, editor);\n }\n });\n };\n\n useEffect(() => {\n const removePasteListener = editor.registerCommand(\n PASTE_COMMAND,\n (event) => {\n if (event instanceof ClipboardEvent) {\n handlePaste(event);\n return true;\n }\n return false;\n },\n COMMAND_PRIORITY_CRITICAL\n );\n\n return () => {\n removePasteListener();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [editor]);\n\n return null;\n};\n"],"x_google_ignoreList":[0,1],"mappings":";;;;;;;;AAEA,CADA,OAAO,eAAe,GAAS,cAAc,EAAE,OAAO,IAAM,CAAC,EAC7D,EAAQ,yBAAyB,EAAQ,mBAAmB,EAAQ,YAAY,EAAQ,mBAAmB,KAAK;CAChH,IAAM,IAAkB,CACpB,wEACA,sCACH;AA4ID,GAAQ,mBA3IR,MAAuB;EACnB,SAAS,GAAY;AACjB,UAAO,EAAgB,MAAK,MAAS,EAAM,KAAK,EAAW,CAAC;;EAEhE,UAAU,GAAY;GAClB,IAAM,EAAE,eAAY,oBAAiB,EAAU,EAA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B;;IAGtB,CAAC,EAAO,CAAC,EAEL"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as e } from "./LexicalComposerContext.prod-Ca-YN_fj.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { at as t, q as n } from "./Lexical.prod-DIglXatJ.js";
|
|
3
|
+
import { f as r, s as i } from "./LexicalUtils.prod-BBTLliac.js";
|
|
4
|
+
import { C as a, T as o, b as s, g as c, l, o as u, t as d, u as f, y as p } from "./LexicalTable.prod-D16GW-aZ.js";
|
|
5
5
|
import { $createTableWrapperNode as m, TableWrapperNode as h } from "./components/RteEditor/nodes/TableWrapperNode/TableWrapperNode.js";
|
|
6
6
|
import { getEditorContentWidth as g, getEditorParrentCellWidth as _, tableHasContent as v } from "./components/RteEditor/Plugins/TablePlugin/helpers.js";
|
|
7
7
|
import { useCallback as y, useEffect as b, useLayoutEffect as x, useMemo as S, useRef as C, useState as w } from "react";
|
|
@@ -33,14 +33,14 @@ function I({ editor: e }) {
|
|
|
33
33
|
let x = C(null), S = C(null), O = C(null), k = C(null), [A, j] = w(null), [I, L] = w(null), [R, z] = w(!1), [B, V] = w(null), H = y(() => {
|
|
34
34
|
L(null), x.current = null, V(null), k.current = null, O.current = null;
|
|
35
35
|
}, []), U = (e) => (e.buttons & 1) == 1;
|
|
36
|
-
b(() => e.registerNodeTransform(
|
|
36
|
+
b(() => e.registerNodeTransform(l, (t) => {
|
|
37
37
|
if (!t.getColWidths()) {
|
|
38
|
-
let n = t.getChildren(),
|
|
38
|
+
let n = t.getChildren(), r = t.getColumnCount(), a = Array(r).fill(void 0);
|
|
39
39
|
n[0].getChildren().forEach((n, o) => {
|
|
40
40
|
let s = e.getElementByKey(n.getKey());
|
|
41
41
|
if (s && s.style.width) a[o] = parseInt(s.style.width, 10), s.style.width = "";
|
|
42
42
|
else if (v(t)) {
|
|
43
|
-
let n = t ?
|
|
43
|
+
let n = t ? i(t, u) : null, s = (n ? _(n, r, e) : g(e)) / r;
|
|
44
44
|
a[o] = Math.max(s, P);
|
|
45
45
|
} else a[o] = P;
|
|
46
46
|
}), t.setColWidths(a);
|
|
@@ -63,13 +63,13 @@ function I({ editor: e }) {
|
|
|
63
63
|
}
|
|
64
64
|
if (z(U(r)), !(S.current && S.current.contains(i)) && x.current !== i) {
|
|
65
65
|
x.current = i;
|
|
66
|
-
let t =
|
|
66
|
+
let t = s(i);
|
|
67
67
|
t && I !== t ? e.getEditorState().read(() => {
|
|
68
68
|
let r = n(t.elem);
|
|
69
69
|
if (!r) throw Error("TableCellResizer: Table cell node not found.");
|
|
70
|
-
let a =
|
|
71
|
-
if (!
|
|
72
|
-
x.current = i, O.current =
|
|
70
|
+
let a = p(r), s = o(a, e.getElementByKey(a.getKey()));
|
|
71
|
+
if (!s) throw Error("TableCellResizer: Table element not found.");
|
|
72
|
+
x.current = i, O.current = s.getBoundingClientRect(), L(t);
|
|
73
73
|
}, { editor: e }) : t ?? H();
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -77,11 +77,11 @@ function I({ editor: e }) {
|
|
|
77
77
|
z(!0);
|
|
78
78
|
}, a = () => {
|
|
79
79
|
z(!1);
|
|
80
|
-
},
|
|
80
|
+
}, c = e.registerRootListener((e, t) => {
|
|
81
81
|
t?.removeEventListener("mousemove", r), t?.removeEventListener("mousedown", i), t?.removeEventListener("mouseup", a), e?.addEventListener("mousemove", r), e?.addEventListener("mousedown", i), e?.addEventListener("mouseup", a);
|
|
82
82
|
});
|
|
83
83
|
return () => {
|
|
84
|
-
|
|
84
|
+
c();
|
|
85
85
|
};
|
|
86
86
|
}, [
|
|
87
87
|
I,
|
|
@@ -93,18 +93,18 @@ function I({ editor: e }) {
|
|
|
93
93
|
if (!I) throw Error("TableCellResizer: Expected active cell.");
|
|
94
94
|
e.update(() => {
|
|
95
95
|
let r = n(I.elem);
|
|
96
|
-
if (!
|
|
97
|
-
let i =
|
|
98
|
-
if (
|
|
99
|
-
let
|
|
100
|
-
if (!
|
|
101
|
-
let
|
|
102
|
-
if (
|
|
103
|
-
let t =
|
|
104
|
-
|
|
96
|
+
if (!d(r)) throw Error("TableCellResizer: Table cell node not found.");
|
|
97
|
+
let i = p(r), a = c(r) + r.getRowSpan() - 1, o = i.getChildren();
|
|
98
|
+
if (a >= o.length || a < 0) throw Error("Expected table cell to be inside of table row.");
|
|
99
|
+
let s = o[a];
|
|
100
|
+
if (!f(s)) throw Error("Expected table row");
|
|
101
|
+
let l = s.getHeight();
|
|
102
|
+
if (l === void 0) {
|
|
103
|
+
let t = s.getChildren();
|
|
104
|
+
l = Math.min(...t.map((t) => K(t, e) ?? Infinity));
|
|
105
105
|
}
|
|
106
|
-
let
|
|
107
|
-
|
|
106
|
+
let u = Math.max(l + t, N);
|
|
107
|
+
s.setHeight(u);
|
|
108
108
|
}, { tag: "skip-scroll-into-view" });
|
|
109
109
|
}, [I, e]), K = (e, t) => t.getElementByKey(e.getKey())?.clientHeight, q = (e, t) => {
|
|
110
110
|
for (let n = 0; n < t.length; n++) for (let r = 0; r < t[n].length; r++) if (t[n][r].cell === e) return r;
|
|
@@ -113,29 +113,29 @@ function I({ editor: e }) {
|
|
|
113
113
|
if (!I) throw Error("TableCellResizer: Expected active cell.");
|
|
114
114
|
e.update(() => {
|
|
115
115
|
let e = n(I.elem);
|
|
116
|
-
if (!
|
|
117
|
-
let r =
|
|
118
|
-
if (
|
|
119
|
-
let
|
|
120
|
-
if (!
|
|
121
|
-
let
|
|
122
|
-
if (
|
|
123
|
-
let
|
|
124
|
-
if (
|
|
116
|
+
if (!d(e)) throw Error("TableCellResizer: Table cell node not found.");
|
|
117
|
+
let r = p(e), [i] = a(r, null, null), o = q(e, i);
|
|
118
|
+
if (o === void 0) throw Error("TableCellResizer: Table column not found.");
|
|
119
|
+
let s = r.getColWidths();
|
|
120
|
+
if (!s) return;
|
|
121
|
+
let c = s[o];
|
|
122
|
+
if (c === void 0) return;
|
|
123
|
+
let l = [...s];
|
|
124
|
+
if (l[o] = Math.max(c + t, P), r.setColWidths(l), o < r.getColumnCount() - 1) {
|
|
125
125
|
let e = r.getColWidths();
|
|
126
126
|
if (!e) return;
|
|
127
|
-
let n = [...e], i =
|
|
128
|
-
n[i] = Math.max(
|
|
127
|
+
let n = [...e], i = o + 1, a = e[i];
|
|
128
|
+
n[i] = Math.max(a - t, P), r.setColWidths(n);
|
|
129
129
|
}
|
|
130
130
|
}, { tag: "skip-scroll-into-view" });
|
|
131
131
|
}, [I, e]), Y = y((e) => {
|
|
132
132
|
let t = (n) => {
|
|
133
133
|
if (n.preventDefault(), n.stopPropagation(), !I) throw Error("TableCellResizer: Expected active cell.");
|
|
134
134
|
if (k.current) {
|
|
135
|
-
let { x:
|
|
135
|
+
let { x: i, y: a } = k.current;
|
|
136
136
|
if (I === null) return;
|
|
137
|
-
let o =
|
|
138
|
-
W(e) ? G((n.clientY - a) / o) : J((n.clientX -
|
|
137
|
+
let o = r(n.target);
|
|
138
|
+
W(e) ? G((n.clientY - a) / o) : J((n.clientX - i) / o), H(), document.removeEventListener("mouseup", t);
|
|
139
139
|
}
|
|
140
140
|
};
|
|
141
141
|
return t;
|
|
@@ -152,12 +152,12 @@ function I({ editor: e }) {
|
|
|
152
152
|
}, j(k.current), V(e), document.addEventListener("mouseup", Y(e));
|
|
153
153
|
}, [I, Y]), Z = y(() => {
|
|
154
154
|
if (I) {
|
|
155
|
-
let { height: e, width: t, top: n, left:
|
|
155
|
+
let { height: e, width: t, top: n, left: i } = I.elem.getBoundingClientRect(), a = r(I.elem), o = {
|
|
156
156
|
bottom: {
|
|
157
157
|
backgroundColor: "none",
|
|
158
158
|
cursor: "ns-resize",
|
|
159
159
|
height: "10px",
|
|
160
|
-
left: `${window.pageXOffset +
|
|
160
|
+
left: `${window.pageXOffset + i}px`,
|
|
161
161
|
top: `${window.pageYOffset + n + e - 10 / F}px`,
|
|
162
162
|
width: `${t}px`,
|
|
163
163
|
zIndex: 5e3
|
|
@@ -166,7 +166,7 @@ function I({ editor: e }) {
|
|
|
166
166
|
backgroundColor: "none",
|
|
167
167
|
cursor: "ew-resize",
|
|
168
168
|
height: `${e}px`,
|
|
169
|
-
left: `${window.pageXOffset +
|
|
169
|
+
left: `${window.pageXOffset + i + t - 10 / F}px`,
|
|
170
170
|
top: `${window.pageYOffset + n}px`,
|
|
171
171
|
width: "10px",
|
|
172
172
|
zIndex: 5e3
|
|
@@ -205,4 +205,4 @@ var L = () => {
|
|
|
205
205
|
//#endregion
|
|
206
206
|
export { j as n, L as t };
|
|
207
207
|
|
|
208
|
-
//# sourceMappingURL=TableCellResizerPlugin-
|
|
208
|
+
//# sourceMappingURL=TableCellResizerPlugin-CgYsYsuY.js.map
|
package/dist/{TableCellResizerPlugin-BGolbi44.js.map → TableCellResizerPlugin-CgYsYsuY.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableCellResizerPlugin-BGolbi44.js","names":["n","t","e","i","r","o"],"sources":["../node_modules/@lexical/react/useLexicalEditable.prod.mjs","../src/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.module.css","../src/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport{useLexicalComposerContext as e}from\"@lexical/react/LexicalComposerContext\";import{useLayoutEffect as n,useEffect as t,useMemo as i,useState as r,useRef as o}from\"react\";const c=\"undefined\"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n:t;function u(e){return{initialValueFn:()=>e.isEditable(),subscribe:n=>e.registerEditableListener(n)}}function a(){return function(n){const[t]=e(),u=i(()=>n(t),[t,n]),[a,l]=r(()=>u.initialValueFn()),d=o(a);return c(()=>{const{initialValueFn:e,subscribe:n}=u,t=e();return d.current!==t&&(d.current=t,l(t)),n(e=>{d.current=e,l(e)})},[u,n]),a}(u)}export{a as useLexicalEditable};\n","/**\r\n * Copyright (c) Meta Platforms, Inc. and affiliates.\r\n *\r\n * This source code is licensed under the MIT license found in the\r\n * LICENSE file in the root directory of this source tree.\r\n *\r\n *\r\n */\n\n.table-cell-resizer__resizer {\n position: absolute;\n}\n","/* eslint-disable jsx-a11y/no-static-element-interactions */\r\n/**\r\n * Copyright (c) Meta Platforms, Inc. and affiliates.\r\n *\r\n * This source code is licensed under the MIT license found in the\r\n * LICENSE file in the root directory of this source tree.\r\n *\r\n * Modified from original to fit project needs wim jurriaans.\r\n *\r\n *\r\n */\r\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\r\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\r\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable';\r\nimport {\r\n $computeTableMapSkipCellCheck,\r\n $getTableNodeFromLexicalNodeOrThrow,\r\n $getTableRowIndexFromTableCellNode,\r\n $isTableCellNode,\r\n $isTableRowNode,\r\n TableNode,\r\n getDOMCellFromTarget,\r\n getTableElement,\r\n TableCellNode,\r\n} from '@lexical/table';\r\nimport { $getNearestNodeOfType, calculateZoomLevel } from '@lexical/utils';\r\nimport { $getNearestNodeFromDOMNode, isHTMLElement } from 'lexical';\r\nimport { createPortal } from 'react-dom';\r\n\r\nimport type { LexicalEditor } from 'lexical';\r\nimport type { TableDOMCell, TableMapType, TableRowNode } from '@lexical/table';\r\nimport type { JSX, MouseEventHandler, ReactPortal } from 'react';\r\n\r\nimport styles from './TableCellResizerPlugin.module.css';\r\n\r\nimport {\r\n getEditorContentWidth,\r\n getEditorParrentCellWidth,\r\n tableHasContent,\r\n} from 'components/RteEditor/Plugins/TablePlugin/helpers';\r\nimport { $createTableWrapperNode, TableWrapperNode } from 'components/RteEditor/nodes';\r\n\r\ntype MousePosition = {\r\n x: number;\r\n y: number;\r\n};\r\n\r\ntype MouseDraggingDirection = 'right' | 'bottom';\r\n\r\nconst MIN_ROW_HEIGHT = 33;\r\nconst MIN_COLUMN_WIDTH = 32;\r\nconst HALF = 2;\r\n\r\nfunction TableCellResizer({ editor }: { editor: LexicalEditor }): JSX.Element {\r\n const targetRef = useRef<HTMLElement | null>(null);\r\n const resizerRef = useRef<HTMLDivElement | null>(null);\r\n const tableRectRef = useRef<DOMRect | null>(null);\r\n\r\n const mouseStartPosRef = useRef<MousePosition | null>(null);\r\n const [mouseCurrentPos, updateMouseCurrentPos] = useState<MousePosition | null>(null);\r\n\r\n const [activeCell, updateActiveCell] = useState<TableDOMCell | null>(null);\r\n const [isMouseDown, updateIsMouseDown] = useState<boolean>(false);\r\n const [draggingDirection, updateDraggingDirection] = useState<MouseDraggingDirection | null>(null);\r\n\r\n const resetState = useCallback(() => {\r\n updateActiveCell(null);\r\n targetRef.current = null;\r\n updateDraggingDirection(null);\r\n mouseStartPosRef.current = null;\r\n tableRectRef.current = null;\r\n }, []);\r\n\r\n const isMouseDownOnEvent = (event: MouseEvent) => {\r\n return (event.buttons & 1) === 1;\r\n };\r\n\r\n useEffect(() => {\r\n return editor.registerNodeTransform(TableNode, (tableNode) => {\r\n // modification: set default column widths if not defined or table cells of imported tables has the width set\r\n if (!tableNode.getColWidths()) {\r\n const tableRows = tableNode.getChildren();\r\n const columnCount = tableNode.getColumnCount();\r\n const colWidths = new Array(columnCount).fill(undefined);\r\n\r\n const firstRow = tableRows[0] as TableRowNode;\r\n const cells = firstRow.getChildren();\r\n cells.forEach((cell, colIdx) => {\r\n const domCell = editor.getElementByKey(cell.getKey());\r\n if (domCell && domCell.style.width) {\r\n colWidths[colIdx] = parseInt(domCell.style.width, 10);\r\n domCell.style.width = '';\r\n } else if (tableHasContent(tableNode)) {\r\n const isNested = tableNode ? $getNearestNodeOfType(tableNode, TableCellNode) : null;\r\n\r\n const availableWidth = isNested\r\n ? getEditorParrentCellWidth(isNested, columnCount, editor)\r\n : getEditorContentWidth(editor);\r\n const newColWidth = availableWidth / columnCount;\r\n colWidths[colIdx] = Math.max(newColWidth, MIN_COLUMN_WIDTH);\r\n } else {\r\n colWidths[colIdx] = MIN_COLUMN_WIDTH;\r\n }\r\n });\r\n\r\n tableNode.setColWidths(colWidths);\r\n }\r\n\r\n // modification: wrap table node in a wrapper node if there is no wrapper node present\r\n if (tableNode && !(tableNode.getParent() instanceof TableWrapperNode)) {\r\n const wrapperNode = $createTableWrapperNode();\r\n tableNode.replace(wrapperNode);\r\n wrapperNode.append(tableNode);\r\n }\r\n\r\n return tableNode;\r\n });\r\n }, [editor]);\r\n\r\n useEffect(() => {\r\n const onMouseMove = (event: MouseEvent) => {\r\n const target = event.target;\r\n if (!isHTMLElement(target)) {\r\n return;\r\n }\r\n\r\n if (draggingDirection) {\r\n updateMouseCurrentPos({\r\n x: event.clientX,\r\n y: event.clientY,\r\n });\r\n return;\r\n }\r\n updateIsMouseDown(isMouseDownOnEvent(event));\r\n if (resizerRef.current && resizerRef.current.contains(target)) {\r\n return;\r\n }\r\n\r\n if (targetRef.current !== target) {\r\n targetRef.current = target;\r\n const cell = getDOMCellFromTarget(target);\r\n\r\n if (cell && activeCell !== cell) {\r\n editor.getEditorState().read(\r\n () => {\r\n const tableCellNode = $getNearestNodeFromDOMNode(cell.elem);\r\n if (!tableCellNode) {\r\n throw new Error('TableCellResizer: Table cell node not found.');\r\n }\r\n\r\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);\r\n const tableElement = getTableElement(tableNode, editor.getElementByKey(tableNode.getKey()));\r\n\r\n if (!tableElement) {\r\n throw new Error('TableCellResizer: Table element not found.');\r\n }\r\n\r\n targetRef.current = target;\r\n tableRectRef.current = tableElement.getBoundingClientRect();\r\n updateActiveCell(cell);\r\n },\r\n { editor }\r\n );\r\n } else if (cell == null) {\r\n resetState();\r\n }\r\n }\r\n };\r\n\r\n const onMouseDown = () => {\r\n updateIsMouseDown(true);\r\n };\r\n\r\n const onMouseUp = () => {\r\n updateIsMouseDown(false);\r\n };\r\n\r\n const removeRootListener = editor.registerRootListener((rootElement, prevRootElement) => {\r\n prevRootElement?.removeEventListener('mousemove', onMouseMove);\r\n prevRootElement?.removeEventListener('mousedown', onMouseDown);\r\n prevRootElement?.removeEventListener('mouseup', onMouseUp);\r\n rootElement?.addEventListener('mousemove', onMouseMove);\r\n rootElement?.addEventListener('mousedown', onMouseDown);\r\n rootElement?.addEventListener('mouseup', onMouseUp);\r\n });\r\n\r\n return () => {\r\n removeRootListener();\r\n };\r\n }, [activeCell, draggingDirection, editor, resetState]);\r\n\r\n const isHeightChanging = (direction: MouseDraggingDirection) => {\r\n if (direction === 'bottom') {\r\n return true;\r\n }\r\n return false;\r\n };\r\n\r\n const updateRowHeight = useCallback(\r\n (heightChange: number) => {\r\n if (!activeCell) {\r\n throw new Error('TableCellResizer: Expected active cell.');\r\n }\r\n\r\n editor.update(\r\n () => {\r\n const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem);\r\n if (!$isTableCellNode(tableCellNode)) {\r\n throw new Error('TableCellResizer: Table cell node not found.');\r\n }\r\n\r\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);\r\n\r\n const tableRowIndex = $getTableRowIndexFromTableCellNode(tableCellNode) + tableCellNode.getRowSpan() - 1;\r\n\r\n const tableRows = tableNode.getChildren();\r\n\r\n if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {\r\n throw new Error('Expected table cell to be inside of table row.');\r\n }\r\n\r\n const tableRow = tableRows[tableRowIndex];\r\n\r\n if (!$isTableRowNode(tableRow)) {\r\n throw new Error('Expected table row');\r\n }\r\n\r\n let height = tableRow.getHeight();\r\n if (height === undefined) {\r\n const rowCells = tableRow.getChildren<TableCellNode>();\r\n height = Math.min(...rowCells.map((cell) => getCellNodeHeight(cell, editor) ?? Infinity));\r\n }\r\n\r\n const newHeight = Math.max(height + heightChange, MIN_ROW_HEIGHT);\r\n tableRow.setHeight(newHeight);\r\n },\r\n { tag: 'skip-scroll-into-view' }\r\n );\r\n },\r\n [activeCell, editor]\r\n );\r\n\r\n const getCellNodeHeight = (cell: TableCellNode, activeEditor: LexicalEditor): number | undefined => {\r\n const domCellNode = activeEditor.getElementByKey(cell.getKey());\r\n return domCellNode?.clientHeight;\r\n };\r\n\r\n const getCellColumnIndex = (tableCellNode: TableCellNode, tableMap: TableMapType) => {\r\n for (let row = 0; row < tableMap.length; row++) {\r\n for (let column = 0; column < tableMap[row].length; column++) {\r\n if (tableMap[row][column].cell === tableCellNode) {\r\n return column;\r\n }\r\n }\r\n }\r\n return -1;\r\n };\r\n\r\n const updateColumnWidth = useCallback(\r\n (widthChange: number) => {\r\n if (!activeCell) {\r\n throw new Error('TableCellResizer: Expected active cell.');\r\n }\r\n editor.update(\r\n () => {\r\n const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem);\r\n if (!$isTableCellNode(tableCellNode)) {\r\n throw new Error('TableCellResizer: Table cell node not found.');\r\n }\r\n\r\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);\r\n const [tableMap] = $computeTableMapSkipCellCheck(tableNode, null, null);\r\n const columnIndex = getCellColumnIndex(tableCellNode, tableMap);\r\n if (columnIndex === undefined) {\r\n throw new Error('TableCellResizer: Table column not found.');\r\n }\r\n\r\n const colWidths = tableNode.getColWidths();\r\n if (!colWidths) {\r\n return;\r\n }\r\n const width = colWidths[columnIndex];\r\n if (width === undefined) {\r\n return;\r\n }\r\n const newColWidths = [...colWidths];\r\n const newWidth = Math.max(width + widthChange, MIN_COLUMN_WIDTH);\r\n newColWidths[columnIndex] = newWidth;\r\n tableNode.setColWidths(newColWidths);\r\n\r\n // modification: when resizing a column, also resize the next column so the table doesn't overflow\r\n if (columnIndex < tableNode.getColumnCount() - 1) {\r\n const nextColWidths = tableNode.getColWidths();\r\n if (!nextColWidths) {\r\n return;\r\n }\r\n const newNextColWidths = [...nextColWidths];\r\n const newColumnIndex = columnIndex + 1;\r\n const newNextWidth = nextColWidths[newColumnIndex];\r\n const nextWidth = Math.max(newNextWidth - widthChange, MIN_COLUMN_WIDTH);\r\n newNextColWidths[newColumnIndex] = nextWidth;\r\n tableNode.setColWidths(newNextColWidths);\r\n }\r\n },\r\n { tag: 'skip-scroll-into-view' }\r\n );\r\n },\r\n [activeCell, editor]\r\n );\r\n\r\n const mouseUpHandler = useCallback(\r\n (direction: MouseDraggingDirection) => {\r\n const handler = (event: MouseEvent) => {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (!activeCell) {\r\n throw new Error('TableCellResizer: Expected active cell.');\r\n }\r\n\r\n if (mouseStartPosRef.current) {\r\n const { x, y } = mouseStartPosRef.current;\r\n\r\n if (activeCell === null) {\r\n return;\r\n }\r\n const zoom = calculateZoomLevel(event.target as Element);\r\n\r\n if (isHeightChanging(direction)) {\r\n const heightChange = (event.clientY - y) / zoom;\r\n updateRowHeight(heightChange);\r\n } else {\r\n const widthChange = (event.clientX - x) / zoom;\r\n updateColumnWidth(widthChange);\r\n }\r\n\r\n resetState();\r\n document.removeEventListener('mouseup', handler);\r\n }\r\n };\r\n return handler;\r\n },\r\n [activeCell, resetState, updateColumnWidth, updateRowHeight]\r\n );\r\n\r\n const toggleResize = useCallback(\r\n (direction: MouseDraggingDirection): MouseEventHandler<HTMLDivElement> =>\r\n (event) => {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (!activeCell) {\r\n throw new Error('TableCellResizer: Expected active cell.');\r\n }\r\n\r\n mouseStartPosRef.current = {\r\n x: event.clientX,\r\n y: event.clientY,\r\n };\r\n updateMouseCurrentPos(mouseStartPosRef.current);\r\n updateDraggingDirection(direction);\r\n\r\n document.addEventListener('mouseup', mouseUpHandler(direction));\r\n },\r\n [activeCell, mouseUpHandler]\r\n );\r\n\r\n const getResizers = useCallback(() => {\r\n if (activeCell) {\r\n const { height, width, top, left } = activeCell.elem.getBoundingClientRect();\r\n const zoom = calculateZoomLevel(activeCell.elem);\r\n const zoneWidth = 10; // Pixel width of the zone where you can drag the edge\r\n const styles = {\r\n bottom: {\r\n backgroundColor: 'none',\r\n cursor: 'ns-resize',\r\n height: `${zoneWidth}px`,\r\n left: `${window.pageXOffset + left}px`,\r\n top: `${window.pageYOffset + top + height - zoneWidth / HALF}px`,\r\n width: `${width}px`,\r\n zIndex: 5000,\r\n },\r\n right: {\r\n backgroundColor: 'none',\r\n cursor: 'ew-resize',\r\n height: `${height}px`,\r\n left: `${window.pageXOffset + left + width - zoneWidth / HALF}px`,\r\n top: `${window.pageYOffset + top}px`,\r\n width: `${zoneWidth}px`,\r\n zIndex: 5000,\r\n },\r\n };\r\n\r\n const tableRect = tableRectRef.current;\r\n\r\n if (draggingDirection && mouseCurrentPos && tableRect) {\r\n if (isHeightChanging(draggingDirection)) {\r\n styles[draggingDirection].left = `${window.pageXOffset + tableRect.left}px`;\r\n styles[draggingDirection].top = `${window.pageYOffset + mouseCurrentPos.y / zoom}px`;\r\n styles[draggingDirection].height = '3px';\r\n styles[draggingDirection].width = `${tableRect.width}px`;\r\n } else {\r\n styles[draggingDirection].top = `${window.pageYOffset + tableRect.top}px`;\r\n styles[draggingDirection].left = `${window.pageXOffset + mouseCurrentPos.x / zoom}px`;\r\n styles[draggingDirection].width = '3px';\r\n styles[draggingDirection].height = `${tableRect.height}px`;\r\n }\r\n\r\n styles[draggingDirection].backgroundColor = '#adf';\r\n }\r\n\r\n return styles;\r\n }\r\n\r\n return {\r\n bottom: null,\r\n left: null,\r\n right: null,\r\n top: null,\r\n };\r\n }, [activeCell, draggingDirection, mouseCurrentPos]);\r\n\r\n const resizerStyles = getResizers();\r\n\r\n return (\r\n <div ref={resizerRef}>\r\n {activeCell != null && !isMouseDown && (\r\n <>\r\n <div\r\n className={styles['table-cell-resizer__resizer']}\r\n style={resizerStyles.right || undefined}\r\n onMouseDown={toggleResize('right')}\r\n />\r\n <div\r\n className={styles['table-cell-resizer__resizer']}\r\n style={resizerStyles.bottom || undefined}\r\n onMouseDown={toggleResize('bottom')}\r\n />\r\n </>\r\n )}\r\n </div>\r\n );\r\n}\r\n\r\nexport const TableCellResizerPlugin = (): null | ReactPortal => {\r\n const [editor] = useLexicalComposerContext();\r\n const isEditable = useLexicalEditable();\r\n\r\n return useMemo(\r\n () => (isEditable ? createPortal(<TableCellResizer editor={editor} />, document.body) : null),\r\n [editor, isEditable]\r\n );\r\n};\r\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;AAQgL,IAAM,IAAe,OAAO,SAApB,OAAqC,OAAO,aAAhB,KAAK,KAA8B,OAAO,SAAS,kBAAzB,KAAK,IAAkCA,IAAEC;AAAE,SAAS,EAAE,GAAE;AAAC,QAAM;EAAC,sBAAmB,EAAE,YAAY;EAAC,YAAU,MAAG,EAAE,yBAAyB,EAAE;EAAC;;AAAC,SAAS,IAAG;AAAC,QAAO,SAAS,GAAE;EAAC,IAAK,CAAC,KAAGC,GAAG,EAAC,IAAEC,QAAM,EAAE,EAAE,EAAC,CAAC,GAAE,EAAE,CAAC,EAAC,CAAC,GAAE,KAAGC,QAAM,EAAE,gBAAgB,CAAC,EAAC,IAAEC,EAAE,EAAE;AAAC,SAAO,QAAM;GAAC,IAAK,EAAC,gBAAe,GAAE,WAAU,MAAG,GAAE,IAAE,GAAG;AAAC,UAAO,EAAE,YAAU,MAAI,EAAE,UAAQ,GAAE,EAAE,EAAE,GAAE,GAAE,MAAG;AAAC,MAAE,UAAQ,GAAE,EAAE,EAAE;KAAE;KAAE,CAAC,GAAE,EAAE,CAAC,EAAC;GAAG,EAAE;;;;oFEyCvmB,IAAiB,IACjB,IAAmB,IACnB,IAAO;AAEb,SAAS,EAAiB,EAAE,aAAkD;CAC5E,IAAM,IAAY,EAA2B,KAAK,EAC5C,IAAa,EAA8B,KAAK,EAChD,IAAe,EAAuB,KAAK,EAE3C,IAAmB,EAA6B,KAAK,EACrD,CAAC,GAAiB,KAAyB,EAA+B,KAAK,EAE/E,CAAC,GAAY,KAAoB,EAA8B,KAAK,EACpE,CAAC,GAAa,KAAqB,EAAkB,GAAM,EAC3D,CAAC,GAAmB,KAA2B,EAAwC,KAAK,EAE5F,IAAa,QAAkB;AAKnC,EAJA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AO,EAAc,UAAU,KAAA;GAC/B,aAAa,EAAa,SAAS;GACnC,CAAA,CACD,EAAA,CAAA;EAED,CAAA;;AAIV,IAAa,UAAmD;CAC9D,IAAM,CAAC,KAAU,GAA2B,EACtC,IAAa,GAAoB;AAEvC,QAAO,QACE,IAAa,EAAa,kBAAC,GAAD,EAA0B,WAAU,CAAA,EAAE,SAAS,KAAK,GAAG,MACxF,CAAC,GAAQ,EAAW,CACrB"}
|
|
1
|
+
{"version":3,"file":"TableCellResizerPlugin-CgYsYsuY.js","names":["n","t","e","i","r","o"],"sources":["../node_modules/@lexical/react/useLexicalEditable.prod.mjs","../src/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.module.css","../src/components/RteEditor/Plugins/TableCellResizerPlugin/TableCellResizerPlugin.tsx"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport{useLexicalComposerContext as e}from\"@lexical/react/LexicalComposerContext\";import{useLayoutEffect as n,useEffect as t,useMemo as i,useState as r,useRef as o}from\"react\";const c=\"undefined\"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?n:t;function u(e){return{initialValueFn:()=>e.isEditable(),subscribe:n=>e.registerEditableListener(n)}}function a(){return function(n){const[t]=e(),u=i(()=>n(t),[t,n]),[a,l]=r(()=>u.initialValueFn()),d=o(a);return c(()=>{const{initialValueFn:e,subscribe:n}=u,t=e();return d.current!==t&&(d.current=t,l(t)),n(e=>{d.current=e,l(e)})},[u,n]),a}(u)}export{a as useLexicalEditable};\n","/**\r\n * Copyright (c) Meta Platforms, Inc. and affiliates.\r\n *\r\n * This source code is licensed under the MIT license found in the\r\n * LICENSE file in the root directory of this source tree.\r\n *\r\n *\r\n */\n\n.table-cell-resizer__resizer {\n position: absolute;\n}\n","/* eslint-disable jsx-a11y/no-static-element-interactions */\r\n/**\r\n * Copyright (c) Meta Platforms, Inc. and affiliates.\r\n *\r\n * This source code is licensed under the MIT license found in the\r\n * LICENSE file in the root directory of this source tree.\r\n *\r\n * Modified from original to fit project needs wim jurriaans.\r\n *\r\n *\r\n */\r\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react';\r\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';\r\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable';\r\nimport {\r\n $computeTableMapSkipCellCheck,\r\n $getTableNodeFromLexicalNodeOrThrow,\r\n $getTableRowIndexFromTableCellNode,\r\n $isTableCellNode,\r\n $isTableRowNode,\r\n TableNode,\r\n getDOMCellFromTarget,\r\n getTableElement,\r\n TableCellNode,\r\n} from '@lexical/table';\r\nimport { $getNearestNodeOfType, calculateZoomLevel } from '@lexical/utils';\r\nimport { $getNearestNodeFromDOMNode, isHTMLElement } from 'lexical';\r\nimport { createPortal } from 'react-dom';\r\n\r\nimport type { LexicalEditor } from 'lexical';\r\nimport type { TableDOMCell, TableMapType, TableRowNode } from '@lexical/table';\r\nimport type { JSX, MouseEventHandler, ReactPortal } from 'react';\r\n\r\nimport styles from './TableCellResizerPlugin.module.css';\r\n\r\nimport {\r\n getEditorContentWidth,\r\n getEditorParrentCellWidth,\r\n tableHasContent,\r\n} from 'components/RteEditor/Plugins/TablePlugin/helpers';\r\nimport { $createTableWrapperNode, TableWrapperNode } from 'components/RteEditor/nodes';\r\n\r\ntype MousePosition = {\r\n x: number;\r\n y: number;\r\n};\r\n\r\ntype MouseDraggingDirection = 'right' | 'bottom';\r\n\r\nconst MIN_ROW_HEIGHT = 33;\r\nconst MIN_COLUMN_WIDTH = 32;\r\nconst HALF = 2;\r\n\r\nfunction TableCellResizer({ editor }: { editor: LexicalEditor }): JSX.Element {\r\n const targetRef = useRef<HTMLElement | null>(null);\r\n const resizerRef = useRef<HTMLDivElement | null>(null);\r\n const tableRectRef = useRef<DOMRect | null>(null);\r\n\r\n const mouseStartPosRef = useRef<MousePosition | null>(null);\r\n const [mouseCurrentPos, updateMouseCurrentPos] = useState<MousePosition | null>(null);\r\n\r\n const [activeCell, updateActiveCell] = useState<TableDOMCell | null>(null);\r\n const [isMouseDown, updateIsMouseDown] = useState<boolean>(false);\r\n const [draggingDirection, updateDraggingDirection] = useState<MouseDraggingDirection | null>(null);\r\n\r\n const resetState = useCallback(() => {\r\n updateActiveCell(null);\r\n targetRef.current = null;\r\n updateDraggingDirection(null);\r\n mouseStartPosRef.current = null;\r\n tableRectRef.current = null;\r\n }, []);\r\n\r\n const isMouseDownOnEvent = (event: MouseEvent) => {\r\n return (event.buttons & 1) === 1;\r\n };\r\n\r\n useEffect(() => {\r\n return editor.registerNodeTransform(TableNode, (tableNode) => {\r\n // modification: set default column widths if not defined or table cells of imported tables has the width set\r\n if (!tableNode.getColWidths()) {\r\n const tableRows = tableNode.getChildren();\r\n const columnCount = tableNode.getColumnCount();\r\n const colWidths = new Array(columnCount).fill(undefined);\r\n\r\n const firstRow = tableRows[0] as TableRowNode;\r\n const cells = firstRow.getChildren();\r\n cells.forEach((cell, colIdx) => {\r\n const domCell = editor.getElementByKey(cell.getKey());\r\n if (domCell && domCell.style.width) {\r\n colWidths[colIdx] = parseInt(domCell.style.width, 10);\r\n domCell.style.width = '';\r\n } else if (tableHasContent(tableNode)) {\r\n const isNested = tableNode ? $getNearestNodeOfType(tableNode, TableCellNode) : null;\r\n\r\n const availableWidth = isNested\r\n ? getEditorParrentCellWidth(isNested, columnCount, editor)\r\n : getEditorContentWidth(editor);\r\n const newColWidth = availableWidth / columnCount;\r\n colWidths[colIdx] = Math.max(newColWidth, MIN_COLUMN_WIDTH);\r\n } else {\r\n colWidths[colIdx] = MIN_COLUMN_WIDTH;\r\n }\r\n });\r\n\r\n tableNode.setColWidths(colWidths);\r\n }\r\n\r\n // modification: wrap table node in a wrapper node if there is no wrapper node present\r\n if (tableNode && !(tableNode.getParent() instanceof TableWrapperNode)) {\r\n const wrapperNode = $createTableWrapperNode();\r\n tableNode.replace(wrapperNode);\r\n wrapperNode.append(tableNode);\r\n }\r\n\r\n return tableNode;\r\n });\r\n }, [editor]);\r\n\r\n useEffect(() => {\r\n const onMouseMove = (event: MouseEvent) => {\r\n const target = event.target;\r\n if (!isHTMLElement(target)) {\r\n return;\r\n }\r\n\r\n if (draggingDirection) {\r\n updateMouseCurrentPos({\r\n x: event.clientX,\r\n y: event.clientY,\r\n });\r\n return;\r\n }\r\n updateIsMouseDown(isMouseDownOnEvent(event));\r\n if (resizerRef.current && resizerRef.current.contains(target)) {\r\n return;\r\n }\r\n\r\n if (targetRef.current !== target) {\r\n targetRef.current = target;\r\n const cell = getDOMCellFromTarget(target);\r\n\r\n if (cell && activeCell !== cell) {\r\n editor.getEditorState().read(\r\n () => {\r\n const tableCellNode = $getNearestNodeFromDOMNode(cell.elem);\r\n if (!tableCellNode) {\r\n throw new Error('TableCellResizer: Table cell node not found.');\r\n }\r\n\r\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);\r\n const tableElement = getTableElement(tableNode, editor.getElementByKey(tableNode.getKey()));\r\n\r\n if (!tableElement) {\r\n throw new Error('TableCellResizer: Table element not found.');\r\n }\r\n\r\n targetRef.current = target;\r\n tableRectRef.current = tableElement.getBoundingClientRect();\r\n updateActiveCell(cell);\r\n },\r\n { editor }\r\n );\r\n } else if (cell == null) {\r\n resetState();\r\n }\r\n }\r\n };\r\n\r\n const onMouseDown = () => {\r\n updateIsMouseDown(true);\r\n };\r\n\r\n const onMouseUp = () => {\r\n updateIsMouseDown(false);\r\n };\r\n\r\n const removeRootListener = editor.registerRootListener((rootElement, prevRootElement) => {\r\n prevRootElement?.removeEventListener('mousemove', onMouseMove);\r\n prevRootElement?.removeEventListener('mousedown', onMouseDown);\r\n prevRootElement?.removeEventListener('mouseup', onMouseUp);\r\n rootElement?.addEventListener('mousemove', onMouseMove);\r\n rootElement?.addEventListener('mousedown', onMouseDown);\r\n rootElement?.addEventListener('mouseup', onMouseUp);\r\n });\r\n\r\n return () => {\r\n removeRootListener();\r\n };\r\n }, [activeCell, draggingDirection, editor, resetState]);\r\n\r\n const isHeightChanging = (direction: MouseDraggingDirection) => {\r\n if (direction === 'bottom') {\r\n return true;\r\n }\r\n return false;\r\n };\r\n\r\n const updateRowHeight = useCallback(\r\n (heightChange: number) => {\r\n if (!activeCell) {\r\n throw new Error('TableCellResizer: Expected active cell.');\r\n }\r\n\r\n editor.update(\r\n () => {\r\n const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem);\r\n if (!$isTableCellNode(tableCellNode)) {\r\n throw new Error('TableCellResizer: Table cell node not found.');\r\n }\r\n\r\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);\r\n\r\n const tableRowIndex = $getTableRowIndexFromTableCellNode(tableCellNode) + tableCellNode.getRowSpan() - 1;\r\n\r\n const tableRows = tableNode.getChildren();\r\n\r\n if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {\r\n throw new Error('Expected table cell to be inside of table row.');\r\n }\r\n\r\n const tableRow = tableRows[tableRowIndex];\r\n\r\n if (!$isTableRowNode(tableRow)) {\r\n throw new Error('Expected table row');\r\n }\r\n\r\n let height = tableRow.getHeight();\r\n if (height === undefined) {\r\n const rowCells = tableRow.getChildren<TableCellNode>();\r\n height = Math.min(...rowCells.map((cell) => getCellNodeHeight(cell, editor) ?? Infinity));\r\n }\r\n\r\n const newHeight = Math.max(height + heightChange, MIN_ROW_HEIGHT);\r\n tableRow.setHeight(newHeight);\r\n },\r\n { tag: 'skip-scroll-into-view' }\r\n );\r\n },\r\n [activeCell, editor]\r\n );\r\n\r\n const getCellNodeHeight = (cell: TableCellNode, activeEditor: LexicalEditor): number | undefined => {\r\n const domCellNode = activeEditor.getElementByKey(cell.getKey());\r\n return domCellNode?.clientHeight;\r\n };\r\n\r\n const getCellColumnIndex = (tableCellNode: TableCellNode, tableMap: TableMapType) => {\r\n for (let row = 0; row < tableMap.length; row++) {\r\n for (let column = 0; column < tableMap[row].length; column++) {\r\n if (tableMap[row][column].cell === tableCellNode) {\r\n return column;\r\n }\r\n }\r\n }\r\n return -1;\r\n };\r\n\r\n const updateColumnWidth = useCallback(\r\n (widthChange: number) => {\r\n if (!activeCell) {\r\n throw new Error('TableCellResizer: Expected active cell.');\r\n }\r\n editor.update(\r\n () => {\r\n const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem);\r\n if (!$isTableCellNode(tableCellNode)) {\r\n throw new Error('TableCellResizer: Table cell node not found.');\r\n }\r\n\r\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode);\r\n const [tableMap] = $computeTableMapSkipCellCheck(tableNode, null, null);\r\n const columnIndex = getCellColumnIndex(tableCellNode, tableMap);\r\n if (columnIndex === undefined) {\r\n throw new Error('TableCellResizer: Table column not found.');\r\n }\r\n\r\n const colWidths = tableNode.getColWidths();\r\n if (!colWidths) {\r\n return;\r\n }\r\n const width = colWidths[columnIndex];\r\n if (width === undefined) {\r\n return;\r\n }\r\n const newColWidths = [...colWidths];\r\n const newWidth = Math.max(width + widthChange, MIN_COLUMN_WIDTH);\r\n newColWidths[columnIndex] = newWidth;\r\n tableNode.setColWidths(newColWidths);\r\n\r\n // modification: when resizing a column, also resize the next column so the table doesn't overflow\r\n if (columnIndex < tableNode.getColumnCount() - 1) {\r\n const nextColWidths = tableNode.getColWidths();\r\n if (!nextColWidths) {\r\n return;\r\n }\r\n const newNextColWidths = [...nextColWidths];\r\n const newColumnIndex = columnIndex + 1;\r\n const newNextWidth = nextColWidths[newColumnIndex];\r\n const nextWidth = Math.max(newNextWidth - widthChange, MIN_COLUMN_WIDTH);\r\n newNextColWidths[newColumnIndex] = nextWidth;\r\n tableNode.setColWidths(newNextColWidths);\r\n }\r\n },\r\n { tag: 'skip-scroll-into-view' }\r\n );\r\n },\r\n [activeCell, editor]\r\n );\r\n\r\n const mouseUpHandler = useCallback(\r\n (direction: MouseDraggingDirection) => {\r\n const handler = (event: MouseEvent) => {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (!activeCell) {\r\n throw new Error('TableCellResizer: Expected active cell.');\r\n }\r\n\r\n if (mouseStartPosRef.current) {\r\n const { x, y } = mouseStartPosRef.current;\r\n\r\n if (activeCell === null) {\r\n return;\r\n }\r\n const zoom = calculateZoomLevel(event.target as Element);\r\n\r\n if (isHeightChanging(direction)) {\r\n const heightChange = (event.clientY - y) / zoom;\r\n updateRowHeight(heightChange);\r\n } else {\r\n const widthChange = (event.clientX - x) / zoom;\r\n updateColumnWidth(widthChange);\r\n }\r\n\r\n resetState();\r\n document.removeEventListener('mouseup', handler);\r\n }\r\n };\r\n return handler;\r\n },\r\n [activeCell, resetState, updateColumnWidth, updateRowHeight]\r\n );\r\n\r\n const toggleResize = useCallback(\r\n (direction: MouseDraggingDirection): MouseEventHandler<HTMLDivElement> =>\r\n (event) => {\r\n event.preventDefault();\r\n event.stopPropagation();\r\n\r\n if (!activeCell) {\r\n throw new Error('TableCellResizer: Expected active cell.');\r\n }\r\n\r\n mouseStartPosRef.current = {\r\n x: event.clientX,\r\n y: event.clientY,\r\n };\r\n updateMouseCurrentPos(mouseStartPosRef.current);\r\n updateDraggingDirection(direction);\r\n\r\n document.addEventListener('mouseup', mouseUpHandler(direction));\r\n },\r\n [activeCell, mouseUpHandler]\r\n );\r\n\r\n const getResizers = useCallback(() => {\r\n if (activeCell) {\r\n const { height, width, top, left } = activeCell.elem.getBoundingClientRect();\r\n const zoom = calculateZoomLevel(activeCell.elem);\r\n const zoneWidth = 10; // Pixel width of the zone where you can drag the edge\r\n const styles = {\r\n bottom: {\r\n backgroundColor: 'none',\r\n cursor: 'ns-resize',\r\n height: `${zoneWidth}px`,\r\n left: `${window.pageXOffset + left}px`,\r\n top: `${window.pageYOffset + top + height - zoneWidth / HALF}px`,\r\n width: `${width}px`,\r\n zIndex: 5000,\r\n },\r\n right: {\r\n backgroundColor: 'none',\r\n cursor: 'ew-resize',\r\n height: `${height}px`,\r\n left: `${window.pageXOffset + left + width - zoneWidth / HALF}px`,\r\n top: `${window.pageYOffset + top}px`,\r\n width: `${zoneWidth}px`,\r\n zIndex: 5000,\r\n },\r\n };\r\n\r\n const tableRect = tableRectRef.current;\r\n\r\n if (draggingDirection && mouseCurrentPos && tableRect) {\r\n if (isHeightChanging(draggingDirection)) {\r\n styles[draggingDirection].left = `${window.pageXOffset + tableRect.left}px`;\r\n styles[draggingDirection].top = `${window.pageYOffset + mouseCurrentPos.y / zoom}px`;\r\n styles[draggingDirection].height = '3px';\r\n styles[draggingDirection].width = `${tableRect.width}px`;\r\n } else {\r\n styles[draggingDirection].top = `${window.pageYOffset + tableRect.top}px`;\r\n styles[draggingDirection].left = `${window.pageXOffset + mouseCurrentPos.x / zoom}px`;\r\n styles[draggingDirection].width = '3px';\r\n styles[draggingDirection].height = `${tableRect.height}px`;\r\n }\r\n\r\n styles[draggingDirection].backgroundColor = '#adf';\r\n }\r\n\r\n return styles;\r\n }\r\n\r\n return {\r\n bottom: null,\r\n left: null,\r\n right: null,\r\n top: null,\r\n };\r\n }, [activeCell, draggingDirection, mouseCurrentPos]);\r\n\r\n const resizerStyles = getResizers();\r\n\r\n return (\r\n <div ref={resizerRef}>\r\n {activeCell != null && !isMouseDown && (\r\n <>\r\n <div\r\n className={styles['table-cell-resizer__resizer']}\r\n style={resizerStyles.right || undefined}\r\n onMouseDown={toggleResize('right')}\r\n />\r\n <div\r\n className={styles['table-cell-resizer__resizer']}\r\n style={resizerStyles.bottom || undefined}\r\n onMouseDown={toggleResize('bottom')}\r\n />\r\n </>\r\n )}\r\n </div>\r\n );\r\n}\r\n\r\nexport const TableCellResizerPlugin = (): null | ReactPortal => {\r\n const [editor] = useLexicalComposerContext();\r\n const isEditable = useLexicalEditable();\r\n\r\n return useMemo(\r\n () => (isEditable ? createPortal(<TableCellResizer editor={editor} />, document.body) : null),\r\n [editor, isEditable]\r\n );\r\n};\r\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;AAQgL,IAAM,IAAe,OAAO,SAApB,OAAqC,OAAO,aAAhB,KAAK,KAA8B,OAA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AAG,MACxF,CAAC,GAAQ,EAAW,CACrB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { B as e, D as t, I as n, L as r, N as i, R as a, V as o, a as s, i as c, r as l, u, z as d } from "./test-
|
|
1
|
+
import { B as e, D as t, I as n, L as r, N as i, R as a, V as o, a as s, i as c, r as l, u, z as d } from "./test-DQruvi8i.js";
|
|
2
2
|
function f(e) {
|
|
3
3
|
return [e, ...e.querySelectorAll("*")].reduce((e, t) => ("shadowRoot" in t && t.shadowRoot && e.push(t.shadowRoot, ...f(t.shadowRoot)), e), []);
|
|
4
4
|
}
|
|
5
5
|
//#endregion
|
|
6
|
-
//#region node_modules/storybook/dist/_browser-chunks/chunk-
|
|
6
|
+
//#region node_modules/storybook/dist/_browser-chunks/chunk-2GLGVABT.js
|
|
7
7
|
var p = {
|
|
8
8
|
AUTODOCS: "autodocs",
|
|
9
9
|
ATTACHED_MDX: "attached-mdx",
|
|
@@ -8146,7 +8146,7 @@ var Ao = (e, t = 0, n) => {
|
|
|
8146
8146
|
return e;
|
|
8147
8147
|
};
|
|
8148
8148
|
//#endregion
|
|
8149
|
-
//#region node_modules/storybook/dist/_browser-chunks/chunk-
|
|
8149
|
+
//#region node_modules/storybook/dist/_browser-chunks/chunk-SZQXB3JV.js
|
|
8150
8150
|
function jo() {
|
|
8151
8151
|
return new ka({ transport: {
|
|
8152
8152
|
setHandler: () => {},
|
|
@@ -8171,7 +8171,7 @@ var Mo = class {
|
|
|
8171
8171
|
function Po() {
|
|
8172
8172
|
return n[No] || (n[No] = new Mo()), n[No];
|
|
8173
8173
|
}
|
|
8174
|
-
var Fo = Po(), Io = (e, t) => e.length === t.length && e.every((e, n) => e === t[n]), Lo = () => /* @__PURE__ */ Error("Storybook preview hooks can only be called inside decorators and story functions.");
|
|
8174
|
+
var Fo = Po(), Io = (e, t) => e.length === t.length && e.every((e, n) => e === t[n]), Lo = () => /* @__PURE__ */ Error("Storybook preview hooks can only be called inside decorators and story functions.\n\nWhen combining Storybook hooks (e.g. useArgs) with framework hooks (e.g. React's useState, useEffect, useRef) in the same render function, use Storybook's equivalents from 'storybook/preview-api' instead: useState, useEffect, useRef, useMemo, useCallback, useReducer.");
|
|
8175
8175
|
function Ro() {
|
|
8176
8176
|
return n.STORYBOOK_HOOKS_CONTEXT || null;
|
|
8177
8177
|
}
|
|
@@ -8445,4 +8445,4 @@ async function xs(e, t) {
|
|
|
8445
8445
|
//#endregion
|
|
8446
8446
|
export { p as _, Uo as a, Me as c, Qt as d, Xt as f, St as g, Ct as h, Wo as i, q as l, Fe as m, $o as n, Ja as o, Ie as p, xs as r, rn as s, fs as t, en as u };
|
|
8447
8447
|
|
|
8448
|
-
//# sourceMappingURL=chunk-
|
|
8448
|
+
//# sourceMappingURL=chunk-SZQXB3JV-D0XG4Tlp.js.map
|