@webiny/lexical-nodes 5.40.0-beta.1 → 5.40.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/FontColorNode.js +8 -14
  2. package/FontColorNode.js.map +1 -1
  3. package/HeadingNode.js +6 -10
  4. package/HeadingNode.js.map +1 -1
  5. package/ImageNode.js +5 -8
  6. package/ImageNode.js.map +1 -1
  7. package/LinkNode.d.ts +2 -7
  8. package/LinkNode.js +29 -137
  9. package/LinkNode.js.map +1 -1
  10. package/ListItemNode.js +5 -8
  11. package/ListItemNode.js.map +1 -1
  12. package/ListNode.js +5 -8
  13. package/ListNode.js.map +1 -1
  14. package/ParagraphNode.js +6 -10
  15. package/ParagraphNode.js.map +1 -1
  16. package/QuoteNode.js +6 -10
  17. package/QuoteNode.js.map +1 -1
  18. package/TypographyNode.js +8 -14
  19. package/TypographyNode.js.map +1 -1
  20. package/components/ImageNode/ContentEditable.js.map +1 -1
  21. package/components/ImageNode/ImageComponent.d.ts +4 -2
  22. package/components/ImageNode/ImageComponent.js +12 -11
  23. package/components/ImageNode/ImageComponent.js.map +1 -1
  24. package/components/ImageNode/ImageResizer.js +5 -4
  25. package/components/ImageNode/ImageResizer.js.map +1 -1
  26. package/components/ImageNode/Placeholder.js.map +1 -1
  27. package/components/ImageNode/SharedHistoryContext.js +7 -8
  28. package/components/ImageNode/SharedHistoryContext.js.map +1 -1
  29. package/index.d.ts +1 -0
  30. package/index.js +13 -2
  31. package/index.js.map +1 -1
  32. package/package.json +6 -6
  33. package/types.js.map +1 -1
  34. package/utils/clearNodeFormating.js +1 -2
  35. package/utils/clearNodeFormating.js.map +1 -1
  36. package/utils/formatList.js.map +1 -1
  37. package/utils/formatToHeading.js +1 -2
  38. package/utils/formatToHeading.js.map +1 -1
  39. package/utils/formatToParagraph.js +1 -2
  40. package/utils/formatToParagraph.js.map +1 -1
  41. package/utils/formatToQuote.js +1 -2
  42. package/utils/formatToQuote.js.map +1 -1
  43. package/utils/listNode.js.map +1 -1
  44. package/utils/toggleLink.d.ts +8 -0
  45. package/utils/toggleLink.js +135 -0
  46. package/utils/toggleLink.js.map +1 -0
