@payloadcms/richtext-lexical 3.0.0-beta.73 → 3.0.0-beta.75
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/exports/client/Field-5GGTGCKC.js +2 -0
- package/dist/exports/client/Field-5GGTGCKC.js.map +7 -0
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/index.js +7 -7
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/blockquote/feature.server.d.ts.map +1 -1
- package/dist/features/blockquote/feature.server.js +5 -2
- package/dist/features/blockquote/feature.server.js.map +1 -1
- package/dist/features/blocks/validate.d.ts.map +1 -1
- package/dist/features/blocks/validate.js +2 -1
- package/dist/features/blocks/validate.js.map +1 -1
- package/dist/features/converters/html/converter/converters/paragraph.d.ts.map +1 -1
- package/dist/features/converters/html/converter/converters/paragraph.js +5 -2
- package/dist/features/converters/html/converter/converters/paragraph.js.map +1 -1
- package/dist/features/converters/html/converter/index.d.ts +8 -2
- package/dist/features/converters/html/converter/index.d.ts.map +1 -1
- package/dist/features/converters/html/converter/index.js +14 -5
- package/dist/features/converters/html/converter/index.js.map +1 -1
- package/dist/features/converters/html/converter/types.d.ts +5 -2
- package/dist/features/converters/html/converter/types.d.ts.map +1 -1
- package/dist/features/converters/html/converter/types.js.map +1 -1
- package/dist/features/converters/html/feature.server.d.ts +2 -2
- package/dist/features/converters/html/feature.server.d.ts.map +1 -1
- package/dist/features/converters/html/feature.server.js.map +1 -1
- package/dist/features/converters/html/field/index.d.ts.map +1 -1
- package/dist/features/converters/html/field/index.js +5 -2
- package/dist/features/converters/html/field/index.js.map +1 -1
- package/dist/features/experimental_table/feature.client.d.ts.map +1 -1
- package/dist/features/experimental_table/feature.client.js +5 -0
- package/dist/features/experimental_table/feature.client.js.map +1 -1
- package/dist/features/experimental_table/feature.server.d.ts +11 -0
- package/dist/features/experimental_table/feature.server.d.ts.map +1 -1
- package/dist/features/experimental_table/feature.server.js +79 -6
- package/dist/features/experimental_table/feature.server.js.map +1 -1
- package/dist/features/experimental_table/plugins/TableActionMenuPlugin/index.d.ts.map +1 -1
- package/dist/features/experimental_table/plugins/TableActionMenuPlugin/index.js +2 -0
- package/dist/features/experimental_table/plugins/TableActionMenuPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/plugins/TableCellResizerPlugin/index.d.ts +0 -1
- package/dist/features/experimental_table/plugins/TableCellResizerPlugin/index.d.ts.map +1 -1
- package/dist/features/experimental_table/plugins/TableCellResizerPlugin/index.js +13 -8
- package/dist/features/experimental_table/plugins/TableCellResizerPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/plugins/TableHoverActionsPlugin/index.d.ts +12 -0
- package/dist/features/experimental_table/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -0
- package/dist/features/experimental_table/plugins/TableHoverActionsPlugin/index.js +181 -0
- package/dist/features/experimental_table/plugins/TableHoverActionsPlugin/index.js.map +1 -0
- package/dist/features/experimental_table/utils/debounce.d.ts +61 -0
- package/dist/features/experimental_table/utils/debounce.d.ts.map +1 -0
- package/dist/features/experimental_table/utils/debounce.js +202 -0
- package/dist/features/experimental_table/utils/debounce.js.map +1 -0
- package/dist/features/experimental_table/utils/useDebounce.d.ts +6 -0
- package/dist/features/experimental_table/utils/useDebounce.d.ts.map +1 -0
- package/dist/features/experimental_table/utils/useDebounce.js +18 -0
- package/dist/features/experimental_table/utils/useDebounce.js.map +1 -0
- package/dist/features/heading/feature.server.d.ts.map +1 -1
- package/dist/features/heading/feature.server.js +5 -2
- package/dist/features/heading/feature.server.js.map +1 -1
- package/dist/features/link/feature.server.d.ts.map +1 -1
- package/dist/features/link/feature.server.js +10 -4
- package/dist/features/link/feature.server.js.map +1 -1
- package/dist/features/link/plugins/autoLink/index.d.ts.map +1 -1
- package/dist/features/link/plugins/autoLink/index.js +19 -6
- package/dist/features/link/plugins/autoLink/index.js.map +1 -1
- package/dist/features/link/validate.d.ts.map +1 -1
- package/dist/features/link/validate.js +2 -1
- package/dist/features/link/validate.js.map +1 -1
- package/dist/features/lists/htmlConverter.d.ts.map +1 -1
- package/dist/features/lists/htmlConverter.js +10 -4
- package/dist/features/lists/htmlConverter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/index.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/index.js +1 -0
- package/dist/features/migrations/slateToLexical/converter/index.js.map +1 -1
- package/dist/features/typesServer.d.ts +2 -1
- package/dist/features/typesServer.d.ts.map +1 -1
- package/dist/features/typesServer.js.map +1 -1
- package/dist/features/upload/feature.server.js +4 -4
- package/dist/features/upload/feature.server.js.map +1 -1
- package/dist/features/upload/validate.d.ts.map +1 -1
- package/dist/features/upload/validate.js +1 -0
- package/dist/features/upload/validate.js.map +1 -1
- package/dist/field/Field.d.ts.map +1 -1
- package/dist/field/Field.js +8 -7
- package/dist/field/Field.js.map +1 -1
- package/dist/field/index.js +8 -8
- package/dist/lexical/LexicalEditor.d.ts.map +1 -1
- package/dist/lexical/LexicalEditor.js +0 -6
- package/dist/lexical/LexicalEditor.js.map +1 -1
- package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
- package/dist/lexical/ui/ContentEditable.js +8 -1
- package/dist/lexical/ui/ContentEditable.js.map +1 -1
- package/dist/lexical/ui/icons/Table/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Table/index.js +1 -0
- package/dist/lexical/ui/icons/Table/index.js.map +1 -1
- package/dist/lexical/ui/icons/Upload/index.js +1 -1
- package/dist/lexical/ui/icons/Upload/index.js.map +1 -1
- package/dist/nodeTypes.d.ts +3 -1
- package/dist/nodeTypes.d.ts.map +1 -1
- package/dist/nodeTypes.js.map +1 -1
- package/dist/populateGraphQL/defaultValue.d.ts.map +1 -1
- package/dist/populateGraphQL/defaultValue.js +1 -0
- package/dist/populateGraphQL/defaultValue.js.map +1 -1
- package/dist/utilities/generateComponentMap.d.ts.map +1 -1
- package/dist/utilities/generateComponentMap.js +3 -1
- package/dist/utilities/generateComponentMap.js.map +1 -1
- package/package.json +33 -33
- package/dist/exports/client/Field-YNHIDK3D.js +0 -2
- package/dist/exports/client/Field-YNHIDK3D.js.map +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/features/experimental_table/feature.server.ts"],"sourcesContent":["import type { Config, Field } from 'payload'\n\nimport { TableCellNode, TableNode, TableRowNode } from '@lexical/table'\nimport { sanitizeFields } from 'payload'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport { TableFeatureClient } from '../../exports/client/index.js'\nimport { createServerFeature } from '../../utilities/createServerFeature.js'\n\nconst fields: Field[] = [\n {\n name: 'rows',\n type: 'number',\n defaultValue: 5,\n required: true,\n },\n {\n name: 'columns',\n type: 'number',\n defaultValue: 5,\n required: true,\n },\n]\nexport const EXPERIMENTAL_TableFeature = createServerFeature({\n feature: async ({ config, isRoot }) => {\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n const sanitizedFields = await sanitizeFields({\n config: config as unknown as Config,\n fields,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n return {\n ClientFeature: TableFeatureClient,\n generateSchemaMap: () => {\n const schemaMap = new Map<string, Field[]>()\n\n schemaMap.set('fields', sanitizedFields)\n\n return schemaMap\n },\n nodes: [\n {\n node: TableNode,\n },\n {\n node: TableCellNode,\n },\n {\n node: TableRowNode,\n },\n ],\n }\n },\n key: 'experimental_table',\n})\n"],"names":["TableCellNode","TableNode","TableRowNode","sanitizeFields","TableFeatureClient","createServerFeature","fields","name","type","defaultValue","required","EXPERIMENTAL_TableFeature","feature","config","isRoot","validRelationships","collections","map","c","slug","sanitizedFields","requireFieldLevelRichTextEditor","ClientFeature","generateSchemaMap","schemaMap","Map","set","nodes","node","key"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/features/experimental_table/feature.server.ts"],"sourcesContent":["import type {\n SerializedTableCellNode as _SerializedTableCellNode,\n SerializedTableNode as _SerializedTableNode,\n SerializedTableRowNode as _SerializedTableRowNode,\n} from '@lexical/table'\nimport type { Spread } from 'lexical'\nimport type { Config, Field } from 'payload'\n\nimport { TableCellNode, TableNode, TableRowNode } from '@lexical/table'\nimport { sanitizeFields } from 'payload'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport { TableFeatureClient } from '../../exports/client/index.js'\nimport { createServerFeature } from '../../utilities/createServerFeature.js'\nimport { convertLexicalNodesToHTML } from '../converters/html/converter/index.js'\nimport { createNode } from '../typeUtilities.js'\n\nconst fields: Field[] = [\n {\n name: 'rows',\n type: 'number',\n defaultValue: 5,\n required: true,\n },\n {\n name: 'columns',\n type: 'number',\n defaultValue: 5,\n required: true,\n },\n]\n\nexport type SerializedTableCellNode = Spread<\n {\n type: 'tablecell'\n },\n _SerializedTableCellNode\n>\n\nexport type SerializedTableNode = Spread<\n {\n type: 'table'\n },\n _SerializedTableNode\n>\n\nexport type SerializedTableRowNode = Spread<\n {\n type: 'tablerow'\n },\n _SerializedTableRowNode\n>\nexport const EXPERIMENTAL_TableFeature = createServerFeature({\n feature: async ({ config, isRoot }) => {\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n const sanitizedFields = await sanitizeFields({\n config: config as unknown as Config,\n fields,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n return {\n ClientFeature: TableFeatureClient,\n generateSchemaMap: () => {\n const schemaMap = new Map<string, Field[]>()\n\n schemaMap.set('fields', sanitizedFields)\n\n return schemaMap\n },\n nodes: [\n createNode({\n converters: {\n html: {\n converter: async ({\n converters,\n draft,\n node,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n draft,\n lexicalNodes: node.children,\n overrideAccess,\n parent: {\n ...node,\n parent,\n },\n req,\n showHiddenFields,\n })\n return `<table class=\"lexical-table\" style=\"border-collapse: collapse;\">${childrenText}</table>`\n },\n nodeTypes: [TableNode.getType()],\n },\n },\n node: TableNode,\n }),\n createNode({\n converters: {\n html: {\n converter: async ({\n converters,\n draft,\n node,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n draft,\n lexicalNodes: node.children,\n overrideAccess,\n parent: {\n ...node,\n parent,\n },\n req,\n showHiddenFields,\n })\n\n const tagName = node.headerState > 0 ? 'th' : 'td'\n const headerStateClass = `lexical-table-cell-header-${node.headerState}`\n const backgroundColor = node.backgroundColor\n ? `background-color: ${node.backgroundColor};`\n : ''\n const colSpan = node.colSpan > 1 ? `colspan=\"${node.colSpan}\"` : ''\n const rowSpan = node.rowSpan > 1 ? `rowspan=\"${node.rowSpan}\"` : ''\n\n return `<${tagName} class=\"lexical-table-cell ${headerStateClass}\" style=\"border: 1px solid #ccc; padding: 8px; ${backgroundColor}\" ${colSpan} ${rowSpan}>${childrenText}</${tagName}>`\n },\n nodeTypes: [TableCellNode.getType()],\n },\n },\n node: TableCellNode,\n }),\n createNode({\n converters: {\n html: {\n converter: async ({\n converters,\n draft,\n node,\n overrideAccess,\n parent,\n req,\n showHiddenFields,\n }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n draft,\n lexicalNodes: node.children,\n overrideAccess,\n parent: {\n ...node,\n parent,\n },\n req,\n showHiddenFields,\n })\n return `<tr class=\"lexical-table-row\">${childrenText}</tr>`\n },\n nodeTypes: [TableRowNode.getType()],\n },\n },\n node: TableRowNode,\n }),\n ],\n }\n },\n key: 'experimental_table',\n})\n"],"names":["TableCellNode","TableNode","TableRowNode","sanitizeFields","TableFeatureClient","createServerFeature","convertLexicalNodesToHTML","createNode","fields","name","type","defaultValue","required","EXPERIMENTAL_TableFeature","feature","config","isRoot","validRelationships","collections","map","c","slug","sanitizedFields","requireFieldLevelRichTextEditor","ClientFeature","generateSchemaMap","schemaMap","Map","set","nodes","converters","html","converter","draft","node","overrideAccess","parent","req","showHiddenFields","childrenText","lexicalNodes","children","nodeTypes","getType","tagName","headerState","headerStateClass","backgroundColor","colSpan","rowSpan","key"],"mappings":"AAQA,S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ACAG;oCACAO,cAAcN,KAAKO,QAAQ;oCAC3BN;oCACAC,QAAQ;wCACN,GAAGF,IAAI;wCACPE;oCACF;oCACAC;oCACAC;gCACF;gCACA,OAAO,CAAC,8BAA8B,EAAEC,aAAa,KAAK,CAAC;4BAC7D;4BACAG,WAAW;gCAACxC,aAAayC,OAAO;6BAAG;wBACrC;oBACF;oBACAT,MAAMhC;gBACR;aACD;QACH;IACF;IACAgD,KAAK;AACP,GAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/experimental_table/plugins/TableActionMenuPlugin/index.tsx"],"names":[],"mappings":"AA4CA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AAIxE,OAAO,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/experimental_table/plugins/TableActionMenuPlugin/index.tsx"],"names":[],"mappings":"AA4CA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AAIxE,OAAO,cAAc,CAAA;AAsoBrB,eAAO,MAAM,qBAAqB,EAAE,yBAQnC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/features/experimental_table/plugins/TableActionMenuPlugin/index.tsx"],"sourcesContent":["'use client'\n\nimport type {\n HTMLTableElementWithWithTableSelectionState,\n TableRowNode,\n TableSelection,\n} from '@lexical/table'\nimport type { ElementNode } from 'lexical'\nimport type { JSX } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport {\n $deleteTableColumn__EXPERIMENTAL,\n $deleteTableRow__EXPERIMENTAL,\n $getNodeTriplet,\n $getTableCellNodeFromLexicalNode,\n $getTableColumnIndexFromTableCellNode,\n $getTableNodeFromLexicalNodeOrThrow,\n $getTableRowIndexFromTableCellNode,\n $insertTableColumn__EXPERIMENTAL,\n $insertTableRow__EXPERIMENTAL,\n $isTableCellNode,\n $isTableRowNode,\n $isTableSelection,\n $unmergeCell,\n TableCellHeaderStates,\n TableCellNode,\n getTableObserverFromTableElement,\n} from '@lexical/table'\nimport { useScrollInfo } from '@payloadcms/ui'\nimport {\n $createParagraphNode,\n $getRoot,\n $getSelection,\n $isElementNode,\n $isParagraphNode,\n $isRangeSelection,\n $isTextNode,\n} from 'lexical'\nimport * as React from 'react'\nimport { useCallback, useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport type { PluginComponentWithAnchor } from '../../../typesClient.js'\n\nimport { MeatballsIcon } from '../../../../lexical/ui/icons/Meatballs/index.js'\nimport { invariant } from '../../../../lexical/utils/invariant.js'\nimport './index.scss'\n\nfunction computeSelectionCount(selection: TableSelection): {\n columns: number\n rows: number\n} {\n const selectionShape = selection.getShape()\n return {\n columns: selectionShape.toX - selectionShape.fromX + 1,\n rows: selectionShape.toY - selectionShape.fromY + 1,\n }\n}\n\n// This is important when merging cells as there is no good way to re-merge weird shapes (a result\n// of selecting merged cells and non-merged)\nfunction isTableSelectionRectangular(selection: TableSelection): boolean {\n const nodes = selection.getNodes()\n const currentRows: Array<number> = []\n let currentRow = null\n let expectedColumns = null\n let currentColumns = 0\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i]\n if ($isTableCellNode(node)) {\n const row = node.getParentOrThrow()\n invariant($isTableRowNode(row), 'Expected CellNode to have a RowNode parent')\n if (currentRow !== row) {\n if (expectedColumns !== null && currentColumns !== expectedColumns) {\n return false\n }\n if (currentRow !== null) {\n expectedColumns = currentColumns\n }\n currentRow = row\n currentColumns = 0\n }\n const colSpan = node.__colSpan\n for (let j = 0; j < colSpan; j++) {\n if (currentRows[currentColumns + j] === undefined) {\n currentRows[currentColumns + j] = 0\n }\n currentRows[currentColumns + j] += node.__rowSpan\n }\n currentColumns += colSpan\n }\n }\n return (\n (expectedColumns === null || currentColumns === expectedColumns) &&\n currentRows.every((v) => v === currentRows[0])\n )\n}\n\nfunction $canUnmerge(): boolean {\n const selection = $getSelection()\n if (\n ($isRangeSelection(selection) && !selection.isCollapsed()) ||\n ($isTableSelection(selection) && !selection.anchor.is(selection.focus)) ||\n (!$isRangeSelection(selection) && !$isTableSelection(selection))\n ) {\n return false\n }\n const [cell] = $getNodeTriplet(selection.anchor)\n return cell.__colSpan > 1 || cell.__rowSpan > 1\n}\n\nfunction $cellContainsEmptyParagraph(cell: TableCellNode): boolean {\n if (cell.getChildrenSize() !== 1) {\n return false\n }\n const firstChild = cell.getFirstChildOrThrow()\n if (!$isParagraphNode(firstChild) || !firstChild.isEmpty()) {\n return false\n }\n return true\n}\n\nfunction $selectLastDescendant(node: ElementNode): void {\n const lastDescendant = node.getLastDescendant()\n if ($isTextNode(lastDescendant)) {\n lastDescendant.select()\n } else if ($isElementNode(lastDescendant)) {\n lastDescendant.selectEnd()\n } else if (lastDescendant !== null) {\n lastDescendant.selectNext()\n }\n}\n\ntype TableCellActionMenuProps = Readonly<{\n cellMerge: boolean\n contextRef: { current: HTMLElement | null }\n onClose: () => void\n setIsMenuOpen: (isOpen: boolean) => void\n tableCellNode: TableCellNode\n}>\n\nfunction TableActionMenu({\n cellMerge,\n contextRef,\n onClose,\n setIsMenuOpen,\n tableCellNode: _tableCellNode,\n}: TableCellActionMenuProps) {\n const [editor] = useLexicalComposerContext()\n const dropDownRef = useRef<HTMLDivElement | null>(null)\n const [tableCellNode, updateTableCellNode] = useState(_tableCellNode)\n const [selectionCounts, updateSelectionCounts] = useState({\n columns: 1,\n rows: 1,\n })\n const [canMergeCells, setCanMergeCells] = useState(false)\n const [canUnmergeCell, setCanUnmergeCell] = useState(false)\n const { y } = useScrollInfo()\n\n useEffect(() => {\n return editor.registerMutationListener(TableCellNode, (nodeMutations) => {\n const nodeUpdated = nodeMutations.get(tableCellNode.getKey()) === 'updated'\n\n if (nodeUpdated) {\n editor.getEditorState().read(() => {\n updateTableCellNode(tableCellNode.getLatest())\n })\n }\n })\n }, [editor, tableCellNode])\n\n useEffect(() => {\n editor.getEditorState().read(() => {\n const selection = $getSelection()\n // Merge cells\n if ($isTableSelection(selection)) {\n const currentSelectionCounts = computeSelectionCount(selection)\n updateSelectionCounts(computeSelectionCount(selection))\n setCanMergeCells(\n isTableSelectionRectangular(selection) &&\n (currentSelectionCounts.columns > 1 || currentSelectionCounts.rows > 1),\n )\n }\n // Unmerge cell\n setCanUnmergeCell($canUnmerge())\n })\n }, [editor])\n\n useEffect(() => {\n const menuButtonElement = contextRef.current\n const dropDownElement = dropDownRef.current\n const rootElement = editor.getRootElement()\n\n if (menuButtonElement != null && dropDownElement != null && rootElement != null) {\n const rootEleRect = rootElement.getBoundingClientRect()\n const menuButtonRect = menuButtonElement.getBoundingClientRect()\n dropDownElement.style.opacity = '1'\n const dropDownElementRect = dropDownElement.getBoundingClientRect()\n const margin = 5\n let leftPosition = menuButtonRect.right + margin\n if (\n leftPosition + dropDownElementRect.width > window.innerWidth ||\n leftPosition + dropDownElementRect.width > rootEleRect.right\n ) {\n const position = menuButtonRect.left - dropDownElementRect.width - margin\n leftPosition = (position < 0 ? margin : position) + window.pageXOffset\n }\n dropDownElement.style.left = `${leftPosition + window.pageXOffset}px`\n\n let topPosition = menuButtonRect.top\n if (topPosition + dropDownElementRect.height > window.innerHeight) {\n const position = menuButtonRect.bottom - dropDownElementRect.height\n topPosition = (position < 0 ? margin : position) + window.pageYOffset\n }\n dropDownElement.style.top = `${topPosition}px`\n }\n }, [contextRef, dropDownRef, editor, y])\n\n useEffect(() => {\n function handleClickOutside(event: MouseEvent) {\n if (\n dropDownRef.current != null &&\n contextRef.current != null &&\n !dropDownRef.current.contains(event.target as Node) &&\n !contextRef.current.contains(event.target as Node)\n ) {\n setIsMenuOpen(false)\n }\n }\n\n window.addEventListener('click', handleClickOutside)\n\n return () => window.removeEventListener('click', handleClickOutside)\n }, [setIsMenuOpen, contextRef])\n\n const clearTableSelection = useCallback(() => {\n editor.update(() => {\n if (tableCellNode.isAttached()) {\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode)\n const tableElement = editor.getElementByKey(\n tableNode.getKey(),\n ) as HTMLTableElementWithWithTableSelectionState\n\n if (!tableElement) {\n throw new Error('Expected to find tableElement in DOM')\n }\n\n const tableSelection = getTableObserverFromTableElement(tableElement)\n if (tableSelection !== null) {\n tableSelection.clearHighlight()\n }\n\n tableNode.markDirty()\n updateTableCellNode(tableCellNode.getLatest())\n }\n\n const rootNode = $getRoot()\n rootNode.selectStart()\n })\n }, [editor, tableCellNode])\n\n const mergeTableCellsAtSelection = () => {\n editor.update(() => {\n const selection = $getSelection()\n if ($isTableSelection(selection)) {\n const { columns, rows } = computeSelectionCount(selection)\n const nodes = selection.getNodes()\n let firstCell: TableCellNode | null = null\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i]\n if ($isTableCellNode(node)) {\n if (firstCell === null) {\n node.setColSpan(columns).setRowSpan(rows)\n firstCell = node\n const isEmpty = $cellContainsEmptyParagraph(node)\n let firstChild\n if (isEmpty && $isParagraphNode((firstChild = node.getFirstChild()))) {\n firstChild.remove()\n }\n } else if ($isTableCellNode(firstCell)) {\n const isEmpty = $cellContainsEmptyParagraph(node)\n if (!isEmpty) {\n firstCell.append(...node.getChildren())\n }\n node.remove()\n }\n }\n }\n if (firstCell !== null) {\n if (firstCell.getChildrenSize() === 0) {\n firstCell.append($createParagraphNode())\n }\n $selectLastDescendant(firstCell)\n }\n onClose()\n }\n })\n }\n\n const unmergeTableCellsAtSelection = () => {\n editor.update(() => {\n $unmergeCell()\n })\n }\n\n const insertTableRowAtSelection = useCallback(\n (shouldInsertAfter: boolean) => {\n editor.update(() => {\n $insertTableRow__EXPERIMENTAL(shouldInsertAfter)\n onClose()\n })\n },\n [editor, onClose],\n )\n\n const insertTableColumnAtSelection = useCallback(\n (shouldInsertAfter: boolean) => {\n editor.update(() => {\n for (let i = 0; i < selectionCounts.columns; i++) {\n $insertTableColumn__EXPERIMENTAL(shouldInsertAfter)\n }\n onClose()\n })\n },\n [editor, onClose, selectionCounts.columns],\n )\n\n const deleteTableRowAtSelection = useCallback(() => {\n editor.update(() => {\n $deleteTableRow__EXPERIMENTAL()\n onClose()\n })\n }, [editor, onClose])\n\n const deleteTableAtSelection = useCallback(() => {\n editor.update(() => {\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode)\n tableNode.remove()\n\n clearTableSelection()\n onClose()\n })\n }, [editor, tableCellNode, clearTableSelection, onClose])\n\n const deleteTableColumnAtSelection = useCallback(() => {\n editor.update(() => {\n $deleteTableColumn__EXPERIMENTAL()\n onClose()\n })\n }, [editor, onClose])\n\n const toggleTableRowIsHeader = useCallback(() => {\n editor.update(() => {\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode)\n\n const tableRowIndex = $getTableRowIndexFromTableCellNode(tableCellNode)\n\n const tableRows = tableNode.getChildren()\n\n if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {\n throw new Error('Expected table cell to be inside of table row.')\n }\n\n const tableRow = tableRows[tableRowIndex]\n\n if (!$isTableRowNode(tableRow)) {\n throw new Error('Expected table row')\n }\n\n tableRow.getChildren().forEach((tableCell) => {\n if (!$isTableCellNode(tableCell)) {\n throw new Error('Expected table cell')\n }\n\n tableCell.toggleHeaderStyle(TableCellHeaderStates.ROW)\n })\n\n clearTableSelection()\n onClose()\n })\n }, [editor, tableCellNode, clearTableSelection, onClose])\n\n const toggleTableColumnIsHeader = useCallback(() => {\n editor.update(() => {\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode)\n\n const tableColumnIndex = $getTableColumnIndexFromTableCellNode(tableCellNode)\n\n const tableRows = tableNode.getChildren<TableRowNode>()\n const maxRowsLength = Math.max(...tableRows.map((row) => row.getChildren().length))\n\n if (tableColumnIndex >= maxRowsLength || tableColumnIndex < 0) {\n throw new Error('Expected table cell to be inside of table row.')\n }\n\n for (let r = 0; r < tableRows.length; r++) {\n const tableRow = tableRows[r]\n\n if (!$isTableRowNode(tableRow)) {\n throw new Error('Expected table row')\n }\n\n const tableCells = tableRow.getChildren()\n if (tableColumnIndex >= tableCells.length) {\n // if cell is outside of bounds for the current row (for example various merge cell cases) we shouldn't highlight it\n continue\n }\n\n const tableCell = tableCells[tableColumnIndex]\n\n if (!$isTableCellNode(tableCell)) {\n throw new Error('Expected table cell')\n }\n\n tableCell.toggleHeaderStyle(TableCellHeaderStates.COLUMN)\n }\n\n clearTableSelection()\n onClose()\n })\n }, [editor, tableCellNode, clearTableSelection, onClose])\n\n let mergeCellButton: JSX.Element | null = null\n if (cellMerge) {\n if (canMergeCells) {\n mergeCellButton = (\n <button\n className=\"item\"\n data-test-id=\"table-merge-cells\"\n onClick={() => mergeTableCellsAtSelection()}\n type=\"button\"\n >\n Merge cells\n </button>\n )\n } else if (canUnmergeCell) {\n mergeCellButton = (\n <button\n className=\"item\"\n data-test-id=\"table-unmerge-cells\"\n onClick={() => unmergeTableCellsAtSelection()}\n type=\"button\"\n >\n Unmerge cells\n </button>\n )\n }\n }\n\n return createPortal(\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions,jsx-a11y/click-events-have-key-events\n <div\n className=\"table-action-menu-dropdown\"\n onClick={(e) => {\n e.stopPropagation()\n }}\n ref={dropDownRef}\n >\n {mergeCellButton ? (\n <React.Fragment>\n {mergeCellButton}\n <hr />\n </React.Fragment>\n ) : null}\n\n <button\n className=\"item\"\n data-test-id=\"table-insert-row-above\"\n onClick={() => insertTableRowAtSelection(false)}\n type=\"button\"\n >\n <span className=\"text\">\n Insert {selectionCounts.rows === 1 ? 'row' : `${selectionCounts.rows} rows`} above\n </span>\n </button>\n <button\n className=\"item\"\n data-test-id=\"table-insert-row-below\"\n onClick={() => insertTableRowAtSelection(true)}\n type=\"button\"\n >\n <span className=\"text\">\n Insert {selectionCounts.rows === 1 ? 'row' : `${selectionCounts.rows} rows`} below\n </span>\n </button>\n <hr />\n <button\n className=\"item\"\n data-test-id=\"table-insert-column-before\"\n onClick={() => insertTableColumnAtSelection(false)}\n type=\"button\"\n >\n <span className=\"text\">\n Insert {selectionCounts.columns === 1 ? 'column' : `${selectionCounts.columns} columns`}{' '}\n left\n </span>\n </button>\n <button\n className=\"item\"\n data-test-id=\"table-insert-column-after\"\n onClick={() => insertTableColumnAtSelection(true)}\n type=\"button\"\n >\n <span className=\"text\">\n Insert {selectionCounts.columns === 1 ? 'column' : `${selectionCounts.columns} columns`}{' '}\n right\n </span>\n </button>\n <hr />\n <button\n className=\"item\"\n data-test-id=\"table-delete-columns\"\n onClick={() => deleteTableColumnAtSelection()}\n type=\"button\"\n >\n <span className=\"text\">Delete column</span>\n </button>\n <button\n className=\"item\"\n data-test-id=\"table-delete-rows\"\n onClick={() => deleteTableRowAtSelection()}\n type=\"button\"\n >\n <span className=\"text\">Delete row</span>\n </button>\n <button\n className=\"item\"\n data-test-id=\"table-delete\"\n onClick={() => deleteTableAtSelection()}\n type=\"button\"\n >\n <span className=\"text\">Delete table</span>\n </button>\n <hr />\n <button className=\"item\" onClick={() => toggleTableRowIsHeader()} type=\"button\">\n <span className=\"text\">\n {(tableCellNode.__headerState & TableCellHeaderStates.ROW) === TableCellHeaderStates.ROW\n ? 'Remove'\n : 'Add'}{' '}\n row header\n </span>\n </button>\n <button\n className=\"item\"\n data-test-id=\"table-column-header\"\n onClick={() => toggleTableColumnIsHeader()}\n type=\"button\"\n >\n <span className=\"text\">\n {(tableCellNode.__headerState & TableCellHeaderStates.COLUMN) ===\n TableCellHeaderStates.COLUMN\n ? 'Remove'\n : 'Add'}{' '}\n column header\n </span>\n </button>\n </div>,\n document.body,\n )\n}\n\nfunction TableCellActionMenuContainer({\n anchorElem,\n cellMerge,\n}: {\n anchorElem: HTMLElement\n cellMerge: boolean\n}): JSX.Element {\n const [editor] = useLexicalComposerContext()\n\n const menuButtonRef = useRef(null)\n const menuRootRef = useRef(null)\n const [isMenuOpen, setIsMenuOpen] = useState(false)\n\n const [tableCellNode, setTableMenuCellNode] = useState<TableCellNode | null>(null)\n\n const $moveMenu = useCallback(() => {\n const menu = menuButtonRef.current\n const selection = $getSelection()\n const nativeSelection = window.getSelection()\n const activeElement = document.activeElement\n\n if (selection == null || menu == null) {\n setTableMenuCellNode(null)\n return\n }\n\n const rootElement = editor.getRootElement()\n\n if (\n $isRangeSelection(selection) &&\n rootElement !== null &&\n nativeSelection !== null &&\n rootElement.contains(nativeSelection.anchorNode)\n ) {\n const tableCellNodeFromSelection = $getTableCellNodeFromLexicalNode(\n selection.anchor.getNode(),\n )\n\n if (tableCellNodeFromSelection == null) {\n setTableMenuCellNode(null)\n return\n }\n\n const tableCellParentNodeDOM = editor.getElementByKey(tableCellNodeFromSelection.getKey())\n\n if (tableCellParentNodeDOM == null) {\n setTableMenuCellNode(null)\n return\n }\n\n setTableMenuCellNode(tableCellNodeFromSelection)\n } else if (!activeElement) {\n setTableMenuCellNode(null)\n }\n }, [editor])\n\n useEffect(() => {\n return editor.registerUpdateListener(() => {\n editor.getEditorState().read(() => {\n $moveMenu()\n })\n })\n })\n\n useEffect(() => {\n const menuButtonDOM = menuButtonRef.current as HTMLButtonElement | null\n\n if (menuButtonDOM != null && tableCellNode != null) {\n const tableCellNodeDOM = editor.getElementByKey(tableCellNode.getKey())\n\n if (tableCellNodeDOM != null) {\n const tableCellRect = tableCellNodeDOM.getBoundingClientRect()\n const menuRect = menuButtonDOM.getBoundingClientRect()\n const anchorRect = anchorElem.getBoundingClientRect()\n\n const top = tableCellRect.top - anchorRect.top + 4\n const left = tableCellRect.right - menuRect.width - 10 - anchorRect.left\n\n menuButtonDOM.style.opacity = '1'\n menuButtonDOM.style.transform = `translate(${left}px, ${top}px)`\n } else {\n menuButtonDOM.style.opacity = '0'\n menuButtonDOM.style.transform = 'translate(-10000px, -10000px)'\n }\n }\n }, [menuButtonRef, tableCellNode, editor, anchorElem])\n\n const prevTableCellDOM = useRef(tableCellNode)\n\n useEffect(() => {\n if (prevTableCellDOM.current !== tableCellNode) {\n setIsMenuOpen(false)\n }\n\n prevTableCellDOM.current = tableCellNode\n }, [prevTableCellDOM, tableCellNode])\n\n return (\n <div className=\"table-cell-action-button-container\" ref={menuButtonRef}>\n {tableCellNode != null && (\n <React.Fragment>\n <button\n className=\"table-cell-action-button\"\n onClick={(e) => {\n e.stopPropagation()\n setIsMenuOpen(!isMenuOpen)\n }}\n ref={menuRootRef}\n type=\"button\"\n >\n <MeatballsIcon />\n </button>\n {isMenuOpen && (\n <TableActionMenu\n cellMerge={cellMerge}\n contextRef={menuRootRef}\n onClose={() => setIsMenuOpen(false)}\n setIsMenuOpen={setIsMenuOpen}\n tableCellNode={tableCellNode}\n />\n )}\n </React.Fragment>\n )}\n </div>\n )\n}\n\nexport const TableActionMenuPlugin: PluginComponentWithAnchor = ({ anchorElem }) => {\n const isEditable = useLexicalEditable()\n return createPortal(\n isEditable ? (\n <TableCellActionMenuContainer anchorElem={anchorElem ?? document.body} cellMerge />\n ) : null,\n anchorElem ?? document.body,\n )\n}\n"],"names":["useLexicalComposerContext","useLexicalEditable","$deleteTableColumn__EXPERIMENTAL","$deleteTableRow__EXPERIMENTAL","$getNodeTriplet","$getTableCellNodeFromLexicalNode","$getTableColumnIndexFromTableCellNode","$getTableNodeFromLexicalNodeOrThrow","$getTableRowIndexFromTableCellNode","$insertTableColumn__EXPERIMENTAL","$insertTableRow__EXPERIMENTAL","$isTableCellNode","$isTableRowNode","$isTableSelection","$unmergeCell","TableCellHeaderStates","TableCellNode","getTableObserverFromTableElement","useScrollInfo","$createParagraphNode","$getRoot","$getSelection","$isElementNode","$isParagraphNode","$isRangeSelection","$isTextNode","React","useCallback","useEffect","useRef","useState","createPortal","MeatballsIcon","invariant","computeSelectionCount","selection","selectionShape","getShape","columns","toX","fromX","rows","toY","fromY","isTableSelectionRectangular","nodes","getNodes","currentRows","currentRow","expectedColumns","currentColumns","i","length","node","row","getParentOrThrow","colSpan","__colSpan","j","undefined","__rowSpan","every","v","$canUnmerge","isCollapsed","anchor","is","focus","cell","$cellContainsEmptyParagraph","getChildrenSize","firstChild","getFirstChildOrThrow","isEmpty","$selectLastDescendant","lastDescendant","getLastDescendant","select","selectEnd","selectNext","TableActionMenu","cellMerge","contextRef","onClose","setIsMenuOpen","tableCellNode","_tableCellNode","editor","dropDownRef","updateTableCellNode","selectionCounts","updateSelectionCounts","canMergeCells","setCanMergeCells","canUnmergeCell","setCanUnmergeCell","y","registerMutationListener","nodeMutations","nodeUpdated","get","getKey","getEditorState","read","getLatest","currentSelectionCounts","menuButtonElement","current","dropDownElement","rootElement","getRootElement","rootEleRect","getBoundingClientRect","menuButtonRect","style","opacity","dropDownElementRect","margin","leftPosition","right","width","window","innerWidth","position","left","pageXOffset","topPosition","top","height","innerHeight","bottom","pageYOffset","handleClickOutside","event","contains","target","addEventListener","removeEventListener","clearTableSelection","update","isAttached","tableNode","tableElement","getElementByKey","Error","tableSelection","clearHighlight","markDirty","rootNode","selectStart","mergeTableCellsAtSelection","firstCell","setColSpan","setRowSpan","getFirstChild","remove","append","getChildren","unmergeTableCellsAtSelection","insertTableRowAtSelection","shouldInsertAfter","insertTableColumnAtSelection","deleteTableRowAtSelection","deleteTableAtSelection","deleteTableColumnAtSelection","toggleTableRowIsHeader","tableRowIndex","tableRows","tableRow","forEach","tableCell","toggleHeaderStyle","ROW","toggleTableColumnIsHeader","tableColumnIndex","maxRowsLength","Math","max","map","r","tableCells","COLUMN","mergeCellButton","button","className","data-test-id","onClick","type","div","e","stopPropagation","ref","Fragment","hr","span","__headerState","document","body","TableCellActionMenuContainer","anchorElem","menuButtonRef","menuRootRef","isMenuOpen","setTableMenuCellNode","$moveMenu","menu","nativeSelection","getSelection","activeElement","anchorNode","tableCellNodeFromSelection","getNode","tableCellParentNodeDOM","registerUpdateListener","menuButtonDOM","tableCellNodeDOM","tableCellRect","menuRect","anchorRect","transform","prevTableCellDOM","TableActionMenuPlugin","isEditable"],"mappings":"AAAA;;AAUA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,kBAAk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BAEL,cAAA,KAAC3J;;gBAEF0K,4BACC,KAAC1H;oBACCC,WAAWA;oBACXC,YAAYuH;oBACZtH,SAAS,IAAMC,cAAc;oBAC7BA,eAAeA;oBACfC,eAAeA;;;;;AAO7B;AAEA,OAAO,MAAMwI,wBAAmD,CAAC,EAAEtB,UAAU,EAAE;IAC7E,MAAMuB,aAAa7N;IACnB,qBAAO8B,aACL+L,2BACE,KAACxB;QAA6BC,YAAYA,cAAcH,SAASC,IAAI;QAAEpH,SAAS;SAC9E,MACJsH,cAAcH,SAASC,IAAI;AAE/B,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/features/experimental_table/plugins/TableActionMenuPlugin/index.tsx"],"sourcesContent":["'use client'\n\nimport type {\n HTMLTableElementWithWithTableSelectionState,\n TableRowNode,\n TableSelection,\n} from '@lexical/table'\nimport type { ElementNode } from 'lexical'\nimport type { JSX } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport {\n $deleteTableColumn__EXPERIMENTAL,\n $deleteTableRow__EXPERIMENTAL,\n $getNodeTriplet,\n $getTableCellNodeFromLexicalNode,\n $getTableColumnIndexFromTableCellNode,\n $getTableNodeFromLexicalNodeOrThrow,\n $getTableRowIndexFromTableCellNode,\n $insertTableColumn__EXPERIMENTAL,\n $insertTableRow__EXPERIMENTAL,\n $isTableCellNode,\n $isTableRowNode,\n $isTableSelection,\n $unmergeCell,\n TableCellHeaderStates,\n TableCellNode,\n getTableObserverFromTableElement,\n} from '@lexical/table'\nimport { useScrollInfo } from '@payloadcms/ui'\nimport {\n $createParagraphNode,\n $getRoot,\n $getSelection,\n $isElementNode,\n $isParagraphNode,\n $isRangeSelection,\n $isTextNode,\n} from 'lexical'\nimport * as React from 'react'\nimport { useCallback, useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport type { PluginComponentWithAnchor } from '../../../typesClient.js'\n\nimport { MeatballsIcon } from '../../../../lexical/ui/icons/Meatballs/index.js'\nimport { invariant } from '../../../../lexical/utils/invariant.js'\nimport './index.scss'\n\nfunction computeSelectionCount(selection: TableSelection): {\n columns: number\n rows: number\n} {\n const selectionShape = selection.getShape()\n return {\n columns: selectionShape.toX - selectionShape.fromX + 1,\n rows: selectionShape.toY - selectionShape.fromY + 1,\n }\n}\n\n// This is important when merging cells as there is no good way to re-merge weird shapes (a result\n// of selecting merged cells and non-merged)\nfunction isTableSelectionRectangular(selection: TableSelection): boolean {\n const nodes = selection.getNodes()\n const currentRows: Array<number> = []\n let currentRow = null\n let expectedColumns = null\n let currentColumns = 0\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i]\n if ($isTableCellNode(node)) {\n const row = node.getParentOrThrow()\n invariant($isTableRowNode(row), 'Expected CellNode to have a RowNode parent')\n if (currentRow !== row) {\n if (expectedColumns !== null && currentColumns !== expectedColumns) {\n return false\n }\n if (currentRow !== null) {\n expectedColumns = currentColumns\n }\n currentRow = row\n currentColumns = 0\n }\n const colSpan = node.__colSpan\n for (let j = 0; j < colSpan; j++) {\n if (currentRows[currentColumns + j] === undefined) {\n currentRows[currentColumns + j] = 0\n }\n currentRows[currentColumns + j] += node.__rowSpan\n }\n currentColumns += colSpan\n }\n }\n return (\n (expectedColumns === null || currentColumns === expectedColumns) &&\n currentRows.every((v) => v === currentRows[0])\n )\n}\n\nfunction $canUnmerge(): boolean {\n const selection = $getSelection()\n if (\n ($isRangeSelection(selection) && !selection.isCollapsed()) ||\n ($isTableSelection(selection) && !selection.anchor.is(selection.focus)) ||\n (!$isRangeSelection(selection) && !$isTableSelection(selection))\n ) {\n return false\n }\n const [cell] = $getNodeTriplet(selection.anchor)\n return cell.__colSpan > 1 || cell.__rowSpan > 1\n}\n\nfunction $cellContainsEmptyParagraph(cell: TableCellNode): boolean {\n if (cell.getChildrenSize() !== 1) {\n return false\n }\n const firstChild = cell.getFirstChildOrThrow()\n if (!$isParagraphNode(firstChild) || !firstChild.isEmpty()) {\n return false\n }\n return true\n}\n\nfunction $selectLastDescendant(node: ElementNode): void {\n const lastDescendant = node.getLastDescendant()\n if ($isTextNode(lastDescendant)) {\n lastDescendant.select()\n } else if ($isElementNode(lastDescendant)) {\n lastDescendant.selectEnd()\n } else if (lastDescendant !== null) {\n lastDescendant.selectNext()\n }\n}\n\ntype TableCellActionMenuProps = Readonly<{\n cellMerge: boolean\n contextRef: { current: HTMLElement | null }\n onClose: () => void\n setIsMenuOpen: (isOpen: boolean) => void\n tableCellNode: TableCellNode\n}>\n\nfunction TableActionMenu({\n cellMerge,\n contextRef,\n onClose,\n setIsMenuOpen,\n tableCellNode: _tableCellNode,\n}: TableCellActionMenuProps) {\n const [editor] = useLexicalComposerContext()\n const dropDownRef = useRef<HTMLDivElement | null>(null)\n const [tableCellNode, updateTableCellNode] = useState(_tableCellNode)\n const [selectionCounts, updateSelectionCounts] = useState({\n columns: 1,\n rows: 1,\n })\n const [canMergeCells, setCanMergeCells] = useState(false)\n const [canUnmergeCell, setCanUnmergeCell] = useState(false)\n const { y } = useScrollInfo()\n\n useEffect(() => {\n return editor.registerMutationListener(\n TableCellNode,\n (nodeMutations) => {\n const nodeUpdated = nodeMutations.get(tableCellNode.getKey()) === 'updated'\n\n if (nodeUpdated) {\n editor.getEditorState().read(() => {\n updateTableCellNode(tableCellNode.getLatest())\n })\n }\n },\n { skipInitialization: true },\n )\n }, [editor, tableCellNode])\n\n useEffect(() => {\n editor.getEditorState().read(() => {\n const selection = $getSelection()\n // Merge cells\n if ($isTableSelection(selection)) {\n const currentSelectionCounts = computeSelectionCount(selection)\n updateSelectionCounts(computeSelectionCount(selection))\n setCanMergeCells(\n isTableSelectionRectangular(selection) &&\n (currentSelectionCounts.columns > 1 || currentSelectionCounts.rows > 1),\n )\n }\n // Unmerge cell\n setCanUnmergeCell($canUnmerge())\n })\n }, [editor])\n\n useEffect(() => {\n const menuButtonElement = contextRef.current\n const dropDownElement = dropDownRef.current\n const rootElement = editor.getRootElement()\n\n if (menuButtonElement != null && dropDownElement != null && rootElement != null) {\n const rootEleRect = rootElement.getBoundingClientRect()\n const menuButtonRect = menuButtonElement.getBoundingClientRect()\n dropDownElement.style.opacity = '1'\n const dropDownElementRect = dropDownElement.getBoundingClientRect()\n const margin = 5\n let leftPosition = menuButtonRect.right + margin\n if (\n leftPosition + dropDownElementRect.width > window.innerWidth ||\n leftPosition + dropDownElementRect.width > rootEleRect.right\n ) {\n const position = menuButtonRect.left - dropDownElementRect.width - margin\n leftPosition = (position < 0 ? margin : position) + window.pageXOffset\n }\n dropDownElement.style.left = `${leftPosition + window.pageXOffset}px`\n\n let topPosition = menuButtonRect.top\n if (topPosition + dropDownElementRect.height > window.innerHeight) {\n const position = menuButtonRect.bottom - dropDownElementRect.height\n topPosition = (position < 0 ? margin : position) + window.pageYOffset\n }\n dropDownElement.style.top = `${topPosition}px`\n }\n }, [contextRef, dropDownRef, editor, y])\n\n useEffect(() => {\n function handleClickOutside(event: MouseEvent) {\n if (\n dropDownRef.current != null &&\n contextRef.current != null &&\n !dropDownRef.current.contains(event.target as Node) &&\n !contextRef.current.contains(event.target as Node)\n ) {\n setIsMenuOpen(false)\n }\n }\n\n window.addEventListener('click', handleClickOutside)\n\n return () => window.removeEventListener('click', handleClickOutside)\n }, [setIsMenuOpen, contextRef])\n\n const clearTableSelection = useCallback(() => {\n editor.update(() => {\n if (tableCellNode.isAttached()) {\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode)\n const tableElement = editor.getElementByKey(\n tableNode.getKey(),\n ) as HTMLTableElementWithWithTableSelectionState\n\n if (!tableElement) {\n throw new Error('Expected to find tableElement in DOM')\n }\n\n const tableSelection = getTableObserverFromTableElement(tableElement)\n if (tableSelection !== null) {\n tableSelection.clearHighlight()\n }\n\n tableNode.markDirty()\n updateTableCellNode(tableCellNode.getLatest())\n }\n\n const rootNode = $getRoot()\n rootNode.selectStart()\n })\n }, [editor, tableCellNode])\n\n const mergeTableCellsAtSelection = () => {\n editor.update(() => {\n const selection = $getSelection()\n if ($isTableSelection(selection)) {\n const { columns, rows } = computeSelectionCount(selection)\n const nodes = selection.getNodes()\n let firstCell: TableCellNode | null = null\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i]\n if ($isTableCellNode(node)) {\n if (firstCell === null) {\n node.setColSpan(columns).setRowSpan(rows)\n firstCell = node\n const isEmpty = $cellContainsEmptyParagraph(node)\n let firstChild\n if (isEmpty && $isParagraphNode((firstChild = node.getFirstChild()))) {\n firstChild.remove()\n }\n } else if ($isTableCellNode(firstCell)) {\n const isEmpty = $cellContainsEmptyParagraph(node)\n if (!isEmpty) {\n firstCell.append(...node.getChildren())\n }\n node.remove()\n }\n }\n }\n if (firstCell !== null) {\n if (firstCell.getChildrenSize() === 0) {\n firstCell.append($createParagraphNode())\n }\n $selectLastDescendant(firstCell)\n }\n onClose()\n }\n })\n }\n\n const unmergeTableCellsAtSelection = () => {\n editor.update(() => {\n $unmergeCell()\n })\n }\n\n const insertTableRowAtSelection = useCallback(\n (shouldInsertAfter: boolean) => {\n editor.update(() => {\n $insertTableRow__EXPERIMENTAL(shouldInsertAfter)\n onClose()\n })\n },\n [editor, onClose],\n )\n\n const insertTableColumnAtSelection = useCallback(\n (shouldInsertAfter: boolean) => {\n editor.update(() => {\n for (let i = 0; i < selectionCounts.columns; i++) {\n $insertTableColumn__EXPERIMENTAL(shouldInsertAfter)\n }\n onClose()\n })\n },\n [editor, onClose, selectionCounts.columns],\n )\n\n const deleteTableRowAtSelection = useCallback(() => {\n editor.update(() => {\n $deleteTableRow__EXPERIMENTAL()\n onClose()\n })\n }, [editor, onClose])\n\n const deleteTableAtSelection = useCallback(() => {\n editor.update(() => {\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode)\n tableNode.remove()\n\n clearTableSelection()\n onClose()\n })\n }, [editor, tableCellNode, clearTableSelection, onClose])\n\n const deleteTableColumnAtSelection = useCallback(() => {\n editor.update(() => {\n $deleteTableColumn__EXPERIMENTAL()\n onClose()\n })\n }, [editor, onClose])\n\n const toggleTableRowIsHeader = useCallback(() => {\n editor.update(() => {\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode)\n\n const tableRowIndex = $getTableRowIndexFromTableCellNode(tableCellNode)\n\n const tableRows = tableNode.getChildren()\n\n if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {\n throw new Error('Expected table cell to be inside of table row.')\n }\n\n const tableRow = tableRows[tableRowIndex]\n\n if (!$isTableRowNode(tableRow)) {\n throw new Error('Expected table row')\n }\n\n tableRow.getChildren().forEach((tableCell) => {\n if (!$isTableCellNode(tableCell)) {\n throw new Error('Expected table cell')\n }\n\n tableCell.toggleHeaderStyle(TableCellHeaderStates.ROW)\n })\n\n clearTableSelection()\n onClose()\n })\n }, [editor, tableCellNode, clearTableSelection, onClose])\n\n const toggleTableColumnIsHeader = useCallback(() => {\n editor.update(() => {\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode)\n\n const tableColumnIndex = $getTableColumnIndexFromTableCellNode(tableCellNode)\n\n const tableRows = tableNode.getChildren<TableRowNode>()\n const maxRowsLength = Math.max(...tableRows.map((row) => row.getChildren().length))\n\n if (tableColumnIndex >= maxRowsLength || tableColumnIndex < 0) {\n throw new Error('Expected table cell to be inside of table row.')\n }\n\n for (let r = 0; r < tableRows.length; r++) {\n const tableRow = tableRows[r]\n\n if (!$isTableRowNode(tableRow)) {\n throw new Error('Expected table row')\n }\n\n const tableCells = tableRow.getChildren()\n if (tableColumnIndex >= tableCells.length) {\n // if cell is outside of bounds for the current row (for example various merge cell cases) we shouldn't highlight it\n continue\n }\n\n const tableCell = tableCells[tableColumnIndex]\n\n if (!$isTableCellNode(tableCell)) {\n throw new Error('Expected table cell')\n }\n\n tableCell.toggleHeaderStyle(TableCellHeaderStates.COLUMN)\n }\n\n clearTableSelection()\n onClose()\n })\n }, [editor, tableCellNode, clearTableSelection, onClose])\n\n let mergeCellButton: JSX.Element | null = null\n if (cellMerge) {\n if (canMergeCells) {\n mergeCellButton = (\n <button\n className=\"item\"\n data-test-id=\"table-merge-cells\"\n onClick={() => mergeTableCellsAtSelection()}\n type=\"button\"\n >\n Merge cells\n </button>\n )\n } else if (canUnmergeCell) {\n mergeCellButton = (\n <button\n className=\"item\"\n data-test-id=\"table-unmerge-cells\"\n onClick={() => unmergeTableCellsAtSelection()}\n type=\"button\"\n >\n Unmerge cells\n </button>\n )\n }\n }\n\n return createPortal(\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions,jsx-a11y/click-events-have-key-events\n <div\n className=\"table-action-menu-dropdown\"\n onClick={(e) => {\n e.stopPropagation()\n }}\n ref={dropDownRef}\n >\n {mergeCellButton ? (\n <React.Fragment>\n {mergeCellButton}\n <hr />\n </React.Fragment>\n ) : null}\n\n <button\n className=\"item\"\n data-test-id=\"table-insert-row-above\"\n onClick={() => insertTableRowAtSelection(false)}\n type=\"button\"\n >\n <span className=\"text\">\n Insert {selectionCounts.rows === 1 ? 'row' : `${selectionCounts.rows} rows`} above\n </span>\n </button>\n <button\n className=\"item\"\n data-test-id=\"table-insert-row-below\"\n onClick={() => insertTableRowAtSelection(true)}\n type=\"button\"\n >\n <span className=\"text\">\n Insert {selectionCounts.rows === 1 ? 'row' : `${selectionCounts.rows} rows`} below\n </span>\n </button>\n <hr />\n <button\n className=\"item\"\n data-test-id=\"table-insert-column-before\"\n onClick={() => insertTableColumnAtSelection(false)}\n type=\"button\"\n >\n <span className=\"text\">\n Insert {selectionCounts.columns === 1 ? 'column' : `${selectionCounts.columns} columns`}{' '}\n left\n </span>\n </button>\n <button\n className=\"item\"\n data-test-id=\"table-insert-column-after\"\n onClick={() => insertTableColumnAtSelection(true)}\n type=\"button\"\n >\n <span className=\"text\">\n Insert {selectionCounts.columns === 1 ? 'column' : `${selectionCounts.columns} columns`}{' '}\n right\n </span>\n </button>\n <hr />\n <button\n className=\"item\"\n data-test-id=\"table-delete-columns\"\n onClick={() => deleteTableColumnAtSelection()}\n type=\"button\"\n >\n <span className=\"text\">Delete column</span>\n </button>\n <button\n className=\"item\"\n data-test-id=\"table-delete-rows\"\n onClick={() => deleteTableRowAtSelection()}\n type=\"button\"\n >\n <span className=\"text\">Delete row</span>\n </button>\n <button\n className=\"item\"\n data-test-id=\"table-delete\"\n onClick={() => deleteTableAtSelection()}\n type=\"button\"\n >\n <span className=\"text\">Delete table</span>\n </button>\n <hr />\n <button className=\"item\" onClick={() => toggleTableRowIsHeader()} type=\"button\">\n <span className=\"text\">\n {(tableCellNode.__headerState & TableCellHeaderStates.ROW) === TableCellHeaderStates.ROW\n ? 'Remove'\n : 'Add'}{' '}\n row header\n </span>\n </button>\n <button\n className=\"item\"\n data-test-id=\"table-column-header\"\n onClick={() => toggleTableColumnIsHeader()}\n type=\"button\"\n >\n <span className=\"text\">\n {(tableCellNode.__headerState & TableCellHeaderStates.COLUMN) ===\n TableCellHeaderStates.COLUMN\n ? 'Remove'\n : 'Add'}{' '}\n column header\n </span>\n </button>\n </div>,\n document.body,\n )\n}\n\nfunction TableCellActionMenuContainer({\n anchorElem,\n cellMerge,\n}: {\n anchorElem: HTMLElement\n cellMerge: boolean\n}): JSX.Element {\n const [editor] = useLexicalComposerContext()\n\n const menuButtonRef = useRef(null)\n const menuRootRef = useRef(null)\n const [isMenuOpen, setIsMenuOpen] = useState(false)\n\n const [tableCellNode, setTableMenuCellNode] = useState<TableCellNode | null>(null)\n\n const $moveMenu = useCallback(() => {\n const menu = menuButtonRef.current\n const selection = $getSelection()\n const nativeSelection = window.getSelection()\n const activeElement = document.activeElement\n\n if (selection == null || menu == null) {\n setTableMenuCellNode(null)\n return\n }\n\n const rootElement = editor.getRootElement()\n\n if (\n $isRangeSelection(selection) &&\n rootElement !== null &&\n nativeSelection !== null &&\n rootElement.contains(nativeSelection.anchorNode)\n ) {\n const tableCellNodeFromSelection = $getTableCellNodeFromLexicalNode(\n selection.anchor.getNode(),\n )\n\n if (tableCellNodeFromSelection == null) {\n setTableMenuCellNode(null)\n return\n }\n\n const tableCellParentNodeDOM = editor.getElementByKey(tableCellNodeFromSelection.getKey())\n\n if (tableCellParentNodeDOM == null) {\n setTableMenuCellNode(null)\n return\n }\n\n setTableMenuCellNode(tableCellNodeFromSelection)\n } else if (!activeElement) {\n setTableMenuCellNode(null)\n }\n }, [editor])\n\n useEffect(() => {\n return editor.registerUpdateListener(() => {\n editor.getEditorState().read(() => {\n $moveMenu()\n })\n })\n })\n\n useEffect(() => {\n const menuButtonDOM = menuButtonRef.current as HTMLButtonElement | null\n\n if (menuButtonDOM != null && tableCellNode != null) {\n const tableCellNodeDOM = editor.getElementByKey(tableCellNode.getKey())\n\n if (tableCellNodeDOM != null) {\n const tableCellRect = tableCellNodeDOM.getBoundingClientRect()\n const menuRect = menuButtonDOM.getBoundingClientRect()\n const anchorRect = anchorElem.getBoundingClientRect()\n\n const top = tableCellRect.top - anchorRect.top + 4\n const left = tableCellRect.right - menuRect.width - 10 - anchorRect.left\n\n menuButtonDOM.style.opacity = '1'\n menuButtonDOM.style.transform = `translate(${left}px, ${top}px)`\n } else {\n menuButtonDOM.style.opacity = '0'\n menuButtonDOM.style.transform = 'translate(-10000px, -10000px)'\n }\n }\n }, [menuButtonRef, tableCellNode, editor, anchorElem])\n\n const prevTableCellDOM = useRef(tableCellNode)\n\n useEffect(() => {\n if (prevTableCellDOM.current !== tableCellNode) {\n setIsMenuOpen(false)\n }\n\n prevTableCellDOM.current = tableCellNode\n }, [prevTableCellDOM, tableCellNode])\n\n return (\n <div className=\"table-cell-action-button-container\" ref={menuButtonRef}>\n {tableCellNode != null && (\n <React.Fragment>\n <button\n className=\"table-cell-action-button\"\n onClick={(e) => {\n e.stopPropagation()\n setIsMenuOpen(!isMenuOpen)\n }}\n ref={menuRootRef}\n type=\"button\"\n >\n <MeatballsIcon />\n </button>\n {isMenuOpen && (\n <TableActionMenu\n cellMerge={cellMerge}\n contextRef={menuRootRef}\n onClose={() => setIsMenuOpen(false)}\n setIsMenuOpen={setIsMenuOpen}\n tableCellNode={tableCellNode}\n />\n )}\n </React.Fragment>\n )}\n </div>\n )\n}\n\nexport const TableActionMenuPlugin: PluginComponentWithAnchor = ({ anchorElem }) => {\n const isEditable = useLexicalEditable()\n return createPortal(\n isEditable ? (\n <TableCellActionMenuContainer anchorElem={anchorElem ?? document.body} cellMerge />\n ) : null,\n anchorElem ?? document.body,\n )\n}\n"],"names":["useLexicalComposerContext","useLexicalEditable","$deleteTableColumn__EXPERIMENTAL","$deleteTableRow__EXPERIMENTAL","$getNodeTriplet","$getTableCellNodeFromLexicalNode","$getTableColumnIndexFromTableCellNode","$getTableNodeFromLexicalNodeOrThrow","$getTableRowIndexFromTableCellNode","$insertTableColumn__EXPERIMENTAL","$insertTableRow__EXPERIMENTAL","$isTableCellNode","$isTableRowNode","$isTableSelection","$unmergeCell","TableCellHeaderStates","TableCellNode","getTableObserverFromTableElement","useScrollInfo","$createParagraphNode","$getRoot","$getSelection","$isElementNode","$isParagraphNode","$isRangeSelection","$isTextNode","React","useCallback","useEffect","useRef","useState","createPortal","MeatballsIcon","invariant","computeSelectionCount","selection","selectionShape","getShape","columns","toX","fromX","rows","toY","fromY","isTableSelectionRectangular","nodes","getNodes","currentRows","currentRow","expectedColumns","currentColumns","i","length","node","row","getParentOrThrow","colSpan","__colSpan","j","undefined","__rowSpan","every","v","$canUnmerge","isCollapsed","anchor","is","focus","cell","$cellContainsEmptyParagraph","getChildrenSize","firstChild","getFirstChildOrThrow","isEmpty","$selectLastDescendant","lastDescendant","getLastDescendant","select","selectEnd","selectNext","TableActionMenu","cellMerge","contextRef","onClose","setIsMenuOpen","tableCellNode","_tableCellNode","editor","dropDownRef","updateTableCellNode","selectionCounts","updateSelectionCounts","canMergeCells","setCanMergeCells","canUnmergeCell","setCanUnmergeCell","y","registerMutationListener","nodeMutations","nodeUpdated","get","getKey","getEditorState","read","getLatest","skipInitialization","currentSelectionCounts","menuButtonElement","current","dropDownElement","rootElement","getRootElement","rootEleRect","getBoundingClientRect","menuButtonRect","style","opacity","dropDownElementRect","margin","leftPosition","right","width","window","innerWidth","position","left","pageXOffset","topPosition","top","height","innerHeight","bottom","pageYOffset","handleClickOutside","event","contains","target","addEventListener","removeEventListener","clearTableSelection","update","isAttached","tableNode","tableElement","getElementByKey","Error","tableSelection","clearHighlight","markDirty","rootNode","selectStart","mergeTableCellsAtSelection","firstCell","setColSpan","setRowSpan","getFirstChild","remove","append","getChildren","unmergeTableCellsAtSelection","insertTableRowAtSelection","shouldInsertAfter","insertTableColumnAtSelection","deleteTableRowAtSelection","deleteTableAtSelection","deleteTableColumnAtSelection","toggleTableRowIsHeader","tableRowIndex","tableRows","tableRow","forEach","tableCell","toggleHeaderStyle","ROW","toggleTableColumnIsHeader","tableColumnIndex","maxRowsLength","Math","max","map","r","tableCells","COLUMN","mergeCellButton","button","className","data-test-id","onClick","type","div","e","stopPropagation","ref","Fragment","hr","span","__headerState","document","body","TableCellActionMenuContainer","anchorElem","menuButtonRef","menuRootRef","isMenuOpen","setTableMenuCellNode","$moveMenu","menu","nativeSelection","getSelection","activeElement","anchorNode","tableCellNodeFromSelection","getNode","tableCellParentNodeDOM","registerUpdateListener","menuButtonDOM","tableCellNodeDOM","tableCellRect","menuRect","anchorRect","transform","prevTableCellDOM","TableActionMenuPlugin","isEditable"],"mappings":"AAAA;;AAUA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SACEC,gCAAgC,EAChCC,6BAA6B,EAC7BC,eAAe,EACfC,gCAAgC,EAChCC,qCAAqC,EACrCC,mCAAmC,EACnCC,kCAAkC,EAClCC,gCAAgC,EAChCC,6BAA6B,EAC7BC,gBAAgB,EAChBC,eAAe,EACfC,iBAAiB,EACjBC,YAAY,EACZC,qBAAqB,EACrBC,aAAa,EACbC,gCAAgC,QAC3B,iBAAgB;AACvB,SAASC,aAAa,QAAQ,iBAAgB;AAC9C,SACEC,oBAAoB,EACpBC,QAAQ,EACRC,aAAa,EACbC,cAAc,EACdC,gB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AAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/experimental_table/plugins/TableCellResizerPlugin/index.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/experimental_table/plugins/TableCellResizerPlugin/index.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AA0X9D,eAAO,MAAM,sBAAsB,EAAE,eAQpC,CAAA"}
|
|
@@ -8,12 +8,14 @@ import { $getNearestNodeFromDOMNode } from 'lexical';
|
|
|
8
8
|
import * as React from 'react';
|
|
9
9
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
10
10
|
import { createPortal } from 'react-dom';
|
|
11
|
+
import { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js';
|
|
11
12
|
const MIN_ROW_HEIGHT = 33;
|
|
12
13
|
const MIN_COLUMN_WIDTH = 50;
|
|
13
14
|
function TableCellResizer({ editor }) {
|
|
14
15
|
const targetRef = useRef(null);
|
|
15
16
|
const resizerRef = useRef(null);
|
|
16
17
|
const tableRectRef = useRef(null);
|
|
18
|
+
const editorConfig = useEditorConfigContext();
|
|
17
19
|
const mouseStartPosRef = useRef(null);
|
|
18
20
|
const [mouseCurrentPos, updateMouseCurrentPos] = useState(null);
|
|
19
21
|
const [activeCell, updateActiveCell] = useState(null);
|
|
@@ -78,13 +80,16 @@ function TableCellResizer({ editor }) {
|
|
|
78
80
|
updateIsMouseDown(false);
|
|
79
81
|
}, 0);
|
|
80
82
|
};
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
const removeRootListener = editor.registerRootListener((rootElement, prevRootElement)=>{
|
|
84
|
+
rootElement?.addEventListener('mousemove', onMouseMove);
|
|
85
|
+
rootElement?.addEventListener('mousedown', onMouseDown);
|
|
86
|
+
rootElement?.addEventListener('mouseup', onMouseUp);
|
|
87
|
+
prevRootElement?.removeEventListener('mousemove', onMouseMove);
|
|
88
|
+
prevRootElement?.removeEventListener('mousedown', onMouseDown);
|
|
89
|
+
prevRootElement?.removeEventListener('mouseup', onMouseUp);
|
|
90
|
+
});
|
|
84
91
|
return ()=>{
|
|
85
|
-
|
|
86
|
-
document.removeEventListener('mousedown', onMouseDown);
|
|
87
|
-
document.removeEventListener('mouseup', onMouseUp);
|
|
92
|
+
removeRootListener();
|
|
88
93
|
};
|
|
89
94
|
}, [
|
|
90
95
|
activeCell,
|
|
@@ -295,12 +300,12 @@ function TableCellResizer({ editor }) {
|
|
|
295
300
|
children: activeCell != null && !isMouseDown && /*#__PURE__*/ _jsxs(React.Fragment, {
|
|
296
301
|
children: [
|
|
297
302
|
/*#__PURE__*/ _jsx("div", {
|
|
298
|
-
className:
|
|
303
|
+
className: `${editorConfig.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,
|
|
299
304
|
onMouseDown: toggleResize('right'),
|
|
300
305
|
style: resizerStyles.right || undefined
|
|
301
306
|
}),
|
|
302
307
|
/*#__PURE__*/ _jsx("div", {
|
|
303
|
-
className:
|
|
308
|
+
className: `${editorConfig.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,
|
|
304
309
|
onMouseDown: toggleResize('bottom'),
|
|
305
310
|
style: resizerStyles.bottom || undefined
|
|
306
311
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/features/experimental_table/plugins/TableCellResizerPlugin/index.tsx"],"sourcesContent":["'use client'\n\nimport type { TableCellNode, TableDOMCell, TableMapType, TableMapValueType } from '@lexical/table'\nimport type { LexicalEditor } from 'lexical'\nimport type { JSX, MouseEventHandler } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport {\n $computeTableMapSkipCellCheck,\n $getTableNodeFromLexicalNodeOrThrow,\n $getTableRowIndexFromTableCellNode,\n $isTableCellNode,\n $isTableRowNode,\n getDOMCellFromTarget,\n} from '@lexical/table'\nimport { calculateZoomLevel } from '@lexical/utils'\nimport { $getNearestNodeFromDOMNode } from 'lexical'\nimport * as React from 'react'\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport type { PluginComponent, PluginComponentWithAnchor } from '../../../typesClient.js'\n\nimport './index.scss'\n\ntype MousePosition = {\n x: number\n y: number\n}\n\ntype MouseDraggingDirection = 'bottom' | 'right'\n\nconst MIN_ROW_HEIGHT = 33\nconst MIN_COLUMN_WIDTH = 50\n\nfunction TableCellResizer({ editor }: { editor: LexicalEditor }): JSX.Element {\n const targetRef = useRef<HTMLElement | null>(null)\n const resizerRef = useRef<HTMLDivElement | null>(null)\n const tableRectRef = useRef<ClientRect | null>(null)\n\n const mouseStartPosRef = useRef<MousePosition | null>(null)\n const [mouseCurrentPos, updateMouseCurrentPos] = useState<MousePosition | null>(null)\n\n const [activeCell, updateActiveCell] = useState<TableDOMCell | null>(null)\n const [isMouseDown, updateIsMouseDown] = useState<boolean>(false)\n const [draggingDirection, updateDraggingDirection] = useState<MouseDraggingDirection | null>(null)\n\n const resetState = useCallback(() => {\n updateActiveCell(null)\n targetRef.current = null\n updateDraggingDirection(null)\n mouseStartPosRef.current = null\n tableRectRef.current = null\n }, [])\n\n const isMouseDownOnEvent = (event: MouseEvent) => {\n return (event.buttons & 1) === 1\n }\n\n useEffect(() => {\n const onMouseMove = (event: MouseEvent) => {\n setTimeout(() => {\n const target = event.target\n\n if (draggingDirection) {\n updateMouseCurrentPos({\n x: event.clientX,\n y: event.clientY,\n })\n return\n }\n updateIsMouseDown(isMouseDownOnEvent(event))\n if (resizerRef.current && resizerRef.current.contains(target as Node)) {\n return\n }\n\n if (targetRef.current !== target) {\n targetRef.current = target as HTMLElement\n const cell = getDOMCellFromTarget(target as HTMLElement)\n\n if (cell && activeCell !== cell) {\n editor.update(() => {\n const tableCellNode = $getNearestNodeFromDOMNode(cell.elem)\n\n if (!tableCellNode) {\n throw new Error('TableCellResizer: Table cell node not found.')\n }\n\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode)\n const tableElement = editor.getElementByKey(tableNode.getKey())\n\n if (!tableElement) {\n throw new Error('TableCellResizer: Table element not found.')\n }\n\n targetRef.current = target as HTMLElement\n tableRectRef.current = tableElement.getBoundingClientRect()\n updateActiveCell(cell)\n })\n } else if (cell == null) {\n resetState()\n }\n }\n }, 0)\n }\n\n const onMouseDown = (event: MouseEvent) => {\n setTimeout(() => {\n updateIsMouseDown(true)\n }, 0)\n }\n\n const onMouseUp = (event: MouseEvent) => {\n setTimeout(() => {\n updateIsMouseDown(false)\n }, 0)\n }\n\n document.addEventListener('mousemove', onMouseMove)\n document.addEventListener('mousedown', onMouseDown)\n document.addEventListener('mouseup', onMouseUp)\n\n return () => {\n document.removeEventListener('mousemove', onMouseMove)\n document.removeEventListener('mousedown', onMouseDown)\n document.removeEventListener('mouseup', onMouseUp)\n }\n }, [activeCell, draggingDirection, editor, resetState])\n\n const isHeightChanging = (direction: MouseDraggingDirection) => {\n if (direction === 'bottom') {\n return true\n }\n return false\n }\n\n const updateRowHeight = useCallback(\n (heightChange: number) => {\n if (!activeCell) {\n throw new Error('TableCellResizer: Expected active cell.')\n }\n\n editor.update(\n () => {\n const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem)\n if (!$isTableCellNode(tableCellNode)) {\n throw new Error('TableCellResizer: Table cell node not found.')\n }\n\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode)\n\n const tableRowIndex = $getTableRowIndexFromTableCellNode(tableCellNode)\n\n const tableRows = tableNode.getChildren()\n\n if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {\n throw new Error('Expected table cell to be inside of table row.')\n }\n\n const tableRow = tableRows[tableRowIndex]\n\n if (!$isTableRowNode(tableRow)) {\n throw new Error('Expected table row')\n }\n\n let height = tableRow.getHeight()\n if (height === undefined) {\n const rowCells = tableRow.getChildren<TableCellNode>()\n height = Math.min(\n ...rowCells.map((cell) => getCellNodeHeight(cell, editor) ?? Infinity),\n )\n }\n\n const newHeight = Math.max(height + heightChange, MIN_ROW_HEIGHT)\n tableRow.setHeight(newHeight)\n },\n { tag: 'skip-scroll-into-view' },\n )\n },\n [activeCell, editor],\n )\n\n const getCellNodeWidth = (\n cell: TableCellNode,\n activeEditor: LexicalEditor,\n ): number | undefined => {\n const width = cell.getWidth()\n if (width !== undefined) {\n return width\n }\n\n const domCellNode = activeEditor.getElementByKey(cell.getKey())\n if (domCellNode == null) {\n return undefined\n }\n const computedStyle = getComputedStyle(domCellNode)\n return (\n domCellNode.clientWidth -\n parseFloat(computedStyle.paddingLeft) -\n parseFloat(computedStyle.paddingRight)\n )\n }\n\n const getCellNodeHeight = (\n cell: TableCellNode,\n activeEditor: LexicalEditor,\n ): number | undefined => {\n const domCellNode = activeEditor.getElementByKey(cell.getKey())\n return domCellNode?.clientHeight\n }\n\n const getCellColumnIndex = (tableCellNode: TableCellNode, tableMap: TableMapType) => {\n for (let row = 0; row < tableMap.length; row++) {\n for (let column = 0; column < tableMap[row].length; column++) {\n if (tableMap[row][column].cell === tableCellNode) {\n return column\n }\n }\n }\n }\n\n const updateColumnWidth = useCallback(\n (widthChange: number) => {\n if (!activeCell) {\n throw new Error('TableCellResizer: Expected active cell.')\n }\n editor.update(\n () => {\n const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem)\n if (!$isTableCellNode(tableCellNode)) {\n throw new Error('TableCellResizer: Table cell node not found.')\n }\n\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode)\n const [tableMap] = $computeTableMapSkipCellCheck(tableNode, null, null)\n const columnIndex = getCellColumnIndex(tableCellNode, tableMap)\n if (columnIndex === undefined) {\n throw new Error('TableCellResizer: Table column not found.')\n }\n\n for (let row = 0; row < tableMap.length; row++) {\n const cell: TableMapValueType = tableMap[row][columnIndex]\n if (\n cell.startRow === row &&\n (columnIndex === tableMap[row].length - 1 ||\n tableMap[row][columnIndex].cell !== tableMap[row][columnIndex + 1].cell)\n ) {\n const width = getCellNodeWidth(cell.cell, editor)\n if (width === undefined) {\n continue\n }\n const newWidth = Math.max(width + widthChange, MIN_COLUMN_WIDTH)\n cell.cell.setWidth(newWidth)\n }\n }\n },\n { tag: 'skip-scroll-into-view' },\n )\n },\n [activeCell, editor],\n )\n\n const mouseUpHandler = useCallback(\n (direction: MouseDraggingDirection) => {\n const handler = (event: MouseEvent) => {\n event.preventDefault()\n event.stopPropagation()\n\n if (!activeCell) {\n throw new Error('TableCellResizer: Expected active cell.')\n }\n\n if (mouseStartPosRef.current) {\n const { x, y } = mouseStartPosRef.current\n\n if (activeCell === null) {\n return\n }\n const zoom = calculateZoomLevel(event.target as Element)\n\n if (isHeightChanging(direction)) {\n const heightChange = (event.clientY - y) / zoom\n updateRowHeight(heightChange)\n } else {\n const widthChange = (event.clientX - x) / zoom\n updateColumnWidth(widthChange)\n }\n\n resetState()\n document.removeEventListener('mouseup', handler)\n }\n }\n return handler\n },\n [activeCell, resetState, updateColumnWidth, updateRowHeight],\n )\n\n const toggleResize = useCallback(\n (direction: MouseDraggingDirection): MouseEventHandler<HTMLDivElement> =>\n (event) => {\n event.preventDefault()\n event.stopPropagation()\n\n if (!activeCell) {\n throw new Error('TableCellResizer: Expected active cell.')\n }\n\n mouseStartPosRef.current = {\n x: event.clientX,\n y: event.clientY,\n }\n updateMouseCurrentPos(mouseStartPosRef.current)\n updateDraggingDirection(direction)\n\n document.addEventListener('mouseup', mouseUpHandler(direction))\n },\n [activeCell, mouseUpHandler],\n )\n\n const getResizers = useCallback(() => {\n if (activeCell) {\n const { height, left, top, width } = activeCell.elem.getBoundingClientRect()\n const zoom = calculateZoomLevel(activeCell.elem)\n const zoneWidth = 10 // Pixel width of the zone where you can drag the edge\n const styles = {\n bottom: {\n backgroundColor: 'none',\n cursor: 'row-resize',\n height: `${zoneWidth}px`,\n left: `${window.pageXOffset + left}px`,\n top: `${window.pageYOffset + top + height - zoneWidth / 2}px`,\n width: `${width}px`,\n },\n right: {\n backgroundColor: 'none',\n cursor: 'col-resize',\n height: `${height}px`,\n left: `${window.pageXOffset + left + width - zoneWidth / 2}px`,\n top: `${window.pageYOffset + top}px`,\n width: `${zoneWidth}px`,\n },\n }\n\n const tableRect = tableRectRef.current\n\n if (draggingDirection && mouseCurrentPos && tableRect) {\n if (isHeightChanging(draggingDirection)) {\n styles[draggingDirection].left = `${window.pageXOffset + tableRect.left}px`\n styles[draggingDirection].top = `${window.pageYOffset + mouseCurrentPos.y / zoom}px`\n styles[draggingDirection].height = '3px'\n styles[draggingDirection].width = `${tableRect.width}px`\n } else {\n styles[draggingDirection].top = `${window.pageYOffset + tableRect.top}px`\n styles[draggingDirection].left = `${window.pageXOffset + mouseCurrentPos.x / zoom}px`\n styles[draggingDirection].width = '3px'\n styles[draggingDirection].height = `${tableRect.height}px`\n }\n\n styles[draggingDirection].backgroundColor = '#adf'\n }\n\n return styles\n }\n\n return {\n bottom: null,\n left: null,\n right: null,\n top: null,\n }\n }, [activeCell, draggingDirection, mouseCurrentPos])\n\n const resizerStyles = getResizers()\n\n return (\n <div ref={resizerRef}>\n {activeCell != null && !isMouseDown && (\n <React.Fragment>\n <div\n className=\"TableCellResizer__resizer TableCellResizer__ui\"\n onMouseDown={toggleResize('right')}\n style={resizerStyles.right || undefined}\n />\n <div\n className=\"TableCellResizer__resizer TableCellResizer__ui\"\n onMouseDown={toggleResize('bottom')}\n style={resizerStyles.bottom || undefined}\n />\n </React.Fragment>\n )}\n </div>\n )\n}\n\nexport const TableCellResizerPlugin: PluginComponent = () => {\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n\n return useMemo(\n () => (isEditable ? createPortal(<TableCellResizer editor={editor} />, document.body) : null),\n [editor, isEditable],\n )\n}\n"],"names":["useLexicalComposerContext","useLexicalEditable","$computeTableMapSkipCellCheck","$getTableNodeFromLexicalNodeOrThrow","$getTableRowIndexFromTableCellNode","$isTableCellNode","$isTableRowNode","getDOMCellFromTarget","calculateZoomLevel","$getNearestNodeFromDOMNode","React","useCallback","useEffect","useMemo","useRef","useState","createPortal","MIN_ROW_HEIGHT","MIN_COLUMN_WIDTH","TableCellResizer","editor","targetRef","resizerRef","tableRectRef","mouseStartPosRef","mouseCurrentPos","updateMouseCurrentPos","activeCell","updateActiveCell","isMouseDown","updateIsMouseDown","draggingDirection","updateDraggingDirection","resetState","current","isMouseDownOnEvent","event","buttons","onMouseMove","setTimeout","target","x","clientX","y","clientY","contains","cell","update","tableCellNode","elem","Error","tableNode","tableElement","getElementByKey","getKey","getBoundingClientRect","onMouseDown","onMouseUp","document","addEventListener","removeEventListener","isHeightChanging","direction","updateRowHeight","heightChange","tableRowIndex","tableRows","getChildren","length","tableRow","height","getHeight","undefined","rowCells","Math","min","map","getCellNodeHeight","Infinity","newHeight","max","setHeight","tag","getCellNodeWidth","activeEditor","width","getWidth","domCellNode","computedStyle","getComputedStyle","clientWidth","parseFloat","paddingLeft","paddingRight","clientHeight","getCellColumnIndex","tableMap","row","column","updateColumnWidth","widthChange","columnIndex","startRow","newWidth","setWidth","mouseUpHandler","handler","preventDefault","stopPropagation","zoom","toggleResize","getResizers","left","top","zoneWidth","styles","bottom","backgroundColor","cursor","window","pageXOffset","pageYOffset","right","tableRect","resizerStyles","div","ref","Fragment","className","style","TableCellResizerPlugin","isEditable","body"],"mappings":"AAAA;;AAMA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SACEC,6BAA6B,EAC7BC,mCAAmC,EACnCC,kCAAkC,EAClCC,gBAAgB,EAChBC,eAAe,EACfC,oBAAoB,QACf,iBAAgB;AACvB,SAASC,kBAAkB,QAAQ,iBAAgB;AACnD,SAASC,0BAA0B,QAAQ,UAAS;AACpD,YAAYC,WAAW,QAAO;AAC9B,SAASC,WAAW,EAAEC,SAA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,CAAC;gBAC1D,OAAO;oBACL8B,MAAM,CAACpF,kBAAkB,CAACkF,GAAG,GAAG,CAAC,EAAEM,OAAOE,WAAW,GAAGE,UAAUV,GAAG,CAAC,EAAE,CAAC;oBACzEE,MAAM,CAACpF,kBAAkB,CAACiF,IAAI,GAAG,CAAC,EAAEO,OAAOC,WAAW,GAAG/F,gBAAgBgB,CAAC,GAAGoE,KAAK,EAAE,CAAC;oBACrFM,MAAM,CAACpF,kBAAkB,CAACsD,KAAK,GAAG;oBAClC8B,MAAM,CAACpF,kBAAkB,CAACuC,MAAM,GAAG,CAAC,EAAEqD,UAAUrD,MAAM,CAAC,EAAE,CAAC;gBAC5D;gBAEA6C,MAAM,CAACpF,kBAAkB,CAACsF,eAAe,GAAG;YAC9C;YAEA,OAAOF;QACT;QAEA,OAAO;YACLC,QAAQ;YACRJ,MAAM;YACNU,OAAO;YACPT,KAAK;QACP;IACF,GAAG;QAACtF;QAAYI;QAAmBN;KAAgB;IAEnD,MAAMmG,gBAAgBb;IAEtB,qBACE,KAACc;QAAIC,KAAKxG;kBACPK,cAAc,QAAQ,CAACE,6BACtB,MAACnB,MAAMqH,QAAQ;;8BACb,KAACF;oBACCG,WAAU;oBACVxE,aAAasD,aAAa;oBAC1BmB,OAAOL,cAAcF,KAAK,IAAIlD;;8BAEhC,KAACqD;oBACCG,WAAU;oBACVxE,aAAasD,aAAa;oBAC1BmB,OAAOL,cAAcR,MAAM,IAAI5C;;;;;AAM3C;AAEA,OAAO,MAAM0D,yBAA0C;IACrD,MAAM,CAAC9G,OAAO,GAAGpB;IACjB,MAAMmI,aAAalI;IAEnB,OAAOY,QACL,IAAOsH,2BAAanH,2BAAa,KAACG;YAAiBC,QAAQA;YAAYsC,SAAS0E,IAAI,IAAI,MACxF;QAAChH;QAAQ+G;KAAW;AAExB,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/features/experimental_table/plugins/TableCellResizerPlugin/index.tsx"],"sourcesContent":["'use client'\n\nimport type { TableCellNode, TableDOMCell, TableMapType, TableMapValueType } from '@lexical/table'\nimport type { LexicalEditor } from 'lexical'\nimport type { JSX, MouseEventHandler } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport {\n $computeTableMapSkipCellCheck,\n $getTableNodeFromLexicalNodeOrThrow,\n $getTableRowIndexFromTableCellNode,\n $isTableCellNode,\n $isTableRowNode,\n getDOMCellFromTarget,\n} from '@lexical/table'\nimport { calculateZoomLevel } from '@lexical/utils'\nimport { $getNearestNodeFromDOMNode } from 'lexical'\nimport * as React from 'react'\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport type { PluginComponent } from '../../../typesClient.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\n\ntype MousePosition = {\n x: number\n y: number\n}\n\ntype MouseDraggingDirection = 'bottom' | 'right'\n\nconst MIN_ROW_HEIGHT = 33\nconst MIN_COLUMN_WIDTH = 50\n\nfunction TableCellResizer({ editor }: { editor: LexicalEditor }): JSX.Element {\n const targetRef = useRef<HTMLElement | null>(null)\n const resizerRef = useRef<HTMLDivElement | null>(null)\n const tableRectRef = useRef<ClientRect | null>(null)\n const editorConfig = useEditorConfigContext()\n\n const mouseStartPosRef = useRef<MousePosition | null>(null)\n const [mouseCurrentPos, updateMouseCurrentPos] = useState<MousePosition | null>(null)\n\n const [activeCell, updateActiveCell] = useState<TableDOMCell | null>(null)\n const [isMouseDown, updateIsMouseDown] = useState<boolean>(false)\n const [draggingDirection, updateDraggingDirection] = useState<MouseDraggingDirection | null>(null)\n\n const resetState = useCallback(() => {\n updateActiveCell(null)\n targetRef.current = null\n updateDraggingDirection(null)\n mouseStartPosRef.current = null\n tableRectRef.current = null\n }, [])\n\n const isMouseDownOnEvent = (event: MouseEvent) => {\n return (event.buttons & 1) === 1\n }\n\n useEffect(() => {\n const onMouseMove = (event: MouseEvent) => {\n setTimeout(() => {\n const target = event.target\n\n if (draggingDirection) {\n updateMouseCurrentPos({\n x: event.clientX,\n y: event.clientY,\n })\n return\n }\n updateIsMouseDown(isMouseDownOnEvent(event))\n if (resizerRef.current && resizerRef.current.contains(target as Node)) {\n return\n }\n\n if (targetRef.current !== target) {\n targetRef.current = target as HTMLElement\n const cell = getDOMCellFromTarget(target as HTMLElement)\n\n if (cell && activeCell !== cell) {\n editor.update(() => {\n const tableCellNode = $getNearestNodeFromDOMNode(cell.elem)\n\n if (!tableCellNode) {\n throw new Error('TableCellResizer: Table cell node not found.')\n }\n\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode)\n const tableElement = editor.getElementByKey(tableNode.getKey())\n\n if (!tableElement) {\n throw new Error('TableCellResizer: Table element not found.')\n }\n\n targetRef.current = target as HTMLElement\n tableRectRef.current = tableElement.getBoundingClientRect()\n updateActiveCell(cell)\n })\n } else if (cell == null) {\n resetState()\n }\n }\n }, 0)\n }\n\n const onMouseDown = (event: MouseEvent) => {\n setTimeout(() => {\n updateIsMouseDown(true)\n }, 0)\n }\n\n const onMouseUp = (event: MouseEvent) => {\n setTimeout(() => {\n updateIsMouseDown(false)\n }, 0)\n }\n\n const removeRootListener = editor.registerRootListener((rootElement, prevRootElement) => {\n rootElement?.addEventListener('mousemove', onMouseMove)\n rootElement?.addEventListener('mousedown', onMouseDown)\n rootElement?.addEventListener('mouseup', onMouseUp)\n\n prevRootElement?.removeEventListener('mousemove', onMouseMove)\n prevRootElement?.removeEventListener('mousedown', onMouseDown)\n prevRootElement?.removeEventListener('mouseup', onMouseUp)\n })\n\n return () => {\n removeRootListener()\n }\n }, [activeCell, draggingDirection, editor, resetState])\n\n const isHeightChanging = (direction: MouseDraggingDirection) => {\n if (direction === 'bottom') {\n return true\n }\n return false\n }\n\n const updateRowHeight = useCallback(\n (heightChange: number) => {\n if (!activeCell) {\n throw new Error('TableCellResizer: Expected active cell.')\n }\n\n editor.update(\n () => {\n const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem)\n if (!$isTableCellNode(tableCellNode)) {\n throw new Error('TableCellResizer: Table cell node not found.')\n }\n\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode)\n\n const tableRowIndex = $getTableRowIndexFromTableCellNode(tableCellNode)\n\n const tableRows = tableNode.getChildren()\n\n if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {\n throw new Error('Expected table cell to be inside of table row.')\n }\n\n const tableRow = tableRows[tableRowIndex]\n\n if (!$isTableRowNode(tableRow)) {\n throw new Error('Expected table row')\n }\n\n let height = tableRow.getHeight()\n if (height === undefined) {\n const rowCells = tableRow.getChildren<TableCellNode>()\n height = Math.min(\n ...rowCells.map((cell) => getCellNodeHeight(cell, editor) ?? Infinity),\n )\n }\n\n const newHeight = Math.max(height + heightChange, MIN_ROW_HEIGHT)\n tableRow.setHeight(newHeight)\n },\n { tag: 'skip-scroll-into-view' },\n )\n },\n [activeCell, editor],\n )\n\n const getCellNodeWidth = (\n cell: TableCellNode,\n activeEditor: LexicalEditor,\n ): number | undefined => {\n const width = cell.getWidth()\n if (width !== undefined) {\n return width\n }\n\n const domCellNode = activeEditor.getElementByKey(cell.getKey())\n if (domCellNode == null) {\n return undefined\n }\n const computedStyle = getComputedStyle(domCellNode)\n return (\n domCellNode.clientWidth -\n parseFloat(computedStyle.paddingLeft) -\n parseFloat(computedStyle.paddingRight)\n )\n }\n\n const getCellNodeHeight = (\n cell: TableCellNode,\n activeEditor: LexicalEditor,\n ): number | undefined => {\n const domCellNode = activeEditor.getElementByKey(cell.getKey())\n return domCellNode?.clientHeight\n }\n\n const getCellColumnIndex = (tableCellNode: TableCellNode, tableMap: TableMapType) => {\n for (let row = 0; row < tableMap.length; row++) {\n for (let column = 0; column < tableMap[row].length; column++) {\n if (tableMap[row][column].cell === tableCellNode) {\n return column\n }\n }\n }\n }\n\n const updateColumnWidth = useCallback(\n (widthChange: number) => {\n if (!activeCell) {\n throw new Error('TableCellResizer: Expected active cell.')\n }\n editor.update(\n () => {\n const tableCellNode = $getNearestNodeFromDOMNode(activeCell.elem)\n if (!$isTableCellNode(tableCellNode)) {\n throw new Error('TableCellResizer: Table cell node not found.')\n }\n\n const tableNode = $getTableNodeFromLexicalNodeOrThrow(tableCellNode)\n const [tableMap] = $computeTableMapSkipCellCheck(tableNode, null, null)\n const columnIndex = getCellColumnIndex(tableCellNode, tableMap)\n if (columnIndex === undefined) {\n throw new Error('TableCellResizer: Table column not found.')\n }\n\n for (let row = 0; row < tableMap.length; row++) {\n const cell: TableMapValueType = tableMap[row][columnIndex]\n if (\n cell.startRow === row &&\n (columnIndex === tableMap[row].length - 1 ||\n tableMap[row][columnIndex].cell !== tableMap[row][columnIndex + 1].cell)\n ) {\n const width = getCellNodeWidth(cell.cell, editor)\n if (width === undefined) {\n continue\n }\n const newWidth = Math.max(width + widthChange, MIN_COLUMN_WIDTH)\n cell.cell.setWidth(newWidth)\n }\n }\n },\n { tag: 'skip-scroll-into-view' },\n )\n },\n [activeCell, editor],\n )\n\n const mouseUpHandler = useCallback(\n (direction: MouseDraggingDirection) => {\n const handler = (event: MouseEvent) => {\n event.preventDefault()\n event.stopPropagation()\n\n if (!activeCell) {\n throw new Error('TableCellResizer: Expected active cell.')\n }\n\n if (mouseStartPosRef.current) {\n const { x, y } = mouseStartPosRef.current\n\n if (activeCell === null) {\n return\n }\n const zoom = calculateZoomLevel(event.target as Element)\n\n if (isHeightChanging(direction)) {\n const heightChange = (event.clientY - y) / zoom\n updateRowHeight(heightChange)\n } else {\n const widthChange = (event.clientX - x) / zoom\n updateColumnWidth(widthChange)\n }\n\n resetState()\n document.removeEventListener('mouseup', handler)\n }\n }\n return handler\n },\n [activeCell, resetState, updateColumnWidth, updateRowHeight],\n )\n\n const toggleResize = useCallback(\n (direction: MouseDraggingDirection): MouseEventHandler<HTMLDivElement> =>\n (event) => {\n event.preventDefault()\n event.stopPropagation()\n\n if (!activeCell) {\n throw new Error('TableCellResizer: Expected active cell.')\n }\n\n mouseStartPosRef.current = {\n x: event.clientX,\n y: event.clientY,\n }\n updateMouseCurrentPos(mouseStartPosRef.current)\n updateDraggingDirection(direction)\n\n document.addEventListener('mouseup', mouseUpHandler(direction))\n },\n [activeCell, mouseUpHandler],\n )\n\n const getResizers = useCallback(() => {\n if (activeCell) {\n const { height, left, top, width } = activeCell.elem.getBoundingClientRect()\n const zoom = calculateZoomLevel(activeCell.elem)\n const zoneWidth = 10 // Pixel width of the zone where you can drag the edge\n const styles = {\n bottom: {\n backgroundColor: 'none',\n cursor: 'row-resize',\n height: `${zoneWidth}px`,\n left: `${window.pageXOffset + left}px`,\n top: `${window.pageYOffset + top + height - zoneWidth / 2}px`,\n width: `${width}px`,\n },\n right: {\n backgroundColor: 'none',\n cursor: 'col-resize',\n height: `${height}px`,\n left: `${window.pageXOffset + left + width - zoneWidth / 2}px`,\n top: `${window.pageYOffset + top}px`,\n width: `${zoneWidth}px`,\n },\n }\n\n const tableRect = tableRectRef.current\n\n if (draggingDirection && mouseCurrentPos && tableRect) {\n if (isHeightChanging(draggingDirection)) {\n styles[draggingDirection].left = `${window.pageXOffset + tableRect.left}px`\n styles[draggingDirection].top = `${window.pageYOffset + mouseCurrentPos.y / zoom}px`\n styles[draggingDirection].height = '3px'\n styles[draggingDirection].width = `${tableRect.width}px`\n } else {\n styles[draggingDirection].top = `${window.pageYOffset + tableRect.top}px`\n styles[draggingDirection].left = `${window.pageXOffset + mouseCurrentPos.x / zoom}px`\n styles[draggingDirection].width = '3px'\n styles[draggingDirection].height = `${tableRect.height}px`\n }\n\n styles[draggingDirection].backgroundColor = '#adf'\n }\n\n return styles\n }\n\n return {\n bottom: null,\n left: null,\n right: null,\n top: null,\n }\n }, [activeCell, draggingDirection, mouseCurrentPos])\n\n const resizerStyles = getResizers()\n\n return (\n <div ref={resizerRef}>\n {activeCell != null && !isMouseDown && (\n <React.Fragment>\n <div\n className={`${editorConfig.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`}\n onMouseDown={toggleResize('right')}\n style={resizerStyles.right || undefined}\n />\n <div\n className={`${editorConfig.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`}\n onMouseDown={toggleResize('bottom')}\n style={resizerStyles.bottom || undefined}\n />\n </React.Fragment>\n )}\n </div>\n )\n}\n\nexport const TableCellResizerPlugin: PluginComponent = () => {\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n\n return useMemo(\n () => (isEditable ? createPortal(<TableCellResizer editor={editor} />, document.body) : null),\n [editor, isEditable],\n )\n}\n"],"names":["useLexicalComposerContext","useLexicalEditable","$computeTableMapSkipCellCheck","$getTableNodeFromLexicalNodeOrThrow","$getTableRowIndexFromTableCellNode","$isTableCellNode","$isTableRowNode","getDOMCellFromTarget","calculateZoomLevel","$getNearestNodeFromDOMNode","React","useCallback","useEffect","useMemo","useRef","useState","createPortal","useEditorConfigContext","MIN_ROW_HEIGHT","MIN_COLUMN_WIDTH","TableCellResizer","editor","targetRef","resizerRef","tableRectRef","editorConfig","mouseStartPosRef","mouseCurrentPos","updateMouseCurrentPos","activeCell","updateActiveCell","isMouseDown","updateIsMouseDown","draggingDirection","updateDraggingDirection","resetState","current","isMouseDownOnEvent","event","buttons","onMouseMove","setTimeout","target","x","clientX","y","clientY","contains","cell","update","tableCellNode","elem","Error","tableNode","tableElement","getElementByKey","getKey","getBoundingClientRect","onMouseDown","onMouseUp","removeRootListener","registerRootListener","rootElement","prevRootElement","addEventListener","removeEventListener","isHeightChanging","direction","updateRowHeight","heightChange","tableRowIndex","tableRows","getChildren","length","tableRow","height","getHeight","undefined","rowCells","Math","min","map","getCellNodeHeight","Infinity","newHeight","max","setHeight","tag","getCellNodeWidth","activeEditor","width","getWidth","domCellNode","computedStyle","getComputedStyle","clientWidth","parseFloat","paddingLeft","paddingRight","clientHeight","getCellColumnIndex","tableMap","row","column","updateColumnWidth","widthChange","columnIndex","startRow","newWidth","setWidth","mouseUpHandler","handler","preventDefault","stopPropagation","zoom","document","toggleResize","getResizers","left","top","zoneWidth","styles","bottom","backgroundColor","cursor","window","pageXOffset","pageYOffset","right","tableRect","resizerStyles","div","ref","Fragment","className","lexical","theme","tableCellResizer","style","TableCellResizerPlugin","isEditable","body"],"mappings":"AAAA;;AAMA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SACEC,6BAA6B,EAC7BC,mCAAmC,EACnCC,kCAAkC,EAClCC,gBAAgB,EAChBC,eAAe,EACfC,oBAAoB,QACf,iBAAgB;AACvB,SAASC,kBAAkB,QAAQ,iBAAgB;AACnD,SAASC,0BAA0B,QAAQ,UAAS;AACpD,YAAYC,WAAW,QAAO;AAC9B,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AACzE,SAASC,YAAY,QAAQ,YAAW;AAIxC,SAASC,sBAAsB,QAAQ,4DAA2D;AASlG,MAAMC,iBAAiB;AACvB,MAAMC,mBAAmB;AAEzB,SAASC,iBAAiB,EAAEC,MAAM,EAA6B;IAC7D,MAAMC,YAAYR,OAA2B;IAC7C,MAAMS,aAAaT,OAA8B;IACjD,MAAMU,eAAeV,OAA0B;IAC/C,MAAMW,eAAeR;IAErB,MAAMS,mBAAmBZ,OAA6B;IACtD,MAAM,CAACa,iBAAiBC,sBAAsB,GAAGb,SAA+B;IAEhF,MAAM,CAACc,YAAYC,iBAAiB,GAAGf,SAA8B;IACrE,MAAM,CAACgB,aAAaC,kBAAkB,GAAGjB,SAAkB;IAC3D,MAAM,CAACkB,mBAAmBC,wBAAwB,GAAGnB,SAAwC;IAE7F,MAAMoB,aAAaxB,YAAY;QAC7BmB,iBAAiB;QACjBR,UAAUc,OAAO,GAAG;QACpBF,wBAAwB;QACxBR,iBAAiBU,OAAO,GAAG;QAC3BZ,aAAaY,OAAO,GAAG;IACzB,GAAG,EAAE;IAEL,MAAMC,qBAAqB,CAACC;QAC1B,OAAO,AAACA,CA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ACc;QAAIC,KAAK7G;kBACPM,cAAc,QAAQ,CAACE,6BACtB,MAACrB,MAAM2H,QAAQ;;8BACb,KAACF;oBACCG,WAAW,CAAC,EAAE7G,aAAaA,YAAY,CAAC8G,OAAO,CAACC,KAAK,CAACC,gBAAgB,CAAC,qBAAqB,CAAC;oBAC7F/E,aAAa0D,aAAa;oBAC1BsB,OAAOR,cAAcF,KAAK,IAAInD;;8BAEhC,KAACsD;oBACCG,WAAW,CAAC,EAAE7G,aAAaA,YAAY,CAAC8G,OAAO,CAACC,KAAK,CAACC,gBAAgB,CAAC,qBAAqB,CAAC;oBAC7F/E,aAAa0D,aAAa;oBAC1BsB,OAAOR,cAAcR,MAAM,IAAI7C;;;;;AAM3C;AAEA,OAAO,MAAM8D,yBAA0C;IACrD,MAAM,CAACtH,OAAO,GAAGrB;IACjB,MAAM4I,aAAa3I;IAEnB,OAAOY,QACL,IAAO+H,2BAAa5H,2BAAa,KAACI;YAAiBC,QAAQA;YAAY8F,SAAS0B,IAAI,IAAI,MACxF;QAACxH;QAAQuH;KAAW;AAExB,EAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import * as React from 'react';
|
|
9
|
+
export declare function TableHoverActionsPlugin({ anchorElem, }: {
|
|
10
|
+
anchorElem?: HTMLElement;
|
|
11
|
+
}): React.ReactPortal | null;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/experimental_table/plugins/TableHoverActionsPlugin/index.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAmBH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAmN9B,wBAAgB,uBAAuB,CAAC,EACtC,UAA0B,GAC3B,EAAE;IACD,UAAU,CAAC,EAAE,WAAW,CAAA;CACzB,GAAG,KAAK,CAAC,WAAW,GAAG,IAAI,CAE3B"}
|