@contember/react-slate-editor-base 2.1.0-alpha.37 → 2.1.0-alpha.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/development/index.cjs +139 -0
- package/dist/development/index.cjs.map +1 -0
- package/dist/development/index.js +136 -0
- package/dist/development/index.js.map +1 -0
- package/dist/development/src/components/RichTextEditor.cjs +106 -0
- package/dist/development/src/components/RichTextEditor.cjs.map +1 -0
- package/dist/development/src/components/RichTextEditor.js +106 -0
- package/dist/development/src/components/RichTextEditor.js.map +1 -0
- package/dist/development/src/components/triggers/EditorElementTrigger.cjs +20 -0
- package/dist/development/src/components/triggers/EditorElementTrigger.cjs.map +1 -0
- package/dist/development/src/components/triggers/EditorElementTrigger.js +20 -0
- package/dist/development/src/components/triggers/EditorElementTrigger.js.map +1 -0
- package/dist/development/src/components/triggers/EditorGenericTrigger.cjs +24 -0
- package/dist/development/src/components/triggers/EditorGenericTrigger.cjs.map +1 -0
- package/dist/development/src/components/triggers/EditorGenericTrigger.js +24 -0
- package/dist/development/src/components/triggers/EditorGenericTrigger.js.map +1 -0
- package/dist/development/src/components/triggers/EditorMarkTrigger.cjs +20 -0
- package/dist/development/src/components/triggers/EditorMarkTrigger.cjs.map +1 -0
- package/dist/development/src/components/triggers/EditorMarkTrigger.js +20 -0
- package/dist/development/src/components/triggers/EditorMarkTrigger.js.map +1 -0
- package/dist/development/src/components/triggers/EditorWrapNodeTrigger.cjs +32 -0
- package/dist/development/src/components/triggers/EditorWrapNodeTrigger.cjs.map +1 -0
- package/dist/development/src/components/triggers/EditorWrapNodeTrigger.js +32 -0
- package/dist/development/src/components/triggers/EditorWrapNodeTrigger.js.map +1 -0
- package/dist/development/src/editor/createEditor.cjs +35 -0
- package/dist/development/src/editor/createEditor.cjs.map +1 -0
- package/dist/development/src/editor/createEditor.js +35 -0
- package/dist/development/src/editor/createEditor.js.map +1 -0
- package/dist/development/src/editor/createEditorWithEssentials.cjs +227 -0
- package/dist/development/src/editor/createEditorWithEssentials.cjs.map +1 -0
- package/dist/development/src/editor/createEditorWithEssentials.js +211 -0
- package/dist/development/src/editor/createEditorWithEssentials.js.map +1 -0
- package/dist/development/src/editor/index.cjs +44 -0
- package/dist/development/src/editor/index.cjs.map +1 -0
- package/dist/development/src/editor/index.js +44 -0
- package/dist/development/src/editor/index.js.map +1 -0
- package/dist/development/src/editor/methods/addMarks.cjs +12 -0
- package/dist/development/src/editor/methods/addMarks.cjs.map +1 -0
- package/dist/development/src/editor/methods/addMarks.js +12 -0
- package/dist/development/src/editor/methods/addMarks.js.map +1 -0
- package/dist/development/src/editor/methods/canToggleMark.cjs +7 -0
- package/dist/development/src/editor/methods/canToggleMark.cjs.map +1 -0
- package/dist/development/src/editor/methods/canToggleMark.js +7 -0
- package/dist/development/src/editor/methods/canToggleMark.js.map +1 -0
- package/dist/development/src/editor/methods/closest.cjs +18 -0
- package/dist/development/src/editor/methods/closest.cjs.map +1 -0
- package/dist/development/src/editor/methods/closest.js +18 -0
- package/dist/development/src/editor/methods/closest.js.map +1 -0
- package/dist/development/src/editor/methods/closestBlockEntry.cjs +10 -0
- package/dist/development/src/editor/methods/closestBlockEntry.cjs.map +1 -0
- package/dist/development/src/editor/methods/closestBlockEntry.js +10 -0
- package/dist/development/src/editor/methods/closestBlockEntry.js.map +1 -0
- package/dist/development/src/editor/methods/closestViableBlockContainerEntry.cjs +9 -0
- package/dist/development/src/editor/methods/closestViableBlockContainerEntry.cjs.map +1 -0
- package/dist/development/src/editor/methods/closestViableBlockContainerEntry.js +9 -0
- package/dist/development/src/editor/methods/closestViableBlockContainerEntry.js.map +1 -0
- package/dist/development/src/editor/methods/ejectElement.cjs +15 -0
- package/dist/development/src/editor/methods/ejectElement.cjs.map +1 -0
- package/dist/development/src/editor/methods/ejectElement.js +15 -0
- package/dist/development/src/editor/methods/ejectElement.js.map +1 -0
- package/dist/development/src/editor/methods/elementToSpecifics.cjs +8 -0
- package/dist/development/src/editor/methods/elementToSpecifics.cjs.map +1 -0
- package/dist/development/src/editor/methods/elementToSpecifics.js +8 -0
- package/dist/development/src/editor/methods/elementToSpecifics.js.map +1 -0
- package/dist/development/src/editor/methods/getElementDataAttributes.cjs +13 -0
- package/dist/development/src/editor/methods/getElementDataAttributes.cjs.map +1 -0
- package/dist/development/src/editor/methods/getElementDataAttributes.js +13 -0
- package/dist/development/src/editor/methods/getElementDataAttributes.js.map +1 -0
- package/dist/development/src/editor/methods/getPreviousSibling.cjs +13 -0
- package/dist/development/src/editor/methods/getPreviousSibling.cjs.map +1 -0
- package/dist/development/src/editor/methods/getPreviousSibling.js +13 -0
- package/dist/development/src/editor/methods/getPreviousSibling.js.map +1 -0
- package/dist/development/src/editor/methods/hasMarks.cjs +23 -0
- package/dist/development/src/editor/methods/hasMarks.cjs.map +1 -0
- package/dist/development/src/editor/methods/hasMarks.js +23 -0
- package/dist/development/src/editor/methods/hasMarks.js.map +1 -0
- package/dist/development/src/editor/methods/hasParentOfType.cjs +15 -0
- package/dist/development/src/editor/methods/hasParentOfType.cjs.map +1 -0
- package/dist/development/src/editor/methods/hasParentOfType.js +15 -0
- package/dist/development/src/editor/methods/hasParentOfType.js.map +1 -0
- package/dist/development/src/editor/methods/isElementType.cjs +24 -0
- package/dist/development/src/editor/methods/isElementType.cjs.map +1 -0
- package/dist/development/src/editor/methods/isElementType.js +24 -0
- package/dist/development/src/editor/methods/isElementType.js.map +1 -0
- package/dist/development/src/editor/methods/permissivelyDeserializeNodes.cjs +22 -0
- package/dist/development/src/editor/methods/permissivelyDeserializeNodes.cjs.map +1 -0
- package/dist/development/src/editor/methods/permissivelyDeserializeNodes.js +22 -0
- package/dist/development/src/editor/methods/permissivelyDeserializeNodes.js.map +1 -0
- package/dist/development/src/editor/methods/removeMarks.cjs +12 -0
- package/dist/development/src/editor/methods/removeMarks.cjs.map +1 -0
- package/dist/development/src/editor/methods/removeMarks.js +12 -0
- package/dist/development/src/editor/methods/removeMarks.js.map +1 -0
- package/dist/development/src/editor/methods/serializeNodes.cjs +15 -0
- package/dist/development/src/editor/methods/serializeNodes.cjs.map +1 -0
- package/dist/development/src/editor/methods/serializeNodes.js +15 -0
- package/dist/development/src/editor/methods/serializeNodes.js.map +1 -0
- package/dist/development/src/editor/methods/strictlyDeserializeNodes.cjs +14 -0
- package/dist/development/src/editor/methods/strictlyDeserializeNodes.cjs.map +1 -0
- package/dist/development/src/editor/methods/strictlyDeserializeNodes.js +14 -0
- package/dist/development/src/editor/methods/strictlyDeserializeNodes.js.map +1 -0
- package/dist/development/src/editor/methods/textToSpecifics.cjs +8 -0
- package/dist/development/src/editor/methods/textToSpecifics.cjs.map +1 -0
- package/dist/development/src/editor/methods/textToSpecifics.js +8 -0
- package/dist/development/src/editor/methods/textToSpecifics.js.map +1 -0
- package/dist/development/src/editor/methods/toLatestFormat.cjs +32 -0
- package/dist/development/src/editor/methods/toLatestFormat.cjs.map +1 -0
- package/dist/development/src/editor/methods/toLatestFormat.js +32 -0
- package/dist/development/src/editor/methods/toLatestFormat.js.map +1 -0
- package/dist/development/src/editor/methods/topLevelNodes.cjs +12 -0
- package/dist/development/src/editor/methods/topLevelNodes.cjs.map +1 -0
- package/dist/development/src/editor/methods/topLevelNodes.js +12 -0
- package/dist/development/src/editor/methods/topLevelNodes.js.map +1 -0
- package/dist/development/src/internal/components/DefaultElement.cjs +11 -0
- package/dist/development/src/internal/components/DefaultElement.cjs.map +1 -0
- package/dist/development/src/internal/components/DefaultElement.js +11 -0
- package/dist/development/src/internal/components/DefaultElement.js.map +1 -0
- package/dist/development/src/internal/hooks/useRichTextFieldNodes.cjs +28 -0
- package/dist/development/src/internal/hooks/useRichTextFieldNodes.cjs.map +1 -0
- package/dist/development/src/internal/hooks/useRichTextFieldNodes.js +28 -0
- package/dist/development/src/internal/hooks/useRichTextFieldNodes.js.map +1 -0
- package/dist/development/src/internal/utils/EditorPasteUtils.cjs +47 -0
- package/dist/development/src/internal/utils/EditorPasteUtils.cjs.map +1 -0
- package/dist/development/src/internal/utils/EditorPasteUtils.js +47 -0
- package/dist/development/src/internal/utils/EditorPasteUtils.js.map +1 -0
- package/dist/development/src/internal/utils/parseUrl.cjs +14 -0
- package/dist/development/src/internal/utils/parseUrl.cjs.map +1 -0
- package/dist/development/src/internal/utils/parseUrl.js +14 -0
- package/dist/development/src/internal/utils/parseUrl.js.map +1 -0
- package/dist/development/src/plugins/attributes/alignment/alignButton.cjs +21 -0
- package/dist/development/src/plugins/attributes/alignment/alignButton.cjs.map +1 -0
- package/dist/development/src/plugins/attributes/alignment/alignButton.js +21 -0
- package/dist/development/src/plugins/attributes/alignment/alignButton.js.map +1 -0
- package/dist/development/src/plugins/behaviour/paste/HtmlDeserializer.cjs +136 -0
- package/dist/development/src/plugins/behaviour/paste/HtmlDeserializer.cjs.map +1 -0
- package/dist/development/src/plugins/behaviour/paste/HtmlDeserializer.js +136 -0
- package/dist/development/src/plugins/behaviour/paste/HtmlDeserializer.js.map +1 -0
- package/dist/development/src/plugins/behaviour/paste/createMarkHtmlDeserializer.cjs +15 -0
- package/dist/development/src/plugins/behaviour/paste/createMarkHtmlDeserializer.cjs.map +1 -0
- package/dist/development/src/plugins/behaviour/paste/createMarkHtmlDeserializer.js +15 -0
- package/dist/development/src/plugins/behaviour/paste/createMarkHtmlDeserializer.js.map +1 -0
- package/dist/development/src/plugins/behaviour/paste/withPaste.cjs +24 -0
- package/dist/development/src/plugins/behaviour/paste/withPaste.cjs.map +1 -0
- package/dist/development/src/plugins/behaviour/paste/withPaste.js +24 -0
- package/dist/development/src/plugins/behaviour/paste/withPaste.js.map +1 -0
- package/dist/development/src/plugins/element/anchors/AnchorElement.cjs +44 -0
- package/dist/development/src/plugins/element/anchors/AnchorElement.cjs.map +1 -0
- package/dist/development/src/plugins/element/anchors/AnchorElement.js +44 -0
- package/dist/development/src/plugins/element/anchors/AnchorElement.js.map +1 -0
- package/dist/development/src/plugins/element/anchors/AnchorHtmlDeserializer.cjs +19 -0
- package/dist/development/src/plugins/element/anchors/AnchorHtmlDeserializer.cjs.map +1 -0
- package/dist/development/src/plugins/element/anchors/AnchorHtmlDeserializer.js +19 -0
- package/dist/development/src/plugins/element/anchors/AnchorHtmlDeserializer.js.map +1 -0
- package/dist/development/src/plugins/element/anchors/AnchorModifications.cjs +29 -0
- package/dist/development/src/plugins/element/anchors/AnchorModifications.cjs.map +1 -0
- package/dist/development/src/plugins/element/anchors/AnchorModifications.js +29 -0
- package/dist/development/src/plugins/element/anchors/AnchorModifications.js.map +1 -0
- package/dist/development/src/plugins/element/anchors/withAnchors.cjs +21 -0
- package/dist/development/src/plugins/element/anchors/withAnchors.cjs.map +1 -0
- package/dist/development/src/plugins/element/anchors/withAnchors.js +21 -0
- package/dist/development/src/plugins/element/anchors/withAnchors.js.map +1 -0
- package/dist/development/src/plugins/element/headings/HeadingElement.cjs +41 -0
- package/dist/development/src/plugins/element/headings/HeadingElement.cjs.map +1 -0
- package/dist/development/src/plugins/element/headings/HeadingElement.js +41 -0
- package/dist/development/src/plugins/element/headings/HeadingElement.js.map +1 -0
- package/dist/development/src/plugins/element/headings/HeadingHtmlDeserializer.cjs +22 -0
- package/dist/development/src/plugins/element/headings/HeadingHtmlDeserializer.cjs.map +1 -0
- package/dist/development/src/plugins/element/headings/HeadingHtmlDeserializer.js +22 -0
- package/dist/development/src/plugins/element/headings/HeadingHtmlDeserializer.js.map +1 -0
- package/dist/development/src/plugins/element/headings/withHeadings.cjs +70 -0
- package/dist/development/src/plugins/element/headings/withHeadings.cjs.map +1 -0
- package/dist/development/src/plugins/element/headings/withHeadings.js +70 -0
- package/dist/development/src/plugins/element/headings/withHeadings.js.map +1 -0
- package/dist/development/src/plugins/element/horizonalRules/HorizontalRuleElement.cjs +41 -0
- package/dist/development/src/plugins/element/horizonalRules/HorizontalRuleElement.cjs.map +1 -0
- package/dist/development/src/plugins/element/horizonalRules/HorizontalRuleElement.js +41 -0
- package/dist/development/src/plugins/element/horizonalRules/HorizontalRuleElement.js.map +1 -0
- package/dist/development/src/plugins/element/horizonalRules/withHorizontalRules.cjs +75 -0
- package/dist/development/src/plugins/element/horizonalRules/withHorizontalRules.cjs.map +1 -0
- package/dist/development/src/plugins/element/horizonalRules/withHorizontalRules.js +75 -0
- package/dist/development/src/plugins/element/horizonalRules/withHorizontalRules.js.map +1 -0
- package/dist/development/src/plugins/element/lists/ListElement.cjs +26 -0
- package/dist/development/src/plugins/element/lists/ListElement.cjs.map +1 -0
- package/dist/development/src/plugins/element/lists/ListElement.js +26 -0
- package/dist/development/src/plugins/element/lists/ListElement.js.map +1 -0
- package/dist/development/src/plugins/element/lists/ListHtmlDeserializer.cjs +98 -0
- package/dist/development/src/plugins/element/lists/ListHtmlDeserializer.cjs.map +1 -0
- package/dist/development/src/plugins/element/lists/ListHtmlDeserializer.js +98 -0
- package/dist/development/src/plugins/element/lists/ListHtmlDeserializer.js.map +1 -0
- package/dist/development/src/plugins/element/lists/ListItemElement.cjs +53 -0
- package/dist/development/src/plugins/element/lists/ListItemElement.cjs.map +1 -0
- package/dist/development/src/plugins/element/lists/ListItemElement.js +53 -0
- package/dist/development/src/plugins/element/lists/ListItemElement.js.map +1 -0
- package/dist/development/src/plugins/element/lists/OrderedListElement.cjs +25 -0
- package/dist/development/src/plugins/element/lists/OrderedListElement.cjs.map +1 -0
- package/dist/development/src/plugins/element/lists/OrderedListElement.js +25 -0
- package/dist/development/src/plugins/element/lists/OrderedListElement.js.map +1 -0
- package/dist/development/src/plugins/element/lists/UnorderedListElement.cjs +25 -0
- package/dist/development/src/plugins/element/lists/UnorderedListElement.cjs.map +1 -0
- package/dist/development/src/plugins/element/lists/UnorderedListElement.js +25 -0
- package/dist/development/src/plugins/element/lists/UnorderedListElement.js.map +1 -0
- package/dist/development/src/plugins/element/lists/transforms/dedentListItem.cjs +57 -0
- package/dist/development/src/plugins/element/lists/transforms/dedentListItem.cjs.map +1 -0
- package/dist/development/src/plugins/element/lists/transforms/dedentListItem.js +57 -0
- package/dist/development/src/plugins/element/lists/transforms/dedentListItem.js.map +1 -0
- package/dist/development/src/plugins/element/lists/transforms/indentListItem.cjs +57 -0
- package/dist/development/src/plugins/element/lists/transforms/indentListItem.cjs.map +1 -0
- package/dist/development/src/plugins/element/lists/transforms/indentListItem.js +57 -0
- package/dist/development/src/plugins/element/lists/transforms/indentListItem.js.map +1 -0
- package/dist/development/src/plugins/element/lists/transforms/normalizeListElement.cjs +22 -0
- package/dist/development/src/plugins/element/lists/transforms/normalizeListElement.cjs.map +1 -0
- package/dist/development/src/plugins/element/lists/transforms/normalizeListElement.js +22 -0
- package/dist/development/src/plugins/element/lists/transforms/normalizeListElement.js.map +1 -0
- package/dist/development/src/plugins/element/lists/transforms/toggleListElement.cjs +93 -0
- package/dist/development/src/plugins/element/lists/transforms/toggleListElement.cjs.map +1 -0
- package/dist/development/src/plugins/element/lists/transforms/toggleListElement.js +93 -0
- package/dist/development/src/plugins/element/lists/transforms/toggleListElement.js.map +1 -0
- package/dist/development/src/plugins/element/lists/withLists.cjs +153 -0
- package/dist/development/src/plugins/element/lists/withLists.cjs.map +1 -0
- package/dist/development/src/plugins/element/lists/withLists.js +153 -0
- package/dist/development/src/plugins/element/lists/withLists.js.map +1 -0
- package/dist/development/src/plugins/element/paragraphs/ParagraphElement.cjs +49 -0
- package/dist/development/src/plugins/element/paragraphs/ParagraphElement.cjs.map +1 -0
- package/dist/development/src/plugins/element/paragraphs/ParagraphElement.js +49 -0
- package/dist/development/src/plugins/element/paragraphs/ParagraphElement.js.map +1 -0
- package/dist/development/src/plugins/element/paragraphs/ParagraphHtmlDeserializer.cjs +11 -0
- package/dist/development/src/plugins/element/paragraphs/ParagraphHtmlDeserializer.cjs.map +1 -0
- package/dist/development/src/plugins/element/paragraphs/ParagraphHtmlDeserializer.js +11 -0
- package/dist/development/src/plugins/element/paragraphs/ParagraphHtmlDeserializer.js.map +1 -0
- package/dist/development/src/plugins/element/paragraphs/withParagraphs.cjs +58 -0
- package/dist/development/src/plugins/element/paragraphs/withParagraphs.cjs.map +1 -0
- package/dist/development/src/plugins/element/paragraphs/withParagraphs.js +58 -0
- package/dist/development/src/plugins/element/paragraphs/withParagraphs.js.map +1 -0
- package/dist/development/src/plugins/element/scrollTargets/ScrollTargetElement.cjs +51 -0
- package/dist/development/src/plugins/element/scrollTargets/ScrollTargetElement.cjs.map +1 -0
- package/dist/development/src/plugins/element/scrollTargets/ScrollTargetElement.js +51 -0
- package/dist/development/src/plugins/element/scrollTargets/ScrollTargetElement.js.map +1 -0
- package/dist/development/src/plugins/element/scrollTargets/withScrollTargets.cjs +9 -0
- package/dist/development/src/plugins/element/scrollTargets/withScrollTargets.cjs.map +1 -0
- package/dist/development/src/plugins/element/scrollTargets/withScrollTargets.js +9 -0
- package/dist/development/src/plugins/element/scrollTargets/withScrollTargets.js.map +1 -0
- package/dist/development/src/plugins/element/tables/TableCellElement.cjs +39 -0
- package/dist/development/src/plugins/element/tables/TableCellElement.cjs.map +1 -0
- package/dist/development/src/plugins/element/tables/TableCellElement.js +39 -0
- package/dist/development/src/plugins/element/tables/TableCellElement.js.map +1 -0
- package/dist/development/src/plugins/element/tables/TableElement.cjs +114 -0
- package/dist/development/src/plugins/element/tables/TableElement.cjs.map +1 -0
- package/dist/development/src/plugins/element/tables/TableElement.js +114 -0
- package/dist/development/src/plugins/element/tables/TableElement.js.map +1 -0
- package/dist/development/src/plugins/element/tables/TableElementSelection.cjs +20 -0
- package/dist/development/src/plugins/element/tables/TableElementSelection.cjs.map +1 -0
- package/dist/development/src/plugins/element/tables/TableElementSelection.js +20 -0
- package/dist/development/src/plugins/element/tables/TableElementSelection.js.map +1 -0
- package/dist/development/src/plugins/element/tables/TableHtmlDeserializer.cjs +36 -0
- package/dist/development/src/plugins/element/tables/TableHtmlDeserializer.cjs.map +1 -0
- package/dist/development/src/plugins/element/tables/TableHtmlDeserializer.js +36 -0
- package/dist/development/src/plugins/element/tables/TableHtmlDeserializer.js.map +1 -0
- package/dist/development/src/plugins/element/tables/TableModifications.cjs +134 -0
- package/dist/development/src/plugins/element/tables/TableModifications.cjs.map +1 -0
- package/dist/development/src/plugins/element/tables/TableModifications.js +134 -0
- package/dist/development/src/plugins/element/tables/TableModifications.js.map +1 -0
- package/dist/development/src/plugins/element/tables/TableRowElement.cjs +43 -0
- package/dist/development/src/plugins/element/tables/TableRowElement.cjs.map +1 -0
- package/dist/development/src/plugins/element/tables/TableRowElement.js +43 -0
- package/dist/development/src/plugins/element/tables/TableRowElement.js.map +1 -0
- package/dist/development/src/plugins/element/tables/gaugeTableColumnCount.cjs +25 -0
- package/dist/development/src/plugins/element/tables/gaugeTableColumnCount.cjs.map +1 -0
- package/dist/development/src/plugins/element/tables/gaugeTableColumnCount.js +25 -0
- package/dist/development/src/plugins/element/tables/gaugeTableColumnCount.js.map +1 -0
- package/dist/development/src/plugins/element/tables/withTables.cjs +283 -0
- package/dist/development/src/plugins/element/tables/withTables.cjs.map +1 -0
- package/dist/development/src/plugins/element/tables/withTables.js +283 -0
- package/dist/development/src/plugins/element/tables/withTables.js.map +1 -0
- package/dist/development/src/plugins/text/bold/boldMark.cjs +13 -0
- package/dist/development/src/plugins/text/bold/boldMark.cjs.map +1 -0
- package/dist/development/src/plugins/text/bold/boldMark.js +13 -0
- package/dist/development/src/plugins/text/bold/boldMark.js.map +1 -0
- package/dist/development/src/plugins/text/bold/withBold.cjs +16 -0
- package/dist/development/src/plugins/text/bold/withBold.cjs.map +1 -0
- package/dist/development/src/plugins/text/bold/withBold.js +16 -0
- package/dist/development/src/plugins/text/bold/withBold.js.map +1 -0
- package/dist/development/src/plugins/text/code/codeMark.cjs +13 -0
- package/dist/development/src/plugins/text/code/codeMark.cjs.map +1 -0
- package/dist/development/src/plugins/text/code/codeMark.js +13 -0
- package/dist/development/src/plugins/text/code/codeMark.js.map +1 -0
- package/dist/development/src/plugins/text/code/withCode.cjs +9 -0
- package/dist/development/src/plugins/text/code/withCode.cjs.map +1 -0
- package/dist/development/src/plugins/text/code/withCode.js +9 -0
- package/dist/development/src/plugins/text/code/withCode.js.map +1 -0
- package/dist/development/src/plugins/text/highlight/highlightMark.cjs +13 -0
- package/dist/development/src/plugins/text/highlight/highlightMark.cjs.map +1 -0
- package/dist/development/src/plugins/text/highlight/highlightMark.js +13 -0
- package/dist/development/src/plugins/text/highlight/highlightMark.js.map +1 -0
- package/dist/development/src/plugins/text/highlight/withHighlight.cjs +9 -0
- package/dist/development/src/plugins/text/highlight/withHighlight.cjs.map +1 -0
- package/dist/development/src/plugins/text/highlight/withHighlight.js +9 -0
- package/dist/development/src/plugins/text/highlight/withHighlight.js.map +1 -0
- package/dist/development/src/plugins/text/italic/italicMark.cjs +13 -0
- package/dist/development/src/plugins/text/italic/italicMark.cjs.map +1 -0
- package/dist/development/src/plugins/text/italic/italicMark.js +13 -0
- package/dist/development/src/plugins/text/italic/italicMark.js.map +1 -0
- package/dist/development/src/plugins/text/italic/withItalic.cjs +16 -0
- package/dist/development/src/plugins/text/italic/withItalic.cjs.map +1 -0
- package/dist/development/src/plugins/text/italic/withItalic.js +16 -0
- package/dist/development/src/plugins/text/italic/withItalic.js.map +1 -0
- package/dist/development/src/plugins/text/newline/withNewline.cjs +15 -0
- package/dist/development/src/plugins/text/newline/withNewline.cjs.map +1 -0
- package/dist/development/src/plugins/text/newline/withNewline.js +15 -0
- package/dist/development/src/plugins/text/newline/withNewline.js.map +1 -0
- package/dist/development/src/plugins/text/strikeThrough/strikeThroughMark.cjs +13 -0
- package/dist/development/src/plugins/text/strikeThrough/strikeThroughMark.cjs.map +1 -0
- package/dist/development/src/plugins/text/strikeThrough/strikeThroughMark.js +13 -0
- package/dist/development/src/plugins/text/strikeThrough/strikeThroughMark.js.map +1 -0
- package/dist/development/src/plugins/text/strikeThrough/withStrikeThrough.cjs +17 -0
- package/dist/development/src/plugins/text/strikeThrough/withStrikeThrough.cjs.map +1 -0
- package/dist/development/src/plugins/text/strikeThrough/withStrikeThrough.js +17 -0
- package/dist/development/src/plugins/text/strikeThrough/withStrikeThrough.js.map +1 -0
- package/dist/development/src/plugins/text/underline/underlineMark.cjs +13 -0
- package/dist/development/src/plugins/text/underline/underlineMark.cjs.map +1 -0
- package/dist/development/src/plugins/text/underline/underlineMark.js +13 -0
- package/dist/development/src/plugins/text/underline/underlineMark.js.map +1 -0
- package/dist/development/src/plugins/text/underline/withUnderline.cjs +17 -0
- package/dist/development/src/plugins/text/underline/withUnderline.cjs.map +1 -0
- package/dist/development/src/plugins/text/underline/withUnderline.js +17 -0
- package/dist/development/src/plugins/text/underline/withUnderline.js.map +1 -0
- package/dist/development/src/slate-reexport.cjs +10 -0
- package/dist/development/src/slate-reexport.cjs.map +1 -0
- package/dist/development/src/slate-reexport.js +8 -0
- package/dist/development/src/slate-reexport.js.map +1 -0
- package/dist/production/index.cjs +139 -0
- package/dist/production/index.cjs.map +1 -0
- package/dist/production/index.js +136 -0
- package/dist/production/index.js.map +1 -0
- package/dist/production/src/components/RichTextEditor.cjs +94 -0
- package/dist/production/src/components/RichTextEditor.cjs.map +1 -0
- package/dist/production/src/components/RichTextEditor.js +94 -0
- package/dist/production/src/components/RichTextEditor.js.map +1 -0
- package/dist/production/src/components/triggers/EditorElementTrigger.cjs +16 -0
- package/dist/production/src/components/triggers/EditorElementTrigger.cjs.map +1 -0
- package/dist/production/src/components/triggers/EditorElementTrigger.js +16 -0
- package/dist/production/src/components/triggers/EditorElementTrigger.js.map +1 -0
- package/dist/production/src/components/triggers/EditorGenericTrigger.cjs +20 -0
- package/dist/production/src/components/triggers/EditorGenericTrigger.cjs.map +1 -0
- package/dist/production/src/components/triggers/EditorGenericTrigger.js +20 -0
- package/dist/production/src/components/triggers/EditorGenericTrigger.js.map +1 -0
- package/dist/production/src/components/triggers/EditorMarkTrigger.cjs +16 -0
- package/dist/production/src/components/triggers/EditorMarkTrigger.cjs.map +1 -0
- package/dist/production/src/components/triggers/EditorMarkTrigger.js +16 -0
- package/dist/production/src/components/triggers/EditorMarkTrigger.js.map +1 -0
- package/dist/production/src/components/triggers/EditorWrapNodeTrigger.cjs +28 -0
- package/dist/production/src/components/triggers/EditorWrapNodeTrigger.cjs.map +1 -0
- package/dist/production/src/components/triggers/EditorWrapNodeTrigger.js +28 -0
- package/dist/production/src/components/triggers/EditorWrapNodeTrigger.js.map +1 -0
- package/dist/production/src/editor/createEditor.cjs +35 -0
- package/dist/production/src/editor/createEditor.cjs.map +1 -0
- package/dist/production/src/editor/createEditor.js +35 -0
- package/dist/production/src/editor/createEditor.js.map +1 -0
- package/dist/production/src/editor/createEditorWithEssentials.cjs +227 -0
- package/dist/production/src/editor/createEditorWithEssentials.cjs.map +1 -0
- package/dist/production/src/editor/createEditorWithEssentials.js +211 -0
- package/dist/production/src/editor/createEditorWithEssentials.js.map +1 -0
- package/dist/production/src/editor/index.cjs +44 -0
- package/dist/production/src/editor/index.cjs.map +1 -0
- package/dist/production/src/editor/index.js +44 -0
- package/dist/production/src/editor/index.js.map +1 -0
- package/dist/production/src/editor/methods/addMarks.cjs +12 -0
- package/dist/production/src/editor/methods/addMarks.cjs.map +1 -0
- package/dist/production/src/editor/methods/addMarks.js +12 -0
- package/dist/production/src/editor/methods/addMarks.js.map +1 -0
- package/dist/production/src/editor/methods/canToggleMark.cjs +7 -0
- package/dist/production/src/editor/methods/canToggleMark.cjs.map +1 -0
- package/dist/production/src/editor/methods/canToggleMark.js +7 -0
- package/dist/production/src/editor/methods/canToggleMark.js.map +1 -0
- package/dist/production/src/editor/methods/closest.cjs +18 -0
- package/dist/production/src/editor/methods/closest.cjs.map +1 -0
- package/dist/production/src/editor/methods/closest.js +18 -0
- package/dist/production/src/editor/methods/closest.js.map +1 -0
- package/dist/production/src/editor/methods/closestBlockEntry.cjs +10 -0
- package/dist/production/src/editor/methods/closestBlockEntry.cjs.map +1 -0
- package/dist/production/src/editor/methods/closestBlockEntry.js +10 -0
- package/dist/production/src/editor/methods/closestBlockEntry.js.map +1 -0
- package/dist/production/src/editor/methods/closestViableBlockContainerEntry.cjs +9 -0
- package/dist/production/src/editor/methods/closestViableBlockContainerEntry.cjs.map +1 -0
- package/dist/production/src/editor/methods/closestViableBlockContainerEntry.js +9 -0
- package/dist/production/src/editor/methods/closestViableBlockContainerEntry.js.map +1 -0
- package/dist/production/src/editor/methods/ejectElement.cjs +15 -0
- package/dist/production/src/editor/methods/ejectElement.cjs.map +1 -0
- package/dist/production/src/editor/methods/ejectElement.js +15 -0
- package/dist/production/src/editor/methods/ejectElement.js.map +1 -0
- package/dist/production/src/editor/methods/elementToSpecifics.cjs +8 -0
- package/dist/production/src/editor/methods/elementToSpecifics.cjs.map +1 -0
- package/dist/production/src/editor/methods/elementToSpecifics.js +8 -0
- package/dist/production/src/editor/methods/elementToSpecifics.js.map +1 -0
- package/dist/production/src/editor/methods/getElementDataAttributes.cjs +13 -0
- package/dist/production/src/editor/methods/getElementDataAttributes.cjs.map +1 -0
- package/dist/production/src/editor/methods/getElementDataAttributes.js +13 -0
- package/dist/production/src/editor/methods/getElementDataAttributes.js.map +1 -0
- package/dist/production/src/editor/methods/getPreviousSibling.cjs +13 -0
- package/dist/production/src/editor/methods/getPreviousSibling.cjs.map +1 -0
- package/dist/production/src/editor/methods/getPreviousSibling.js +13 -0
- package/dist/production/src/editor/methods/getPreviousSibling.js.map +1 -0
- package/dist/production/src/editor/methods/hasMarks.cjs +23 -0
- package/dist/production/src/editor/methods/hasMarks.cjs.map +1 -0
- package/dist/production/src/editor/methods/hasMarks.js +23 -0
- package/dist/production/src/editor/methods/hasMarks.js.map +1 -0
- package/dist/production/src/editor/methods/hasParentOfType.cjs +15 -0
- package/dist/production/src/editor/methods/hasParentOfType.cjs.map +1 -0
- package/dist/production/src/editor/methods/hasParentOfType.js +15 -0
- package/dist/production/src/editor/methods/hasParentOfType.js.map +1 -0
- package/dist/production/src/editor/methods/isElementType.cjs +24 -0
- package/dist/production/src/editor/methods/isElementType.cjs.map +1 -0
- package/dist/production/src/editor/methods/isElementType.js +24 -0
- package/dist/production/src/editor/methods/isElementType.js.map +1 -0
- package/dist/production/src/editor/methods/permissivelyDeserializeNodes.cjs +22 -0
- package/dist/production/src/editor/methods/permissivelyDeserializeNodes.cjs.map +1 -0
- package/dist/production/src/editor/methods/permissivelyDeserializeNodes.js +22 -0
- package/dist/production/src/editor/methods/permissivelyDeserializeNodes.js.map +1 -0
- package/dist/production/src/editor/methods/removeMarks.cjs +12 -0
- package/dist/production/src/editor/methods/removeMarks.cjs.map +1 -0
- package/dist/production/src/editor/methods/removeMarks.js +12 -0
- package/dist/production/src/editor/methods/removeMarks.js.map +1 -0
- package/dist/production/src/editor/methods/serializeNodes.cjs +15 -0
- package/dist/production/src/editor/methods/serializeNodes.cjs.map +1 -0
- package/dist/production/src/editor/methods/serializeNodes.js +15 -0
- package/dist/production/src/editor/methods/serializeNodes.js.map +1 -0
- package/dist/production/src/editor/methods/strictlyDeserializeNodes.cjs +14 -0
- package/dist/production/src/editor/methods/strictlyDeserializeNodes.cjs.map +1 -0
- package/dist/production/src/editor/methods/strictlyDeserializeNodes.js +14 -0
- package/dist/production/src/editor/methods/strictlyDeserializeNodes.js.map +1 -0
- package/dist/production/src/editor/methods/textToSpecifics.cjs +8 -0
- package/dist/production/src/editor/methods/textToSpecifics.cjs.map +1 -0
- package/dist/production/src/editor/methods/textToSpecifics.js +8 -0
- package/dist/production/src/editor/methods/textToSpecifics.js.map +1 -0
- package/dist/production/src/editor/methods/toLatestFormat.cjs +32 -0
- package/dist/production/src/editor/methods/toLatestFormat.cjs.map +1 -0
- package/dist/production/src/editor/methods/toLatestFormat.js +32 -0
- package/dist/production/src/editor/methods/toLatestFormat.js.map +1 -0
- package/dist/production/src/editor/methods/topLevelNodes.cjs +12 -0
- package/dist/production/src/editor/methods/topLevelNodes.cjs.map +1 -0
- package/dist/production/src/editor/methods/topLevelNodes.js +12 -0
- package/dist/production/src/editor/methods/topLevelNodes.js.map +1 -0
- package/dist/production/src/internal/components/DefaultElement.cjs +11 -0
- package/dist/production/src/internal/components/DefaultElement.cjs.map +1 -0
- package/dist/production/src/internal/components/DefaultElement.js +11 -0
- package/dist/production/src/internal/components/DefaultElement.js.map +1 -0
- package/dist/production/src/internal/hooks/useRichTextFieldNodes.cjs +28 -0
- package/dist/production/src/internal/hooks/useRichTextFieldNodes.cjs.map +1 -0
- package/dist/production/src/internal/hooks/useRichTextFieldNodes.js +28 -0
- package/dist/production/src/internal/hooks/useRichTextFieldNodes.js.map +1 -0
- package/dist/production/src/internal/utils/EditorPasteUtils.cjs +47 -0
- package/dist/production/src/internal/utils/EditorPasteUtils.cjs.map +1 -0
- package/dist/production/src/internal/utils/EditorPasteUtils.js +47 -0
- package/dist/production/src/internal/utils/EditorPasteUtils.js.map +1 -0
- package/dist/production/src/internal/utils/parseUrl.cjs +14 -0
- package/dist/production/src/internal/utils/parseUrl.cjs.map +1 -0
- package/dist/production/src/internal/utils/parseUrl.js +14 -0
- package/dist/production/src/internal/utils/parseUrl.js.map +1 -0
- package/dist/production/src/plugins/attributes/alignment/alignButton.cjs +21 -0
- package/dist/production/src/plugins/attributes/alignment/alignButton.cjs.map +1 -0
- package/dist/production/src/plugins/attributes/alignment/alignButton.js +21 -0
- package/dist/production/src/plugins/attributes/alignment/alignButton.js.map +1 -0
- package/dist/production/src/plugins/behaviour/paste/HtmlDeserializer.cjs +136 -0
- package/dist/production/src/plugins/behaviour/paste/HtmlDeserializer.cjs.map +1 -0
- package/dist/production/src/plugins/behaviour/paste/HtmlDeserializer.js +136 -0
- package/dist/production/src/plugins/behaviour/paste/HtmlDeserializer.js.map +1 -0
- package/dist/production/src/plugins/behaviour/paste/createMarkHtmlDeserializer.cjs +15 -0
- package/dist/production/src/plugins/behaviour/paste/createMarkHtmlDeserializer.cjs.map +1 -0
- package/dist/production/src/plugins/behaviour/paste/createMarkHtmlDeserializer.js +15 -0
- package/dist/production/src/plugins/behaviour/paste/createMarkHtmlDeserializer.js.map +1 -0
- package/dist/production/src/plugins/behaviour/paste/withPaste.cjs +24 -0
- package/dist/production/src/plugins/behaviour/paste/withPaste.cjs.map +1 -0
- package/dist/production/src/plugins/behaviour/paste/withPaste.js +24 -0
- package/dist/production/src/plugins/behaviour/paste/withPaste.js.map +1 -0
- package/dist/production/src/plugins/element/anchors/AnchorElement.cjs +44 -0
- package/dist/production/src/plugins/element/anchors/AnchorElement.cjs.map +1 -0
- package/dist/production/src/plugins/element/anchors/AnchorElement.js +44 -0
- package/dist/production/src/plugins/element/anchors/AnchorElement.js.map +1 -0
- package/dist/production/src/plugins/element/anchors/AnchorHtmlDeserializer.cjs +19 -0
- package/dist/production/src/plugins/element/anchors/AnchorHtmlDeserializer.cjs.map +1 -0
- package/dist/production/src/plugins/element/anchors/AnchorHtmlDeserializer.js +19 -0
- package/dist/production/src/plugins/element/anchors/AnchorHtmlDeserializer.js.map +1 -0
- package/dist/production/src/plugins/element/anchors/AnchorModifications.cjs +29 -0
- package/dist/production/src/plugins/element/anchors/AnchorModifications.cjs.map +1 -0
- package/dist/production/src/plugins/element/anchors/AnchorModifications.js +29 -0
- package/dist/production/src/plugins/element/anchors/AnchorModifications.js.map +1 -0
- package/dist/production/src/plugins/element/anchors/withAnchors.cjs +21 -0
- package/dist/production/src/plugins/element/anchors/withAnchors.cjs.map +1 -0
- package/dist/production/src/plugins/element/anchors/withAnchors.js +21 -0
- package/dist/production/src/plugins/element/anchors/withAnchors.js.map +1 -0
- package/dist/production/src/plugins/element/headings/HeadingElement.cjs +41 -0
- package/dist/production/src/plugins/element/headings/HeadingElement.cjs.map +1 -0
- package/dist/production/src/plugins/element/headings/HeadingElement.js +41 -0
- package/dist/production/src/plugins/element/headings/HeadingElement.js.map +1 -0
- package/dist/production/src/plugins/element/headings/HeadingHtmlDeserializer.cjs +22 -0
- package/dist/production/src/plugins/element/headings/HeadingHtmlDeserializer.cjs.map +1 -0
- package/dist/production/src/plugins/element/headings/HeadingHtmlDeserializer.js +22 -0
- package/dist/production/src/plugins/element/headings/HeadingHtmlDeserializer.js.map +1 -0
- package/dist/production/src/plugins/element/headings/withHeadings.cjs +70 -0
- package/dist/production/src/plugins/element/headings/withHeadings.cjs.map +1 -0
- package/dist/production/src/plugins/element/headings/withHeadings.js +70 -0
- package/dist/production/src/plugins/element/headings/withHeadings.js.map +1 -0
- package/dist/production/src/plugins/element/horizonalRules/HorizontalRuleElement.cjs +41 -0
- package/dist/production/src/plugins/element/horizonalRules/HorizontalRuleElement.cjs.map +1 -0
- package/dist/production/src/plugins/element/horizonalRules/HorizontalRuleElement.js +41 -0
- package/dist/production/src/plugins/element/horizonalRules/HorizontalRuleElement.js.map +1 -0
- package/dist/production/src/plugins/element/horizonalRules/withHorizontalRules.cjs +75 -0
- package/dist/production/src/plugins/element/horizonalRules/withHorizontalRules.cjs.map +1 -0
- package/dist/production/src/plugins/element/horizonalRules/withHorizontalRules.js +75 -0
- package/dist/production/src/plugins/element/horizonalRules/withHorizontalRules.js.map +1 -0
- package/dist/production/src/plugins/element/lists/ListElement.cjs +26 -0
- package/dist/production/src/plugins/element/lists/ListElement.cjs.map +1 -0
- package/dist/production/src/plugins/element/lists/ListElement.js +26 -0
- package/dist/production/src/plugins/element/lists/ListElement.js.map +1 -0
- package/dist/production/src/plugins/element/lists/ListHtmlDeserializer.cjs +98 -0
- package/dist/production/src/plugins/element/lists/ListHtmlDeserializer.cjs.map +1 -0
- package/dist/production/src/plugins/element/lists/ListHtmlDeserializer.js +98 -0
- package/dist/production/src/plugins/element/lists/ListHtmlDeserializer.js.map +1 -0
- package/dist/production/src/plugins/element/lists/ListItemElement.cjs +53 -0
- package/dist/production/src/plugins/element/lists/ListItemElement.cjs.map +1 -0
- package/dist/production/src/plugins/element/lists/ListItemElement.js +53 -0
- package/dist/production/src/plugins/element/lists/ListItemElement.js.map +1 -0
- package/dist/production/src/plugins/element/lists/OrderedListElement.cjs +25 -0
- package/dist/production/src/plugins/element/lists/OrderedListElement.cjs.map +1 -0
- package/dist/production/src/plugins/element/lists/OrderedListElement.js +25 -0
- package/dist/production/src/plugins/element/lists/OrderedListElement.js.map +1 -0
- package/dist/production/src/plugins/element/lists/UnorderedListElement.cjs +25 -0
- package/dist/production/src/plugins/element/lists/UnorderedListElement.cjs.map +1 -0
- package/dist/production/src/plugins/element/lists/UnorderedListElement.js +25 -0
- package/dist/production/src/plugins/element/lists/UnorderedListElement.js.map +1 -0
- package/dist/production/src/plugins/element/lists/transforms/dedentListItem.cjs +57 -0
- package/dist/production/src/plugins/element/lists/transforms/dedentListItem.cjs.map +1 -0
- package/dist/production/src/plugins/element/lists/transforms/dedentListItem.js +57 -0
- package/dist/production/src/plugins/element/lists/transforms/dedentListItem.js.map +1 -0
- package/dist/production/src/plugins/element/lists/transforms/indentListItem.cjs +57 -0
- package/dist/production/src/plugins/element/lists/transforms/indentListItem.cjs.map +1 -0
- package/dist/production/src/plugins/element/lists/transforms/indentListItem.js +57 -0
- package/dist/production/src/plugins/element/lists/transforms/indentListItem.js.map +1 -0
- package/dist/production/src/plugins/element/lists/transforms/normalizeListElement.cjs +22 -0
- package/dist/production/src/plugins/element/lists/transforms/normalizeListElement.cjs.map +1 -0
- package/dist/production/src/plugins/element/lists/transforms/normalizeListElement.js +22 -0
- package/dist/production/src/plugins/element/lists/transforms/normalizeListElement.js.map +1 -0
- package/dist/production/src/plugins/element/lists/transforms/toggleListElement.cjs +93 -0
- package/dist/production/src/plugins/element/lists/transforms/toggleListElement.cjs.map +1 -0
- package/dist/production/src/plugins/element/lists/transforms/toggleListElement.js +93 -0
- package/dist/production/src/plugins/element/lists/transforms/toggleListElement.js.map +1 -0
- package/dist/production/src/plugins/element/lists/withLists.cjs +153 -0
- package/dist/production/src/plugins/element/lists/withLists.cjs.map +1 -0
- package/dist/production/src/plugins/element/lists/withLists.js +153 -0
- package/dist/production/src/plugins/element/lists/withLists.js.map +1 -0
- package/dist/production/src/plugins/element/paragraphs/ParagraphElement.cjs +49 -0
- package/dist/production/src/plugins/element/paragraphs/ParagraphElement.cjs.map +1 -0
- package/dist/production/src/plugins/element/paragraphs/ParagraphElement.js +49 -0
- package/dist/production/src/plugins/element/paragraphs/ParagraphElement.js.map +1 -0
- package/dist/production/src/plugins/element/paragraphs/ParagraphHtmlDeserializer.cjs +11 -0
- package/dist/production/src/plugins/element/paragraphs/ParagraphHtmlDeserializer.cjs.map +1 -0
- package/dist/production/src/plugins/element/paragraphs/ParagraphHtmlDeserializer.js +11 -0
- package/dist/production/src/plugins/element/paragraphs/ParagraphHtmlDeserializer.js.map +1 -0
- package/dist/production/src/plugins/element/paragraphs/withParagraphs.cjs +58 -0
- package/dist/production/src/plugins/element/paragraphs/withParagraphs.cjs.map +1 -0
- package/dist/production/src/plugins/element/paragraphs/withParagraphs.js +58 -0
- package/dist/production/src/plugins/element/paragraphs/withParagraphs.js.map +1 -0
- package/dist/production/src/plugins/element/scrollTargets/ScrollTargetElement.cjs +51 -0
- package/dist/production/src/plugins/element/scrollTargets/ScrollTargetElement.cjs.map +1 -0
- package/dist/production/src/plugins/element/scrollTargets/ScrollTargetElement.js +51 -0
- package/dist/production/src/plugins/element/scrollTargets/ScrollTargetElement.js.map +1 -0
- package/dist/production/src/plugins/element/scrollTargets/withScrollTargets.cjs +9 -0
- package/dist/production/src/plugins/element/scrollTargets/withScrollTargets.cjs.map +1 -0
- package/dist/production/src/plugins/element/scrollTargets/withScrollTargets.js +9 -0
- package/dist/production/src/plugins/element/scrollTargets/withScrollTargets.js.map +1 -0
- package/dist/production/src/plugins/element/tables/TableCellElement.cjs +39 -0
- package/dist/production/src/plugins/element/tables/TableCellElement.cjs.map +1 -0
- package/dist/production/src/plugins/element/tables/TableCellElement.js +39 -0
- package/dist/production/src/plugins/element/tables/TableCellElement.js.map +1 -0
- package/dist/production/src/plugins/element/tables/TableElement.cjs +114 -0
- package/dist/production/src/plugins/element/tables/TableElement.cjs.map +1 -0
- package/dist/production/src/plugins/element/tables/TableElement.js +114 -0
- package/dist/production/src/plugins/element/tables/TableElement.js.map +1 -0
- package/dist/production/src/plugins/element/tables/TableElementSelection.cjs +20 -0
- package/dist/production/src/plugins/element/tables/TableElementSelection.cjs.map +1 -0
- package/dist/production/src/plugins/element/tables/TableElementSelection.js +20 -0
- package/dist/production/src/plugins/element/tables/TableElementSelection.js.map +1 -0
- package/dist/production/src/plugins/element/tables/TableHtmlDeserializer.cjs +36 -0
- package/dist/production/src/plugins/element/tables/TableHtmlDeserializer.cjs.map +1 -0
- package/dist/production/src/plugins/element/tables/TableHtmlDeserializer.js +36 -0
- package/dist/production/src/plugins/element/tables/TableHtmlDeserializer.js.map +1 -0
- package/dist/production/src/plugins/element/tables/TableModifications.cjs +134 -0
- package/dist/production/src/plugins/element/tables/TableModifications.cjs.map +1 -0
- package/dist/production/src/plugins/element/tables/TableModifications.js +134 -0
- package/dist/production/src/plugins/element/tables/TableModifications.js.map +1 -0
- package/dist/production/src/plugins/element/tables/TableRowElement.cjs +43 -0
- package/dist/production/src/plugins/element/tables/TableRowElement.cjs.map +1 -0
- package/dist/production/src/plugins/element/tables/TableRowElement.js +43 -0
- package/dist/production/src/plugins/element/tables/TableRowElement.js.map +1 -0
- package/dist/production/src/plugins/element/tables/gaugeTableColumnCount.cjs +25 -0
- package/dist/production/src/plugins/element/tables/gaugeTableColumnCount.cjs.map +1 -0
- package/dist/production/src/plugins/element/tables/gaugeTableColumnCount.js +25 -0
- package/dist/production/src/plugins/element/tables/gaugeTableColumnCount.js.map +1 -0
- package/dist/production/src/plugins/element/tables/withTables.cjs +283 -0
- package/dist/production/src/plugins/element/tables/withTables.cjs.map +1 -0
- package/dist/production/src/plugins/element/tables/withTables.js +283 -0
- package/dist/production/src/plugins/element/tables/withTables.js.map +1 -0
- package/dist/production/src/plugins/text/bold/boldMark.cjs +13 -0
- package/dist/production/src/plugins/text/bold/boldMark.cjs.map +1 -0
- package/dist/production/src/plugins/text/bold/boldMark.js +13 -0
- package/dist/production/src/plugins/text/bold/boldMark.js.map +1 -0
- package/dist/production/src/plugins/text/bold/withBold.cjs +16 -0
- package/dist/production/src/plugins/text/bold/withBold.cjs.map +1 -0
- package/dist/production/src/plugins/text/bold/withBold.js +16 -0
- package/dist/production/src/plugins/text/bold/withBold.js.map +1 -0
- package/dist/production/src/plugins/text/code/codeMark.cjs +13 -0
- package/dist/production/src/plugins/text/code/codeMark.cjs.map +1 -0
- package/dist/production/src/plugins/text/code/codeMark.js +13 -0
- package/dist/production/src/plugins/text/code/codeMark.js.map +1 -0
- package/dist/production/src/plugins/text/code/withCode.cjs +9 -0
- package/dist/production/src/plugins/text/code/withCode.cjs.map +1 -0
- package/dist/production/src/plugins/text/code/withCode.js +9 -0
- package/dist/production/src/plugins/text/code/withCode.js.map +1 -0
- package/dist/production/src/plugins/text/highlight/highlightMark.cjs +13 -0
- package/dist/production/src/plugins/text/highlight/highlightMark.cjs.map +1 -0
- package/dist/production/src/plugins/text/highlight/highlightMark.js +13 -0
- package/dist/production/src/plugins/text/highlight/highlightMark.js.map +1 -0
- package/dist/production/src/plugins/text/highlight/withHighlight.cjs +9 -0
- package/dist/production/src/plugins/text/highlight/withHighlight.cjs.map +1 -0
- package/dist/production/src/plugins/text/highlight/withHighlight.js +9 -0
- package/dist/production/src/plugins/text/highlight/withHighlight.js.map +1 -0
- package/dist/production/src/plugins/text/italic/italicMark.cjs +13 -0
- package/dist/production/src/plugins/text/italic/italicMark.cjs.map +1 -0
- package/dist/production/src/plugins/text/italic/italicMark.js +13 -0
- package/dist/production/src/plugins/text/italic/italicMark.js.map +1 -0
- package/dist/production/src/plugins/text/italic/withItalic.cjs +16 -0
- package/dist/production/src/plugins/text/italic/withItalic.cjs.map +1 -0
- package/dist/production/src/plugins/text/italic/withItalic.js +16 -0
- package/dist/production/src/plugins/text/italic/withItalic.js.map +1 -0
- package/dist/production/src/plugins/text/newline/withNewline.cjs +15 -0
- package/dist/production/src/plugins/text/newline/withNewline.cjs.map +1 -0
- package/dist/production/src/plugins/text/newline/withNewline.js +15 -0
- package/dist/production/src/plugins/text/newline/withNewline.js.map +1 -0
- package/dist/production/src/plugins/text/strikeThrough/strikeThroughMark.cjs +13 -0
- package/dist/production/src/plugins/text/strikeThrough/strikeThroughMark.cjs.map +1 -0
- package/dist/production/src/plugins/text/strikeThrough/strikeThroughMark.js +13 -0
- package/dist/production/src/plugins/text/strikeThrough/strikeThroughMark.js.map +1 -0
- package/dist/production/src/plugins/text/strikeThrough/withStrikeThrough.cjs +17 -0
- package/dist/production/src/plugins/text/strikeThrough/withStrikeThrough.cjs.map +1 -0
- package/dist/production/src/plugins/text/strikeThrough/withStrikeThrough.js +17 -0
- package/dist/production/src/plugins/text/strikeThrough/withStrikeThrough.js.map +1 -0
- package/dist/production/src/plugins/text/underline/underlineMark.cjs +13 -0
- package/dist/production/src/plugins/text/underline/underlineMark.cjs.map +1 -0
- package/dist/production/src/plugins/text/underline/underlineMark.js +13 -0
- package/dist/production/src/plugins/text/underline/underlineMark.js.map +1 -0
- package/dist/production/src/plugins/text/underline/withUnderline.cjs +17 -0
- package/dist/production/src/plugins/text/underline/withUnderline.cjs.map +1 -0
- package/dist/production/src/plugins/text/underline/withUnderline.js +17 -0
- package/dist/production/src/plugins/text/underline/withUnderline.js.map +1 -0
- package/dist/production/src/slate-reexport.cjs +10 -0
- package/dist/production/src/slate-reexport.cjs.map +1 -0
- package/dist/production/src/slate-reexport.js +8 -0
- package/dist/production/src/slate-reexport.js.map +1 -0
- package/dist/types/components/RichTextEditor.d.ts +13 -0
- package/dist/types/components/RichTextEditor.d.ts.map +1 -0
- package/dist/types/components/index.d.ts +3 -0
- package/dist/types/components/index.d.ts.map +1 -0
- package/dist/types/components/triggers/EditorElementTrigger.d.ts +8 -0
- package/dist/types/components/triggers/EditorElementTrigger.d.ts.map +1 -0
- package/dist/types/components/triggers/EditorGenericTrigger.d.ts +16 -0
- package/dist/types/components/triggers/EditorGenericTrigger.d.ts.map +1 -0
- package/dist/types/components/triggers/EditorMarkTrigger.d.ts +7 -0
- package/dist/types/components/triggers/EditorMarkTrigger.d.ts.map +1 -0
- package/dist/types/components/triggers/EditorWrapNodeTrigger.d.ts +11 -0
- package/dist/types/components/triggers/EditorWrapNodeTrigger.d.ts.map +1 -0
- package/dist/types/components/triggers/index.d.ts +5 -0
- package/dist/types/components/triggers/index.d.ts.map +1 -0
- package/dist/types/editor/createEditor.d.ts +24 -0
- package/dist/types/editor/createEditor.d.ts.map +1 -0
- package/dist/types/editor/createEditorWithEssentials.d.ts +5 -0
- package/dist/types/editor/createEditorWithEssentials.d.ts.map +1 -0
- package/dist/types/editor/index.d.ts +35 -0
- package/dist/types/editor/index.d.ts.map +1 -0
- package/dist/types/editor/methods/addMarks.d.ts +4 -0
- package/dist/types/editor/methods/addMarks.d.ts.map +1 -0
- package/dist/types/editor/methods/canToggleMark.d.ts +3 -0
- package/dist/types/editor/methods/canToggleMark.d.ts.map +1 -0
- package/dist/types/editor/methods/closest.d.ts +6 -0
- package/dist/types/editor/methods/closest.d.ts.map +1 -0
- package/dist/types/editor/methods/closestBlockEntry.d.ts +6 -0
- package/dist/types/editor/methods/closestBlockEntry.d.ts.map +1 -0
- package/dist/types/editor/methods/closestViableBlockContainerEntry.d.ts +6 -0
- package/dist/types/editor/methods/closestViableBlockContainerEntry.d.ts.map +1 -0
- package/dist/types/editor/methods/ejectElement.d.ts +3 -0
- package/dist/types/editor/methods/ejectElement.d.ts.map +1 -0
- package/dist/types/editor/methods/elementToSpecifics.d.ts +3 -0
- package/dist/types/editor/methods/elementToSpecifics.d.ts.map +1 -0
- package/dist/types/editor/methods/getElementDataAttributes.d.ts +7 -0
- package/dist/types/editor/methods/getElementDataAttributes.d.ts.map +1 -0
- package/dist/types/editor/methods/getPreviousSibling.d.ts +3 -0
- package/dist/types/editor/methods/getPreviousSibling.d.ts.map +1 -0
- package/dist/types/editor/methods/hasMarks.d.ts +7 -0
- package/dist/types/editor/methods/hasMarks.d.ts.map +1 -0
- package/dist/types/editor/methods/hasParentOfType.d.ts +3 -0
- package/dist/types/editor/methods/hasParentOfType.d.ts.map +1 -0
- package/dist/types/editor/methods/index.d.ts +20 -0
- package/dist/types/editor/methods/index.d.ts.map +1 -0
- package/dist/types/editor/methods/isElementType.d.ts +3 -0
- package/dist/types/editor/methods/isElementType.d.ts.map +1 -0
- package/dist/types/editor/methods/permissivelyDeserializeNodes.d.ts +3 -0
- package/dist/types/editor/methods/permissivelyDeserializeNodes.d.ts.map +1 -0
- package/dist/types/editor/methods/removeMarks.d.ts +4 -0
- package/dist/types/editor/methods/removeMarks.d.ts.map +1 -0
- package/dist/types/editor/methods/serializeNodes.d.ts +3 -0
- package/dist/types/editor/methods/serializeNodes.d.ts.map +1 -0
- package/dist/types/editor/methods/strictlyDeserializeNodes.d.ts +3 -0
- package/dist/types/editor/methods/strictlyDeserializeNodes.d.ts.map +1 -0
- package/dist/types/editor/methods/textToSpecifics.d.ts +4 -0
- package/dist/types/editor/methods/textToSpecifics.d.ts.map +1 -0
- package/dist/types/editor/methods/toLatestFormat.d.ts +4 -0
- package/dist/types/editor/methods/toLatestFormat.d.ts.map +1 -0
- package/dist/types/editor/methods/topLevelNodes.d.ts +3 -0
- package/dist/types/editor/methods/topLevelNodes.d.ts.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/internal/components/DefaultElement.d.ts +6 -0
- package/dist/types/internal/components/DefaultElement.d.ts.map +1 -0
- package/dist/types/internal/hooks/useRichTextFieldNodes.d.ts +9 -0
- package/dist/types/internal/hooks/useRichTextFieldNodes.d.ts.map +1 -0
- package/dist/types/internal/utils/EditorPasteUtils.d.ts +7 -0
- package/dist/types/internal/utils/EditorPasteUtils.d.ts.map +1 -0
- package/dist/types/internal/utils/index.d.ts +3 -0
- package/dist/types/internal/utils/index.d.ts.map +1 -0
- package/dist/types/internal/utils/parseIframeSrc.d.ts +2 -0
- package/dist/types/internal/utils/parseIframeSrc.d.ts.map +1 -0
- package/dist/types/internal/utils/parseUrl.d.ts +2 -0
- package/dist/types/internal/utils/parseUrl.d.ts.map +1 -0
- package/dist/types/plugins/attributes/alignment/alignButton.d.ts +14 -0
- package/dist/types/plugins/attributes/alignment/alignButton.d.ts.map +1 -0
- package/dist/types/plugins/attributes/alignment/index.d.ts +2 -0
- package/dist/types/plugins/attributes/alignment/index.d.ts.map +1 -0
- package/dist/types/plugins/attributes/index.d.ts +2 -0
- package/dist/types/plugins/attributes/index.d.ts.map +1 -0
- package/dist/types/plugins/behaviour/index.d.ts +2 -0
- package/dist/types/plugins/behaviour/index.d.ts.map +1 -0
- package/dist/types/plugins/behaviour/paste/HtmlDeserializer.d.ts +34 -0
- package/dist/types/plugins/behaviour/paste/HtmlDeserializer.d.ts.map +1 -0
- package/dist/types/plugins/behaviour/paste/createMarkHtmlDeserializer.d.ts +3 -0
- package/dist/types/plugins/behaviour/paste/createMarkHtmlDeserializer.d.ts.map +1 -0
- package/dist/types/plugins/behaviour/paste/index.d.ts +3 -0
- package/dist/types/plugins/behaviour/paste/index.d.ts.map +1 -0
- package/dist/types/plugins/behaviour/paste/withPaste.d.ts +3 -0
- package/dist/types/plugins/behaviour/paste/withPaste.d.ts.map +1 -0
- package/dist/types/plugins/element/anchors/AnchorElement.d.ts +14 -0
- package/dist/types/plugins/element/anchors/AnchorElement.d.ts.map +1 -0
- package/dist/types/plugins/element/anchors/AnchorHtmlDeserializer.d.ts +3 -0
- package/dist/types/plugins/element/anchors/AnchorHtmlDeserializer.d.ts.map +1 -0
- package/dist/types/plugins/element/anchors/AnchorModifications.d.ts +6 -0
- package/dist/types/plugins/element/anchors/AnchorModifications.d.ts.map +1 -0
- package/dist/types/plugins/element/anchors/index.d.ts +4 -0
- package/dist/types/plugins/element/anchors/index.d.ts.map +1 -0
- package/dist/types/plugins/element/anchors/withAnchors.d.ts +7 -0
- package/dist/types/plugins/element/anchors/withAnchors.d.ts.map +1 -0
- package/dist/types/plugins/element/headings/HeadingElement.d.ts +17 -0
- package/dist/types/plugins/element/headings/HeadingElement.d.ts.map +1 -0
- package/dist/types/plugins/element/headings/HeadingHtmlDeserializer.d.ts +3 -0
- package/dist/types/plugins/element/headings/HeadingHtmlDeserializer.d.ts.map +1 -0
- package/dist/types/plugins/element/headings/index.d.ts +4 -0
- package/dist/types/plugins/element/headings/index.d.ts.map +1 -0
- package/dist/types/plugins/element/headings/withHeadings.d.ts +7 -0
- package/dist/types/plugins/element/headings/withHeadings.d.ts.map +1 -0
- package/dist/types/plugins/element/horizonalRules/HorizontalRuleElement.d.ts +13 -0
- package/dist/types/plugins/element/horizonalRules/HorizontalRuleElement.d.ts.map +1 -0
- package/dist/types/plugins/element/horizonalRules/index.d.ts +3 -0
- package/dist/types/plugins/element/horizonalRules/index.d.ts.map +1 -0
- package/dist/types/plugins/element/horizonalRules/withHorizontalRules.d.ts +7 -0
- package/dist/types/plugins/element/horizonalRules/withHorizontalRules.d.ts.map +1 -0
- package/dist/types/plugins/element/index.d.ts +8 -0
- package/dist/types/plugins/element/index.d.ts.map +1 -0
- package/dist/types/plugins/element/lists/ListElement.d.ts +6 -0
- package/dist/types/plugins/element/lists/ListElement.d.ts.map +1 -0
- package/dist/types/plugins/element/lists/ListHtmlDeserializer.d.ts +10 -0
- package/dist/types/plugins/element/lists/ListHtmlDeserializer.d.ts.map +1 -0
- package/dist/types/plugins/element/lists/ListItemElement.d.ts +12 -0
- package/dist/types/plugins/element/lists/ListItemElement.d.ts.map +1 -0
- package/dist/types/plugins/element/lists/OrderedListElement.d.ts +12 -0
- package/dist/types/plugins/element/lists/OrderedListElement.d.ts.map +1 -0
- package/dist/types/plugins/element/lists/UnorderedListElement.d.ts +12 -0
- package/dist/types/plugins/element/lists/UnorderedListElement.d.ts.map +1 -0
- package/dist/types/plugins/element/lists/index.d.ts +6 -0
- package/dist/types/plugins/element/lists/index.d.ts.map +1 -0
- package/dist/types/plugins/element/lists/transforms/dedentListItem.d.ts +4 -0
- package/dist/types/plugins/element/lists/transforms/dedentListItem.d.ts.map +1 -0
- package/dist/types/plugins/element/lists/transforms/indentListItem.d.ts +4 -0
- package/dist/types/plugins/element/lists/transforms/indentListItem.d.ts.map +1 -0
- package/dist/types/plugins/element/lists/transforms/index.d.ts +5 -0
- package/dist/types/plugins/element/lists/transforms/index.d.ts.map +1 -0
- package/dist/types/plugins/element/lists/transforms/normalizeListElement.d.ts +7 -0
- package/dist/types/plugins/element/lists/transforms/normalizeListElement.d.ts.map +1 -0
- package/dist/types/plugins/element/lists/transforms/toggleListElement.d.ts +5 -0
- package/dist/types/plugins/element/lists/transforms/toggleListElement.d.ts.map +1 -0
- package/dist/types/plugins/element/lists/withLists.d.ts +11 -0
- package/dist/types/plugins/element/lists/withLists.d.ts.map +1 -0
- package/dist/types/plugins/element/paragraphs/ParagraphElement.d.ts +15 -0
- package/dist/types/plugins/element/paragraphs/ParagraphElement.d.ts.map +1 -0
- package/dist/types/plugins/element/paragraphs/ParagraphHtmlDeserializer.d.ts +3 -0
- package/dist/types/plugins/element/paragraphs/ParagraphHtmlDeserializer.d.ts.map +1 -0
- package/dist/types/plugins/element/paragraphs/index.d.ts +4 -0
- package/dist/types/plugins/element/paragraphs/index.d.ts.map +1 -0
- package/dist/types/plugins/element/paragraphs/withParagraphs.d.ts +7 -0
- package/dist/types/plugins/element/paragraphs/withParagraphs.d.ts.map +1 -0
- package/dist/types/plugins/element/scrollTargets/ScrollTargetElement.d.ts +14 -0
- package/dist/types/plugins/element/scrollTargets/ScrollTargetElement.d.ts.map +1 -0
- package/dist/types/plugins/element/scrollTargets/index.d.ts +3 -0
- package/dist/types/plugins/element/scrollTargets/index.d.ts.map +1 -0
- package/dist/types/plugins/element/scrollTargets/withScrollTargets.d.ts +7 -0
- package/dist/types/plugins/element/scrollTargets/withScrollTargets.d.ts.map +1 -0
- package/dist/types/plugins/element/tables/TableCellElement.d.ts +20 -0
- package/dist/types/plugins/element/tables/TableCellElement.d.ts.map +1 -0
- package/dist/types/plugins/element/tables/TableElement.d.ts +26 -0
- package/dist/types/plugins/element/tables/TableElement.d.ts.map +1 -0
- package/dist/types/plugins/element/tables/TableElementSelection.d.ts +6 -0
- package/dist/types/plugins/element/tables/TableElementSelection.d.ts.map +1 -0
- package/dist/types/plugins/element/tables/TableHtmlDeserializer.d.ts +3 -0
- package/dist/types/plugins/element/tables/TableHtmlDeserializer.d.ts.map +1 -0
- package/dist/types/plugins/element/tables/TableModifications.d.ts +14 -0
- package/dist/types/plugins/element/tables/TableModifications.d.ts.map +1 -0
- package/dist/types/plugins/element/tables/TableRowElement.d.ts +22 -0
- package/dist/types/plugins/element/tables/TableRowElement.d.ts.map +1 -0
- package/dist/types/plugins/element/tables/gaugeTableColumnCount.d.ts +3 -0
- package/dist/types/plugins/element/tables/gaugeTableColumnCount.d.ts.map +1 -0
- package/dist/types/plugins/element/tables/index.d.ts +6 -0
- package/dist/types/plugins/element/tables/index.d.ts.map +1 -0
- package/dist/types/plugins/element/tables/withTables.d.ts +11 -0
- package/dist/types/plugins/element/tables/withTables.d.ts.map +1 -0
- package/dist/types/plugins/index.d.ts +5 -0
- package/dist/types/plugins/index.d.ts.map +1 -0
- package/dist/types/plugins/text/bold/boldMark.d.ts +4 -0
- package/dist/types/plugins/text/bold/boldMark.d.ts.map +1 -0
- package/dist/types/plugins/text/bold/index.d.ts +3 -0
- package/dist/types/plugins/text/bold/index.d.ts.map +1 -0
- package/dist/types/plugins/text/bold/withBold.d.ts +3 -0
- package/dist/types/plugins/text/bold/withBold.d.ts.map +1 -0
- package/dist/types/plugins/text/code/codeMark.d.ts +4 -0
- package/dist/types/plugins/text/code/codeMark.d.ts.map +1 -0
- package/dist/types/plugins/text/code/index.d.ts +3 -0
- package/dist/types/plugins/text/code/index.d.ts.map +1 -0
- package/dist/types/plugins/text/code/withCode.d.ts +3 -0
- package/dist/types/plugins/text/code/withCode.d.ts.map +1 -0
- package/dist/types/plugins/text/highlight/highlightMark.d.ts +4 -0
- package/dist/types/plugins/text/highlight/highlightMark.d.ts.map +1 -0
- package/dist/types/plugins/text/highlight/index.d.ts +3 -0
- package/dist/types/plugins/text/highlight/index.d.ts.map +1 -0
- package/dist/types/plugins/text/highlight/withHighlight.d.ts +3 -0
- package/dist/types/plugins/text/highlight/withHighlight.d.ts.map +1 -0
- package/dist/types/plugins/text/index.d.ts +8 -0
- package/dist/types/plugins/text/index.d.ts.map +1 -0
- package/dist/types/plugins/text/italic/index.d.ts +3 -0
- package/dist/types/plugins/text/italic/index.d.ts.map +1 -0
- package/dist/types/plugins/text/italic/italicMark.d.ts +4 -0
- package/dist/types/plugins/text/italic/italicMark.d.ts.map +1 -0
- package/dist/types/plugins/text/italic/withItalic.d.ts +3 -0
- package/dist/types/plugins/text/italic/withItalic.d.ts.map +1 -0
- package/dist/types/plugins/text/newline/index.d.ts +2 -0
- package/dist/types/plugins/text/newline/index.d.ts.map +1 -0
- package/dist/types/plugins/text/newline/withNewline.d.ts +3 -0
- package/dist/types/plugins/text/newline/withNewline.d.ts.map +1 -0
- package/dist/types/plugins/text/strikeThrough/index.d.ts +3 -0
- package/dist/types/plugins/text/strikeThrough/index.d.ts.map +1 -0
- package/dist/types/plugins/text/strikeThrough/strikeThroughMark.d.ts +4 -0
- package/dist/types/plugins/text/strikeThrough/strikeThroughMark.d.ts.map +1 -0
- package/dist/types/plugins/text/strikeThrough/withStrikeThrough.d.ts +3 -0
- package/dist/types/plugins/text/strikeThrough/withStrikeThrough.d.ts.map +1 -0
- package/dist/types/plugins/text/underline/index.d.ts +3 -0
- package/dist/types/plugins/text/underline/index.d.ts.map +1 -0
- package/dist/types/plugins/text/underline/underlineMark.d.ts +4 -0
- package/dist/types/plugins/text/underline/underlineMark.d.ts.map +1 -0
- package/dist/types/plugins/text/underline/withUnderline.d.ts +3 -0
- package/dist/types/plugins/text/underline/withUnderline.d.ts.map +1 -0
- package/dist/types/slate-reexport.d.ts +3 -0
- package/dist/types/slate-reexport.d.ts.map +1 -0
- package/dist/types/slate-types.d.ts +31 -0
- package/dist/types/slate-types.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/dist/types/types/editor.d.ts +43 -0
- package/dist/types/types/editor.d.ts.map +1 -0
- package/dist/types/types/htmlDeserializer.d.ts +38 -0
- package/dist/types/types/htmlDeserializer.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +4 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/types/plugins.d.ts +58 -0
- package/dist/types/types/plugins.d.ts.map +1 -0
- package/package.json +14 -14
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { Element, Editor, Range, Node, Transforms } from "slate";
|
|
2
|
+
import { createEmptyTableRowElement, isTableRowElement, tableRowElementType } from "./TableRowElement.js";
|
|
3
|
+
import { ContemberEditor } from "../../../editor/index.js";
|
|
4
|
+
import { gaugeTableColumnCount } from "./gaugeTableColumnCount.js";
|
|
5
|
+
import { createEmptyTableCellElement } from "./TableCellElement.js";
|
|
6
|
+
const tableElementType = "table";
|
|
7
|
+
const isTableElement = (element) => Element.isElement(element) && element.type === tableElementType;
|
|
8
|
+
const createEmptyTableElement = (rowCount = 3, columnCount = 2) => ({
|
|
9
|
+
type: tableElementType,
|
|
10
|
+
children: Array.from({ length: rowCount }, () => createEmptyTableRowElement(columnCount))
|
|
11
|
+
});
|
|
12
|
+
const getTableElementRowCount = (element) => {
|
|
13
|
+
return element.children.length;
|
|
14
|
+
};
|
|
15
|
+
const getTableElementColumnCount = (element) => {
|
|
16
|
+
const firstRow = element.children[0];
|
|
17
|
+
return firstRow?.children.length ?? 0;
|
|
18
|
+
};
|
|
19
|
+
const tableElementPlugin = ({ render }) => ({
|
|
20
|
+
type: tableElementType,
|
|
21
|
+
render,
|
|
22
|
+
normalizeNode: ({ editor, element, path, preventDefault }) => {
|
|
23
|
+
if (element.children.length === 0) {
|
|
24
|
+
Transforms.removeNodes(editor, { at: path });
|
|
25
|
+
return preventDefault();
|
|
26
|
+
}
|
|
27
|
+
let didTransform = false;
|
|
28
|
+
for (const [child, childPath] of Node.children(editor, path)) {
|
|
29
|
+
if (Element.isElement(child)) {
|
|
30
|
+
if (!isTableRowElement(child)) {
|
|
31
|
+
ContemberEditor.ejectElement(editor, childPath);
|
|
32
|
+
Transforms.setNodes(editor, { type: tableRowElementType }, { at: childPath });
|
|
33
|
+
didTransform = true;
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
Transforms.removeNodes(editor, { at: path });
|
|
37
|
+
return preventDefault();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (didTransform) {
|
|
41
|
+
return preventDefault();
|
|
42
|
+
}
|
|
43
|
+
const columnCount = gaugeTableColumnCount(element);
|
|
44
|
+
for (const [row, childPath] of Node.children(editor, path)) {
|
|
45
|
+
const currentColumnCount = row.children.length;
|
|
46
|
+
if (currentColumnCount === columnCount) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (currentColumnCount > columnCount) {
|
|
50
|
+
const shouldBiasTowardsStart = childPath[childPath.length - 1] === 0;
|
|
51
|
+
for (let i = columnCount; i < currentColumnCount; i++) {
|
|
52
|
+
Transforms.removeNodes(editor, { at: [...childPath, shouldBiasTowardsStart ? 0 : i] });
|
|
53
|
+
}
|
|
54
|
+
} else if (currentColumnCount < columnCount) {
|
|
55
|
+
const shouldBiasTowardsStart = childPath[childPath.length - 1] === 0;
|
|
56
|
+
for (let i = currentColumnCount; i < columnCount; i++) {
|
|
57
|
+
Transforms.insertNodes(editor, createEmptyTableCellElement(), {
|
|
58
|
+
at: [...childPath, shouldBiasTowardsStart ? 0 : i]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
canContainAnyBlocks: false,
|
|
65
|
+
toggleElement: ({ editor }) => {
|
|
66
|
+
const closestTableEntry = Editor.above(editor, {
|
|
67
|
+
mode: "lowest",
|
|
68
|
+
match: (matchedNode) => Element.isElement(matchedNode) && isTableElement(matchedNode)
|
|
69
|
+
});
|
|
70
|
+
if (closestTableEntry) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const { selection } = editor;
|
|
74
|
+
if (!selection || Range.isExpanded(selection)) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const closestDefaultEntry = Editor.above(editor, {
|
|
78
|
+
at: selection.focus,
|
|
79
|
+
mode: "lowest",
|
|
80
|
+
match: (matchedNode) => Element.isElement(matchedNode) && editor.isDefaultElement(matchedNode)
|
|
81
|
+
});
|
|
82
|
+
if (!closestDefaultEntry) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const [closestDefault, closestDefaultPath] = closestDefaultEntry;
|
|
86
|
+
if (closestDefaultPath.length !== 1) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
Editor.withoutNormalizing(editor, () => {
|
|
90
|
+
let targetPath;
|
|
91
|
+
if (Node.string(closestDefault) === "") {
|
|
92
|
+
Transforms.removeNodes(editor, {
|
|
93
|
+
at: closestDefaultPath
|
|
94
|
+
});
|
|
95
|
+
targetPath = closestDefaultPath;
|
|
96
|
+
} else {
|
|
97
|
+
targetPath = [closestDefaultPath[0] + 1];
|
|
98
|
+
}
|
|
99
|
+
const table = createEmptyTableElement();
|
|
100
|
+
Transforms.insertNodes(editor, table, {
|
|
101
|
+
at: targetPath
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
export {
|
|
107
|
+
createEmptyTableElement,
|
|
108
|
+
getTableElementColumnCount,
|
|
109
|
+
getTableElementRowCount,
|
|
110
|
+
isTableElement,
|
|
111
|
+
tableElementPlugin,
|
|
112
|
+
tableElementType
|
|
113
|
+
};
|
|
114
|
+
//# sourceMappingURL=TableElement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableElement.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableElement.ts"],"sourcesContent":["import {\n\tEditor,\n\tEditor as SlateEditor,\n\tElement,\n\tElement as SlateElement,\n\tNode,\n\tNode as SlateNode,\n\tNodeEntry,\n\tPath as SlatePath,\n\tRange as SlateRange,\n\tTransforms,\n} from 'slate'\nimport { createEmptyTableRowElement, isTableRowElement, TableRowElement, tableRowElementType } from './TableRowElement'\nimport { ContemberEditor } from '../../../editor'\nimport { gaugeTableColumnCount } from './gaugeTableColumnCount'\nimport { createEmptyTableCellElement } from './TableCellElement'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const tableElementType = 'table' as const\n\nexport interface TableElement extends SlateElement {\n\ttype: typeof tableElementType\n\tchildren: SlateEditor['children']\n}\n\nexport const isTableElement = (element: Node): element is TableElement => Element.isElement(element) && element.type === tableElementType\n\nexport const createEmptyTableElement = (rowCount = 3, columnCount = 2) => ({\n\ttype: tableElementType,\n\tchildren: Array.from({ length: rowCount }, () => createEmptyTableRowElement(columnCount)),\n})\n\nexport const getTableElementRowCount = (element: TableElement): number => {\n\treturn element.children.length\n}\n\nexport const getTableElementColumnCount = (element: TableElement): number => {\n\tconst firstRow = element.children[0] as TableRowElement | undefined\n\treturn firstRow?.children.length ?? 0\n}\n\nexport const tableElementPlugin = ({ render }: { render: ElementRenderer<TableElement> }): EditorElementPlugin<TableElement> => ({\n\ttype: tableElementType,\n\trender,\n\tnormalizeNode: ({ editor, element, path, preventDefault }) => {\n\t\tif (element.children.length === 0) {\n\t\t\tTransforms.removeNodes(editor, { at: path })\n\t\t\treturn preventDefault()\n\t\t}\n\n\t\tlet didTransform = false\n\t\tfor (const [child, childPath] of SlateNode.children(editor, path)) {\n\t\t\tif (SlateElement.isElement(child)) {\n\t\t\t\tif (!isTableRowElement(child)) {\n\t\t\t\t\tContemberEditor.ejectElement(editor, childPath)\n\t\t\t\t\tTransforms.setNodes(editor, { type: tableRowElementType }, { at: childPath })\n\t\t\t\t\tdidTransform = true\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tTransforms.removeNodes(editor, { at: path })\n\t\t\t\treturn preventDefault()\n\t\t\t}\n\t\t}\n\t\tif (didTransform) {\n\t\t\treturn preventDefault()\n\t\t}\n\t\tconst columnCount = gaugeTableColumnCount(element)\n\t\tfor (const [row, childPath] of SlateNode.children(editor, path) as Iterable<NodeEntry<TableRowElement>>) {\n\t\t\tconst currentColumnCount = row.children.length\n\t\t\tif (currentColumnCount === columnCount) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// For the first row, we prepend or insert at the start which in most cases will likely preserve the\n\t\t\t// already existing cells' positions.\n\t\t\tif (currentColumnCount > columnCount) {\n\t\t\t\tconst shouldBiasTowardsStart = childPath[childPath.length - 1] === 0\n\t\t\t\tfor (let i = columnCount; i < currentColumnCount; i++) {\n\t\t\t\t\tTransforms.removeNodes(editor, { at: [...childPath, shouldBiasTowardsStart ? 0 : i] })\n\t\t\t\t}\n\t\t\t} else if (currentColumnCount < columnCount) {\n\t\t\t\tconst shouldBiasTowardsStart = childPath[childPath.length - 1] === 0\n\t\t\t\tfor (let i = currentColumnCount; i < columnCount; i++) {\n\t\t\t\t\tTransforms.insertNodes(editor, createEmptyTableCellElement(), {\n\t\t\t\t\t\tat: [...childPath, shouldBiasTowardsStart ? 0 : i],\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\tcanContainAnyBlocks: false,\n\ttoggleElement: ({ editor }) => {\n\t\tconst closestTableEntry = Editor.above(editor, {\n\t\t\tmode: 'lowest',\n\t\t\tmatch: matchedNode => SlateElement.isElement(matchedNode) && isTableElement(matchedNode),\n\t\t})\n\t\tif (closestTableEntry) {\n\t\t\treturn\n\t\t}\n\t\tconst { selection } = editor\n\t\tif (!selection || SlateRange.isExpanded(selection)) {\n\t\t\treturn\n\t\t}\n\n\t\tconst closestDefaultEntry: NodeEntry | undefined = Editor.above(editor, {\n\t\t\tat: selection.focus,\n\t\t\tmode: 'lowest',\n\t\t\tmatch: matchedNode => SlateElement.isElement(matchedNode) && editor.isDefaultElement(matchedNode),\n\t\t})\n\t\tif (!closestDefaultEntry) {\n\t\t\treturn\n\t\t}\n\t\tconst [closestDefault, closestDefaultPath] = closestDefaultEntry\n\n\t\tif (closestDefaultPath.length !== 1) {\n\t\t\treturn // We only support tables at the very top level\n\t\t}\n\n\t\tEditor.withoutNormalizing(editor, () => {\n\t\t\tlet targetPath: SlatePath\n\t\t\tif (SlateNode.string(closestDefault) === '') {\n\t\t\t\tTransforms.removeNodes(editor, {\n\t\t\t\t\tat: closestDefaultPath,\n\t\t\t\t})\n\t\t\t\ttargetPath = closestDefaultPath\n\t\t\t} else {\n\t\t\t\ttargetPath = [closestDefaultPath[0] + 1]\n\t\t\t}\n\t\t\tconst table = createEmptyTableElement()\n\n\t\t\tTransforms.insertNodes(editor, table, {\n\t\t\t\tat: targetPath,\n\t\t\t})\n\t\t})\n\t},\n})\n"],"names":["SlateNode","SlateElement","SlateRange"],"mappings":"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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const slateReact = require("slate-react");
|
|
4
|
+
const Slate = require("slate");
|
|
5
|
+
const selectTableCellContents = (editor, table, rowIndex, columnIndex) => {
|
|
6
|
+
if (!Array.isArray(table)) {
|
|
7
|
+
table = slateReact.ReactEditor.findPath(editor, table);
|
|
8
|
+
}
|
|
9
|
+
Slate.Transforms.select(editor, {
|
|
10
|
+
anchor: Slate.Editor.start(editor, [...table, rowIndex, columnIndex]),
|
|
11
|
+
focus: Slate.Editor.end(editor, [...table, rowIndex, columnIndex])
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
const getTableCellCoordinates = (editor, element) => {
|
|
15
|
+
const cellPath = slateReact.ReactEditor.findPath(editor, element);
|
|
16
|
+
return cellPath.slice(-2);
|
|
17
|
+
};
|
|
18
|
+
exports.getTableCellCoordinates = getTableCellCoordinates;
|
|
19
|
+
exports.selectTableCellContents = selectTableCellContents;
|
|
20
|
+
//# sourceMappingURL=TableElementSelection.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableElementSelection.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableElementSelection.ts"],"sourcesContent":["import { ReactEditor } from 'slate-react'\nimport { Editor, Path as SlatePath, Transforms } from 'slate'\nimport { TableCellElement } from './TableCellElement'\nimport { TableElement } from './TableElement'\n\nexport const selectTableCellContents = (editor: Editor, table: TableElement | SlatePath, rowIndex: number, columnIndex: number) => {\n\tif (!Array.isArray(table)) {\n\t\ttable = ReactEditor.findPath(editor, table)\n\t}\n\tTransforms.select(editor, {\n\t\tanchor: Editor.start(editor, [...table, rowIndex, columnIndex]),\n\t\tfocus: Editor.end(editor, [...table, rowIndex, columnIndex]),\n\t})\n}\n\nexport const getTableCellCoordinates = (editor: Editor, element: TableCellElement) => {\n\tconst cellPath = ReactEditor.findPath(editor, element)\n\treturn cellPath.slice(-2) as [number, number]\n}\n"],"names":["ReactEditor","Transforms","Editor"],"mappings":";;;;AAKO,MAAM,0BAA0B,CAAC,QAAgB,OAAiC,UAAkB,gBAAwB;AAClI,MAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AAC1B,YAAQA,WAAAA,YAAY,SAAS,QAAQ,KAAK;AAAA,EAC3C;AACAC,QAAAA,WAAW,OAAO,QAAQ;AAAA,IACzB,QAAQC,MAAAA,OAAO,MAAM,QAAQ,CAAC,GAAG,OAAO,UAAU,WAAW,CAAC;AAAA,IAC9D,OAAOA,MAAAA,OAAO,IAAI,QAAQ,CAAC,GAAG,OAAO,UAAU,WAAW,CAAC;AAAA,EAAA,CAC3D;AACF;AAEO,MAAM,0BAA0B,CAAC,QAAgB,YAA8B;AACrF,QAAM,WAAWF,WAAAA,YAAY,SAAS,QAAQ,OAAO;AACrD,SAAO,SAAS,MAAM,EAAE;AACzB;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactEditor } from "slate-react";
|
|
2
|
+
import { Transforms, Editor } from "slate";
|
|
3
|
+
const selectTableCellContents = (editor, table, rowIndex, columnIndex) => {
|
|
4
|
+
if (!Array.isArray(table)) {
|
|
5
|
+
table = ReactEditor.findPath(editor, table);
|
|
6
|
+
}
|
|
7
|
+
Transforms.select(editor, {
|
|
8
|
+
anchor: Editor.start(editor, [...table, rowIndex, columnIndex]),
|
|
9
|
+
focus: Editor.end(editor, [...table, rowIndex, columnIndex])
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
const getTableCellCoordinates = (editor, element) => {
|
|
13
|
+
const cellPath = ReactEditor.findPath(editor, element);
|
|
14
|
+
return cellPath.slice(-2);
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
getTableCellCoordinates,
|
|
18
|
+
selectTableCellContents
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=TableElementSelection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableElementSelection.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableElementSelection.ts"],"sourcesContent":["import { ReactEditor } from 'slate-react'\nimport { Editor, Path as SlatePath, Transforms } from 'slate'\nimport { TableCellElement } from './TableCellElement'\nimport { TableElement } from './TableElement'\n\nexport const selectTableCellContents = (editor: Editor, table: TableElement | SlatePath, rowIndex: number, columnIndex: number) => {\n\tif (!Array.isArray(table)) {\n\t\ttable = ReactEditor.findPath(editor, table)\n\t}\n\tTransforms.select(editor, {\n\t\tanchor: Editor.start(editor, [...table, rowIndex, columnIndex]),\n\t\tfocus: Editor.end(editor, [...table, rowIndex, columnIndex]),\n\t})\n}\n\nexport const getTableCellCoordinates = (editor: Editor, element: TableCellElement) => {\n\tconst cellPath = ReactEditor.findPath(editor, element)\n\treturn cellPath.slice(-2) as [number, number]\n}\n"],"names":[],"mappings":";;AAKO,MAAM,0BAA0B,CAAC,QAAgB,OAAiC,UAAkB,gBAAwB;AAClI,MAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AAC1B,YAAQ,YAAY,SAAS,QAAQ,KAAK;AAAA,EAC3C;AACA,aAAW,OAAO,QAAQ;AAAA,IACzB,QAAQ,OAAO,MAAM,QAAQ,CAAC,GAAG,OAAO,UAAU,WAAW,CAAC;AAAA,IAC9D,OAAO,OAAO,IAAI,QAAQ,CAAC,GAAG,OAAO,UAAU,WAAW,CAAC;AAAA,EAAA,CAC3D;AACF;AAEO,MAAM,0BAA0B,CAAC,QAAgB,YAA8B;AACrF,QAAM,WAAW,YAAY,SAAS,QAAQ,OAAO;AACrD,SAAO,SAAS,MAAM,EAAE;AACzB;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const TableCellElement = require("./TableCellElement.cjs");
|
|
4
|
+
const TableElement = require("./TableElement.cjs");
|
|
5
|
+
const TableRowElement = require("./TableRowElement.cjs");
|
|
6
|
+
const tableHTMLDeserializer = {
|
|
7
|
+
processBlockPaste: ({ element, next, cumulativeTextAttrs }) => {
|
|
8
|
+
if (element.tagName === "TABLE") {
|
|
9
|
+
return [
|
|
10
|
+
{
|
|
11
|
+
type: TableElement.tableElementType,
|
|
12
|
+
children: next(element.childNodes, cumulativeTextAttrs)
|
|
13
|
+
}
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
if (element.tagName === "TR") {
|
|
17
|
+
return [
|
|
18
|
+
{
|
|
19
|
+
type: TableRowElement.tableRowElementType,
|
|
20
|
+
children: next(element.childNodes, cumulativeTextAttrs)
|
|
21
|
+
}
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
if (element.tagName === "TD" || element.tagName === "TH") {
|
|
25
|
+
return [
|
|
26
|
+
{
|
|
27
|
+
type: TableCellElement.tableCellElementType,
|
|
28
|
+
children: next(element.childNodes, cumulativeTextAttrs)
|
|
29
|
+
}
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
exports.tableHTMLDeserializer = tableHTMLDeserializer;
|
|
36
|
+
//# sourceMappingURL=TableHtmlDeserializer.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableHtmlDeserializer.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableHtmlDeserializer.ts"],"sourcesContent":["import { HtmlDeserializerPlugin } from '../../../types'\nimport { tableCellElementType } from './TableCellElement'\nimport { tableElementType } from './TableElement'\nimport { tableRowElementType } from './TableRowElement'\n\nexport const tableHTMLDeserializer: HtmlDeserializerPlugin = {\n\tprocessBlockPaste: ({ element, next, cumulativeTextAttrs }) => {\n\t\tif (element.tagName === 'TABLE') {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: tableElementType,\n\t\t\t\t\tchildren: next(element.childNodes, cumulativeTextAttrs),\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\n\t\tif (element.tagName === 'TR') {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: tableRowElementType,\n\t\t\t\t\tchildren: next(element.childNodes, cumulativeTextAttrs),\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\n\t\tif (element.tagName === 'TD' || element.tagName === 'TH') {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: tableCellElementType,\n\t\t\t\t\tchildren: next(element.childNodes, cumulativeTextAttrs),\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\n\t\treturn null\n\t},\n}\n"],"names":["tableElementType","tableRowElementType","tableCellElementType"],"mappings":";;;;;AAKO,MAAM,wBAAgD;AAAA,EAC5D,mBAAmB,CAAC,EAAE,SAAS,MAAM,0BAA0B;AAC9D,QAAI,QAAQ,YAAY,SAAS;AAChC,aAAO;AAAA,QACN;AAAA,UACC,MAAMA,aAAAA;AAAAA,UACN,UAAU,KAAK,QAAQ,YAAY,mBAAmB;AAAA,QAAA;AAAA,MACvD;AAAA,IAEF;AAEA,QAAI,QAAQ,YAAY,MAAM;AAC7B,aAAO;AAAA,QACN;AAAA,UACC,MAAMC,gBAAAA;AAAAA,UACN,UAAU,KAAK,QAAQ,YAAY,mBAAmB;AAAA,QAAA;AAAA,MACvD;AAAA,IAEF;AAEA,QAAI,QAAQ,YAAY,QAAQ,QAAQ,YAAY,MAAM;AACzD,aAAO;AAAA,QACN;AAAA,UACC,MAAMC,iBAAAA;AAAAA,UACN,UAAU,KAAK,QAAQ,YAAY,mBAAmB;AAAA,QAAA;AAAA,MACvD;AAAA,IAEF;AAEA,WAAO;AAAA,EACR;AACD;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { tableCellElementType } from "./TableCellElement.js";
|
|
2
|
+
import { tableElementType } from "./TableElement.js";
|
|
3
|
+
import { tableRowElementType } from "./TableRowElement.js";
|
|
4
|
+
const tableHTMLDeserializer = {
|
|
5
|
+
processBlockPaste: ({ element, next, cumulativeTextAttrs }) => {
|
|
6
|
+
if (element.tagName === "TABLE") {
|
|
7
|
+
return [
|
|
8
|
+
{
|
|
9
|
+
type: tableElementType,
|
|
10
|
+
children: next(element.childNodes, cumulativeTextAttrs)
|
|
11
|
+
}
|
|
12
|
+
];
|
|
13
|
+
}
|
|
14
|
+
if (element.tagName === "TR") {
|
|
15
|
+
return [
|
|
16
|
+
{
|
|
17
|
+
type: tableRowElementType,
|
|
18
|
+
children: next(element.childNodes, cumulativeTextAttrs)
|
|
19
|
+
}
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
if (element.tagName === "TD" || element.tagName === "TH") {
|
|
23
|
+
return [
|
|
24
|
+
{
|
|
25
|
+
type: tableCellElementType,
|
|
26
|
+
children: next(element.childNodes, cumulativeTextAttrs)
|
|
27
|
+
}
|
|
28
|
+
];
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
tableHTMLDeserializer
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=TableHtmlDeserializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableHtmlDeserializer.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableHtmlDeserializer.ts"],"sourcesContent":["import { HtmlDeserializerPlugin } from '../../../types'\nimport { tableCellElementType } from './TableCellElement'\nimport { tableElementType } from './TableElement'\nimport { tableRowElementType } from './TableRowElement'\n\nexport const tableHTMLDeserializer: HtmlDeserializerPlugin = {\n\tprocessBlockPaste: ({ element, next, cumulativeTextAttrs }) => {\n\t\tif (element.tagName === 'TABLE') {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: tableElementType,\n\t\t\t\t\tchildren: next(element.childNodes, cumulativeTextAttrs),\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\n\t\tif (element.tagName === 'TR') {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: tableRowElementType,\n\t\t\t\t\tchildren: next(element.childNodes, cumulativeTextAttrs),\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\n\t\tif (element.tagName === 'TD' || element.tagName === 'TH') {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: tableCellElementType,\n\t\t\t\t\tchildren: next(element.childNodes, cumulativeTextAttrs),\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\n\t\treturn null\n\t},\n}\n"],"names":[],"mappings":";;;AAKO,MAAM,wBAAgD;AAAA,EAC5D,mBAAmB,CAAC,EAAE,SAAS,MAAM,0BAA0B;AAC9D,QAAI,QAAQ,YAAY,SAAS;AAChC,aAAO;AAAA,QACN;AAAA,UACC,MAAM;AAAA,UACN,UAAU,KAAK,QAAQ,YAAY,mBAAmB;AAAA,QAAA;AAAA,MACvD;AAAA,IAEF;AAEA,QAAI,QAAQ,YAAY,MAAM;AAC7B,aAAO;AAAA,QACN;AAAA,UACC,MAAM;AAAA,UACN,UAAU,KAAK,QAAQ,YAAY,mBAAmB;AAAA,QAAA;AAAA,MACvD;AAAA,IAEF;AAEA,QAAI,QAAQ,YAAY,QAAQ,QAAQ,YAAY,MAAM;AACzD,aAAO;AAAA,QACN;AAAA,UACC,MAAM;AAAA,UACN,UAAU,KAAK,QAAQ,YAAY,mBAAmB;AAAA,QAAA;AAAA,MACvD;AAAA,IAEF;AAEA,WAAO;AAAA,EACR;AACD;"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const Slate = require("slate");
|
|
4
|
+
const slateReact = require("slate-react");
|
|
5
|
+
const TableElement = require("./TableElement.cjs");
|
|
6
|
+
const TableRowElement = require("./TableRowElement.cjs");
|
|
7
|
+
const index = require("../../../editor/index.cjs");
|
|
8
|
+
const TableCellElement = require("./TableCellElement.cjs");
|
|
9
|
+
class TableModifications {
|
|
10
|
+
static deleteTableColumn(editor, element, index2) {
|
|
11
|
+
const tablePath = slateReact.ReactEditor.findPath(editor, element);
|
|
12
|
+
const rowCount = element.children.length;
|
|
13
|
+
Slate.Editor.withoutNormalizing(editor, () => {
|
|
14
|
+
for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {
|
|
15
|
+
Slate.Transforms.removeNodes(editor, {
|
|
16
|
+
at: [...tablePath, rowIndex, index2]
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
static addTableRow(editor, element, index$1) {
|
|
22
|
+
const tablePath = slateReact.ReactEditor.findPath(editor, element);
|
|
23
|
+
const columnCount = TableElement.getTableElementColumnCount(element);
|
|
24
|
+
const rowIndex = index$1 ?? element.children.length;
|
|
25
|
+
let tableRow;
|
|
26
|
+
if (element.children.length === 0) {
|
|
27
|
+
tableRow = TableRowElement.createEmptyTableRowElement(columnCount);
|
|
28
|
+
} else {
|
|
29
|
+
const blueprintRow = element.children[rowIndex === 0 ? 0 : rowIndex - 1];
|
|
30
|
+
tableRow = {
|
|
31
|
+
...index.ContemberEditor.elementToSpecifics(blueprintRow),
|
|
32
|
+
type: TableRowElement.tableRowElementType,
|
|
33
|
+
children: Array.from(
|
|
34
|
+
{ length: columnCount },
|
|
35
|
+
(_, columnIndex) => copyTableCell(blueprintRow.children[columnIndex])
|
|
36
|
+
)
|
|
37
|
+
};
|
|
38
|
+
if (rowIndex === 0) {
|
|
39
|
+
const firstRow = element.children[0];
|
|
40
|
+
if (firstRow.headerScope) {
|
|
41
|
+
Slate.Transforms.setNodes(editor, { headerScope: null }, { at: [...tablePath, 0] });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
Slate.Transforms.insertNodes(editor, tableRow, {
|
|
46
|
+
at: [...tablePath, rowIndex]
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
static addTableColumn(editor, element, index2) {
|
|
50
|
+
const tablePath = slateReact.ReactEditor.findPath(editor, element);
|
|
51
|
+
const columnCount = TableElement.getTableElementColumnCount(element);
|
|
52
|
+
const rowCount = TableElement.getTableElementRowCount(element);
|
|
53
|
+
const columnIndex = index2 ?? columnCount ?? 0;
|
|
54
|
+
Slate.Editor.withoutNormalizing(editor, () => {
|
|
55
|
+
for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {
|
|
56
|
+
const tableRow = element.children[rowIndex];
|
|
57
|
+
let tableCell;
|
|
58
|
+
if (tableRow.children.length === 0) {
|
|
59
|
+
tableCell = TableCellElement.createEmptyTableCellElement();
|
|
60
|
+
} else {
|
|
61
|
+
tableCell = copyTableCell(tableRow.children[columnIndex === 0 ? 0 : columnIndex - 1]);
|
|
62
|
+
if (columnIndex === 0) {
|
|
63
|
+
const firstCell = tableRow.children[0];
|
|
64
|
+
if (firstCell.headerScope) {
|
|
65
|
+
Slate.Transforms.setNodes(editor, { headerScope: null }, { at: [...tablePath, rowIndex, 0] });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
Slate.Transforms.insertNodes(editor, tableCell, {
|
|
70
|
+
at: [...tablePath, rowIndex, columnIndex]
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
static justifyTableColumn(editor, element, columnIndex, direction) {
|
|
76
|
+
forEachCellInColumn(editor, element, columnIndex, ([, cellPath]) => {
|
|
77
|
+
Slate.Transforms.setNodes(
|
|
78
|
+
editor,
|
|
79
|
+
{ justify: direction ?? void 0 },
|
|
80
|
+
{ match: (node) => TableCellElement.isTableCellElement(node), at: cellPath }
|
|
81
|
+
);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
static toggleTableRowHeaderScope(editor, element, rowIndex, scope) {
|
|
85
|
+
const rowCount = element.children.length;
|
|
86
|
+
if (rowIndex !== 0 || rowCount < 1) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const tablePath = slateReact.ReactEditor.findPath(editor, element);
|
|
90
|
+
const firstRow = element.children[0];
|
|
91
|
+
Slate.Transforms.setNodes(
|
|
92
|
+
editor,
|
|
93
|
+
{ headerScope: firstRow.headerScope === scope ? void 0 : scope },
|
|
94
|
+
{ match: (node) => TableRowElement.isTableRowElement(node), at: [...tablePath, 0] }
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
static toggleTableColumnHeaderScope(editor, element, columnIndex, scope) {
|
|
98
|
+
let currentStatusScore = 0;
|
|
99
|
+
const rowCount = element.children.length;
|
|
100
|
+
forEachCellInColumn(editor, element, columnIndex, ([cell]) => {
|
|
101
|
+
currentStatusScore += cell.headerScope === scope ? 1 : -1;
|
|
102
|
+
});
|
|
103
|
+
const shouldSetScope = -currentStatusScore === rowCount || currentStatusScore > 0 && currentStatusScore !== rowCount;
|
|
104
|
+
forEachCellInColumn(editor, element, columnIndex, ([, cellPath]) => {
|
|
105
|
+
Slate.Transforms.setNodes(
|
|
106
|
+
editor,
|
|
107
|
+
{ headerScope: shouldSetScope ? scope : void 0 },
|
|
108
|
+
{ match: (node) => TableCellElement.isTableCellElement(node), at: cellPath }
|
|
109
|
+
);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
static deleteTableRow(editor, element, index2) {
|
|
113
|
+
const tablePath = slateReact.ReactEditor.findPath(editor, element);
|
|
114
|
+
Slate.Transforms.removeNodes(editor, {
|
|
115
|
+
at: [...tablePath, index2]
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const forEachCellInColumn = (editor, element, columnIndex, callback) => {
|
|
120
|
+
const tablePath = slateReact.ReactEditor.findPath(editor, element);
|
|
121
|
+
const rowCount = TableElement.getTableElementRowCount(element);
|
|
122
|
+
Slate.Editor.withoutNormalizing(editor, () => {
|
|
123
|
+
for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {
|
|
124
|
+
callback(Slate.Editor.node(editor, [...tablePath, rowIndex, columnIndex]));
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
const copyTableCell = (tableCellElement) => ({
|
|
129
|
+
...index.ContemberEditor.elementToSpecifics(tableCellElement),
|
|
130
|
+
type: TableCellElement.tableCellElementType,
|
|
131
|
+
children: [{ text: "" }]
|
|
132
|
+
});
|
|
133
|
+
exports.TableModifications = TableModifications;
|
|
134
|
+
//# sourceMappingURL=TableModifications.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableModifications.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableModifications.ts"],"sourcesContent":["import { Editor, NodeEntry, Transforms } from 'slate'\nimport { ReactEditor } from 'slate-react'\nimport { getTableElementColumnCount, getTableElementRowCount, TableElement } from './TableElement'\nimport { createEmptyTableRowElement, isTableRowElement, TableRowElement, tableRowElementType } from './TableRowElement'\nimport { ContemberEditor } from '../../../editor'\nimport { createEmptyTableCellElement, isTableCellElement, TableCellElement, tableCellElementType } from './TableCellElement'\n\nexport class TableModifications {\n\tpublic static deleteTableColumn(editor: Editor, element: TableElement, index: number) {\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tconst rowCount = element.children.length\n\n\t\tEditor.withoutNormalizing(editor, () => {\n\t\t\tfor (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {\n\t\t\t\tTransforms.removeNodes(editor, {\n\t\t\t\t\tat: [...tablePath, rowIndex, index],\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic static addTableRow(editor: Editor, element: TableElement, index?: number) {\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tconst columnCount = getTableElementColumnCount(element)\n\t\tconst rowIndex = index ?? element.children.length\n\n\t\tlet tableRow: TableRowElement\n\t\tif (element.children.length === 0) {\n\t\t\ttableRow = createEmptyTableRowElement(columnCount)\n\t\t} else {\n\t\t\tconst blueprintRow = element.children[rowIndex === 0 ? 0 : rowIndex - 1] as TableRowElement\n\n\t\t\ttableRow = {\n\t\t\t\t...ContemberEditor.elementToSpecifics(blueprintRow),\n\t\t\t\ttype: tableRowElementType,\n\t\t\t\tchildren: Array.from(\n\t\t\t\t\t{ length: columnCount },\n\t\t\t\t\t(_, columnIndex): TableCellElement => copyTableCell(blueprintRow.children[columnIndex] as TableCellElement),\n\t\t\t\t),\n\t\t\t}\n\n\t\t\tif (rowIndex === 0) {\n\t\t\t\tconst firstRow = element.children[0] as TableRowElement\n\t\t\t\tif (firstRow.headerScope) {\n\t\t\t\t\tTransforms.setNodes(editor, { headerScope: null }, { at: [...tablePath, 0] })\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tTransforms.insertNodes(editor, tableRow, {\n\t\t\tat: [...tablePath, rowIndex],\n\t\t})\n\t}\n\n\tpublic static addTableColumn(editor: Editor, element: TableElement, index?: number) {\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tconst columnCount = getTableElementColumnCount(element)\n\t\tconst rowCount = getTableElementRowCount(element)\n\t\tconst columnIndex = index ?? columnCount ?? 0\n\n\t\tEditor.withoutNormalizing(editor, () => {\n\t\t\tfor (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {\n\t\t\t\tconst tableRow = element.children[rowIndex] as TableRowElement\n\n\t\t\t\tlet tableCell: TableCellElement\n\t\t\t\tif (tableRow.children.length === 0) {\n\t\t\t\t\ttableCell = createEmptyTableCellElement()\n\t\t\t\t} else {\n\t\t\t\t\ttableCell = copyTableCell(tableRow.children[columnIndex === 0 ? 0 : columnIndex - 1] as TableCellElement)\n\n\t\t\t\t\tif (columnIndex === 0) {\n\t\t\t\t\t\tconst firstCell = tableRow.children[0] as TableCellElement\n\t\t\t\t\t\tif (firstCell.headerScope) {\n\t\t\t\t\t\t\tTransforms.setNodes(editor, { headerScope: null }, { at: [...tablePath, rowIndex, 0] })\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tTransforms.insertNodes(editor, tableCell, {\n\t\t\t\t\tat: [...tablePath, rowIndex, columnIndex],\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic static justifyTableColumn(editor: Editor, element: TableElement, columnIndex: number, direction: TableCellElement['justify']) {\n\t\tforEachCellInColumn(editor, element, columnIndex, ([, cellPath]) => {\n\t\t\tTransforms.setNodes(\n\t\t\t\teditor,\n\t\t\t\t{ justify: direction ?? undefined },\n\t\t\t\t{ match: node => isTableCellElement(node), at: cellPath },\n\t\t\t)\n\t\t})\n\t}\n\n\tpublic static toggleTableRowHeaderScope(editor: Editor, element: TableElement, rowIndex: number, scope: TableRowElement['headerScope']) {\n\t\tconst rowCount = element.children.length\n\t\tif (rowIndex !== 0 || rowCount < 1) {\n\t\t\treturn\n\t\t}\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tconst firstRow = element.children[0] as TableRowElement\n\n\t\tTransforms.setNodes(\n\t\t\teditor,\n\t\t\t{ headerScope: firstRow.headerScope === scope ? undefined : scope },\n\t\t\t{ match: node => isTableRowElement(node), at: [...tablePath, 0] },\n\t\t)\n\t}\n\n\tpublic static toggleTableColumnHeaderScope(editor: Editor, element: TableElement, columnIndex: number, scope: TableCellElement['headerScope']) {\n\t\tlet currentStatusScore = 0\n\t\tconst rowCount = element.children.length\n\n\t\tforEachCellInColumn(editor, element, columnIndex, ([cell]) => {\n\t\t\tcurrentStatusScore += cell.headerScope === scope ? 1 : -1\n\t\t})\n\n\t\t// If none have it or the majority does but not all.\n\t\tconst shouldSetScope = -currentStatusScore === rowCount || (currentStatusScore > 0 && currentStatusScore !== rowCount)\n\n\t\tforEachCellInColumn(editor, element, columnIndex, ([, cellPath]) => {\n\t\t\tTransforms.setNodes(\n\t\t\t\teditor,\n\t\t\t\t{ headerScope: shouldSetScope ? scope : undefined },\n\t\t\t\t{ match: node => isTableCellElement(node), at: cellPath },\n\t\t\t)\n\t\t})\n\t}\n\n\tpublic static deleteTableRow(editor: Editor, element: TableElement, index: number) {\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tTransforms.removeNodes(editor, {\n\t\t\tat: [...tablePath, index],\n\t\t})\n\t}\n}\n\nconst forEachCellInColumn = (\n\teditor: Editor,\n\telement: TableElement,\n\tcolumnIndex: number,\n\tcallback: (cellEntry: NodeEntry<TableCellElement>) => void,\n) => {\n\tconst tablePath = ReactEditor.findPath(editor, element)\n\tconst rowCount = getTableElementRowCount(element)\n\n\tEditor.withoutNormalizing(editor, () => {\n\t\tfor (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {\n\t\t\tcallback(Editor.node(editor, [...tablePath, rowIndex, columnIndex]) as NodeEntry<TableCellElement>)\n\t\t}\n\t})\n}\nconst copyTableCell = (tableCellElement: TableCellElement): TableCellElement => ({\n\t...ContemberEditor.elementToSpecifics(tableCellElement),\n\ttype: tableCellElementType,\n\tchildren: [{ text: '' }],\n})\n"],"names":["index","ReactEditor","Editor","Transforms","getTableElementColumnCount","createEmptyTableRowElement","ContemberEditor","tableRowElementType","getTableElementRowCount","createEmptyTableCellElement","isTableCellElement","isTableRowElement","tableCellElementType"],"mappings":"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"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { Editor, Transforms } from "slate";
|
|
2
|
+
import { ReactEditor } from "slate-react";
|
|
3
|
+
import { getTableElementColumnCount, getTableElementRowCount } from "./TableElement.js";
|
|
4
|
+
import { createEmptyTableRowElement, tableRowElementType, isTableRowElement } from "./TableRowElement.js";
|
|
5
|
+
import { ContemberEditor } from "../../../editor/index.js";
|
|
6
|
+
import { createEmptyTableCellElement, tableCellElementType, isTableCellElement } from "./TableCellElement.js";
|
|
7
|
+
class TableModifications {
|
|
8
|
+
static deleteTableColumn(editor, element, index) {
|
|
9
|
+
const tablePath = ReactEditor.findPath(editor, element);
|
|
10
|
+
const rowCount = element.children.length;
|
|
11
|
+
Editor.withoutNormalizing(editor, () => {
|
|
12
|
+
for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {
|
|
13
|
+
Transforms.removeNodes(editor, {
|
|
14
|
+
at: [...tablePath, rowIndex, index]
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
static addTableRow(editor, element, index) {
|
|
20
|
+
const tablePath = ReactEditor.findPath(editor, element);
|
|
21
|
+
const columnCount = getTableElementColumnCount(element);
|
|
22
|
+
const rowIndex = index ?? element.children.length;
|
|
23
|
+
let tableRow;
|
|
24
|
+
if (element.children.length === 0) {
|
|
25
|
+
tableRow = createEmptyTableRowElement(columnCount);
|
|
26
|
+
} else {
|
|
27
|
+
const blueprintRow = element.children[rowIndex === 0 ? 0 : rowIndex - 1];
|
|
28
|
+
tableRow = {
|
|
29
|
+
...ContemberEditor.elementToSpecifics(blueprintRow),
|
|
30
|
+
type: tableRowElementType,
|
|
31
|
+
children: Array.from(
|
|
32
|
+
{ length: columnCount },
|
|
33
|
+
(_, columnIndex) => copyTableCell(blueprintRow.children[columnIndex])
|
|
34
|
+
)
|
|
35
|
+
};
|
|
36
|
+
if (rowIndex === 0) {
|
|
37
|
+
const firstRow = element.children[0];
|
|
38
|
+
if (firstRow.headerScope) {
|
|
39
|
+
Transforms.setNodes(editor, { headerScope: null }, { at: [...tablePath, 0] });
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
Transforms.insertNodes(editor, tableRow, {
|
|
44
|
+
at: [...tablePath, rowIndex]
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
static addTableColumn(editor, element, index) {
|
|
48
|
+
const tablePath = ReactEditor.findPath(editor, element);
|
|
49
|
+
const columnCount = getTableElementColumnCount(element);
|
|
50
|
+
const rowCount = getTableElementRowCount(element);
|
|
51
|
+
const columnIndex = index ?? columnCount ?? 0;
|
|
52
|
+
Editor.withoutNormalizing(editor, () => {
|
|
53
|
+
for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {
|
|
54
|
+
const tableRow = element.children[rowIndex];
|
|
55
|
+
let tableCell;
|
|
56
|
+
if (tableRow.children.length === 0) {
|
|
57
|
+
tableCell = createEmptyTableCellElement();
|
|
58
|
+
} else {
|
|
59
|
+
tableCell = copyTableCell(tableRow.children[columnIndex === 0 ? 0 : columnIndex - 1]);
|
|
60
|
+
if (columnIndex === 0) {
|
|
61
|
+
const firstCell = tableRow.children[0];
|
|
62
|
+
if (firstCell.headerScope) {
|
|
63
|
+
Transforms.setNodes(editor, { headerScope: null }, { at: [...tablePath, rowIndex, 0] });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
Transforms.insertNodes(editor, tableCell, {
|
|
68
|
+
at: [...tablePath, rowIndex, columnIndex]
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
static justifyTableColumn(editor, element, columnIndex, direction) {
|
|
74
|
+
forEachCellInColumn(editor, element, columnIndex, ([, cellPath]) => {
|
|
75
|
+
Transforms.setNodes(
|
|
76
|
+
editor,
|
|
77
|
+
{ justify: direction ?? void 0 },
|
|
78
|
+
{ match: (node) => isTableCellElement(node), at: cellPath }
|
|
79
|
+
);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
static toggleTableRowHeaderScope(editor, element, rowIndex, scope) {
|
|
83
|
+
const rowCount = element.children.length;
|
|
84
|
+
if (rowIndex !== 0 || rowCount < 1) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const tablePath = ReactEditor.findPath(editor, element);
|
|
88
|
+
const firstRow = element.children[0];
|
|
89
|
+
Transforms.setNodes(
|
|
90
|
+
editor,
|
|
91
|
+
{ headerScope: firstRow.headerScope === scope ? void 0 : scope },
|
|
92
|
+
{ match: (node) => isTableRowElement(node), at: [...tablePath, 0] }
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
static toggleTableColumnHeaderScope(editor, element, columnIndex, scope) {
|
|
96
|
+
let currentStatusScore = 0;
|
|
97
|
+
const rowCount = element.children.length;
|
|
98
|
+
forEachCellInColumn(editor, element, columnIndex, ([cell]) => {
|
|
99
|
+
currentStatusScore += cell.headerScope === scope ? 1 : -1;
|
|
100
|
+
});
|
|
101
|
+
const shouldSetScope = -currentStatusScore === rowCount || currentStatusScore > 0 && currentStatusScore !== rowCount;
|
|
102
|
+
forEachCellInColumn(editor, element, columnIndex, ([, cellPath]) => {
|
|
103
|
+
Transforms.setNodes(
|
|
104
|
+
editor,
|
|
105
|
+
{ headerScope: shouldSetScope ? scope : void 0 },
|
|
106
|
+
{ match: (node) => isTableCellElement(node), at: cellPath }
|
|
107
|
+
);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
static deleteTableRow(editor, element, index) {
|
|
111
|
+
const tablePath = ReactEditor.findPath(editor, element);
|
|
112
|
+
Transforms.removeNodes(editor, {
|
|
113
|
+
at: [...tablePath, index]
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const forEachCellInColumn = (editor, element, columnIndex, callback) => {
|
|
118
|
+
const tablePath = ReactEditor.findPath(editor, element);
|
|
119
|
+
const rowCount = getTableElementRowCount(element);
|
|
120
|
+
Editor.withoutNormalizing(editor, () => {
|
|
121
|
+
for (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {
|
|
122
|
+
callback(Editor.node(editor, [...tablePath, rowIndex, columnIndex]));
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
const copyTableCell = (tableCellElement) => ({
|
|
127
|
+
...ContemberEditor.elementToSpecifics(tableCellElement),
|
|
128
|
+
type: tableCellElementType,
|
|
129
|
+
children: [{ text: "" }]
|
|
130
|
+
});
|
|
131
|
+
export {
|
|
132
|
+
TableModifications
|
|
133
|
+
};
|
|
134
|
+
//# sourceMappingURL=TableModifications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableModifications.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableModifications.ts"],"sourcesContent":["import { Editor, NodeEntry, Transforms } from 'slate'\nimport { ReactEditor } from 'slate-react'\nimport { getTableElementColumnCount, getTableElementRowCount, TableElement } from './TableElement'\nimport { createEmptyTableRowElement, isTableRowElement, TableRowElement, tableRowElementType } from './TableRowElement'\nimport { ContemberEditor } from '../../../editor'\nimport { createEmptyTableCellElement, isTableCellElement, TableCellElement, tableCellElementType } from './TableCellElement'\n\nexport class TableModifications {\n\tpublic static deleteTableColumn(editor: Editor, element: TableElement, index: number) {\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tconst rowCount = element.children.length\n\n\t\tEditor.withoutNormalizing(editor, () => {\n\t\t\tfor (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {\n\t\t\t\tTransforms.removeNodes(editor, {\n\t\t\t\t\tat: [...tablePath, rowIndex, index],\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic static addTableRow(editor: Editor, element: TableElement, index?: number) {\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tconst columnCount = getTableElementColumnCount(element)\n\t\tconst rowIndex = index ?? element.children.length\n\n\t\tlet tableRow: TableRowElement\n\t\tif (element.children.length === 0) {\n\t\t\ttableRow = createEmptyTableRowElement(columnCount)\n\t\t} else {\n\t\t\tconst blueprintRow = element.children[rowIndex === 0 ? 0 : rowIndex - 1] as TableRowElement\n\n\t\t\ttableRow = {\n\t\t\t\t...ContemberEditor.elementToSpecifics(blueprintRow),\n\t\t\t\ttype: tableRowElementType,\n\t\t\t\tchildren: Array.from(\n\t\t\t\t\t{ length: columnCount },\n\t\t\t\t\t(_, columnIndex): TableCellElement => copyTableCell(blueprintRow.children[columnIndex] as TableCellElement),\n\t\t\t\t),\n\t\t\t}\n\n\t\t\tif (rowIndex === 0) {\n\t\t\t\tconst firstRow = element.children[0] as TableRowElement\n\t\t\t\tif (firstRow.headerScope) {\n\t\t\t\t\tTransforms.setNodes(editor, { headerScope: null }, { at: [...tablePath, 0] })\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tTransforms.insertNodes(editor, tableRow, {\n\t\t\tat: [...tablePath, rowIndex],\n\t\t})\n\t}\n\n\tpublic static addTableColumn(editor: Editor, element: TableElement, index?: number) {\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tconst columnCount = getTableElementColumnCount(element)\n\t\tconst rowCount = getTableElementRowCount(element)\n\t\tconst columnIndex = index ?? columnCount ?? 0\n\n\t\tEditor.withoutNormalizing(editor, () => {\n\t\t\tfor (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {\n\t\t\t\tconst tableRow = element.children[rowIndex] as TableRowElement\n\n\t\t\t\tlet tableCell: TableCellElement\n\t\t\t\tif (tableRow.children.length === 0) {\n\t\t\t\t\ttableCell = createEmptyTableCellElement()\n\t\t\t\t} else {\n\t\t\t\t\ttableCell = copyTableCell(tableRow.children[columnIndex === 0 ? 0 : columnIndex - 1] as TableCellElement)\n\n\t\t\t\t\tif (columnIndex === 0) {\n\t\t\t\t\t\tconst firstCell = tableRow.children[0] as TableCellElement\n\t\t\t\t\t\tif (firstCell.headerScope) {\n\t\t\t\t\t\t\tTransforms.setNodes(editor, { headerScope: null }, { at: [...tablePath, rowIndex, 0] })\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tTransforms.insertNodes(editor, tableCell, {\n\t\t\t\t\tat: [...tablePath, rowIndex, columnIndex],\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic static justifyTableColumn(editor: Editor, element: TableElement, columnIndex: number, direction: TableCellElement['justify']) {\n\t\tforEachCellInColumn(editor, element, columnIndex, ([, cellPath]) => {\n\t\t\tTransforms.setNodes(\n\t\t\t\teditor,\n\t\t\t\t{ justify: direction ?? undefined },\n\t\t\t\t{ match: node => isTableCellElement(node), at: cellPath },\n\t\t\t)\n\t\t})\n\t}\n\n\tpublic static toggleTableRowHeaderScope(editor: Editor, element: TableElement, rowIndex: number, scope: TableRowElement['headerScope']) {\n\t\tconst rowCount = element.children.length\n\t\tif (rowIndex !== 0 || rowCount < 1) {\n\t\t\treturn\n\t\t}\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tconst firstRow = element.children[0] as TableRowElement\n\n\t\tTransforms.setNodes(\n\t\t\teditor,\n\t\t\t{ headerScope: firstRow.headerScope === scope ? undefined : scope },\n\t\t\t{ match: node => isTableRowElement(node), at: [...tablePath, 0] },\n\t\t)\n\t}\n\n\tpublic static toggleTableColumnHeaderScope(editor: Editor, element: TableElement, columnIndex: number, scope: TableCellElement['headerScope']) {\n\t\tlet currentStatusScore = 0\n\t\tconst rowCount = element.children.length\n\n\t\tforEachCellInColumn(editor, element, columnIndex, ([cell]) => {\n\t\t\tcurrentStatusScore += cell.headerScope === scope ? 1 : -1\n\t\t})\n\n\t\t// If none have it or the majority does but not all.\n\t\tconst shouldSetScope = -currentStatusScore === rowCount || (currentStatusScore > 0 && currentStatusScore !== rowCount)\n\n\t\tforEachCellInColumn(editor, element, columnIndex, ([, cellPath]) => {\n\t\t\tTransforms.setNodes(\n\t\t\t\teditor,\n\t\t\t\t{ headerScope: shouldSetScope ? scope : undefined },\n\t\t\t\t{ match: node => isTableCellElement(node), at: cellPath },\n\t\t\t)\n\t\t})\n\t}\n\n\tpublic static deleteTableRow(editor: Editor, element: TableElement, index: number) {\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tTransforms.removeNodes(editor, {\n\t\t\tat: [...tablePath, index],\n\t\t})\n\t}\n}\n\nconst forEachCellInColumn = (\n\teditor: Editor,\n\telement: TableElement,\n\tcolumnIndex: number,\n\tcallback: (cellEntry: NodeEntry<TableCellElement>) => void,\n) => {\n\tconst tablePath = ReactEditor.findPath(editor, element)\n\tconst rowCount = getTableElementRowCount(element)\n\n\tEditor.withoutNormalizing(editor, () => {\n\t\tfor (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {\n\t\t\tcallback(Editor.node(editor, [...tablePath, rowIndex, columnIndex]) as NodeEntry<TableCellElement>)\n\t\t}\n\t})\n}\nconst copyTableCell = (tableCellElement: TableCellElement): TableCellElement => ({\n\t...ContemberEditor.elementToSpecifics(tableCellElement),\n\ttype: tableCellElementType,\n\tchildren: [{ text: '' }],\n})\n"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const Slate = require("slate");
|
|
4
|
+
const TableCellElement = require("./TableCellElement.cjs");
|
|
5
|
+
const index = require("../../../editor/index.cjs");
|
|
6
|
+
const TableElement = require("./TableElement.cjs");
|
|
7
|
+
const tableRowElementType = "tableRow";
|
|
8
|
+
const isTableRowElement = (element) => Slate.Element.isElement(element) && element.type === tableRowElementType;
|
|
9
|
+
const createEmptyTableRowElement = (columnCount = 2) => ({
|
|
10
|
+
type: tableRowElementType,
|
|
11
|
+
children: Array.from({ length: columnCount }, () => TableCellElement.createEmptyTableCellElement())
|
|
12
|
+
});
|
|
13
|
+
const tableRowElementPlugin = ({ render }) => ({
|
|
14
|
+
type: tableRowElementType,
|
|
15
|
+
render,
|
|
16
|
+
normalizeNode: ({ editor, path, element, preventDefault }) => {
|
|
17
|
+
for (const [child, childPath] of Slate.Node.children(editor, path)) {
|
|
18
|
+
if (Slate.Element.isElement(child)) {
|
|
19
|
+
if (!TableCellElement.isTableCellElement(child)) {
|
|
20
|
+
index.ContemberEditor.ejectElement(editor, childPath);
|
|
21
|
+
Slate.Transforms.setNodes(editor, { type: TableCellElement.tableCellElementType }, { at: childPath });
|
|
22
|
+
}
|
|
23
|
+
} else {
|
|
24
|
+
Slate.Transforms.removeNodes(editor, { at: path });
|
|
25
|
+
return preventDefault();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (!index.ContemberEditor.hasParentOfType(editor, [element, path], TableElement.tableElementType)) {
|
|
29
|
+
Slate.Transforms.unwrapNodes(editor, { at: path });
|
|
30
|
+
return preventDefault();
|
|
31
|
+
}
|
|
32
|
+
if (path[path.length - 1] > 0 && element.headerScope) {
|
|
33
|
+
Slate.Transforms.setNodes(editor, { headerScope: null }, { at: path });
|
|
34
|
+
return preventDefault();
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
canContainAnyBlocks: false
|
|
38
|
+
});
|
|
39
|
+
exports.createEmptyTableRowElement = createEmptyTableRowElement;
|
|
40
|
+
exports.isTableRowElement = isTableRowElement;
|
|
41
|
+
exports.tableRowElementPlugin = tableRowElementPlugin;
|
|
42
|
+
exports.tableRowElementType = tableRowElementType;
|
|
43
|
+
//# sourceMappingURL=TableRowElement.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableRowElement.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableRowElement.ts"],"sourcesContent":["import { Editor as SlateEditor, Element, Element as SlateElement, Node, Node as SlateNode, Transforms } from 'slate'\nimport { createEmptyTableCellElement, isTableCellElement, tableCellElementType } from './TableCellElement'\nimport { ContemberEditor } from '../../../editor'\nimport { tableElementType } from './TableElement'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const tableRowElementType = 'tableRow' as const\n\nexport interface TableRowElement extends SlateElement {\n\ttype: typeof tableRowElementType\n\tchildren: SlateEditor['children']\n\theaderScope?: 'table'\n}\n\nexport const isTableRowElement = (element: Node): element is TableRowElement => Element.isElement(element) && element.type === tableRowElementType\n\nexport const createEmptyTableRowElement = (columnCount = 2) => ({\n\ttype: tableRowElementType,\n\tchildren: Array.from({ length: columnCount }, () => createEmptyTableCellElement()),\n})\n\nexport const tableRowElementPlugin = ({ render }: { render: ElementRenderer<TableRowElement> }): EditorElementPlugin<TableRowElement> => ({\n\ttype: tableRowElementType,\n\trender,\n\tnormalizeNode: ({ editor, path, element, preventDefault }) => {\n\t\tfor (const [child, childPath] of SlateNode.children(editor, path)) {\n\t\t\tif (SlateElement.isElement(child)) {\n\t\t\t\tif (!isTableCellElement(child)) {\n\t\t\t\t\tContemberEditor.ejectElement(editor, childPath)\n\t\t\t\t\tTransforms.setNodes(editor, { type: tableCellElementType }, { at: childPath })\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tTransforms.removeNodes(editor, { at: path })\n\t\t\t\treturn preventDefault()\n\t\t\t}\n\t\t}\n\t\tif (!ContemberEditor.hasParentOfType(editor, [element, path], tableElementType)) {\n\t\t\tTransforms.unwrapNodes(editor, { at: path })\n\t\t\treturn preventDefault()\n\t\t}\n\t\tif (path[path.length - 1] > 0 && element.headerScope) {\n\t\t\tTransforms.setNodes(editor, { headerScope: null }, { at: path })\n\t\t\treturn preventDefault()\n\t\t}\n\t},\n\tcanContainAnyBlocks: false,\n})\n"],"names":["Element","createEmptyTableCellElement","SlateNode","SlateElement","isTableCellElement","ContemberEditor","Transforms","tableCellElementType","tableElementType"],"mappings":";;;;;;AAMO,MAAM,sBAAsB;AAQ5B,MAAM,oBAAoB,CAAC,YAA8CA,MAAAA,QAAQ,UAAU,OAAO,KAAK,QAAQ,SAAS;AAExH,MAAM,6BAA6B,CAAC,cAAc,OAAO;AAAA,EAC/D,MAAM;AAAA,EACN,UAAU,MAAM,KAAK,EAAE,QAAQ,YAAA,GAAe,MAAMC,6CAAA,CAA6B;AAClF;AAEO,MAAM,wBAAwB,CAAC,EAAE,cAAkG;AAAA,EACzI,MAAM;AAAA,EACN;AAAA,EACA,eAAe,CAAC,EAAE,QAAQ,MAAM,SAAS,qBAAqB;AAC7D,eAAW,CAAC,OAAO,SAAS,KAAKC,MAAAA,KAAU,SAAS,QAAQ,IAAI,GAAG;AAClE,UAAIC,MAAAA,QAAa,UAAU,KAAK,GAAG;AAClC,YAAI,CAACC,iBAAAA,mBAAmB,KAAK,GAAG;AAC/BC,gCAAgB,aAAa,QAAQ,SAAS;AAC9CC,2BAAW,SAAS,QAAQ,EAAE,MAAMC,iBAAAA,wBAAwB,EAAE,IAAI,WAAW;AAAA,QAC9E;AAAA,MACD,OAAO;AACND,cAAAA,WAAW,YAAY,QAAQ,EAAE,IAAI,MAAM;AAC3C,eAAO,eAAA;AAAA,MACR;AAAA,IACD;AACA,QAAI,CAACD,MAAAA,gBAAgB,gBAAgB,QAAQ,CAAC,SAAS,IAAI,GAAGG,aAAAA,gBAAgB,GAAG;AAChFF,YAAAA,WAAW,YAAY,QAAQ,EAAE,IAAI,MAAM;AAC3C,aAAO,eAAA;AAAA,IACR;AACA,QAAI,KAAK,KAAK,SAAS,CAAC,IAAI,KAAK,QAAQ,aAAa;AACrDA,uBAAW,SAAS,QAAQ,EAAE,aAAa,QAAQ,EAAE,IAAI,MAAM;AAC/D,aAAO,eAAA;AAAA,IACR;AAAA,EACD;AAAA,EACA,qBAAqB;AACtB;;;;;"}
|