@@ -1 +1 @@
1
- {"version":3,"names":["React","_interopRequireWildcard","require","clamp","value","min","max","Math","Direction","east","north","south","west","ImageResizer","_ref","onResizeStart","onResizeEnd","buttonRef","imageRef","maxWidth","editor","showCaption","setShowCaption","captionsEnabled","controlWrapperRef","useRef","userSelect","priority","positioningRef","currentHeight","currentWidth","direction","isResizing","ratio","startHeight","startWidth","startX","startY","editorRootElement","getRootElement","maxWidthContainer","getBoundingClientRect","width","maxHeightContainer","height","minWidth","minHeight","setStartCursor","ew","ns","nwse","cursorDir","style","setProperty","concat","document","body","current","getPropertyValue","getPropertyPriority","setEndCursor","handlePointerDown","event","isEditable","image","controlWrapper","_image$getBoundingCli","positioning","clientX","clientY","classList","add","addEventListener","handlePointerMove","handlePointerUp","isHorizontal","isVertical","diff","floor","remove","removeEventListener","createElement","ref","className","onClick","onPointerDown"],"sources":["ImageResizer.tsx"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport type { LexicalEditor } from \"lexical\";\n\nimport * as React from \"react\";\nimport { useRef } from \"react\";\n\nfunction clamp(value: number, min: number, max: number) {\n return Math.min(Math.max(value, min), max);\n}\n\nconst Direction = {\n east: 1 << 0,\n north: 1 << 3,\n south: 1 << 1,\n west: 1 << 2\n};\n\nexport function ImageResizer({\n onResizeStart,\n onResizeEnd,\n buttonRef,\n imageRef,\n maxWidth,\n editor,\n showCaption,\n setShowCaption,\n captionsEnabled\n}: {\n editor: LexicalEditor;\n buttonRef: { current: null | HTMLButtonElement };\n imageRef: { current: null | HTMLElement };\n maxWidth?: number;\n onResizeEnd: (width: \"inherit\" | number, height: \"inherit\" | number) => void;\n onResizeStart: () => void;\n setShowCaption: (show: boolean) => void;\n showCaption: boolean;\n captionsEnabled: boolean;\n}): JSX.Element {\n const controlWrapperRef = useRef<HTMLDivElement>(null);\n const userSelect = useRef({\n priority: \"\",\n value: \"default\"\n });\n const positioningRef = useRef<{\n currentHeight: \"inherit\" | number;\n currentWidth: \"inherit\" | number;\n direction: number;\n isResizing: boolean;\n ratio: number;\n startHeight: number;\n startWidth: number;\n startX: number;\n startY: number;\n }>({\n currentHeight: 0,\n currentWidth: 0,\n direction: 0,\n isResizing: false,\n ratio: 0,\n startHeight: 0,\n startWidth: 0,\n startX: 0,\n startY: 0\n });\n const editorRootElement = editor.getRootElement();\n // Find max width, accounting for editor padding.\n const maxWidthContainer = maxWidth\n ? maxWidth\n : editorRootElement !== null\n ? editorRootElement.getBoundingClientRect().width - 20\n : 100;\n const maxHeightContainer =\n editorRootElement !== null ? editorRootElement.getBoundingClientRect().height - 20 : 100;\n\n const minWidth = 100;\n const minHeight = 100;\n\n const setStartCursor = (direction: number) => {\n const ew = direction === Direction.east || direction === Direction.west;\n const ns = direction === Direction.north || direction === Direction.south;\n const nwse =\n (direction & Direction.north && direction & Direction.west) ||\n (direction & Direction.south && direction & Direction.east);\n\n const cursorDir = ew ? \"ew\" : ns ? \"ns\" : nwse ? \"nwse\" : \"nesw\";\n\n if (editorRootElement !== null) {\n editorRootElement.style.setProperty(\"cursor\", `${cursorDir}-resize`, \"important\");\n }\n if (document.body !== null) {\n document.body.style.setProperty(\"cursor\", `${cursorDir}-resize`, \"important\");\n userSelect.current.value = document.body.style.getPropertyValue(\"-webkit-user-select\");\n userSelect.current.priority =\n document.body.style.getPropertyPriority(\"-webkit-user-select\");\n document.body.style.setProperty(\"-webkit-user-select\", `none`, \"important\");\n }\n };\n\n const setEndCursor = () => {\n if (editorRootElement !== null) {\n editorRootElement.style.setProperty(\"cursor\", \"text\");\n }\n if (document.body !== null) {\n document.body.style.setProperty(\"cursor\", \"default\");\n document.body.style.setProperty(\n \"-webkit-user-select\",\n userSelect.current.value,\n userSelect.current.priority\n );\n }\n };\n\n const handlePointerDown = (event: React.PointerEvent<HTMLDivElement>, direction: number) => {\n if (!editor.isEditable()) {\n return;\n }\n\n const image = imageRef.current;\n const controlWrapper = controlWrapperRef.current;\n\n if (image !== null && controlWrapper !== null) {\n const { width, height } = image.getBoundingClientRect();\n const positioning = positioningRef.current;\n positioning.startWidth = width;\n positioning.startHeight = height;\n positioning.ratio = width / height;\n positioning.currentWidth = width;\n positioning.currentHeight = height;\n positioning.startX = event.clientX;\n positioning.startY = event.clientY;\n positioning.isResizing = true;\n positioning.direction = direction;\n\n setStartCursor(direction);\n onResizeStart();\n\n controlWrapper.classList.add(\"image-control-wrapper--resizing\");\n image.style.height = `${height}px`;\n image.style.width = `${width}px`;\n\n document.addEventListener(\"pointermove\", handlePointerMove);\n document.addEventListener(\"pointerup\", handlePointerUp);\n }\n };\n const handlePointerMove = (event: PointerEvent) => {\n const image = imageRef.current;\n const positioning = positioningRef.current;\n\n const isHorizontal = positioning.direction & (Direction.east | Direction.west);\n const isVertical = positioning.direction & (Direction.south | Direction.north);\n\n if (image !== null && positioning.isResizing) {\n // Corner cursor\n if (isHorizontal && isVertical) {\n let diff = Math.floor(positioning.startX - event.clientX);\n diff = positioning.direction & Direction.east ? -diff : diff;\n\n const width = clamp(positioning.startWidth + diff, minWidth, maxWidthContainer);\n\n const height = width / positioning.ratio;\n image.style.width = `${width}px`;\n image.style.height = `${height}px`;\n positioning.currentHeight = height;\n positioning.currentWidth = width;\n } else if (isVertical) {\n let diff = Math.floor(positioning.startY - event.clientY);\n diff = positioning.direction & Direction.south ? -diff : diff;\n\n const height = clamp(positioning.startHeight + diff, minHeight, maxHeightContainer);\n\n image.style.height = `${height}px`;\n positioning.currentHeight = height;\n } else {\n let diff = Math.floor(positioning.startX - event.clientX);\n diff = positioning.direction & Direction.east ? -diff : diff;\n\n const width = clamp(positioning.startWidth + diff, minWidth, maxWidthContainer);\n\n image.style.width = `${width}px`;\n positioning.currentWidth = width;\n }\n }\n };\n const handlePointerUp = () => {\n const image = imageRef.current;\n const positioning = positioningRef.current;\n const controlWrapper = controlWrapperRef.current;\n if (image !== null && controlWrapper !== null && positioning.isResizing) {\n const width = positioning.currentWidth;\n const height = positioning.currentHeight;\n positioning.startWidth = 0;\n positioning.startHeight = 0;\n positioning.ratio = 0;\n positioning.startX = 0;\n positioning.startY = 0;\n positioning.currentWidth = 0;\n positioning.currentHeight = 0;\n positioning.isResizing = false;\n\n controlWrapper.classList.remove(\"image-control-wrapper--resizing\");\n\n setEndCursor();\n onResizeEnd(width, height);\n\n document.removeEventListener(\"pointermove\", handlePointerMove);\n document.removeEventListener(\"pointerup\", handlePointerUp);\n }\n };\n return (\n <div ref={controlWrapperRef}>\n {!showCaption && captionsEnabled && (\n <button\n className=\"image-caption-button\"\n ref={buttonRef}\n onClick={() => {\n setShowCaption(!showCaption);\n }}\n >\n Add Caption\n </button>\n )}\n <div\n className=\"image-resizer image-resizer-n\"\n onPointerDown={event => {\n handlePointerDown(event, Direction.north);\n }}\n />\n <div\n className=\"image-resizer image-resizer-ne\"\n onPointerDown={event => {\n handlePointerDown(event, Direction.north | Direction.east);\n }}\n />\n <div\n className=\"image-resizer image-resizer-e\"\n onPointerDown={event => {\n handlePointerDown(event, Direction.east);\n }}\n />\n <div\n className=\"image-resizer image-resizer-se\"\n onPointerDown={event => {\n handlePointerDown(event, Direction.south | Direction.east);\n }}\n />\n <div\n className=\"image-resizer image-resizer-s\"\n onPointerDown={event => {\n handlePointerDown(event, Direction.south);\n }}\n />\n <div\n className=\"image-resizer image-resizer-sw\"\n onPointerDown={event => {\n handlePointerDown(event, Direction.south | Direction.west);\n }}\n />\n <div\n className=\"image-resizer image-resizer-w\"\n onPointerDown={event => {\n handlePointerDown(event, Direction.west);\n }}\n />\n <div\n className=\"image-resizer image-resizer-nw\"\n onPointerDown={event => {\n handlePointerDown(event, Direction.north | Direction.west);\n }}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;AAUA,IAAAA,KAAA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AAS,EAAC,gCAAgC;IAC1CE,aAAa,EAAE,SAAAA,cAAAvB,KAAK,EAAI;MACpBD,iBAAiB,CAACC,KAAK,EAAEtD,SAAS,CAACG,KAAK,GAAGH,SAAS,CAACC,IAAI,CAAC;IAC9D;EAAE,CACL,CAAC,eACFT,KAAA,CAAAiF,aAAA;IACIE,SAAS,EAAC,+BAA+B;IACzCE,aAAa,EAAE,SAAAA,cAAAvB,KAAK,EAAI;MACpBD,iBAAiB,CAACC,KAAK,EAAEtD,SAAS,CAACG,KAAK,CAAC;IAC7C;EAAE,CACL,CAAC,eACFX,KAAA,CAAAiF,aAAA;IACIE,SAAS,EAAC,gCAAgC;IAC1CE,aAAa,EAAE,SAAAA,cAAAvB,KAAK,EAAI;MACpBD,iBAAiB,CAACC,KAAK,EAAEtD,SAAS,CAACG,KAAK,GAAGH,SAAS,CAACI,IAAI,CAAC;IAC9D;EAAE,CACL,CAAC,eACFZ,KAAA,CAAAiF,aAAA;IACIE,SAAS,EAAC,+BAA+B;IACzCE,aAAa,EAAE,SAAAA,cAAAvB,KAAK,EAAI;MACpBD,iBAAiB,CAACC,KAAK,EAAEtD,SAAS,CAACI,IAAI,CAAC;IAC5C;EAAE,CACL,CAAC,eACFZ,KAAA,CAAAiF,aAAA;IACIE,SAAS,EAAC,gCAAgC;IAC1CE,aAAa,EAAE,SAAAA,cAAAvB,KAAK,EAAI;MACpBD,iBAAiB,CAACC,KAAK,EAAEtD,SAAS,CAACE,KAAK,GAAGF,SAAS,CAACI,IAAI,CAAC;IAC9D;EAAE,CACL,CACA,CAAC;AAEd"}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","React","clamp","value","min","max","Math","Direction","east","north","south","west","ImageResizer","_ref","onResizeStart","onResizeEnd","buttonRef","imageRef","maxWidth","editor","showCaption","setShowCaption","captionsEnabled","controlWrapperRef","useRef","userSelect","priority","positioningRef","currentHeight","currentWidth","direction","isResizing","ratio","startHeight","startWidth","startX","startY","editorRootElement","getRootElement","maxWidthContainer","getBoundingClientRect","width","maxHeightContainer","height","minWidth","minHeight","setStartCursor","ew","ns","nwse","cursorDir","style","setProperty","concat","document","body","current","getPropertyValue","getPropertyPriority","setEndCursor","handlePointerDown","event","isEditable","image","controlWrapper","_image$getBoundingCli","positioning","clientX","clientY","classList","add","addEventListener","handlePointerMove","handlePointerUp","isHorizontal","isVertical","diff","floor","remove","removeEventListener","createElement","ref","className","onClick","onPointerDown"],"sources":["ImageResizer.tsx"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport type { LexicalEditor } from \"lexical\";\n\nimport * as React from \"react\";\nimport { useRef } from \"react\";\n\nfunction clamp(value: number, min: number, max: number) {\n return Math.min(Math.max(value, min), max);\n}\n\nconst Direction = {\n east: 1 << 0,\n north: 1 << 3,\n south: 1 << 1,\n west: 1 << 2\n};\n\nexport function ImageResizer({\n onResizeStart,\n onResizeEnd,\n buttonRef,\n imageRef,\n maxWidth,\n editor,\n showCaption,\n setShowCaption,\n captionsEnabled\n}: {\n editor: LexicalEditor;\n buttonRef: { current: null | HTMLButtonElement };\n imageRef: { current: null | HTMLElement };\n maxWidth?: number;\n onResizeEnd: (width: \"inherit\" | number, height: \"inherit\" | number) => void;\n onResizeStart: () => void;\n setShowCaption: (show: boolean) => void;\n showCaption: boolean;\n captionsEnabled: boolean;\n}): JSX.Element {\n const controlWrapperRef = useRef<HTMLDivElement>(null);\n const userSelect = useRef({\n priority: \"\",\n value: \"default\"\n });\n const positioningRef = useRef<{\n currentHeight: \"inherit\" | number;\n currentWidth: \"inherit\" | number;\n direction: number;\n isResizing: boolean;\n ratio: number;\n startHeight: number;\n startWidth: number;\n startX: number;\n startY: number;\n }>({\n currentHeight: 0,\n currentWidth: 0,\n direction: 0,\n isResizing: false,\n ratio: 0,\n startHeight: 0,\n startWidth: 0,\n startX: 0,\n startY: 0\n });\n const editorRootElement = editor.getRootElement();\n // Find max width, accounting for editor padding.\n const maxWidthContainer = maxWidth\n ? maxWidth\n : editorRootElement !== null\n ? editorRootElement.getBoundingClientRect().width - 20\n : 100;\n const maxHeightContainer =\n editorRootElement !== null ? editorRootElement.getBoundingClientRect().height - 20 : 100;\n\n const minWidth = 100;\n const minHeight = 100;\n\n const setStartCursor = (direction: number) => {\n const ew = direction === Direction.east || direction === Direction.west;\n const ns = direction === Direction.north || direction === Direction.south;\n const nwse =\n (direction & Direction.north && direction & Direction.west) ||\n (direction & Direction.south && direction & Direction.east);\n\n const cursorDir = ew ? \"ew\" : ns ? \"ns\" : nwse ? \"nwse\" : \"nesw\";\n\n if (editorRootElement !== null) {\n editorRootElement.style.setProperty(\"cursor\", `${cursorDir}-resize`, \"important\");\n }\n if (document.body !== null) {\n document.body.style.setProperty(\"cursor\", `${cursorDir}-resize`, \"important\");\n userSelect.current.value = document.body.style.getPropertyValue(\"-webkit-user-select\");\n userSelect.current.priority =\n document.body.style.getPropertyPriority(\"-webkit-user-select\");\n document.body.style.setProperty(\"-webkit-user-select\", `none`, \"important\");\n }\n };\n\n const setEndCursor = () => {\n if (editorRootElement !== null) {\n editorRootElement.style.setProperty(\"cursor\", \"text\");\n }\n if (document.body !== null) {\n document.body.style.setProperty(\"cursor\", \"default\");\n document.body.style.setProperty(\n \"-webkit-user-select\",\n userSelect.current.value,\n userSelect.current.priority\n );\n }\n };\n\n const handlePointerDown = (event: React.PointerEvent<HTMLDivElement>, direction: number) => {\n if (!editor.isEditable()) {\n return;\n }\n\n const image = imageRef.current;\n const controlWrapper = controlWrapperRef.current;\n\n if (image !== null && controlWrapper !== null) {\n const { width, height } = image.getBoundingClientRect();\n const positioning = positioningRef.current;\n positioning.startWidth = width;\n positioning.startHeight = height;\n positioning.ratio = width / height;\n positioning.currentWidth = width;\n positioning.currentHeight = height;\n positioning.startX = event.clientX;\n positioning.startY = event.clientY;\n positioning.isResizing = true;\n positioning.direction = direction;\n\n setStartCursor(direction);\n onResizeStart();\n\n controlWrapper.classList.add(\"image-control-wrapper--resizing\");\n image.style.height = `${height}px`;\n image.style.width = `${width}px`;\n\n document.addEventListener(\"pointermove\", handlePointerMove);\n document.addEventListener(\"pointerup\", handlePointerUp);\n }\n };\n const handlePointerMove = (event: PointerEvent) => {\n const image = imageRef.current;\n const positioning = positioningRef.current;\n\n const isHorizontal = positioning.direction & (Direction.east | Direction.west);\n const isVertical = positioning.direction & (Direction.south | Direction.north);\n\n if (image !== null && positioning.isResizing) {\n // Corner cursor\n if (isHorizontal && isVertical) {\n let diff = Math.floor(positioning.startX - event.clientX);\n diff = positioning.direction & Direction.east ? -diff : diff;\n\n const width = clamp(positioning.startWidth + diff, minWidth, maxWidthContainer);\n\n const height = width / positioning.ratio;\n image.style.width = `${width}px`;\n image.style.height = `${height}px`;\n positioning.currentHeight = height;\n positioning.currentWidth = width;\n } else if (isVertical) {\n let diff = Math.floor(positioning.startY - event.clientY);\n diff = positioning.direction & Direction.south ? -diff : diff;\n\n const height = clamp(positioning.startHeight + diff, minHeight, maxHeightContainer);\n\n image.style.height = `${height}px`;\n positioning.currentHeight = height;\n } else {\n let diff = Math.floor(positioning.startX - event.clientX);\n diff = positioning.direction & Direction.east ? -diff : diff;\n\n const width = clamp(positioning.startWidth + diff, minWidth, maxWidthContainer);\n\n image.style.width = `${width}px`;\n positioning.currentWidth = width;\n }\n }\n };\n const handlePointerUp = () => {\n const image = imageRef.current;\n const positioning = positioningRef.current;\n const controlWrapper = controlWrapperRef.current;\n if (image !== null && controlWrapper !== null && positioning.isResizing) {\n const width = positioning.currentWidth;\n const height = positioning.currentHeight;\n positioning.startWidth = 0;\n positioning.startHeight = 0;\n positioning.ratio = 0;\n positioning.startX = 0;\n positioning.startY = 0;\n positioning.currentWidth = 0;\n positioning.currentHeight = 0;\n positioning.isResizing = false;\n\n controlWrapper.classList.remove(\"image-control-wrapper--resizing\");\n\n setEndCursor();\n onResizeEnd(width, height);\n\n document.removeEventListener(\"pointermove\", handlePointerMove);\n document.removeEventListener(\"pointerup\", handlePointerUp);\n }\n };\n return (\n <div ref={controlWrapperRef}>\n {!showCaption && captionsEnabled && (\n <button\n className=\"image-caption-button\"\n ref={buttonRef}\n onClick={() => {\n setShowCaption(!showCaption);\n }}\n >\n Add Caption\n </button>\n )}\n <div\n className=\"image-resizer image-resizer-n\"\n onPointerDown={event => {\n handlePointerDown(event, Direction.north);\n }}\n />\n <div\n className=\"image-resizer image-resizer-ne\"\n onPointerDown={event => {\n handlePointerDown(event, Direction.north | Direction.east);\n }}\n />\n <div\n className=\"image-resizer image-resizer-e\"\n onPointerDown={event => {\n handlePointerDown(event, Direction.east);\n }}\n />\n <div\n className=\"image-resizer image-resizer-se\"\n onPointerDown={event => {\n handlePointerDown(event, Direction.south | Direction.east);\n }}\n />\n <div\n className=\"image-resizer image-resizer-s\"\n onPointerDown={event => {\n handlePointerDown(event, Direction.south);\n }}\n />\n <div\n className=\"image-resizer image-resizer-sw\"\n onPointerDown={event => {\n handlePointerDown(event, Direction.south | Direction.west);\n }}\n />\n <div\n className=\"image-resizer image-resizer-w\"\n onPointerDown={event => {\n handlePointerDown(event, Direction.west);\n }}\n />\n <div\n className=\"image-resizer image-resizer-nw\"\n onPointerDown={event => {\n handlePointerDown(event, Direction.north | Direction.west);\n }}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;AAUA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA+B,IAAAC,KAAA,GAAAH,MAAA;AAV/B;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA,SAASI,KAAKA,CAACC,KAAa,EAAEC,GAAW,EAAEC,GAAW,EAAE;EACpD,OAAOC,IAAI,CAACF,GAAG,CAACE,IAAI,CAACD,GAAG,CAACF,KAAK,EAAEC,GAAG,CAAC,EAAEC,GAAG,CAAC;AAC9C;AAEA,IAAME,SAAS,GAAG;EACdC,IAAI,EAAE,CAAC,IAAI,CAAC;EACZC,KAAK,EAAE,CAAC,IAAI,CAAC;EACbC,KAAK,EA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L,CAAC,eACFT,KAAA,CAAA+E,aAAA;IACIE,SAAS,EAAC,gCAAgC;IAC1CE,aAAa,EAAE,SAAAA,cAAAvB,KAAK,EAAI;MACpBD,iBAAiB,CAACC,KAAK,EAAEtD,SAAS,CAACG,KAAK,GAAGH,SAAS,CAACI,IAAI,CAAC;IAC9D;EAAE,CACL,CAAC,eACFV,KAAA,CAAA+E,aAAA;IACIE,SAAS,EAAC,+BAA+B;IACzCE,aAAa,EAAE,SAAAA,cAAAvB,KAAK,EAAI;MACpBD,iBAAiB,CAACC,KAAK,EAAEtD,SAAS,CAACI,IAAI,CAAC;IAC5C;EAAE,CACL,CAAC,eACFV,KAAA,CAAA+E,aAAA;IACIE,SAAS,EAAC,gCAAgC;IAC1CE,aAAa,EAAE,SAAAA,cAAAvB,KAAK,EAAI;MACpBD,iBAAiB,CAACC,KAAK,EAAEtD,SAAS,CAACE,KAAK,GAAGF,SAAS,CAACI,IAAI,CAAC;IAC9D;EAAE,CACL,CACA,CAAC;AAEd","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["require","React","_interopRequireWildcard","Placeholder","_ref","children","className","styles","createElement","style","_objectSpread2","default"],"sources":["Placeholder.tsx"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport \"./Placeholder.css\";\n\nimport * as React from \"react\";\nimport { ReactNode } from \"react\";\n\nexport function Placeholder({\n children,\n className,\n styles\n}: {\n children: ReactNode;\n className?: string;\n styles?: React.CSSProperties;\n}): JSX.Element {\n return (\n <div style={{ ...styles }} className={className || \"Placeholder__root\"}>\n {children}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAQAA,OAAA;AAEA,IAAAC,KAAA,GAAAC,uBAAA,CAAAF,OAAA;AAVA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOO,SAASG,WAAWA,CAAAC,IAAA,EAQX;EAAA,IAPZC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,SAAS,GAAAF,IAAA,CAATE,SAAS;IACTC,MAAM,GAAAH,IAAA,CAANG,MAAM;EAMN,oBACIN,KAAA,CAAAO,aAAA;IAAKC,KAAK,MAAAC,cAAA,CAAAC,OAAA,MAAOJ,MAAM,CAAG;IAACD,SAAS,EAAEA,SAAS,IAAI;EAAoB,GAClED,QACA,CAAC;AAEd"}
1
+ {"version":3,"names":["require","React","_interopRequireWildcard","Placeholder","_ref","children","className","styles","createElement","style","_objectSpread2","default"],"sources":["Placeholder.tsx"],"sourcesContent":["/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n */\n\nimport \"./Placeholder.css\";\n\nimport * as React from \"react\";\nimport { ReactNode } from \"react\";\n\nexport function Placeholder({\n children,\n className,\n styles\n}: {\n children: ReactNode;\n className?: string;\n styles?: React.CSSProperties;\n}): JSX.Element {\n return (\n <div style={{ ...styles }} className={className || \"Placeholder__root\"}>\n {children}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAQAA,OAAA;AAEA,IAAAC,KAAA,GAAAC,uBAAA,CAAAF,OAAA;AAVA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOO,SAASG,WAAWA,CAAAC,IAAA,EAQX;EAAA,IAPZC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,SAAS,GAAAF,IAAA,CAATE,SAAS;IACTC,MAAM,GAAAH,IAAA,CAANG,MAAM;EAMN,oBACIN,KAAA,CAAAO,aAAA;IAAKC,KAAK,MAAAC,cAAA,CAAAC,OAAA,MAAOJ,MAAM,CAAG;IAACD,SAAS,EAAEA,SAAS,IAAI;EAAoB,GAClED,QACA,CAAC;AAEd","ignoreList":[]}
@@ -5,12 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.useSharedHistoryContext = exports.SharedHistoryContext = void 0;
8
- var React = _interopRequireWildcard(require("react"));
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var React = _react;
9
10
  var _history = require("@lexical/history");
10
- var Context = /*#__PURE__*/(0, React.createContext)({});
11
- var SharedHistoryContext = function SharedHistoryContext(_ref) {
11
+ var Context = /*#__PURE__*/(0, _react.createContext)({});
12
+ var SharedHistoryContext = exports.SharedHistoryContext = function SharedHistoryContext(_ref) {
12
13
  var children = _ref.children;
13
- var historyContext = (0, React.useMemo)(function () {
14
+ var historyContext = (0, _react.useMemo)(function () {
14
15
  return {
15
16
  historyState: (0, _history.createEmptyHistoryState)()
16
17
  };
@@ -19,10 +20,8 @@ var SharedHistoryContext = function SharedHistoryContext(_ref) {
19
20
  value: historyContext
20
21
  }, children);
21
22
  };
22
- exports.SharedHistoryContext = SharedHistoryContext;
23
- var useSharedHistoryContext = function useSharedHistoryContext() {
24
- return (0, React.useContext)(Context);
23
+ var useSharedHistoryContext = exports.useSharedHistoryContext = function useSharedHistoryContext() {
24
+ return (0, _react.useContext)(Context);
25
25
  };
26
- exports.useSharedHistoryContext = useSharedHistoryContext;
27
26
 
28
27
  //# sourceMappingURL=SharedHistoryContext.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","_interopRequireWildcard","require","_history","Context","createContext","SharedHistoryContext","_ref","children","historyContext","useMemo","historyState","createEmptyHistoryState","createElement","Provider","value","exports","useSharedHistoryContext","useContext"],"sources":["SharedHistoryContext.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { createContext, ReactNode, useContext, useMemo } from \"react\";\nimport { createEmptyHistoryState, HistoryState } from \"@lexical/history\";\n\ntype ContextShape = {\n historyState?: HistoryState;\n};\n\nconst Context: React.Context<ContextShape> = createContext({});\n\nexport const SharedHistoryContext = ({ children }: { children: ReactNode }): JSX.Element => {\n const historyContext = useMemo(() => ({ historyState: createEmptyHistoryState() }), []);\n return <Context.Provider value={historyContext}>{children}</Context.Provider>;\n};\n\nexport const useSharedHistoryContext = (): ContextShape => {\n return useContext(Context);\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AAMA,IAAME,OAAoC,gBAAG,IAAAC,mBAAa,EAAC,CAAC,CAAC,CAAC;AAEvD,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAAC,IAAA,EAA2D;EAAA,IAArDC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;EAC3C,IAAMC,cAAc,GAAG,IAAAC,aAAO,EAAC;IAAA,OAAO;MAAEC,YAAY,EAAE,IAAAC,gCAAuB,EAAC;IAAE,CAAC;EAAA,CAAC,EAAE,EAAE,CAAC;EACvF,oBAAOZ,KAAA,CAAAa,aAAA,CAACT,OAAO,CAACU,QAAQ;IAACC,KAAK,EAAEN;EAAe,GAAED,QAA2B,CAAC;AACjF,CAAC;AAACQ,OAAA,CAAAV,oBAAA,GAAAA,oBAAA;AAEK,IAAMW,uBAAuB,GAAG,SAA1BA,uBAAuBA,CAAA,EAAuB;EACvD,OAAO,IAAAC,gBAAU,EAACd,OAAO,CAAC;AAC9B,CAAC;AAACY,OAAA,CAAAC,uBAAA,GAAAA,uBAAA"}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","React","_history","Context","createContext","SharedHistoryContext","exports","_ref","children","historyContext","useMemo","historyState","createEmptyHistoryState","createElement","Provider","value","useSharedHistoryContext","useContext"],"sources":["SharedHistoryContext.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { createContext, ReactNode, useContext, useMemo } from \"react\";\nimport { createEmptyHistoryState, HistoryState } from \"@lexical/history\";\n\ntype ContextShape = {\n historyState?: HistoryState;\n};\n\nconst Context: React.Context<ContextShape> = createContext({});\n\nexport const SharedHistoryContext = ({ children }: { children: ReactNode }): JSX.Element => {\n const historyContext = useMemo(() => ({ historyState: createEmptyHistoryState() }), []);\n return <Context.Provider value={historyContext}>{children}</Context.Provider>;\n};\n\nexport const useSharedHistoryContext = (): ContextShape => {\n return useContext(Context);\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA+B,IAAAC,KAAA,GAAAH,MAAA;AAE/B,IAAAI,QAAA,GAAAF,OAAA;AAMA,IAAMG,OAAoC,gBAAG,IAAAC,oBAAa,EAAC,CAAC,CAAC,CAAC;AAEvD,IAAMC,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAG,SAAvBA,oBAAoBA,CAAAE,IAAA,EAA2D;EAAA,IAArDC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;EAC3C,IAAMC,cAAc,GAAG,IAAAC,cAAO,EAAC;IAAA,OAAO;MAAEC,YAAY,EAAE,IAAAC,gCAAuB,EAAC;IAAE,CAAC;EAAA,CAAC,EAAE,EAAE,CAAC;EACvF,oBAAOX,KAAA,CAAAY,aAAA,CAACV,OAAO,CAACW,QAAQ;IAACC,KAAK,EAAEN;EAAe,GAAED,QAA2B,CAAC;AACjF,CAAC;AAEM,IAAMQ,uBAAuB,GAAAV,OAAA,CAAAU,uBAAA,GAAG,SAA1BA,uBAAuBA,CAAA,EAAuB;EACvD,OAAO,IAAAC,iBAAU,EAACd,OAAO,CAAC;AAC9B,CAAC","ignoreList":[]}
package/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export * from "./utils/formatToQuote";
14
14
  export * from "./utils/formatToHeading";
15
15
  export * from "./utils/formatToParagraph";
16
16
  export * from "./utils/clearNodeFormating";
17
+ export * from "./utils/toggleLink";
17
18
  export declare const allNodes: ReadonlyArray<Klass<LexicalNode> | {
18
19
  replace: Klass<LexicalNode>;
19
20
  with: <T extends {
package/index.js CHANGED
@@ -193,8 +193,20 @@ Object.keys(_clearNodeFormating).forEach(function (key) {
193
193
  }
194
194
  });
195
195
  });
196
+ var _toggleLink = require("./utils/toggleLink");
197
+ Object.keys(_toggleLink).forEach(function (key) {
198
+ if (key === "default" || key === "__esModule") return;
199
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
200
+ if (key in exports && exports[key] === _toggleLink[key]) return;
201
+ Object.defineProperty(exports, key, {
202
+ enumerable: true,
203
+ get: function get() {
204
+ return _toggleLink[key];
205
+ }
206
+ });
207
+ });
196
208
  // This is a list of all the nodes that our Lexical implementation supports OOTB.
197
- var allNodes = [
209
+ var allNodes = exports.allNodes = [
198
210
  // These nodes are copy-pasted from Lexical and modified to fit our needs.
199
211
  // https://github.com/facebook/lexical/tree/main/packages/lexical-playground/src/nodes
200
212
  // https://github.com/facebook/lexical/tree/main/packages
@@ -221,6 +233,5 @@ _ParagraphNode.ParagraphNode, {
221
233
  return new _QuoteNode.QuoteNode();
222
234
  }
223
235
  }, _LinkNode.LinkNode];
224
- exports.allNodes = allNodes;
225
236
 
226
237
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_lexical","require","_code","_hashtag","_mark","_richText","_overflow","_LinkNode","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_FontColorNode","_TypographyNode","_ListNode","_ListItemNode","_HeadingNode","_ParagraphNode","_QuoteNode","_ImageNode","_formatList","_listNode","_formatToQuote","_formatToHeading","_formatToParagraph","_clearNodeFormating","allNodes","ImageNode","ListNode","ListItemNode","CodeNode","HashtagNode","CodeHighlightNode","AutoLinkNode","OverflowNode","MarkNode","FontColorNode","TypographyNode","ParagraphNode","replace","BaseParagraphNode","with","_with","HeadingNode","BaseHeadingNode","node","getTag","QuoteNode","BaseQuoteNode","LinkNode"],"sources":["index.ts"],"sourcesContent":["import type { Klass, LexicalNode } from \"lexical\";\nimport { ParagraphNode as BaseParagraphNode } from \"lexical\";\nimport { CodeHighlightNode, CodeNode } from \"@lexical/code\";\nimport { HashtagNode } from \"@lexical/hashtag\";\nimport { MarkNode } from \"@lexical/mark\";\nimport { HeadingNode as BaseHeadingNode, QuoteNode as BaseQuoteNode } from \"@lexical/rich-text\";\nimport { OverflowNode } from \"@lexical/overflow\";\n\nimport { AutoLinkNode, LinkNode } from \"./LinkNode\";\nimport { FontColorNode } from \"./FontColorNode\";\nimport { TypographyNode } from \"./TypographyNode\";\nimport { ListNode } from \"./ListNode\";\nimport { ListItemNode } from \"./ListItemNode\";\nimport { HeadingNode } from \"./HeadingNode\";\nimport { ParagraphNode } from \"./ParagraphNode\";\nimport { QuoteNode } from \"./QuoteNode\";\nimport { ImageNode } from \"./ImageNode\";\n\nexport * from \"./FontColorNode\";\nexport * from \"./TypographyNode\";\nexport * from \"./ListNode\";\nexport * from \"./ListItemNode\";\nexport * from \"./HeadingNode\";\nexport * from \"./ParagraphNode\";\nexport * from \"./QuoteNode\";\nexport * from \"./ImageNode\";\nexport * from \"./LinkNode\";\n\nexport * from \"./utils/formatList\";\nexport * from \"./utils/listNode\";\nexport * from \"./utils/formatToQuote\";\nexport * from \"./utils/formatToHeading\";\nexport * from \"./utils/formatToParagraph\";\nexport * from \"./utils/clearNodeFormating\";\n\n// This is a list of all the nodes that our Lexical implementation supports OOTB.\nexport const allNodes: ReadonlyArray<\n | Klass<LexicalNode>\n | {\n replace: Klass<LexicalNode>;\n with: <T extends { new (...args: any): any }>(node: InstanceType<T>) => LexicalNode;\n }\n> = [\n // These nodes are copy-pasted from Lexical and modified to fit our needs.\n // https://github.com/facebook/lexical/tree/main/packages/lexical-playground/src/nodes\n // https://github.com/facebook/lexical/tree/main/packages\n ImageNode,\n ListNode,\n ListItemNode,\n\n // These nodes are directly imported from Lexical.\n CodeNode,\n HashtagNode,\n CodeHighlightNode,\n AutoLinkNode,\n OverflowNode,\n MarkNode,\n\n // Our custom nodes.\n FontColorNode,\n TypographyNode,\n\n // The following code replaces the built-in Lexical nodes with our custom ones.\n // https://lexical.dev/docs/concepts/node-replacement\n ParagraphNode,\n {\n replace: BaseParagraphNode,\n with: () => {\n return new ParagraphNode();\n }\n },\n HeadingNode,\n {\n replace: BaseHeadingNode,\n with: (node: BaseHeadingNode) => {\n return new HeadingNode(node.getTag());\n }\n },\n QuoteN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;EAC9B;AACJ,CAAC,EACDK,wBAAW,EACX;EACIJ,OAAO,EAAEK,qBAAe;EACxBH,IAAI,EAAE,SAAAC,MAACG,IAAqB,EAAK;IAC7B,OAAO,IAAIF,wBAAW,CAACE,IAAI,CAACC,MAAM,CAAC,CAAC,CAAC;EACzC;AACJ,CAAC,EACDC,oBAAS,EACT;EACIR,OAAO,EAAES,mBAAa;EACtBP,IAAI,EAAE,SAAAC,MAAA,EAAM;IACR,OAAO,IAAIK,oBAAS,CAAC,CAAC;EAC1B;AACJ,CAAC,EACDE,kBAAQ,CACX;AAACzC,OAAA,CAAAkB,QAAA,GAAAA,QAAA"}
1
+ {"version":3,"names":["_lexical","require","_code","_hashtag","_mark","_richText","_overflow","_LinkNode","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_FontColorNode","_TypographyNode","_ListNode","_ListItemNode","_HeadingNode","_ParagraphNode","_QuoteNode","_ImageNode","_formatList","_listNode","_formatToQuote","_formatToHeading","_formatToParagraph","_clearNodeFormating","_toggleLink","allNodes","ImageNode","ListNode","ListItemNode","CodeNode","HashtagNode","CodeHighlightNode","AutoLinkNode","OverflowNode","MarkNode","FontColorNode","TypographyNode","ParagraphNode","replace","BaseParagraphNode","with","_with","HeadingNode","BaseHeadingNode","node","getTag","QuoteNode","BaseQuoteNode","LinkNode"],"sources":["index.ts"],"sourcesContent":["import type { Klass, LexicalNode } from \"lexical\";\nimport { ParagraphNode as BaseParagraphNode } from \"lexical\";\nimport { CodeHighlightNode, CodeNode } from \"@lexical/code\";\nimport { HashtagNode } from \"@lexical/hashtag\";\nimport { MarkNode } from \"@lexical/mark\";\nimport { HeadingNode as BaseHeadingNode, QuoteNode as BaseQuoteNode } from \"@lexical/rich-text\";\nimport { OverflowNode } from \"@lexical/overflow\";\n\nimport { AutoLinkNode, LinkNode } from \"./LinkNode\";\nimport { FontColorNode } from \"./FontColorNode\";\nimport { TypographyNode } from \"./TypographyNode\";\nimport { ListNode } from \"./ListNode\";\nimport { ListItemNode } from \"./ListItemNode\";\nimport { HeadingNode } from \"./HeadingNode\";\nimport { ParagraphNode } from \"./ParagraphNode\";\nimport { QuoteNode } from \"./QuoteNode\";\nimport { ImageNode } from \"./ImageNode\";\n\nexport * from \"./FontColorNode\";\nexport * from \"./TypographyNode\";\nexport * from \"./ListNode\";\nexport * from \"./ListItemNode\";\nexport * from \"./HeadingNode\";\nexport * from \"./ParagraphNode\";\nexport * from \"./QuoteNode\";\nexport * from \"./ImageNode\";\nexport * from \"./LinkNode\";\n\nexport * from \"./utils/formatList\";\nexport * from \"./utils/listNode\";\nexport * from \"./utils/formatToQuote\";\nexport * from \"./utils/formatToHeading\";\nexport * from \"./utils/formatToParagraph\";\nexport * from \"./utils/clearNodeFormating\";\nexport * from \"./utils/toggleLink\";\n\n// This is a list of all the nodes that our Lexical implementation supports OOTB.\nexport const allNodes: ReadonlyArray<\n | Klass<LexicalNode>\n | {\n replace: Klass<LexicalNode>;\n with: <T extends { new (...args: any): any }>(node: InstanceType<T>) => LexicalNode;\n }\n> = [\n // These nodes are copy-pasted from Lexical and modified to fit our needs.\n // https://github.com/facebook/lexical/tree/main/packages/lexical-playground/src/nodes\n // https://github.com/facebook/lexical/tree/main/packages\n ImageNode,\n ListNode,\n ListItemNode,\n\n // These nodes are directly imported from Lexical.\n CodeNode,\n HashtagNode,\n CodeHighlightNode,\n AutoLinkNode,\n OverflowNode,\n MarkNode,\n\n // Our custom nodes.\n FontColorNode,\n TypographyNode,\n\n // The following code replaces the built-in Lexical nodes with our custom ones.\n // https://lexical.dev/docs/concepts/node-replacement\n ParagraphNode,\n {\n replace: BaseParagraphNode,\n with: () => {\n return new ParagraphNode();\n }\n },\n HeadingNode,\n {\n replace: BaseHeadingNode,\n with: (node: BaseHeadingNode) => {\n return new HeadingNode(node.getTag());\n }\n },\n QuoteNode,\n {\n replace: BaseQuoteNode,\n with: () => {\n return new QuoteNode();\n }\n },\n LinkNode\n];\n"],"mappings":";;;;;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AAAvB,GAAA;IAAA;EAAA;AAAA;AAEA;AACO,IAAMwB,QAMZ,GAAAnB,OAAA,CAAAmB,QAAA,GAAG;AACA;AACA;AACA;AACAC,oBAAS,EACTC,kBAAQ,EACRC,0BAAY;AAEZ;AACAC,cAAQ,EACRC,oBAAW,EACXC,uBAAiB,EACjBC,sBAAY,EACZC,sBAAY,EACZC,cAAQ;AAER;AACAC,4BAAa,EACbC,8BAAc;AAEd;AACA;AACAC,4BAAa,EACb;EACIC,OAAO,EAAEC,sBAAiB;EAC1BC,IAAI,EAAE,SAAAC,MAAA,EAAM;IACR,OAAO,IAAIJ,4BAAa,CAAC,CAAC;EAC9B;AACJ,CAAC,EACDK,wBAAW,EACX;EACIJ,OAAO,EAAEK,qBAAe;EACxBH,IAAI,EAAE,SAAAC,MAACG,IAAqB,EAAK;IAC7B,OAAO,IAAIF,wBAAW,CAACE,IAAI,CAACC,MAAM,CAAC,CAAC,CAAC;EACzC;AACJ,CAAC,EACDC,oBAAS,EACT;EACIR,OAAO,EAAES,mBAAa;EACtBP,IAAI,EAAE,SAAAC,MAAA,EAAM;IACR,OAAO,IAAIK,oBAAS,CAAC,CAAC;EAC1B;AACJ,CAAC,EACDE,kBAAQ,CACX","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/lexical-nodes",
3
- "version": "5.40.0-beta.1",
3
+ "version": "5.40.0-beta.3",
4
4
  "dependencies": {
5
5
  "@lexical/code": "0.12.2",
6
6
  "@lexical/hashtag": "0.12.2",
@@ -12,13 +12,13 @@
12
12
  "@lexical/rich-text": "0.12.2",
13
13
  "@lexical/selection": "0.12.2",
14
14
  "@lexical/utils": "0.12.2",
15
- "@webiny/lexical-theme": "5.40.0-beta.1",
15
+ "@webiny/lexical-theme": "5.40.0-beta.3",
16
16
  "lexical": "0.12.2"
17
17
  },
18
18
  "devDependencies": {
19
- "@webiny/cli": "5.40.0-beta.1",
20
- "@webiny/project-utils": "5.40.0-beta.1",
21
- "react": "17.0.2"
19
+ "@webiny/cli": "5.40.0-beta.3",
20
+ "@webiny/project-utils": "5.40.0-beta.3",
21
+ "react": "18.2.0"
22
22
  },
23
23
  "publishConfig": {
24
24
  "access": "public",
@@ -28,5 +28,5 @@
28
28
  "build": "yarn webiny run build",
29
29
  "watch": "yarn webiny run watch"
30
30
  },
31
- "gitHead": "cadaa7aa80ddff01df7ecb3b356f2be9432e14e0"
31
+ "gitHead": "638d8b84063906cd1aa979ed6e0487ad26fbcf2f"
32
32
  }
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["export type ThemeStyleType = \"typography\" | \"colors\" | \"fonts\";\n\nexport interface ThemeStyleValue {\n styleId: string;\n type: ThemeStyleType;\n}\n\nexport interface TextNodeThemeStyles {\n getThemeStyles: () => ThemeStyleValue[];\n setThemeStyles: (styles: ThemeStyleValue[]) => void;\n}\n\n/*\n * Indicates that the node is implementing the typography styles\n */\nexport interface TypographyStylesNode {\n setTypography: (typographyStyleId: string) => void;\n getTypographyStyleId: () => string | undefined;\n clearTypographyStyle: () => void;\n hasTypographyStyle: () => boolean;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["export type ThemeStyleType = \"typography\" | \"colors\" | \"fonts\";\n\nexport interface ThemeStyleValue {\n styleId: string;\n type: ThemeStyleType;\n}\n\nexport interface TextNodeThemeStyles {\n getThemeStyles: () => ThemeStyleValue[];\n setThemeStyles: (styles: ThemeStyleValue[]) => void;\n}\n\n/*\n * Indicates that the node is implementing the typography styles\n */\nexport interface TypographyStylesNode {\n setTypography: (typographyStyleId: string) => void;\n getTypographyStyleId: () => string | undefined;\n clearTypographyStyle: () => void;\n hasTypographyStyle: () => boolean;\n}\n"],"mappings":"","ignoreList":[]}
@@ -8,7 +8,7 @@ var _lexical = require("lexical");
8
8
  var _selection = require("@lexical/selection");
9
9
  var _utils = require("@lexical/utils");
10
10
  var _LexicalDecoratorBlockNode = require("@lexical/react/LexicalDecoratorBlockNode");
11
- var clearNodeFormatting = function clearNodeFormatting(activeEditor, selection) {
11
+ var clearNodeFormatting = exports.clearNodeFormatting = function clearNodeFormatting(activeEditor, selection) {
12
12
  activeEditor.update(function () {
13
13
  if ((0, _lexical.$isRangeSelection)(selection)) {
14
14
  (0, _selection.$selectAll)(selection);
@@ -25,6 +25,5 @@ var clearNodeFormatting = function clearNodeFormatting(activeEditor, selection)
25
25
  }
26
26
  });
27
27
  };
28
- exports.clearNodeFormatting = clearNodeFormatting;
29
28
 
30
29
  //# sourceMappingURL=clearNodeFormating.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_lexical","require","_selection","_utils","_LexicalDecoratorBlockNode","clearNodeFormatting","activeEditor","selection","update","$isRangeSelection","$selectAll","getNodes","forEach","node","$isTextNode","setFormat","setStyle","$getNearestBlockElementAncestorOrThrow","$isDecoratorBlockNode","exports"],"sources":["clearNodeFormating.ts"],"sourcesContent":["import {\n $isRangeSelection,\n $isTextNode,\n GridSelection,\n LexicalEditor,\n NodeSelection,\n RangeSelection\n} from \"lexical\";\nimport { $selectAll } from \"@lexical/selection\";\nimport { $getNearestBlockElementAncestorOrThrow } from \"@lexical/utils\";\nimport { $isDecoratorBlockNode } from \"@lexical/react/LexicalDecoratorBlockNode\";\n\nexport const clearNodeFormatting = (\n activeEditor: LexicalEditor,\n selection: RangeSelection | NodeSelection | GridSelection | null\n) => {\n activeEditor.update(() => {\n if ($isRangeSelection(selection)) {\n $selectAll(selection);\n selection.getNodes().forEach(node => {\n if ($isTextNode(node)) {\n node.setFormat(0);\n node.setStyle(\"\");\n $getNearestBlockElementAncestorOrThrow(node).setFormat(\"\");\n }\n if ($isDecoratorBlockNode(node)) {\n node.setFormat(\"\");\n }\n });\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAQA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,0BAAA,GAAAH,OAAA;AAEO,IAAMI,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAC5BC,YAA2B,EAC3BC,SAAgE,EAC/D;EACDD,YAAY,CAACE,MAAM,CAAC,YAAM;IACtB,IAAI,IAAAC,0BAAiB,EAACF,SAAS,CAAC,EAAE;MAC9B,IAAAG,qBAAU,EAACH,SAAS,CAAC;MACrBA,SAAS,CAACI,QAAQ,CAAC,CAAC,CAACC,OAAO,CAAC,UAAAC,IAAI,EAAI;QACjC,IAAI,IAAAC,oBAAW,EAACD,IAAI,CAAC,EAAE;UACnBA,IAAI,CAACE,SAAS,CAAC,CAAC,CAAC;UACjBF,IAAI,CAACG,QAAQ,CAAC,EAAE,CAAC;UACjB,IAAAC,6CAAsC,EAACJ,IAAI,CAAC,CAACE,SAAS,CAAC,EAAE,CAAC;QAC9D;QACA,IAAI,IAAAG,gDAAqB,EAACL,IAAI,CAAC,EAAE;UAC7BA,IAAI,CAACE,SAAS,CAAC,EAAE,CAAC;QACtB;MACJ,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;AACN,CAAC;AAACI,OAAA,CAAAd,mBAAA,GAAAA,mBAAA"}
1
+ {"version":3,"names":["_lexical","require","_selection","_utils","_LexicalDecoratorBlockNode","clearNodeFormatting","exports","activeEditor","selection","update","$isRangeSelection","$selectAll","getNodes","forEach","node","$isTextNode","setFormat","setStyle","$getNearestBlockElementAncestorOrThrow","$isDecoratorBlockNode"],"sources":["clearNodeFormating.ts"],"sourcesContent":["import {\n $isRangeSelection,\n $isTextNode,\n GridSelection,\n LexicalEditor,\n NodeSelection,\n RangeSelection\n} from \"lexical\";\nimport { $selectAll } from \"@lexical/selection\";\nimport { $getNearestBlockElementAncestorOrThrow } from \"@lexical/utils\";\nimport { $isDecoratorBlockNode } from \"@lexical/react/LexicalDecoratorBlockNode\";\n\nexport const clearNodeFormatting = (\n activeEditor: LexicalEditor,\n selection: RangeSelection | NodeSelection | GridSelection | null\n) => {\n activeEditor.update(() => {\n if ($isRangeSelection(selection)) {\n $selectAll(selection);\n selection.getNodes().forEach(node => {\n if ($isTextNode(node)) {\n node.setFormat(0);\n node.setStyle(\"\");\n $getNearestBlockElementAncestorOrThrow(node).setFormat(\"\");\n }\n if ($isDecoratorBlockNode(node)) {\n node.setFormat(\"\");\n }\n });\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAQA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,0BAAA,GAAAH,OAAA;AAEO,IAAMI,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG,SAAtBA,mBAAmBA,CAC5BE,YAA2B,EAC3BC,SAAgE,EAC/D;EACDD,YAAY,CAACE,MAAM,CAAC,YAAM;IACtB,IAAI,IAAAC,0BAAiB,EAACF,SAAS,CAAC,EAAE;MAC9B,IAAAG,qBAAU,EAACH,SAAS,CAAC;MACrBA,SAAS,CAACI,QAAQ,CAAC,CAAC,CAACC,OAAO,CAAC,UAAAC,IAAI,EAAI;QACjC,IAAI,IAAAC,oBAAW,EAACD,IAAI,CAAC,EAAE;UACnBA,IAAI,CAACE,SAAS,CAAC,CAAC,CAAC;UACjBF,IAAI,CAACG,QAAQ,CAAC,EAAE,CAAC;UACjB,IAAAC,6CAAsC,EAACJ,IAAI,CAAC,CAACE,SAAS,CAAC,EAAE,CAAC;QAC9D;QACA,IAAI,IAAAG,gDAAqB,EAACL,IAAI,CAAC,EAAE;UAC7BA,IAAI,CAACE,SAAS,CAAC,EAAE,CAAC;QACtB;MACJ,CAAC,CAAC;IACN;EACJ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_lexical","require","_ListNode","_utils","_ListItemNode","_ParagraphNode","_listNode","DEFAULT_LIST_START_NUMBER","$isSelectingEmptyListItem","anchorNode","nodes","$isListItemNode","length","is","getChildrenSize","$getListItemValue","listItem","list","getParent","value","$isListNode","console","log","getStart","siblings","getPreviousSiblings","i","sibling","getFirstChild","insertList","editor","listType","styleId","update","selection","$getSelection","$isRangeSelection","DEPRECATED_$isGridSelection","getNodes","anchor","getNode","anchorNodeParent","$createListNode","$isRootOrShadowRoot","replace","$createListItemNode","$isElementNode","setFormat","getFormatType","setIndent","getIndent","append","parent","getParentOrThrow","getChildren","handled","Set","node","isEmpty","has","getKey","createListOrMerge","$isLeafNode","parentKey","newListNode","updateChildrenListItemValue","add","nextParent","nodesToAppend","splice","previousSibling","getPreviousSibling","nextSibling","getNextSibling","getListType","remove","getFirstChildOrThrow","insertBefore","mergeLists","list1","list2","listItem1","getLastChild","listItem2","isNestedListNode","toMerge","apply","_toConsumableArray2","default","removeList","listNodes","$getTopListNode","listItemNode","$getNearestNodeOfType","ListItemNode","_iterator","_createForOfIteratorHelper2","_step","s","n","done","listNode","insertionPoint","listItems","$getAllListItems","_iterator2","_step2","paragraph","$createParagraphNode","insertAfter","__key","key","set","focus","err","e","f","children","childrenOrExisting","undefined","child","prevValue","getValue","nextValue","setValue","$handleIndent","WebinyListItemNodes","removed","forEach","WebinyListItemNode","innerList","nextInnerList","firstChild","newListItem","newList","getStyleId","$handleOutdent","parentList","grandparentListItem","greatGrandparentList","lastChild","themeStyleId","previousSiblingsListItem","previousSiblingsList","nextSiblingsListItem","nextSiblingsList","getNextSiblings","maybeIndentOrOutdent","direction","selectedNodes","webinyListItemNodes","push","nearestWebinyListItemNode","findNearestListItemNode","getUniqueListItemNodes","indentList","outdentList","$handleListInsertParagraph","isCollapsed","getTextContent","topListNode","grandparent","replacementNode","select","nextSiblings","$isParagraphNode","$removeHighestEmptyListParent"],"sources":["formatList.ts"],"sourcesContent":["import {\n $getSelection,\n $isElementNode,\n $isLeafNode,\n $isParagraphNode,\n $isRangeSelection,\n $isRootOrShadowRoot,\n DEPRECATED_$isGridSelection,\n ElementNode,\n LexicalEditor,\n LexicalNode,\n NodeKey\n} from \"lexical\";\nimport { $createListNode, $isListNode, ListNode } from \"~/ListNode\";\nimport { $getNearestNodeOfType } from \"@lexical/utils\";\nimport { $createListItemNode, $isListItemNode, ListItemNode } from \"~/ListItemNode\";\nimport { ListType } from \"@lexical/list\";\nimport { $createParagraphNode, ParagraphNode } from \"~/ParagraphNode\";\nimport {\n $getAllListItems,\n $getTopListNode,\n $removeHighestEmptyListParent,\n findNearestListItemNode,\n getUniqueListItemNodes,\n isNestedListNode\n} from \"~/utils/listNode\";\n\nconst DEFAULT_LIST_START_NUMBER = 1;\n\nfunction $isSelectingEmptyListItem(\n anchorNode: ListItemNode | LexicalNode,\n nodes: Array<LexicalNode>\n): boolean {\n return (\n $isListItemNode(anchorNode) &&\n (nodes.length === 0 ||\n (nodes.length === 1 && anchorNode.is(nodes[0]) && anchorNode.getChildrenSize() === 0))\n );\n}\n\nfunction $getListItemValue(listItem: ListItemNode): number {\n const list = listItem.getParent();\n\n let value = 1;\n\n if (list !== null) {\n if (!$isListNode(list)) {\n console.log(\n \"$getListItemValue: webiny list node is not parent of webiny list item node\"\n );\n return DEFAULT_LIST_START_NUMBER;\n } else {\n value = list.getStart();\n }\n }\n\n const siblings = listItem.getPreviousSiblings();\n for (let i = 0; i < siblings.length; i++) {\n const sibling = siblings[i];\n\n if ($isListItemNode(sibling) && !$isListNode(sibling.getFirstChild())) {\n value++;\n }\n }\n return value;\n}\n\nexport function insertList(editor: LexicalEditor, listType: ListType, styleId?: string): void {\n editor.update(() => {\n const selection = $getSelection();\n\n if ($isRangeSelection(selection) || DEPRECATED_$isGridSelection(selection)) {\n const nodes = selection.getNodes();\n const anchor = selection.anchor;\n const anchorNode = anchor.getNode();\n const anchorNodeParent = anchorNode.getParent();\n\n if ($isSelectingEmptyListItem(anchorNode, nodes)) {\n const list = $createListNode(listType, styleId);\n\n if ($isRootOrShadowRoot(anchorNodeParent)) {\n anchorNode.replace(list);\n const listItem = $createListItemNode();\n if ($isElementNode(anchorNode)) {\n listItem.setFormat(anchorNode.getFormatType());\n listItem.setIndent(anchorNode.getIndent());\n }\n list.append(listItem);\n } else if ($isListItemNode(anchorNode)) {\n const parent = anchorNode.getParentOrThrow();\n append(list, parent.getChildren());\n parent.replace(list);\n }\n\n return;\n } else {\n const handled = new Set();\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n\n if ($isElementNode(node) && node.isEmpty() && !handled.has(node.getKey())) {\n createListOrMerge(node, listType, styleId);\n continue;\n }\n\n if ($isLeafNode(node)) {\n let parent = node.getParent();\n while (parent != null) {\n const parentKey = parent.getKey();\n\n if ($isListNode(parent)) {\n if (!handled.has(parentKey)) {\n const newListNode = $createListNode(listType, styleId);\n append(newListNode, parent.getChildren());\n parent.replace(newListNode);\n updateChildrenListItemValue(newListNode);\n handled.add(parentKey);\n }\n\n break;\n } else {\n const nextParent = parent.getParent();\n\n if ($isRootOrShadowRoot(nextParent) && !handled.has(parentKey)) {\n handled.add(parentKey);\n createListOrMerge(parent, listType, styleId);\n break;\n }\n\n parent = nextParent;\n }\n }\n }\n }\n }\n }\n });\n}\n\nfunction append(node: ElementNode, nodesToAppend: Array<LexicalNode>) {\n node.splice(node.getChildrenSize(), 0, nodesToAppend);\n}\n\nfunction createListOrMerge(node: ElementNode, listType: ListType, styleId?: string): ListNode {\n if ($isListNode(node)) {\n return node;\n }\n\n const previousSibling = node.getPreviousSibling();\n const nextSibling = node.getNextSibling();\n const listItem = $createListItemNode();\n listItem.setFormat(node.getFormatType());\n listItem.setIndent(node.getIndent());\n append(listItem, node.getChildren());\n\n if ($isListNode(previousSibling) && listType === previousSibling.getListType()) {\n previousSibling.append(listItem);\n node.remove();\n // if the same type of list is on both sides, merge them.\n\n if ($isListNode(nextSibling) && listType === nextSibling.getListType()) {\n append(previousSibling, nextSibling.getChildren());\n nextSibling.remove();\n }\n return previousSibling;\n } else if ($isListNode(nextSibling) && listType === nextSibling.getListType()) {\n nextSibling.getFirstChildOrThrow().insertBefore(listItem);\n node.remove();\n return nextSibling;\n } else {\n const list = $createListNode(listType, styleId);\n list.append(listItem);\n node.replace(list);\n updateChildrenListItemValue(list);\n return list;\n }\n}\n\n/**\n * A recursive function that goes through each list and their children, including nested lists,\n * appending list2 children after list1 children and updating ListItemNode values.\n * @param list1 - The first list to be merged.\n * @param list2 - The second list to be merged.\n */\nexport function mergeLists(list1: ListNode, list2: ListNode): void {\n const listItem1 = list1.getLastChild();\n const listItem2 = list2.getFirstChild();\n\n if (listItem1 && listItem2 && isNestedListNode(listItem1) && isNestedListNode(listItem2)) {\n mergeLists(listItem1.getFirstChild(), listItem2.getFirstChild());\n listItem2.remove();\n }\n\n const toMerge = list2.getChildren();\n if (toMerge.length > 0) {\n list1.append(...toMerge);\n updateChildrenListItemValue(list1);\n }\n\n list2.remove();\n}\n\nexport function removeList(editor: LexicalEditor): void {\n editor.update(() => {\n const selection = $getSelection();\n\n if ($isRangeSelection(selection)) {\n const listNodes = new Set<ListNode>();\n const nodes = selection.getNodes();\n const anchorNode = selection.anchor.getNode();\n\n if ($isSelectingEmptyListItem(anchorNode, nodes)) {\n listNodes.add($getTopListNode(anchorNode));\n } else {\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n\n if ($isLeafNode(node)) {\n const listItemNode = $getNearestNodeOfType(node, ListItemNode);\n\n if (listItemNode != null) {\n listNodes.add($getTopListNode(listItemNode));\n }\n }\n }\n }\n\n for (const listNode of listNodes) {\n let insertionPoint: ListNode | ParagraphNode = listNode;\n\n const listItems = $getAllListItems(listNode);\n\n for (const listItemNode of listItems) {\n const paragraph = $createParagraphNode();\n\n append(paragraph, listItemNode.getChildren());\n\n insertionPoint.insertAfter(paragraph);\n insertionPoint = paragraph;\n\n // When the anchor and focus fall on the textNode\n // we don't have to change the selection because the textNode will be appended to\n // the newly generated paragraph.\n // When selection is in empty nested list item, selection is actually on the listItemNode.\n // When the corresponding listItemNode is deleted and replaced by the newly generated paragraph\n // we should manually set the selection's focus and anchor to the newly generated paragraph.\n if (listItemNode.__key === selection.anchor.key) {\n selection.anchor.set(paragraph.getKey(), 0, \"element\");\n }\n if (listItemNode.__key === selection.focus.key) {\n selection.focus.set(paragraph.getKey(), 0, \"element\");\n }\n\n listItemNode.remove();\n }\n listNode.remove();\n }\n }\n });\n}\n\nexport function updateChildrenListItemValue(list: ListNode, children?: Array<LexicalNode>): void {\n const childrenOrExisting = children || list.getChildren();\n if (childrenOrExisting !== undefined) {\n for (let i = 0; i < childrenOrExisting.length; i++) {\n const child = childrenOrExisting[i];\n if ($isListItemNode(child)) {\n const prevValue = child.getValue();\n const nextValue = $getListItemValue(child);\n\n if (prevValue !== nextValue) {\n child.setValue(nextValue);\n }\n }\n }\n }\n}\n\nexport function $handleIndent(WebinyListItemNodes: Array<ListItemNode>): void {\n // go through each node and decide where to move it.\n const removed = new Set<NodeKey>();\n\n WebinyListItemNodes.forEach((WebinyListItemNode: ListItemNode) => {\n if (isNestedListNode(WebinyListItemNode) || removed.has(WebinyListItemNode.getKey())) {\n return;\n }\n\n const parent = WebinyListItemNode.getParent();\n\n // We can cast both of the below `isNestedListNode` only returns a boolean type instead of a user-defined type guards\n const nextSibling = WebinyListItemNode.getNextSibling<ListItemNode>() as ListItemNode;\n const previousSibling =\n WebinyListItemNode.getPreviousSibling<ListItemNode>() as ListItemNode;\n // if there are nested lists on either side, merge them all together.\n\n if (isNestedListNode(nextSibling) && isNestedListNode(previousSibling)) {\n const innerList = previousSibling.getFirstChild();\n\n if ($isListNode(innerList)) {\n innerList.append(WebinyListItemNode);\n const nextInnerList = nextSibling.getFirstChild();\n\n if ($isListNode(nextInnerList)) {\n const children = nextInnerList.getChildren();\n append(innerList, children);\n nextSibling.remove();\n removed.add(nextSibling.getKey());\n }\n updateChildrenListItemValue(innerList);\n }\n } else if (isNestedListNode(nextSibling)) {\n // if the WebinyListItemNode is next to a nested ListNode, merge them\n const innerList = nextSibling.getFirstChild();\n\n if ($isListNode(innerList)) {\n const firstChild = innerList.getFirstChild();\n\n if (firstChild !== null) {\n firstChild.insertBefore(WebinyListItemNode);\n }\n updateChildrenListItemValue(innerList);\n }\n } else if (isNestedListNode(previousSibling)) {\n const innerList = previousSibling.getFirstChild();\n\n if ($isListNode(innerList)) {\n innerList.append(WebinyListItemNode);\n updateChildrenListItemValue(innerList);\n }\n } else {\n // otherwise, we need to create a new nested ListNode\n\n if ($isListNode(parent)) {\n const newListItem = $createListItemNode();\n const newList = $createListNode(parent.getListType(), parent.getStyleId());\n newListItem.append(newList);\n newList.append(WebinyListItemNode);\n\n if (previousSibling) {\n previousSibling.insertAfter(newListItem);\n } else if (nextSibling) {\n nextSibling.insertBefore(newListItem);\n } else {\n parent.append(newListItem);\n }\n }\n }\n\n if ($isListNode(parent)) {\n updateChildrenListItemValue(parent);\n }\n });\n}\n\nexport function $handleOutdent(WebinyListItemNodes: Array<ListItemNode>): void {\n // go through each node and decide where to move it.\n\n WebinyListItemNodes.forEach(WebinyListItemNode => {\n if (isNestedListNode(WebinyListItemNode)) {\n return;\n }\n const parentList = WebinyListItemNode.getParent();\n const grandparentListItem = parentList ? parentList.getParent() : undefined;\n const greatGrandparentList = grandparentListItem\n ? grandparentListItem.getParent()\n : undefined;\n // If it doesn't have these ancestors, it's not indented.\n\n if (\n $isListNode(greatGrandparentList) &&\n $isListItemNode(grandparentListItem) &&\n $isListNode(parentList)\n ) {\n // if it's the first child in it's parent list, insert it into the\n // great grandparent list before the grandparent\n const firstChild = parentList ? parentList.getFirstChild() : undefined;\n const lastChild = parentList ? parentList.getLastChild() : undefined;\n\n if (WebinyListItemNode.is(firstChild)) {\n grandparentListItem.insertBefore(WebinyListItemNode);\n\n if (parentList.isEmpty()) {\n grandparentListItem.remove();\n }\n // if it's the last child in it's parent list, insert it into the\n // great grandparent list after the grandparent.\n } else if (WebinyListItemNode.is(lastChild)) {\n grandparentListItem.insertAfter(WebinyListItemNode);\n\n if (parentList.isEmpty()) {\n grandparentListItem.remove();\n }\n } else {\n // otherwise, we need to split the siblings into two new nested lists\n const listType = parentList.getListType();\n const themeStyleId = parentList.getStyleId();\n const previousSiblingsListItem = $createListItemNode();\n const previousSiblingsList = $createListNode(listType, themeStyleId);\n previousSiblingsListItem.append(previousSiblingsList);\n WebinyListItemNode.getPreviousSiblings().forEach(sibling =>\n previousSiblingsList.append(sibling)\n );\n const nextSiblingsListItem = $createListItemNode();\n const nextSiblingsList = $createListNode(listType, themeStyleId);\n nextSiblingsListItem.append(nextSiblingsList);\n append(nextSiblingsList, WebinyListItemNode.getNextSiblings());\n // put the sibling nested lists on either side of the grandparent list item in the great grandparent.\n grandparentListItem.insertBefore(previousSiblingsListItem);\n grandparentListItem.insertAfter(nextSiblingsListItem);\n // replace the grandparent list item (now between the siblings) with the outdented list item.\n grandparentListItem.replace(WebinyListItemNode);\n }\n updateChildrenListItemValue(parentList);\n updateChildrenListItemValue(greatGrandparentList);\n }\n });\n}\n\nfunction maybeIndentOrOutdent(direction: \"indent\" | \"outdent\"): void {\n const selection = $getSelection();\n\n if (!$isRangeSelection(selection)) {\n return;\n }\n const selectedNodes = selection.getNodes();\n let webinyListItemNodes: Array<ListItemNode> = [];\n\n if (selectedNodes.length === 0) {\n selectedNodes.push(selection.anchor.getNode());\n }\n\n if (selectedNodes.length === 1) {\n // Only 1 node selected. Selection may not contain the ListNodeItem so we traverse the tree to\n // find whether this is part of a WebinyListItemNode\n const nearestWebinyListItemNode = findNearestListItemNode(selectedNodes[0]);\n\n if (nearestWebinyListItemNode !== null) {\n webinyListItemNodes = [nearestWebinyListItemNode];\n }\n } else {\n webinyListItemNodes = getUniqueListItemNodes(selectedNodes);\n }\n\n if (webinyListItemNodes.length > 0) {\n if (direction === \"indent\") {\n $handleIndent(webinyListItemNodes);\n } else {\n $handleOutdent(webinyListItemNodes);\n }\n }\n}\n\nexport function indentList(): void {\n maybeIndentOrOutdent(\"indent\");\n}\n\nexport function outdentList(): void {\n maybeIndentOrOutdent(\"outdent\");\n}\n\nexport function $handleListInsertParagraph(): boolean {\n const selection = $getSelection();\n\n if (!$isRangeSelection(selection) || !selection.isCollapsed()) {\n return false;\n }\n\n // Only run this code on empty list items\n const anchor = selection.anchor.getNode();\n\n if (!$isListItemNode(anchor) || anchor.getTextContent() !== \"\") {\n return false;\n }\n const topListNode = $getTopListNode(anchor);\n const parent = anchor.getParent();\n\n if (!$isListNode(parent)) {\n console.log(\"A WebinyListItemNode must have a WebinyListNode for a parent.\");\n return false;\n }\n\n const grandparent = parent?.getParent() || null;\n\n let replacementNode;\n\n if ($isRootOrShadowRoot(grandparent)) {\n replacementNode = $createParagraphNode();\n topListNode.insertAfter(replacementNode);\n } else if ($isListItemNode(grandparent)) {\n replacementNode = $createListItemNode();\n grandparent.insertAfter(replacementNode);\n } else {\n return false;\n }\n replacementNode.select();\n\n const nextSiblings = anchor.getNextSiblings();\n\n if (nextSiblings.length > 0) {\n const newList = $createListNode(parent?.getListType(), parent?.getStyleId());\n\n if ($isParagraphNode(replacementNode)) {\n replacementNode.insertAfter(newList);\n } else {\n const newListItem = $createListItemNode();\n newListItem.append(newList);\n replacementNode.insertAfter(newListItem);\n }\n nextSiblings.forEach(sibling => {\n sibling.remove();\n newList.append(sibling);\n });\n }\n\n // Don't leave hanging nested empty lists\n $removeHighestEmptyListParent(anchor);\n\n return true;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAaA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AAEA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AASA,IAAMM,yBAAyB,GAAG,CAAC;AAEnC,SAASC,yBAAyBA,CAC9BC,UAAsC,EACtCC,KAAyB,EAClB;EACP,OACI,IAAAC,6BAAe,EAACF,UAAU,CAAC,KAC1BC,KAAK,CAACE,MAAM,KAAK,CAAC,IACdF,KAAK,CAACE,MAAM,KAAK,CAAC,IAAIH,UAAU,CAACI,EAAE,CAACH,KAAK,CAAC,CAAC,CAAC,CAAC,IAAID,U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,MAAM,CAAC2G,eAAe,CAAC,CAAC;EAE7C,IAAIkB,YAAY,CAACxJ,MAAM,GAAG,CAAC,EAAE;IACzB,IAAM0H,OAAO,GAAG,IAAA5F,yBAAe,EAACU,MAAM,EAAEsB,WAAW,CAAC,CAAC,EAAEtB,MAAM,EAAEmF,UAAU,CAAC,CAAC,CAAC;IAE5E,IAAI,IAAA8B,yBAAgB,EAACH,eAAe,CAAC,EAAE;MACnCA,eAAe,CAACrD,WAAW,CAACyB,OAAO,CAAC;IACxC,CAAC,MAAM;MACH,IAAMD,WAAW,GAAG,IAAAxF,iCAAmB,EAAC,CAAC;MACzCwF,WAAW,CAAClF,MAAM,CAACmF,OAAO,CAAC;MAC3B4B,eAAe,CAACrD,WAAW,CAACwB,WAAW,CAAC;IAC5C;IACA+B,YAAY,CAACpC,OAAO,CAAC,UAAArG,OAAO,EAAI;MAC5BA,OAAO,CAACgD,MAAM,CAAC,CAAC;MAChB2D,OAAO,CAACnF,MAAM,CAACxB,OAAO,CAAC;IAC3B,CAAC,CAAC;EACN;;EAEA;EACA,IAAA2I,uCAA6B,EAAC/H,MAAM,CAAC;EAErC,OAAO,IAAI;AACf"}
1
+ {"version":3,"names":["_lexical","require","_ListNode","_utils","_ListItemNode","_ParagraphNode","_listNode","DEFAULT_LIST_START_NUMBER","$isSelectingEmptyListItem","anchorNode","nodes","$isListItemNode","length","is","getChildrenSize","$getListItemValue","listItem","list","getParent","value","$isListNode","console","log","getStart","siblings","getPreviousSiblings","i","sibling","getFirstChild","insertList","editor","listType","styleId","update","selection","$getSelection","$isRangeSelection","DEPRECATED_$isGridSelection","getNodes","anchor","getNode","anchorNodeParent","$createListNode","$isRootOrShadowRoot","replace","$createListItemNode","$isElementNode","setFormat","getFormatType","setIndent","getIndent","append","parent","getParentOrThrow","getChildren","handled","Set","node","isEmpty","has","getKey","createListOrMerge","$isLeafNode","parentKey","newListNode","updateChildrenListItemValue","add","nextParent","nodesToAppend","splice","previousSibling","getPreviousSibling","nextSibling","getNextSibling","getListType","remove","getFirstChildOrThrow","insertBefore","mergeLists","list1","list2","listItem1","getLastChild","listItem2","isNestedListNode","toMerge","apply","_toConsumableArray2","default","removeList","listNodes","$getTopListNode","listItemNode","$getNearestNodeOfType","ListItemNode","_iterator","_createForOfIteratorHelper2","_step","s","n","done","listNode","insertionPoint","listItems","$getAllListItems","_iterator2","_step2","paragraph","$createParagraphNode","insertAfter","__key","key","set","focus","err","e","f","children","childrenOrExisting","undefined","child","prevValue","getValue","nextValue","setValue","$handleIndent","WebinyListItemNodes","removed","forEach","WebinyListItemNode","innerList","nextInnerList","firstChild","newListItem","newList","getStyleId","$handleOutdent","parentList","grandparentListItem","greatGrandparentList","lastChild","themeStyleId","previousSiblingsListItem","previousSiblingsList","nextSiblingsListItem","nextSiblingsList","getNextSiblings","maybeIndentOrOutdent","direction","selectedNodes","webinyListItemNodes","push","nearestWebinyListItemNode","findNearestListItemNode","getUniqueListItemNodes","indentList","outdentList","$handleListInsertParagraph","isCollapsed","getTextContent","topListNode","grandparent","replacementNode","select","nextSiblings","$isParagraphNode","$removeHighestEmptyListParent"],"sources":["formatList.ts"],"sourcesContent":["import {\n $getSelection,\n $isElementNode,\n $isLeafNode,\n $isParagraphNode,\n $isRangeSelection,\n $isRootOrShadowRoot,\n DEPRECATED_$isGridSelection,\n ElementNode,\n LexicalEditor,\n LexicalNode,\n NodeKey\n} from \"lexical\";\nimport { $createListNode, $isListNode, ListNode } from \"~/ListNode\";\nimport { $getNearestNodeOfType } from \"@lexical/utils\";\nimport { $createListItemNode, $isListItemNode, ListItemNode } from \"~/ListItemNode\";\nimport { ListType } from \"@lexical/list\";\nimport { $createParagraphNode, ParagraphNode } from \"~/ParagraphNode\";\nimport {\n $getAllListItems,\n $getTopListNode,\n $removeHighestEmptyListParent,\n findNearestListItemNode,\n getUniqueListItemNodes,\n isNestedListNode\n} from \"~/utils/listNode\";\n\nconst DEFAULT_LIST_START_NUMBER = 1;\n\nfunction $isSelectingEmptyListItem(\n anchorNode: ListItemNode | LexicalNode,\n nodes: Array<LexicalNode>\n): boolean {\n return (\n $isListItemNode(anchorNode) &&\n (nodes.length === 0 ||\n (nodes.length === 1 && anchorNode.is(nodes[0]) && anchorNode.getChildrenSize() === 0))\n );\n}\n\nfunction $getListItemValue(listItem: ListItemNode): number {\n const list = listItem.getParent();\n\n let value = 1;\n\n if (list !== null) {\n if (!$isListNode(list)) {\n console.log(\n \"$getListItemValue: webiny list node is not parent of webiny list item node\"\n );\n return DEFAULT_LIST_START_NUMBER;\n } else {\n value = list.getStart();\n }\n }\n\n const siblings = listItem.getPreviousSiblings();\n for (let i = 0; i < siblings.length; i++) {\n const sibling = siblings[i];\n\n if ($isListItemNode(sibling) && !$isListNode(sibling.getFirstChild())) {\n value++;\n }\n }\n return value;\n}\n\nexport function insertList(editor: LexicalEditor, listType: ListType, styleId?: string): void {\n editor.update(() => {\n const selection = $getSelection();\n\n if ($isRangeSelection(selection) || DEPRECATED_$isGridSelection(selection)) {\n const nodes = selection.getNodes();\n const anchor = selection.anchor;\n const anchorNode = anchor.getNode();\n const anchorNodeParent = anchorNode.getParent();\n\n if ($isSelectingEmptyListItem(anchorNode, nodes)) {\n const list = $createListNode(listType, styleId);\n\n if ($isRootOrShadowRoot(anchorNodeParent)) {\n anchorNode.replace(list);\n const listItem = $createListItemNode();\n if ($isElementNode(anchorNode)) {\n listItem.setFormat(anchorNode.getFormatType());\n listItem.setIndent(anchorNode.getIndent());\n }\n list.append(listItem);\n } else if ($isListItemNode(anchorNode)) {\n const parent = anchorNode.getParentOrThrow();\n append(list, parent.getChildren());\n parent.replace(list);\n }\n\n return;\n } else {\n const handled = new Set();\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n\n if ($isElementNode(node) && node.isEmpty() && !handled.has(node.getKey())) {\n createListOrMerge(node, listType, styleId);\n continue;\n }\n\n if ($isLeafNode(node)) {\n let parent = node.getParent();\n while (parent != null) {\n const parentKey = parent.getKey();\n\n if ($isListNode(parent)) {\n if (!handled.has(parentKey)) {\n const newListNode = $createListNode(listType, styleId);\n append(newListNode, parent.getChildren());\n parent.replace(newListNode);\n updateChildrenListItemValue(newListNode);\n handled.add(parentKey);\n }\n\n break;\n } else {\n const nextParent = parent.getParent();\n\n if ($isRootOrShadowRoot(nextParent) && !handled.has(parentKey)) {\n handled.add(parentKey);\n createListOrMerge(parent, listType, styleId);\n break;\n }\n\n parent = nextParent;\n }\n }\n }\n }\n }\n }\n });\n}\n\nfunction append(node: ElementNode, nodesToAppend: Array<LexicalNode>) {\n node.splice(node.getChildrenSize(), 0, nodesToAppend);\n}\n\nfunction createListOrMerge(node: ElementNode, listType: ListType, styleId?: string): ListNode {\n if ($isListNode(node)) {\n return node;\n }\n\n const previousSibling = node.getPreviousSibling();\n const nextSibling = node.getNextSibling();\n const listItem = $createListItemNode();\n listItem.setFormat(node.getFormatType());\n listItem.setIndent(node.getIndent());\n append(listItem, node.getChildren());\n\n if ($isListNode(previousSibling) && listType === previousSibling.getListType()) {\n previousSibling.append(listItem);\n node.remove();\n // if the same type of list is on both sides, merge them.\n\n if ($isListNode(nextSibling) && listType === nextSibling.getListType()) {\n append(previousSibling, nextSibling.getChildren());\n nextSibling.remove();\n }\n return previousSibling;\n } else if ($isListNode(nextSibling) && listType === nextSibling.getListType()) {\n nextSibling.getFirstChildOrThrow().insertBefore(listItem);\n node.remove();\n return nextSibling;\n } else {\n const list = $createListNode(listType, styleId);\n list.append(listItem);\n node.replace(list);\n updateChildrenListItemValue(list);\n return list;\n }\n}\n\n/**\n * A recursive function that goes through each list and their children, including nested lists,\n * appending list2 children after list1 children and updating ListItemNode values.\n * @param list1 - The first list to be merged.\n * @param list2 - The second list to be merged.\n */\nexport function mergeLists(list1: ListNode, list2: ListNode): void {\n const listItem1 = list1.getLastChild();\n const listItem2 = list2.getFirstChild();\n\n if (listItem1 && listItem2 && isNestedListNode(listItem1) && isNestedListNode(listItem2)) {\n mergeLists(listItem1.getFirstChild(), listItem2.getFirstChild());\n listItem2.remove();\n }\n\n const toMerge = list2.getChildren();\n if (toMerge.length > 0) {\n list1.append(...toMerge);\n updateChildrenListItemValue(list1);\n }\n\n list2.remove();\n}\n\nexport function removeList(editor: LexicalEditor): void {\n editor.update(() => {\n const selection = $getSelection();\n\n if ($isRangeSelection(selection)) {\n const listNodes = new Set<ListNode>();\n const nodes = selection.getNodes();\n const anchorNode = selection.anchor.getNode();\n\n if ($isSelectingEmptyListItem(anchorNode, nodes)) {\n listNodes.add($getTopListNode(anchorNode));\n } else {\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n\n if ($isLeafNode(node)) {\n const listItemNode = $getNearestNodeOfType(node, ListItemNode);\n\n if (listItemNode != null) {\n listNodes.add($getTopListNode(listItemNode));\n }\n }\n }\n }\n\n for (const listNode of listNodes) {\n let insertionPoint: ListNode | ParagraphNode = listNode;\n\n const listItems = $getAllListItems(listNode);\n\n for (const listItemNode of listItems) {\n const paragraph = $createParagraphNode();\n\n append(paragraph, listItemNode.getChildren());\n\n insertionPoint.insertAfter(paragraph);\n insertionPoint = paragraph;\n\n // When the anchor and focus fall on the textNode\n // we don't have to change the selection because the textNode will be appended to\n // the newly generated paragraph.\n // When selection is in empty nested list item, selection is actually on the listItemNode.\n // When the corresponding listItemNode is deleted and replaced by the newly generated paragraph\n // we should manually set the selection's focus and anchor to the newly generated paragraph.\n if (listItemNode.__key === selection.anchor.key) {\n selection.anchor.set(paragraph.getKey(), 0, \"element\");\n }\n if (listItemNode.__key === selection.focus.key) {\n selection.focus.set(paragraph.getKey(), 0, \"element\");\n }\n\n listItemNode.remove();\n }\n listNode.remove();\n }\n }\n });\n}\n\nexport function updateChildrenListItemValue(list: ListNode, children?: Array<LexicalNode>): void {\n const childrenOrExisting = children || list.getChildren();\n if (childrenOrExisting !== undefined) {\n for (let i = 0; i < childrenOrExisting.length; i++) {\n const child = childrenOrExisting[i];\n if ($isListItemNode(child)) {\n const prevValue = child.getValue();\n const nextValue = $getListItemValue(child);\n\n if (prevValue !== nextValue) {\n child.setValue(nextValue);\n }\n }\n }\n }\n}\n\nexport function $handleIndent(WebinyListItemNodes: Array<ListItemNode>): void {\n // go through each node and decide where to move it.\n const removed = new Set<NodeKey>();\n\n WebinyListItemNodes.forEach((WebinyListItemNode: ListItemNode) => {\n if (isNestedListNode(WebinyListItemNode) || removed.has(WebinyListItemNode.getKey())) {\n return;\n }\n\n const parent = WebinyListItemNode.getParent();\n\n // We can cast both of the below `isNestedListNode` only returns a boolean type instead of a user-defined type guards\n const nextSibling = WebinyListItemNode.getNextSibling<ListItemNode>() as ListItemNode;\n const previousSibling =\n WebinyListItemNode.getPreviousSibling<ListItemNode>() as ListItemNode;\n // if there are nested lists on either side, merge them all together.\n\n if (isNestedListNode(nextSibling) && isNestedListNode(previousSibling)) {\n const innerList = previousSibling.getFirstChild();\n\n if ($isListNode(innerList)) {\n innerList.append(WebinyListItemNode);\n const nextInnerList = nextSibling.getFirstChild();\n\n if ($isListNode(nextInnerList)) {\n const children = nextInnerList.getChildren();\n append(innerList, children);\n nextSibling.remove();\n removed.add(nextSibling.getKey());\n }\n updateChildrenListItemValue(innerList);\n }\n } else if (isNestedListNode(nextSibling)) {\n // if the WebinyListItemNode is next to a nested ListNode, merge them\n const innerList = nextSibling.getFirstChild();\n\n if ($isListNode(innerList)) {\n const firstChild = innerList.getFirstChild();\n\n if (firstChild !== null) {\n firstChild.insertBefore(WebinyListItemNode);\n }\n updateChildrenListItemValue(innerList);\n }\n } else if (isNestedListNode(previousSibling)) {\n const innerList = previousSibling.getFirstChild();\n\n if ($isListNode(innerList)) {\n innerList.append(WebinyListItemNode);\n updateChildrenListItemValue(innerList);\n }\n } else {\n // otherwise, we need to create a new nested ListNode\n\n if ($isListNode(parent)) {\n const newListItem = $createListItemNode();\n const newList = $createListNode(parent.getListType(), parent.getStyleId());\n newListItem.append(newList);\n newList.append(WebinyListItemNode);\n\n if (previousSibling) {\n previousSibling.insertAfter(newListItem);\n } else if (nextSibling) {\n nextSibling.insertBefore(newListItem);\n } else {\n parent.append(newListItem);\n }\n }\n }\n\n if ($isListNode(parent)) {\n updateChildrenListItemValue(parent);\n }\n });\n}\n\nexport function $handleOutdent(WebinyListItemNodes: Array<ListItemNode>): void {\n // go through each node and decide where to move it.\n\n WebinyListItemNodes.forEach(WebinyListItemNode => {\n if (isNestedListNode(WebinyListItemNode)) {\n return;\n }\n const parentList = WebinyListItemNode.getParent();\n const grandparentListItem = parentList ? parentList.getParent() : undefined;\n const greatGrandparentList = grandparentListItem\n ? grandparentListItem.getParent()\n : undefined;\n // If it doesn't have these ancestors, it's not indented.\n\n if (\n $isListNode(greatGrandparentList) &&\n $isListItemNode(grandparentListItem) &&\n $isListNode(parentList)\n ) {\n // if it's the first child in it's parent list, insert it into the\n // great grandparent list before the grandparent\n const firstChild = parentList ? parentList.getFirstChild() : undefined;\n const lastChild = parentList ? parentList.getLastChild() : undefined;\n\n if (WebinyListItemNode.is(firstChild)) {\n grandparentListItem.insertBefore(WebinyListItemNode);\n\n if (parentList.isEmpty()) {\n grandparentListItem.remove();\n }\n // if it's the last child in it's parent list, insert it into the\n // great grandparent list after the grandparent.\n } else if (WebinyListItemNode.is(lastChild)) {\n grandparentListItem.insertAfter(WebinyListItemNode);\n\n if (parentList.isEmpty()) {\n grandparentListItem.remove();\n }\n } else {\n // otherwise, we need to split the siblings into two new nested lists\n const listType = parentList.getListType();\n const themeStyleId = parentList.getStyleId();\n const previousSiblingsListItem = $createListItemNode();\n const previousSiblingsList = $createListNode(listType, themeStyleId);\n previousSiblingsListItem.append(previousSiblingsList);\n WebinyListItemNode.getPreviousSiblings().forEach(sibling =>\n previousSiblingsList.append(sibling)\n );\n const nextSiblingsListItem = $createListItemNode();\n const nextSiblingsList = $createListNode(listType, themeStyleId);\n nextSiblingsListItem.append(nextSiblingsList);\n append(nextSiblingsList, WebinyListItemNode.getNextSiblings());\n // put the sibling nested lists on either side of the grandparent list item in the great grandparent.\n grandparentListItem.insertBefore(previousSiblingsListItem);\n grandparentListItem.insertAfter(nextSiblingsListItem);\n // replace the grandparent list item (now between the siblings) with the outdented list item.\n grandparentListItem.replace(WebinyListItemNode);\n }\n updateChildrenListItemValue(parentList);\n updateChildrenListItemValue(greatGrandparentList);\n }\n });\n}\n\nfunction maybeIndentOrOutdent(direction: \"indent\" | \"outdent\"): void {\n const selection = $getSelection();\n\n if (!$isRangeSelection(selection)) {\n return;\n }\n const selectedNodes = selection.getNodes();\n let webinyListItemNodes: Array<ListItemNode> = [];\n\n if (selectedNodes.length === 0) {\n selectedNodes.push(selection.anchor.getNode());\n }\n\n if (selectedNodes.length === 1) {\n // Only 1 node selected. Selection may not contain the ListNodeItem so we traverse the tree to\n // find whether this is part of a WebinyListItemNode\n const nearestWebinyListItemNode = findNearestListItemNode(selectedNodes[0]);\n\n if (nearestWebinyListItemNode !== null) {\n webinyListItemNodes = [nearestWebinyListItemNode];\n }\n } else {\n webinyListItemNodes = getUniqueListItemNodes(selectedNodes);\n }\n\n if (webinyListItemNodes.length > 0) {\n if (direction === \"indent\") {\n $handleIndent(webinyListItemNodes);\n } else {\n $handleOutdent(webinyListItemNodes);\n }\n }\n}\n\nexport function indentList(): void {\n maybeIndentOrOutdent(\"indent\");\n}\n\nexport function outdentList(): void {\n maybeIndentOrOutdent(\"outdent\");\n}\n\nexport function $handleListInsertParagraph(): boolean {\n const selection = $getSelection();\n\n if (!$isRangeSelection(selection) || !selection.isCollapsed()) {\n return false;\n }\n\n // Only run this code on empty list items\n const anchor = selection.anchor.getNode();\n\n if (!$isListItemNode(anchor) || anchor.getTextContent() !== \"\") {\n return false;\n }\n const topListNode = $getTopListNode(anchor);\n const parent = anchor.getParent();\n\n if (!$isListNode(parent)) {\n console.log(\"A WebinyListItemNode must have a WebinyListNode for a parent.\");\n return false;\n }\n\n const grandparent = parent?.getParent() || null;\n\n let replacementNode;\n\n if ($isRootOrShadowRoot(grandparent)) {\n replacementNode = $createParagraphNode();\n topListNode.insertAfter(replacementNode);\n } else if ($isListItemNode(grandparent)) {\n replacementNode = $createListItemNode();\n grandparent.insertAfter(replacementNode);\n } else {\n return false;\n }\n replacementNode.select();\n\n const nextSiblings = anchor.getNextSiblings();\n\n if (nextSiblings.length > 0) {\n const newList = $createListNode(parent?.getListType(), parent?.getStyleId());\n\n if ($isParagraphNode(replacementNode)) {\n replacementNode.insertAfter(newList);\n } else {\n const newListItem = $createListItemNode();\n newListItem.append(newList);\n replacementNode.insertAfter(newListItem);\n }\n nextSiblings.forEach(sibling => {\n sibling.remove();\n newList.append(sibling);\n });\n }\n\n // Don't leave hanging nested empty lists\n $removeHighestEmptyListParent(anchor);\n\n return true;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAaA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AAEA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AASA,IAAMM,yBAAyB,GAAG,CAAC;AAEnC,SAASC,yBAAyBA,CAC9BC,UAAsC,EACtCC,KAAyB,EAClB;EACP,OACI,IAAAC,6BAAe,EAACF,UAAU,CAAC,KAC1BC,KAAK,CAACE,MAAM,KAAK,CAAC,IACdF,KAAK,CAACE,MAAM,KAAK,CAAC,IAAIH,UAAU,CAACI,EAAE,CAACH,KAAK,CAAC,CAAC,CAAC,CAAC,IAAID,UAAU,CAACK,eAAe,CAAC,CAAC,KAAK,CAAE,CAAC;AAElG;AAEA,SAASC,iBAAiBA,CAACC,QAAsB,EAAU;EACvD,IAAMC,IAAI,GAAGD,QAAQ,CAACE,SAAS,CAAC,CAAC;EAEjC,IAAIC,KAAK,GAAG,CAAC;EAEb,IAAIF,IAAI,KAAK,IAAI,EAAE;IACf,IAAI,CAAC,IAAAG,qBAAW,EAACH,IAAI,CAAC,EAAE;MACpBI,OAAO,CAACC,GAAG,CACP,4EACJ,CAAC;MACD,OAAOf,yBAAyB;IACp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,WAAW,GAAG,IAAAxF,iCAAmB,EAAC,CAAC;MACzCwF,WAAW,CAAClF,MAAM,CAACmF,OAAO,CAAC;MAC3B4B,eAAe,CAACrD,WAAW,CAACwB,WAAW,CAAC;IAC5C;IACA+B,YAAY,CAACpC,OAAO,CAAC,UAAArG,OAAO,EAAI;MAC5BA,OAAO,CAACgD,MAAM,CAAC,CAAC;MAChB2D,OAAO,CAACnF,MAAM,CAACxB,OAAO,CAAC;IAC3B,CAAC,CAAC;EACN;;EAEA;EACA,IAAA2I,uCAA6B,EAAC/H,MAAM,CAAC;EAErC,OAAO,IAAI;AACf","ignoreList":[]}
@@ -12,7 +12,7 @@ var _HeadingNode = require("../HeadingNode");
12
12
  * For example if the selection is p with content inside after formatting the root tag
13
13
  * will be h1 with heading 1 theme style and the same content inside.
14
14
  * */
15
- var formatToHeading = function formatToHeading(editor, tag, typographyStyleId) {
15
+ var formatToHeading = exports.formatToHeading = function formatToHeading(editor, tag, typographyStyleId) {
16
16
  editor.update(function () {
17
17
  var selection = (0, _lexical.$getSelection)();
18
18
  if ((0, _lexical.$isRangeSelection)(selection) || (0, _lexical.DEPRECATED_$isGridSelection)(selection)) {
@@ -22,6 +22,5 @@ var formatToHeading = function formatToHeading(editor, tag, typographyStyleId) {
22
22
  }
23
23
  });
24
24
  };
25
- exports.formatToHeading = formatToHeading;
26
25
 
27
26
  //# sourceMappingURL=formatToHeading.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_lexical","require","_selection","_HeadingNode","formatToHeading","editor","tag","typographyStyleId","update","selection","$getSelection","$isRangeSelection","DEPRECATED_$isGridSelection","$setBlocksType","$createHeadingNode","exports"],"sources":["formatToHeading.ts"],"sourcesContent":["import {\n $getSelection,\n $isRangeSelection,\n DEPRECATED_$isGridSelection,\n LexicalEditor\n} from \"lexical\";\nimport { $setBlocksType } from \"@lexical/selection\";\nimport { HeadingTagType } from \"@lexical/rich-text\";\nimport { $createHeadingNode } from \"~/HeadingNode\";\n\n/*\n * Will change the selected HTML tag to specified heading or h1-h6.\n * For example if the selection is p with content inside after formatting the root tag\n * will be h1 with heading 1 theme style and the same content inside.\n * */\nexport const formatToHeading = (\n editor: LexicalEditor,\n tag: HeadingTagType,\n typographyStyleId?: string\n) => {\n editor.update(() => {\n const selection = $getSelection();\n if ($isRangeSelection(selection) || DEPRECATED_$isGridSelection(selection)) {\n $setBlocksType(selection, () => $createHeadingNode(tag, typographyStyleId));\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAMA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACO,IAAMG,eAAe,GAAG,SAAlBA,eAAeA,CACxBC,MAAqB,EACrBC,GAAmB,EACnBC,iBAA0B,EACzB;EACDF,MAAM,CAACG,MAAM,CAAC,YAAM;IAChB,IAAMC,SAAS,GAAG,IAAAC,sBAAa,EAAC,CAAC;IACjC,IAAI,IAAAC,0BAAiB,EAACF,SAAS,CAAC,IAAI,IAAAG,oCAA2B,EAACH,SAAS,CAAC,EAAE;MACxE,IAAAI,yBAAc,EAACJ,SAAS,EAAE;QAAA,OAAM,IAAAK,+BAAkB,EAACR,GAAG,EAAEC,iBAAiB,CAAC;MAAA,EAAC;IAC/E;EACJ,CAAC,CAAC;AACN,CAAC;AAACQ,OAAA,CAAAX,eAAA,GAAAA,eAAA"}
1
+ {"version":3,"names":["_lexical","require","_selection","_HeadingNode","formatToHeading","exports","editor","tag","typographyStyleId","update","selection","$getSelection","$isRangeSelection","DEPRECATED_$isGridSelection","$setBlocksType","$createHeadingNode"],"sources":["formatToHeading.ts"],"sourcesContent":["import {\n $getSelection,\n $isRangeSelection,\n DEPRECATED_$isGridSelection,\n LexicalEditor\n} from \"lexical\";\nimport { $setBlocksType } from \"@lexical/selection\";\nimport { HeadingTagType } from \"@lexical/rich-text\";\nimport { $createHeadingNode } from \"~/HeadingNode\";\n\n/*\n * Will change the selected HTML tag to specified heading or h1-h6.\n * For example if the selection is p with content inside after formatting the root tag\n * will be h1 with heading 1 theme style and the same content inside.\n * */\nexport const formatToHeading = (\n editor: LexicalEditor,\n tag: HeadingTagType,\n typographyStyleId?: string\n) => {\n editor.update(() => {\n const selection = $getSelection();\n if ($isRangeSelection(selection) || DEPRECATED_$isGridSelection(selection)) {\n $setBlocksType(selection, () => $createHeadingNode(tag, typographyStyleId));\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAMA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,YAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACO,IAAMG,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,SAAlBA,eAAeA,CACxBE,MAAqB,EACrBC,GAAmB,EACnBC,iBAA0B,EACzB;EACDF,MAAM,CAACG,MAAM,CAAC,YAAM;IAChB,IAAMC,SAAS,GAAG,IAAAC,sBAAa,EAAC,CAAC;IACjC,IAAI,IAAAC,0BAAiB,EAACF,SAAS,CAAC,IAAI,IAAAG,oCAA2B,EAACH,SAAS,CAAC,EAAE;MACxE,IAAAI,yBAAc,EAACJ,SAAS,EAAE;QAAA,OAAM,IAAAK,+BAAkB,EAACR,GAAG,EAAEC,iBAAiB,CAAC;MAAA,EAAC;IAC/E;EACJ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -7,7 +7,7 @@ exports.formatToParagraph = void 0;
7
7
  var _lexical = require("lexical");
8
8
  var _selection = require("@lexical/selection");
9
9
  var _ParagraphNode = require("../ParagraphNode");
10
- var formatToParagraph = function formatToParagraph(editor, typographyStyleId) {
10
+ var formatToParagraph = exports.formatToParagraph = function formatToParagraph(editor, typographyStyleId) {
11
11
  editor.update(function () {
12
12
  var selection = (0, _lexical.$getSelection)();
13
13
  if ((0, _lexical.$isRangeSelection)(selection) || (0, _lexical.DEPRECATED_$isGridSelection)(selection)) {
@@ -17,6 +17,5 @@ var formatToParagraph = function formatToParagraph(editor, typographyStyleId) {
17
17
  }
18
18
  });
19
19
  };
20
- exports.formatToParagraph = formatToParagraph;
21
20
 
22
21
  //# sourceMappingURL=formatToParagraph.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_lexical","require","_selection","_ParagraphNode","formatToParagraph","editor","typographyStyleId","update","selection","$getSelection","$isRangeSelection","DEPRECATED_$isGridSelection","$setBlocksType","$createParagraphNode","exports"],"sources":["formatToParagraph.ts"],"sourcesContent":["import {\n $getSelection,\n $isRangeSelection,\n DEPRECATED_$isGridSelection,\n LexicalEditor\n} from \"lexical\";\nimport { $setBlocksType } from \"@lexical/selection\";\nimport { $createParagraphNode } from \"~/ParagraphNode\";\n\nexport const formatToParagraph = (editor: LexicalEditor, typographyStyleId?: string) => {\n editor.update(() => {\n const selection = $getSelection();\n if ($isRangeSelection(selection) || DEPRECATED_$isGridSelection(selection)) {\n $setBlocksType(selection, () => $createParagraphNode(typographyStyleId));\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAMA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAEO,IAAMG,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAIC,MAAqB,EAAEC,iBAA0B,EAAK;EACpFD,MAAM,CAACE,MAAM,CAAC,YAAM;IAChB,IAAMC,SAAS,GAAG,IAAAC,sBAAa,EAAC,CAAC;IACjC,IAAI,IAAAC,0BAAiB,EAACF,SAAS,CAAC,IAAI,IAAAG,oCAA2B,EAACH,SAAS,CAAC,EAAE;MACxE,IAAAI,yBAAc,EAACJ,SAAS,EAAE;QAAA,OAAM,IAAAK,mCAAoB,EAACP,iBAAiB,CAAC;MAAA,EAAC;IAC5E;EACJ,CAAC,CAAC;AACN,CAAC;AAACQ,OAAA,CAAAV,iBAAA,GAAAA,iBAAA"}
1
+ {"version":3,"names":["_lexical","require","_selection","_ParagraphNode","formatToParagraph","exports","editor","typographyStyleId","update","selection","$getSelection","$isRangeSelection","DEPRECATED_$isGridSelection","$setBlocksType","$createParagraphNode"],"sources":["formatToParagraph.ts"],"sourcesContent":["import {\n $getSelection,\n $isRangeSelection,\n DEPRECATED_$isGridSelection,\n LexicalEditor\n} from \"lexical\";\nimport { $setBlocksType } from \"@lexical/selection\";\nimport { $createParagraphNode } from \"~/ParagraphNode\";\n\nexport const formatToParagraph = (editor: LexicalEditor, typographyStyleId?: string) => {\n editor.update(() => {\n const selection = $getSelection();\n if ($isRangeSelection(selection) || DEPRECATED_$isGridSelection(selection)) {\n $setBlocksType(selection, () => $createParagraphNode(typographyStyleId));\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAMA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAEO,IAAMG,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,SAApBA,iBAAiBA,CAAIE,MAAqB,EAAEC,iBAA0B,EAAK;EACpFD,MAAM,CAACE,MAAM,CAAC,YAAM;IAChB,IAAMC,SAAS,GAAG,IAAAC,sBAAa,EAAC,CAAC;IACjC,IAAI,IAAAC,0BAAiB,EAACF,SAAS,CAAC,IAAI,IAAAG,oCAA2B,EAACH,SAAS,CAAC,EAAE;MACxE,IAAAI,yBAAc,EAACJ,SAAS,EAAE;QAAA,OAAM,IAAAK,mCAAoB,EAACP,iBAAiB,CAAC;MAAA,EAAC;IAC5E;EACJ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}
@@ -12,7 +12,7 @@ var _QuoteNode = require("../QuoteNode");
12
12
  * For example if the selection is paragraph <p> with content inside after formatting the root tag
13
13
  * will be quoteblock with same content inside.
14
14
  * */
15
- var formatToQuote = function formatToQuote(editor, themeStyleId) {
15
+ var formatToQuote = exports.formatToQuote = function formatToQuote(editor, themeStyleId) {
16
16
  editor.update(function () {
17
17
  var selection = (0, _lexical.$getSelection)();
18
18
  if ((0, _lexical.$isRangeSelection)(selection) || (0, _lexical.DEPRECATED_$isGridSelection)(selection)) {
@@ -22,6 +22,5 @@ var formatToQuote = function formatToQuote(editor, themeStyleId) {
22
22
  }
23
23
  });
24
24
  };
25
- exports.formatToQuote = formatToQuote;
26
25
 
27
26
  //# sourceMappingURL=formatToQuote.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_lexical","require","_selection","_QuoteNode","formatToQuote","editor","themeStyleId","update","selection","$getSelection","$isRangeSelection","DEPRECATED_$isGridSelection","$setBlocksType","$createQuoteNode","exports"],"sources":["formatToQuote.ts"],"sourcesContent":["import {\n $getSelection,\n $isRangeSelection,\n DEPRECATED_$isGridSelection,\n LexicalEditor\n} from \"lexical\";\nimport { $setBlocksType } from \"@lexical/selection\";\nimport { $createQuoteNode } from \"~/QuoteNode\";\n\n/*\n * Will change the selected root HTML tag to specified quoteblock tag.\n * For example if the selection is paragraph <p> with content inside after formatting the root tag\n * will be quoteblock with same content inside.\n * */\nexport const formatToQuote = (editor: LexicalEditor, themeStyleId?: string) => {\n editor.update(() => {\n const selection = $getSelection();\n if ($isRangeSelection(selection) || DEPRECATED_$isGridSelection(selection)) {\n $setBlocksType(selection, () => $createQuoteNode(themeStyleId));\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAMA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACO,IAAMG,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,MAAqB,EAAEC,YAAqB,EAAK;EAC3ED,MAAM,CAACE,MAAM,CAAC,YAAM;IAChB,IAAMC,SAAS,GAAG,IAAAC,sBAAa,EAAC,CAAC;IACjC,IAAI,IAAAC,0BAAiB,EAACF,SAAS,CAAC,IAAI,IAAAG,oCAA2B,EAACH,SAAS,CAAC,EAAE;MACxE,IAAAI,yBAAc,EAACJ,SAAS,EAAE;QAAA,OAAM,IAAAK,2BAAgB,EAACP,YAAY,CAAC;MAAA,EAAC;IACnE;EACJ,CAAC,CAAC;AACN,CAAC;AAACQ,OAAA,CAAAV,aAAA,GAAAA,aAAA"}
1
+ {"version":3,"names":["_lexical","require","_selection","_QuoteNode","formatToQuote","exports","editor","themeStyleId","update","selection","$getSelection","$isRangeSelection","DEPRECATED_$isGridSelection","$setBlocksType","$createQuoteNode"],"sources":["formatToQuote.ts"],"sourcesContent":["import {\n $getSelection,\n $isRangeSelection,\n DEPRECATED_$isGridSelection,\n LexicalEditor\n} from \"lexical\";\nimport { $setBlocksType } from \"@lexical/selection\";\nimport { $createQuoteNode } from \"~/QuoteNode\";\n\n/*\n * Will change the selected root HTML tag to specified quoteblock tag.\n * For example if the selection is paragraph <p> with content inside after formatting the root tag\n * will be quoteblock with same content inside.\n * */\nexport const formatToQuote = (editor: LexicalEditor, themeStyleId?: string) => {\n editor.update(() => {\n const selection = $getSelection();\n if ($isRangeSelection(selection) || DEPRECATED_$isGridSelection(selection)) {\n $setBlocksType(selection, () => $createQuoteNode(themeStyleId));\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAMA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACO,IAAMG,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG,SAAhBA,aAAaA,CAAIE,MAAqB,EAAEC,YAAqB,EAAK;EAC3ED,MAAM,CAACE,MAAM,CAAC,YAAM;IAChB,IAAMC,SAAS,GAAG,IAAAC,sBAAa,EAAC,CAAC;IACjC,IAAI,IAAAC,0BAAiB,EAACF,SAAS,CAAC,IAAI,IAAAG,oCAA2B,EAACH,SAAS,CAAC,EAAE;MACxE,IAAAI,yBAAc,EAACJ,SAAS,EAAE;QAAA,OAAM,IAAAK,2BAAgB,EAACP,YAAY,CAAC;MAAA,EAAC;IACnE;EACJ,CAAC,CAAC;AACN,CAAC","ignoreList":[]}