@contember/react-slate-editor-base 2.0.0-alpha.1
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/components/RichTextEditor.cjs +93 -0
- package/dist/development/components/RichTextEditor.cjs.map +1 -0
- package/dist/development/components/RichTextEditor.js +93 -0
- package/dist/development/components/RichTextEditor.js.map +1 -0
- package/dist/development/components/triggers/EditorElementTrigger.cjs +16 -0
- package/dist/development/components/triggers/EditorElementTrigger.cjs.map +1 -0
- package/dist/development/components/triggers/EditorElementTrigger.js +16 -0
- package/dist/development/components/triggers/EditorElementTrigger.js.map +1 -0
- package/dist/development/components/triggers/EditorGenericTrigger.cjs +20 -0
- package/dist/development/components/triggers/EditorGenericTrigger.cjs.map +1 -0
- package/dist/development/components/triggers/EditorGenericTrigger.js +20 -0
- package/dist/development/components/triggers/EditorGenericTrigger.js.map +1 -0
- package/dist/development/components/triggers/EditorMarkTrigger.cjs +16 -0
- package/dist/development/components/triggers/EditorMarkTrigger.cjs.map +1 -0
- package/dist/development/components/triggers/EditorMarkTrigger.js +16 -0
- package/dist/development/components/triggers/EditorMarkTrigger.js.map +1 -0
- package/dist/development/components/triggers/EditorWrapNodeTrigger.cjs +28 -0
- package/dist/development/components/triggers/EditorWrapNodeTrigger.cjs.map +1 -0
- package/dist/development/components/triggers/EditorWrapNodeTrigger.js +28 -0
- package/dist/development/components/triggers/EditorWrapNodeTrigger.js.map +1 -0
- package/dist/development/editor/createEditor.cjs +35 -0
- package/dist/development/editor/createEditor.cjs.map +1 -0
- package/dist/development/editor/createEditor.js +35 -0
- package/dist/development/editor/createEditor.js.map +1 -0
- package/dist/development/editor/createEditorWithEssentials.cjs +227 -0
- package/dist/development/editor/createEditorWithEssentials.cjs.map +1 -0
- package/dist/development/editor/createEditorWithEssentials.js +211 -0
- package/dist/development/editor/createEditorWithEssentials.js.map +1 -0
- package/dist/development/editor/index.cjs +44 -0
- package/dist/development/editor/index.cjs.map +1 -0
- package/dist/development/editor/index.js +44 -0
- package/dist/development/editor/index.js.map +1 -0
- package/dist/development/editor/methods/addMarks.cjs +12 -0
- package/dist/development/editor/methods/addMarks.cjs.map +1 -0
- package/dist/development/editor/methods/addMarks.js +12 -0
- package/dist/development/editor/methods/addMarks.js.map +1 -0
- package/dist/development/editor/methods/canToggleMark.cjs +7 -0
- package/dist/development/editor/methods/canToggleMark.cjs.map +1 -0
- package/dist/development/editor/methods/canToggleMark.js +7 -0
- package/dist/development/editor/methods/canToggleMark.js.map +1 -0
- package/dist/development/editor/methods/closest.cjs +18 -0
- package/dist/development/editor/methods/closest.cjs.map +1 -0
- package/dist/development/editor/methods/closest.js +18 -0
- package/dist/development/editor/methods/closest.js.map +1 -0
- package/dist/development/editor/methods/closestBlockEntry.cjs +10 -0
- package/dist/development/editor/methods/closestBlockEntry.cjs.map +1 -0
- package/dist/development/editor/methods/closestBlockEntry.js +10 -0
- package/dist/development/editor/methods/closestBlockEntry.js.map +1 -0
- package/dist/development/editor/methods/closestViableBlockContainerEntry.cjs +9 -0
- package/dist/development/editor/methods/closestViableBlockContainerEntry.cjs.map +1 -0
- package/dist/development/editor/methods/closestViableBlockContainerEntry.js +9 -0
- package/dist/development/editor/methods/closestViableBlockContainerEntry.js.map +1 -0
- package/dist/development/editor/methods/ejectElement.cjs +15 -0
- package/dist/development/editor/methods/ejectElement.cjs.map +1 -0
- package/dist/development/editor/methods/ejectElement.js +15 -0
- package/dist/development/editor/methods/ejectElement.js.map +1 -0
- package/dist/development/editor/methods/elementToSpecifics.cjs +8 -0
- package/dist/development/editor/methods/elementToSpecifics.cjs.map +1 -0
- package/dist/development/editor/methods/elementToSpecifics.js +8 -0
- package/dist/development/editor/methods/elementToSpecifics.js.map +1 -0
- package/dist/development/editor/methods/getElementDataAttributes.cjs +13 -0
- package/dist/development/editor/methods/getElementDataAttributes.cjs.map +1 -0
- package/dist/development/editor/methods/getElementDataAttributes.js +13 -0
- package/dist/development/editor/methods/getElementDataAttributes.js.map +1 -0
- package/dist/development/editor/methods/getPreviousSibling.cjs +13 -0
- package/dist/development/editor/methods/getPreviousSibling.cjs.map +1 -0
- package/dist/development/editor/methods/getPreviousSibling.js +13 -0
- package/dist/development/editor/methods/getPreviousSibling.js.map +1 -0
- package/dist/development/editor/methods/hasMarks.cjs +23 -0
- package/dist/development/editor/methods/hasMarks.cjs.map +1 -0
- package/dist/development/editor/methods/hasMarks.js +23 -0
- package/dist/development/editor/methods/hasMarks.js.map +1 -0
- package/dist/development/editor/methods/hasParentOfType.cjs +15 -0
- package/dist/development/editor/methods/hasParentOfType.cjs.map +1 -0
- package/dist/development/editor/methods/hasParentOfType.js +15 -0
- package/dist/development/editor/methods/hasParentOfType.js.map +1 -0
- package/dist/development/editor/methods/isElementType.cjs +24 -0
- package/dist/development/editor/methods/isElementType.cjs.map +1 -0
- package/dist/development/editor/methods/isElementType.js +24 -0
- package/dist/development/editor/methods/isElementType.js.map +1 -0
- package/dist/development/editor/methods/permissivelyDeserializeNodes.cjs +22 -0
- package/dist/development/editor/methods/permissivelyDeserializeNodes.cjs.map +1 -0
- package/dist/development/editor/methods/permissivelyDeserializeNodes.js +22 -0
- package/dist/development/editor/methods/permissivelyDeserializeNodes.js.map +1 -0
- package/dist/development/editor/methods/removeMarks.cjs +12 -0
- package/dist/development/editor/methods/removeMarks.cjs.map +1 -0
- package/dist/development/editor/methods/removeMarks.js +12 -0
- package/dist/development/editor/methods/removeMarks.js.map +1 -0
- package/dist/development/editor/methods/serializeNodes.cjs +15 -0
- package/dist/development/editor/methods/serializeNodes.cjs.map +1 -0
- package/dist/development/editor/methods/serializeNodes.js +15 -0
- package/dist/development/editor/methods/serializeNodes.js.map +1 -0
- package/dist/development/editor/methods/strictlyDeserializeNodes.cjs +14 -0
- package/dist/development/editor/methods/strictlyDeserializeNodes.cjs.map +1 -0
- package/dist/development/editor/methods/strictlyDeserializeNodes.js +14 -0
- package/dist/development/editor/methods/strictlyDeserializeNodes.js.map +1 -0
- package/dist/development/editor/methods/textToSpecifics.cjs +8 -0
- package/dist/development/editor/methods/textToSpecifics.cjs.map +1 -0
- package/dist/development/editor/methods/textToSpecifics.js +8 -0
- package/dist/development/editor/methods/textToSpecifics.js.map +1 -0
- package/dist/development/editor/methods/toLatestFormat.cjs +34 -0
- package/dist/development/editor/methods/toLatestFormat.cjs.map +1 -0
- package/dist/development/editor/methods/toLatestFormat.js +34 -0
- package/dist/development/editor/methods/toLatestFormat.js.map +1 -0
- package/dist/development/editor/methods/topLevelNodes.cjs +12 -0
- package/dist/development/editor/methods/topLevelNodes.cjs.map +1 -0
- package/dist/development/editor/methods/topLevelNodes.js +12 -0
- package/dist/development/editor/methods/topLevelNodes.js.map +1 -0
- 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/internal/components/DefaultElement.cjs +11 -0
- package/dist/development/internal/components/DefaultElement.cjs.map +1 -0
- package/dist/development/internal/components/DefaultElement.js +11 -0
- package/dist/development/internal/components/DefaultElement.js.map +1 -0
- package/dist/development/internal/hooks/useRichTextFieldNodes.cjs +28 -0
- package/dist/development/internal/hooks/useRichTextFieldNodes.cjs.map +1 -0
- package/dist/development/internal/hooks/useRichTextFieldNodes.js +28 -0
- package/dist/development/internal/hooks/useRichTextFieldNodes.js.map +1 -0
- package/dist/development/internal/utils/EditorPasteUtils.cjs +47 -0
- package/dist/development/internal/utils/EditorPasteUtils.cjs.map +1 -0
- package/dist/development/internal/utils/EditorPasteUtils.js +47 -0
- package/dist/development/internal/utils/EditorPasteUtils.js.map +1 -0
- package/dist/development/internal/utils/parseUrl.cjs +14 -0
- package/dist/development/internal/utils/parseUrl.cjs.map +1 -0
- package/dist/development/internal/utils/parseUrl.js +14 -0
- package/dist/development/internal/utils/parseUrl.js.map +1 -0
- package/dist/development/plugins/attributes/alignment/alignButton.cjs +21 -0
- package/dist/development/plugins/attributes/alignment/alignButton.cjs.map +1 -0
- package/dist/development/plugins/attributes/alignment/alignButton.js +21 -0
- package/dist/development/plugins/attributes/alignment/alignButton.js.map +1 -0
- package/dist/development/plugins/behaviour/paste/HtmlDeserializer.cjs +138 -0
- package/dist/development/plugins/behaviour/paste/HtmlDeserializer.cjs.map +1 -0
- package/dist/development/plugins/behaviour/paste/HtmlDeserializer.js +138 -0
- package/dist/development/plugins/behaviour/paste/HtmlDeserializer.js.map +1 -0
- package/dist/development/plugins/behaviour/paste/createMarkHtmlDeserializer.cjs +15 -0
- package/dist/development/plugins/behaviour/paste/createMarkHtmlDeserializer.cjs.map +1 -0
- package/dist/development/plugins/behaviour/paste/createMarkHtmlDeserializer.js +15 -0
- package/dist/development/plugins/behaviour/paste/createMarkHtmlDeserializer.js.map +1 -0
- package/dist/development/plugins/behaviour/paste/withPaste.cjs +24 -0
- package/dist/development/plugins/behaviour/paste/withPaste.cjs.map +1 -0
- package/dist/development/plugins/behaviour/paste/withPaste.js +24 -0
- package/dist/development/plugins/behaviour/paste/withPaste.js.map +1 -0
- package/dist/development/plugins/element/anchors/AnchorElement.cjs +44 -0
- package/dist/development/plugins/element/anchors/AnchorElement.cjs.map +1 -0
- package/dist/development/plugins/element/anchors/AnchorElement.js +44 -0
- package/dist/development/plugins/element/anchors/AnchorElement.js.map +1 -0
- package/dist/development/plugins/element/anchors/AnchorHtmlDeserializer.cjs +19 -0
- package/dist/development/plugins/element/anchors/AnchorHtmlDeserializer.cjs.map +1 -0
- package/dist/development/plugins/element/anchors/AnchorHtmlDeserializer.js +19 -0
- package/dist/development/plugins/element/anchors/AnchorHtmlDeserializer.js.map +1 -0
- package/dist/development/plugins/element/anchors/AnchorModifications.cjs +29 -0
- package/dist/development/plugins/element/anchors/AnchorModifications.cjs.map +1 -0
- package/dist/development/plugins/element/anchors/AnchorModifications.js +29 -0
- package/dist/development/plugins/element/anchors/AnchorModifications.js.map +1 -0
- package/dist/development/plugins/element/anchors/withAnchors.cjs +21 -0
- package/dist/development/plugins/element/anchors/withAnchors.cjs.map +1 -0
- package/dist/development/plugins/element/anchors/withAnchors.js +21 -0
- package/dist/development/plugins/element/anchors/withAnchors.js.map +1 -0
- package/dist/development/plugins/element/headings/HeadingElement.cjs +41 -0
- package/dist/development/plugins/element/headings/HeadingElement.cjs.map +1 -0
- package/dist/development/plugins/element/headings/HeadingElement.js +41 -0
- package/dist/development/plugins/element/headings/HeadingElement.js.map +1 -0
- package/dist/development/plugins/element/headings/HeadingHtmlDeserializer.cjs +22 -0
- package/dist/development/plugins/element/headings/HeadingHtmlDeserializer.cjs.map +1 -0
- package/dist/development/plugins/element/headings/HeadingHtmlDeserializer.js +22 -0
- package/dist/development/plugins/element/headings/HeadingHtmlDeserializer.js.map +1 -0
- package/dist/development/plugins/element/headings/withHeadings.cjs +70 -0
- package/dist/development/plugins/element/headings/withHeadings.cjs.map +1 -0
- package/dist/development/plugins/element/headings/withHeadings.js +70 -0
- package/dist/development/plugins/element/headings/withHeadings.js.map +1 -0
- package/dist/development/plugins/element/horizonalRules/HorizontalRuleElement.cjs +41 -0
- package/dist/development/plugins/element/horizonalRules/HorizontalRuleElement.cjs.map +1 -0
- package/dist/development/plugins/element/horizonalRules/HorizontalRuleElement.js +41 -0
- package/dist/development/plugins/element/horizonalRules/HorizontalRuleElement.js.map +1 -0
- package/dist/development/plugins/element/horizonalRules/withHorizontalRules.cjs +75 -0
- package/dist/development/plugins/element/horizonalRules/withHorizontalRules.cjs.map +1 -0
- package/dist/development/plugins/element/horizonalRules/withHorizontalRules.js +75 -0
- package/dist/development/plugins/element/horizonalRules/withHorizontalRules.js.map +1 -0
- package/dist/development/plugins/element/lists/ListElement.cjs +26 -0
- package/dist/development/plugins/element/lists/ListElement.cjs.map +1 -0
- package/dist/development/plugins/element/lists/ListElement.js +26 -0
- package/dist/development/plugins/element/lists/ListElement.js.map +1 -0
- package/dist/development/plugins/element/lists/ListHtmlDeserializer.cjs +98 -0
- package/dist/development/plugins/element/lists/ListHtmlDeserializer.cjs.map +1 -0
- package/dist/development/plugins/element/lists/ListHtmlDeserializer.js +98 -0
- package/dist/development/plugins/element/lists/ListHtmlDeserializer.js.map +1 -0
- package/dist/development/plugins/element/lists/ListItemElement.cjs +53 -0
- package/dist/development/plugins/element/lists/ListItemElement.cjs.map +1 -0
- package/dist/development/plugins/element/lists/ListItemElement.js +53 -0
- package/dist/development/plugins/element/lists/ListItemElement.js.map +1 -0
- package/dist/development/plugins/element/lists/OrderedListElement.cjs +25 -0
- package/dist/development/plugins/element/lists/OrderedListElement.cjs.map +1 -0
- package/dist/development/plugins/element/lists/OrderedListElement.js +25 -0
- package/dist/development/plugins/element/lists/OrderedListElement.js.map +1 -0
- package/dist/development/plugins/element/lists/UnorderedListElement.cjs +25 -0
- package/dist/development/plugins/element/lists/UnorderedListElement.cjs.map +1 -0
- package/dist/development/plugins/element/lists/UnorderedListElement.js +25 -0
- package/dist/development/plugins/element/lists/UnorderedListElement.js.map +1 -0
- package/dist/development/plugins/element/lists/transforms/dedentListItem.cjs +57 -0
- package/dist/development/plugins/element/lists/transforms/dedentListItem.cjs.map +1 -0
- package/dist/development/plugins/element/lists/transforms/dedentListItem.js +57 -0
- package/dist/development/plugins/element/lists/transforms/dedentListItem.js.map +1 -0
- package/dist/development/plugins/element/lists/transforms/indentListItem.cjs +57 -0
- package/dist/development/plugins/element/lists/transforms/indentListItem.cjs.map +1 -0
- package/dist/development/plugins/element/lists/transforms/indentListItem.js +57 -0
- package/dist/development/plugins/element/lists/transforms/indentListItem.js.map +1 -0
- package/dist/development/plugins/element/lists/transforms/normalizeListElement.cjs +22 -0
- package/dist/development/plugins/element/lists/transforms/normalizeListElement.cjs.map +1 -0
- package/dist/development/plugins/element/lists/transforms/normalizeListElement.js +22 -0
- package/dist/development/plugins/element/lists/transforms/normalizeListElement.js.map +1 -0
- package/dist/development/plugins/element/lists/transforms/toggleListElement.cjs +93 -0
- package/dist/development/plugins/element/lists/transforms/toggleListElement.cjs.map +1 -0
- package/dist/development/plugins/element/lists/transforms/toggleListElement.js +93 -0
- package/dist/development/plugins/element/lists/transforms/toggleListElement.js.map +1 -0
- package/dist/development/plugins/element/lists/withLists.cjs +153 -0
- package/dist/development/plugins/element/lists/withLists.cjs.map +1 -0
- package/dist/development/plugins/element/lists/withLists.js +153 -0
- package/dist/development/plugins/element/lists/withLists.js.map +1 -0
- package/dist/development/plugins/element/paragraphs/ParagraphElement.cjs +49 -0
- package/dist/development/plugins/element/paragraphs/ParagraphElement.cjs.map +1 -0
- package/dist/development/plugins/element/paragraphs/ParagraphElement.js +49 -0
- package/dist/development/plugins/element/paragraphs/ParagraphElement.js.map +1 -0
- package/dist/development/plugins/element/paragraphs/ParagraphHtmlDeserializer.cjs +11 -0
- package/dist/development/plugins/element/paragraphs/ParagraphHtmlDeserializer.cjs.map +1 -0
- package/dist/development/plugins/element/paragraphs/ParagraphHtmlDeserializer.js +11 -0
- package/dist/development/plugins/element/paragraphs/ParagraphHtmlDeserializer.js.map +1 -0
- package/dist/development/plugins/element/paragraphs/withParagraphs.cjs +58 -0
- package/dist/development/plugins/element/paragraphs/withParagraphs.cjs.map +1 -0
- package/dist/development/plugins/element/paragraphs/withParagraphs.js +58 -0
- package/dist/development/plugins/element/paragraphs/withParagraphs.js.map +1 -0
- package/dist/development/plugins/element/scrollTargets/ScrollTargetElement.cjs +51 -0
- package/dist/development/plugins/element/scrollTargets/ScrollTargetElement.cjs.map +1 -0
- package/dist/development/plugins/element/scrollTargets/ScrollTargetElement.js +51 -0
- package/dist/development/plugins/element/scrollTargets/ScrollTargetElement.js.map +1 -0
- package/dist/development/plugins/element/scrollTargets/withScrollTargets.cjs +9 -0
- package/dist/development/plugins/element/scrollTargets/withScrollTargets.cjs.map +1 -0
- package/dist/development/plugins/element/scrollTargets/withScrollTargets.js +9 -0
- package/dist/development/plugins/element/scrollTargets/withScrollTargets.js.map +1 -0
- package/dist/development/plugins/element/tables/TableCellElement.cjs +39 -0
- package/dist/development/plugins/element/tables/TableCellElement.cjs.map +1 -0
- package/dist/development/plugins/element/tables/TableCellElement.js +39 -0
- package/dist/development/plugins/element/tables/TableCellElement.js.map +1 -0
- package/dist/development/plugins/element/tables/TableElement.cjs +114 -0
- package/dist/development/plugins/element/tables/TableElement.cjs.map +1 -0
- package/dist/development/plugins/element/tables/TableElement.js +114 -0
- package/dist/development/plugins/element/tables/TableElement.js.map +1 -0
- package/dist/development/plugins/element/tables/TableElementSelection.cjs +20 -0
- package/dist/development/plugins/element/tables/TableElementSelection.cjs.map +1 -0
- package/dist/development/plugins/element/tables/TableElementSelection.js +20 -0
- package/dist/development/plugins/element/tables/TableElementSelection.js.map +1 -0
- package/dist/development/plugins/element/tables/TableModifications.cjs +134 -0
- package/dist/development/plugins/element/tables/TableModifications.cjs.map +1 -0
- package/dist/development/plugins/element/tables/TableModifications.js +134 -0
- package/dist/development/plugins/element/tables/TableModifications.js.map +1 -0
- package/dist/development/plugins/element/tables/TableRowElement.cjs +43 -0
- package/dist/development/plugins/element/tables/TableRowElement.cjs.map +1 -0
- package/dist/development/plugins/element/tables/TableRowElement.js +43 -0
- package/dist/development/plugins/element/tables/TableRowElement.js.map +1 -0
- package/dist/development/plugins/element/tables/gaugeTableColumnCount.cjs +25 -0
- package/dist/development/plugins/element/tables/gaugeTableColumnCount.cjs.map +1 -0
- package/dist/development/plugins/element/tables/gaugeTableColumnCount.js +25 -0
- package/dist/development/plugins/element/tables/gaugeTableColumnCount.js.map +1 -0
- package/dist/development/plugins/element/tables/withTables.cjs +281 -0
- package/dist/development/plugins/element/tables/withTables.cjs.map +1 -0
- package/dist/development/plugins/element/tables/withTables.js +281 -0
- package/dist/development/plugins/element/tables/withTables.js.map +1 -0
- package/dist/development/plugins/text/bold/boldMark.cjs +13 -0
- package/dist/development/plugins/text/bold/boldMark.cjs.map +1 -0
- package/dist/development/plugins/text/bold/boldMark.js +13 -0
- package/dist/development/plugins/text/bold/boldMark.js.map +1 -0
- package/dist/development/plugins/text/bold/withBold.cjs +16 -0
- package/dist/development/plugins/text/bold/withBold.cjs.map +1 -0
- package/dist/development/plugins/text/bold/withBold.js +16 -0
- package/dist/development/plugins/text/bold/withBold.js.map +1 -0
- package/dist/development/plugins/text/code/codeMark.cjs +13 -0
- package/dist/development/plugins/text/code/codeMark.cjs.map +1 -0
- package/dist/development/plugins/text/code/codeMark.js +13 -0
- package/dist/development/plugins/text/code/codeMark.js.map +1 -0
- package/dist/development/plugins/text/code/withCode.cjs +9 -0
- package/dist/development/plugins/text/code/withCode.cjs.map +1 -0
- package/dist/development/plugins/text/code/withCode.js +9 -0
- package/dist/development/plugins/text/code/withCode.js.map +1 -0
- package/dist/development/plugins/text/highlight/highlightMark.cjs +13 -0
- package/dist/development/plugins/text/highlight/highlightMark.cjs.map +1 -0
- package/dist/development/plugins/text/highlight/highlightMark.js +13 -0
- package/dist/development/plugins/text/highlight/highlightMark.js.map +1 -0
- package/dist/development/plugins/text/highlight/withHighlight.cjs +9 -0
- package/dist/development/plugins/text/highlight/withHighlight.cjs.map +1 -0
- package/dist/development/plugins/text/highlight/withHighlight.js +9 -0
- package/dist/development/plugins/text/highlight/withHighlight.js.map +1 -0
- package/dist/development/plugins/text/italic/italicMark.cjs +13 -0
- package/dist/development/plugins/text/italic/italicMark.cjs.map +1 -0
- package/dist/development/plugins/text/italic/italicMark.js +13 -0
- package/dist/development/plugins/text/italic/italicMark.js.map +1 -0
- package/dist/development/plugins/text/italic/withItalic.cjs +16 -0
- package/dist/development/plugins/text/italic/withItalic.cjs.map +1 -0
- package/dist/development/plugins/text/italic/withItalic.js +16 -0
- package/dist/development/plugins/text/italic/withItalic.js.map +1 -0
- package/dist/development/plugins/text/newline/withNewline.cjs +15 -0
- package/dist/development/plugins/text/newline/withNewline.cjs.map +1 -0
- package/dist/development/plugins/text/newline/withNewline.js +15 -0
- package/dist/development/plugins/text/newline/withNewline.js.map +1 -0
- package/dist/development/plugins/text/strikeThrough/strikeThroughMark.cjs +13 -0
- package/dist/development/plugins/text/strikeThrough/strikeThroughMark.cjs.map +1 -0
- package/dist/development/plugins/text/strikeThrough/strikeThroughMark.js +13 -0
- package/dist/development/plugins/text/strikeThrough/strikeThroughMark.js.map +1 -0
- package/dist/development/plugins/text/strikeThrough/withStrikeThrough.cjs +17 -0
- package/dist/development/plugins/text/strikeThrough/withStrikeThrough.cjs.map +1 -0
- package/dist/development/plugins/text/strikeThrough/withStrikeThrough.js +17 -0
- package/dist/development/plugins/text/strikeThrough/withStrikeThrough.js.map +1 -0
- package/dist/development/plugins/text/underline/underlineMark.cjs +13 -0
- package/dist/development/plugins/text/underline/underlineMark.cjs.map +1 -0
- package/dist/development/plugins/text/underline/underlineMark.js +13 -0
- package/dist/development/plugins/text/underline/underlineMark.js.map +1 -0
- package/dist/development/plugins/text/underline/withUnderline.cjs +17 -0
- package/dist/development/plugins/text/underline/withUnderline.cjs.map +1 -0
- package/dist/development/plugins/text/underline/withUnderline.js +17 -0
- package/dist/development/plugins/text/underline/withUnderline.js.map +1 -0
- package/dist/development/slate-reexport.cjs +10 -0
- package/dist/development/slate-reexport.cjs.map +1 -0
- package/dist/development/slate-reexport.js +8 -0
- package/dist/development/slate-reexport.js.map +1 -0
- package/dist/production/components/RichTextEditor.cjs +93 -0
- package/dist/production/components/RichTextEditor.cjs.map +1 -0
- package/dist/production/components/RichTextEditor.js +93 -0
- package/dist/production/components/RichTextEditor.js.map +1 -0
- package/dist/production/components/triggers/EditorElementTrigger.cjs +16 -0
- package/dist/production/components/triggers/EditorElementTrigger.cjs.map +1 -0
- package/dist/production/components/triggers/EditorElementTrigger.js +16 -0
- package/dist/production/components/triggers/EditorElementTrigger.js.map +1 -0
- package/dist/production/components/triggers/EditorGenericTrigger.cjs +20 -0
- package/dist/production/components/triggers/EditorGenericTrigger.cjs.map +1 -0
- package/dist/production/components/triggers/EditorGenericTrigger.js +20 -0
- package/dist/production/components/triggers/EditorGenericTrigger.js.map +1 -0
- package/dist/production/components/triggers/EditorMarkTrigger.cjs +16 -0
- package/dist/production/components/triggers/EditorMarkTrigger.cjs.map +1 -0
- package/dist/production/components/triggers/EditorMarkTrigger.js +16 -0
- package/dist/production/components/triggers/EditorMarkTrigger.js.map +1 -0
- package/dist/production/components/triggers/EditorWrapNodeTrigger.cjs +28 -0
- package/dist/production/components/triggers/EditorWrapNodeTrigger.cjs.map +1 -0
- package/dist/production/components/triggers/EditorWrapNodeTrigger.js +28 -0
- package/dist/production/components/triggers/EditorWrapNodeTrigger.js.map +1 -0
- package/dist/production/editor/createEditor.cjs +35 -0
- package/dist/production/editor/createEditor.cjs.map +1 -0
- package/dist/production/editor/createEditor.js +35 -0
- package/dist/production/editor/createEditor.js.map +1 -0
- package/dist/production/editor/createEditorWithEssentials.cjs +227 -0
- package/dist/production/editor/createEditorWithEssentials.cjs.map +1 -0
- package/dist/production/editor/createEditorWithEssentials.js +211 -0
- package/dist/production/editor/createEditorWithEssentials.js.map +1 -0
- package/dist/production/editor/index.cjs +44 -0
- package/dist/production/editor/index.cjs.map +1 -0
- package/dist/production/editor/index.js +44 -0
- package/dist/production/editor/index.js.map +1 -0
- package/dist/production/editor/methods/addMarks.cjs +12 -0
- package/dist/production/editor/methods/addMarks.cjs.map +1 -0
- package/dist/production/editor/methods/addMarks.js +12 -0
- package/dist/production/editor/methods/addMarks.js.map +1 -0
- package/dist/production/editor/methods/canToggleMark.cjs +7 -0
- package/dist/production/editor/methods/canToggleMark.cjs.map +1 -0
- package/dist/production/editor/methods/canToggleMark.js +7 -0
- package/dist/production/editor/methods/canToggleMark.js.map +1 -0
- package/dist/production/editor/methods/closest.cjs +18 -0
- package/dist/production/editor/methods/closest.cjs.map +1 -0
- package/dist/production/editor/methods/closest.js +18 -0
- package/dist/production/editor/methods/closest.js.map +1 -0
- package/dist/production/editor/methods/closestBlockEntry.cjs +10 -0
- package/dist/production/editor/methods/closestBlockEntry.cjs.map +1 -0
- package/dist/production/editor/methods/closestBlockEntry.js +10 -0
- package/dist/production/editor/methods/closestBlockEntry.js.map +1 -0
- package/dist/production/editor/methods/closestViableBlockContainerEntry.cjs +9 -0
- package/dist/production/editor/methods/closestViableBlockContainerEntry.cjs.map +1 -0
- package/dist/production/editor/methods/closestViableBlockContainerEntry.js +9 -0
- package/dist/production/editor/methods/closestViableBlockContainerEntry.js.map +1 -0
- package/dist/production/editor/methods/ejectElement.cjs +15 -0
- package/dist/production/editor/methods/ejectElement.cjs.map +1 -0
- package/dist/production/editor/methods/ejectElement.js +15 -0
- package/dist/production/editor/methods/ejectElement.js.map +1 -0
- package/dist/production/editor/methods/elementToSpecifics.cjs +8 -0
- package/dist/production/editor/methods/elementToSpecifics.cjs.map +1 -0
- package/dist/production/editor/methods/elementToSpecifics.js +8 -0
- package/dist/production/editor/methods/elementToSpecifics.js.map +1 -0
- package/dist/production/editor/methods/getElementDataAttributes.cjs +13 -0
- package/dist/production/editor/methods/getElementDataAttributes.cjs.map +1 -0
- package/dist/production/editor/methods/getElementDataAttributes.js +13 -0
- package/dist/production/editor/methods/getElementDataAttributes.js.map +1 -0
- package/dist/production/editor/methods/getPreviousSibling.cjs +13 -0
- package/dist/production/editor/methods/getPreviousSibling.cjs.map +1 -0
- package/dist/production/editor/methods/getPreviousSibling.js +13 -0
- package/dist/production/editor/methods/getPreviousSibling.js.map +1 -0
- package/dist/production/editor/methods/hasMarks.cjs +23 -0
- package/dist/production/editor/methods/hasMarks.cjs.map +1 -0
- package/dist/production/editor/methods/hasMarks.js +23 -0
- package/dist/production/editor/methods/hasMarks.js.map +1 -0
- package/dist/production/editor/methods/hasParentOfType.cjs +15 -0
- package/dist/production/editor/methods/hasParentOfType.cjs.map +1 -0
- package/dist/production/editor/methods/hasParentOfType.js +15 -0
- package/dist/production/editor/methods/hasParentOfType.js.map +1 -0
- package/dist/production/editor/methods/isElementType.cjs +24 -0
- package/dist/production/editor/methods/isElementType.cjs.map +1 -0
- package/dist/production/editor/methods/isElementType.js +24 -0
- package/dist/production/editor/methods/isElementType.js.map +1 -0
- package/dist/production/editor/methods/permissivelyDeserializeNodes.cjs +22 -0
- package/dist/production/editor/methods/permissivelyDeserializeNodes.cjs.map +1 -0
- package/dist/production/editor/methods/permissivelyDeserializeNodes.js +22 -0
- package/dist/production/editor/methods/permissivelyDeserializeNodes.js.map +1 -0
- package/dist/production/editor/methods/removeMarks.cjs +12 -0
- package/dist/production/editor/methods/removeMarks.cjs.map +1 -0
- package/dist/production/editor/methods/removeMarks.js +12 -0
- package/dist/production/editor/methods/removeMarks.js.map +1 -0
- package/dist/production/editor/methods/serializeNodes.cjs +15 -0
- package/dist/production/editor/methods/serializeNodes.cjs.map +1 -0
- package/dist/production/editor/methods/serializeNodes.js +15 -0
- package/dist/production/editor/methods/serializeNodes.js.map +1 -0
- package/dist/production/editor/methods/strictlyDeserializeNodes.cjs +14 -0
- package/dist/production/editor/methods/strictlyDeserializeNodes.cjs.map +1 -0
- package/dist/production/editor/methods/strictlyDeserializeNodes.js +14 -0
- package/dist/production/editor/methods/strictlyDeserializeNodes.js.map +1 -0
- package/dist/production/editor/methods/textToSpecifics.cjs +8 -0
- package/dist/production/editor/methods/textToSpecifics.cjs.map +1 -0
- package/dist/production/editor/methods/textToSpecifics.js +8 -0
- package/dist/production/editor/methods/textToSpecifics.js.map +1 -0
- package/dist/production/editor/methods/toLatestFormat.cjs +34 -0
- package/dist/production/editor/methods/toLatestFormat.cjs.map +1 -0
- package/dist/production/editor/methods/toLatestFormat.js +34 -0
- package/dist/production/editor/methods/toLatestFormat.js.map +1 -0
- package/dist/production/editor/methods/topLevelNodes.cjs +12 -0
- package/dist/production/editor/methods/topLevelNodes.cjs.map +1 -0
- package/dist/production/editor/methods/topLevelNodes.js +12 -0
- package/dist/production/editor/methods/topLevelNodes.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/internal/components/DefaultElement.cjs +11 -0
- package/dist/production/internal/components/DefaultElement.cjs.map +1 -0
- package/dist/production/internal/components/DefaultElement.js +11 -0
- package/dist/production/internal/components/DefaultElement.js.map +1 -0
- package/dist/production/internal/hooks/useRichTextFieldNodes.cjs +28 -0
- package/dist/production/internal/hooks/useRichTextFieldNodes.cjs.map +1 -0
- package/dist/production/internal/hooks/useRichTextFieldNodes.js +28 -0
- package/dist/production/internal/hooks/useRichTextFieldNodes.js.map +1 -0
- package/dist/production/internal/utils/EditorPasteUtils.cjs +47 -0
- package/dist/production/internal/utils/EditorPasteUtils.cjs.map +1 -0
- package/dist/production/internal/utils/EditorPasteUtils.js +47 -0
- package/dist/production/internal/utils/EditorPasteUtils.js.map +1 -0
- package/dist/production/internal/utils/parseUrl.cjs +14 -0
- package/dist/production/internal/utils/parseUrl.cjs.map +1 -0
- package/dist/production/internal/utils/parseUrl.js +14 -0
- package/dist/production/internal/utils/parseUrl.js.map +1 -0
- package/dist/production/plugins/attributes/alignment/alignButton.cjs +21 -0
- package/dist/production/plugins/attributes/alignment/alignButton.cjs.map +1 -0
- package/dist/production/plugins/attributes/alignment/alignButton.js +21 -0
- package/dist/production/plugins/attributes/alignment/alignButton.js.map +1 -0
- package/dist/production/plugins/behaviour/paste/HtmlDeserializer.cjs +138 -0
- package/dist/production/plugins/behaviour/paste/HtmlDeserializer.cjs.map +1 -0
- package/dist/production/plugins/behaviour/paste/HtmlDeserializer.js +138 -0
- package/dist/production/plugins/behaviour/paste/HtmlDeserializer.js.map +1 -0
- package/dist/production/plugins/behaviour/paste/createMarkHtmlDeserializer.cjs +15 -0
- package/dist/production/plugins/behaviour/paste/createMarkHtmlDeserializer.cjs.map +1 -0
- package/dist/production/plugins/behaviour/paste/createMarkHtmlDeserializer.js +15 -0
- package/dist/production/plugins/behaviour/paste/createMarkHtmlDeserializer.js.map +1 -0
- package/dist/production/plugins/behaviour/paste/withPaste.cjs +24 -0
- package/dist/production/plugins/behaviour/paste/withPaste.cjs.map +1 -0
- package/dist/production/plugins/behaviour/paste/withPaste.js +24 -0
- package/dist/production/plugins/behaviour/paste/withPaste.js.map +1 -0
- package/dist/production/plugins/element/anchors/AnchorElement.cjs +44 -0
- package/dist/production/plugins/element/anchors/AnchorElement.cjs.map +1 -0
- package/dist/production/plugins/element/anchors/AnchorElement.js +44 -0
- package/dist/production/plugins/element/anchors/AnchorElement.js.map +1 -0
- package/dist/production/plugins/element/anchors/AnchorHtmlDeserializer.cjs +19 -0
- package/dist/production/plugins/element/anchors/AnchorHtmlDeserializer.cjs.map +1 -0
- package/dist/production/plugins/element/anchors/AnchorHtmlDeserializer.js +19 -0
- package/dist/production/plugins/element/anchors/AnchorHtmlDeserializer.js.map +1 -0
- package/dist/production/plugins/element/anchors/AnchorModifications.cjs +29 -0
- package/dist/production/plugins/element/anchors/AnchorModifications.cjs.map +1 -0
- package/dist/production/plugins/element/anchors/AnchorModifications.js +29 -0
- package/dist/production/plugins/element/anchors/AnchorModifications.js.map +1 -0
- package/dist/production/plugins/element/anchors/withAnchors.cjs +21 -0
- package/dist/production/plugins/element/anchors/withAnchors.cjs.map +1 -0
- package/dist/production/plugins/element/anchors/withAnchors.js +21 -0
- package/dist/production/plugins/element/anchors/withAnchors.js.map +1 -0
- package/dist/production/plugins/element/headings/HeadingElement.cjs +41 -0
- package/dist/production/plugins/element/headings/HeadingElement.cjs.map +1 -0
- package/dist/production/plugins/element/headings/HeadingElement.js +41 -0
- package/dist/production/plugins/element/headings/HeadingElement.js.map +1 -0
- package/dist/production/plugins/element/headings/HeadingHtmlDeserializer.cjs +22 -0
- package/dist/production/plugins/element/headings/HeadingHtmlDeserializer.cjs.map +1 -0
- package/dist/production/plugins/element/headings/HeadingHtmlDeserializer.js +22 -0
- package/dist/production/plugins/element/headings/HeadingHtmlDeserializer.js.map +1 -0
- package/dist/production/plugins/element/headings/withHeadings.cjs +70 -0
- package/dist/production/plugins/element/headings/withHeadings.cjs.map +1 -0
- package/dist/production/plugins/element/headings/withHeadings.js +70 -0
- package/dist/production/plugins/element/headings/withHeadings.js.map +1 -0
- package/dist/production/plugins/element/horizonalRules/HorizontalRuleElement.cjs +41 -0
- package/dist/production/plugins/element/horizonalRules/HorizontalRuleElement.cjs.map +1 -0
- package/dist/production/plugins/element/horizonalRules/HorizontalRuleElement.js +41 -0
- package/dist/production/plugins/element/horizonalRules/HorizontalRuleElement.js.map +1 -0
- package/dist/production/plugins/element/horizonalRules/withHorizontalRules.cjs +75 -0
- package/dist/production/plugins/element/horizonalRules/withHorizontalRules.cjs.map +1 -0
- package/dist/production/plugins/element/horizonalRules/withHorizontalRules.js +75 -0
- package/dist/production/plugins/element/horizonalRules/withHorizontalRules.js.map +1 -0
- package/dist/production/plugins/element/lists/ListElement.cjs +26 -0
- package/dist/production/plugins/element/lists/ListElement.cjs.map +1 -0
- package/dist/production/plugins/element/lists/ListElement.js +26 -0
- package/dist/production/plugins/element/lists/ListElement.js.map +1 -0
- package/dist/production/plugins/element/lists/ListHtmlDeserializer.cjs +98 -0
- package/dist/production/plugins/element/lists/ListHtmlDeserializer.cjs.map +1 -0
- package/dist/production/plugins/element/lists/ListHtmlDeserializer.js +98 -0
- package/dist/production/plugins/element/lists/ListHtmlDeserializer.js.map +1 -0
- package/dist/production/plugins/element/lists/ListItemElement.cjs +53 -0
- package/dist/production/plugins/element/lists/ListItemElement.cjs.map +1 -0
- package/dist/production/plugins/element/lists/ListItemElement.js +53 -0
- package/dist/production/plugins/element/lists/ListItemElement.js.map +1 -0
- package/dist/production/plugins/element/lists/OrderedListElement.cjs +25 -0
- package/dist/production/plugins/element/lists/OrderedListElement.cjs.map +1 -0
- package/dist/production/plugins/element/lists/OrderedListElement.js +25 -0
- package/dist/production/plugins/element/lists/OrderedListElement.js.map +1 -0
- package/dist/production/plugins/element/lists/UnorderedListElement.cjs +25 -0
- package/dist/production/plugins/element/lists/UnorderedListElement.cjs.map +1 -0
- package/dist/production/plugins/element/lists/UnorderedListElement.js +25 -0
- package/dist/production/plugins/element/lists/UnorderedListElement.js.map +1 -0
- package/dist/production/plugins/element/lists/transforms/dedentListItem.cjs +57 -0
- package/dist/production/plugins/element/lists/transforms/dedentListItem.cjs.map +1 -0
- package/dist/production/plugins/element/lists/transforms/dedentListItem.js +57 -0
- package/dist/production/plugins/element/lists/transforms/dedentListItem.js.map +1 -0
- package/dist/production/plugins/element/lists/transforms/indentListItem.cjs +57 -0
- package/dist/production/plugins/element/lists/transforms/indentListItem.cjs.map +1 -0
- package/dist/production/plugins/element/lists/transforms/indentListItem.js +57 -0
- package/dist/production/plugins/element/lists/transforms/indentListItem.js.map +1 -0
- package/dist/production/plugins/element/lists/transforms/normalizeListElement.cjs +22 -0
- package/dist/production/plugins/element/lists/transforms/normalizeListElement.cjs.map +1 -0
- package/dist/production/plugins/element/lists/transforms/normalizeListElement.js +22 -0
- package/dist/production/plugins/element/lists/transforms/normalizeListElement.js.map +1 -0
- package/dist/production/plugins/element/lists/transforms/toggleListElement.cjs +93 -0
- package/dist/production/plugins/element/lists/transforms/toggleListElement.cjs.map +1 -0
- package/dist/production/plugins/element/lists/transforms/toggleListElement.js +93 -0
- package/dist/production/plugins/element/lists/transforms/toggleListElement.js.map +1 -0
- package/dist/production/plugins/element/lists/withLists.cjs +153 -0
- package/dist/production/plugins/element/lists/withLists.cjs.map +1 -0
- package/dist/production/plugins/element/lists/withLists.js +153 -0
- package/dist/production/plugins/element/lists/withLists.js.map +1 -0
- package/dist/production/plugins/element/paragraphs/ParagraphElement.cjs +49 -0
- package/dist/production/plugins/element/paragraphs/ParagraphElement.cjs.map +1 -0
- package/dist/production/plugins/element/paragraphs/ParagraphElement.js +49 -0
- package/dist/production/plugins/element/paragraphs/ParagraphElement.js.map +1 -0
- package/dist/production/plugins/element/paragraphs/ParagraphHtmlDeserializer.cjs +11 -0
- package/dist/production/plugins/element/paragraphs/ParagraphHtmlDeserializer.cjs.map +1 -0
- package/dist/production/plugins/element/paragraphs/ParagraphHtmlDeserializer.js +11 -0
- package/dist/production/plugins/element/paragraphs/ParagraphHtmlDeserializer.js.map +1 -0
- package/dist/production/plugins/element/paragraphs/withParagraphs.cjs +58 -0
- package/dist/production/plugins/element/paragraphs/withParagraphs.cjs.map +1 -0
- package/dist/production/plugins/element/paragraphs/withParagraphs.js +58 -0
- package/dist/production/plugins/element/paragraphs/withParagraphs.js.map +1 -0
- package/dist/production/plugins/element/scrollTargets/ScrollTargetElement.cjs +51 -0
- package/dist/production/plugins/element/scrollTargets/ScrollTargetElement.cjs.map +1 -0
- package/dist/production/plugins/element/scrollTargets/ScrollTargetElement.js +51 -0
- package/dist/production/plugins/element/scrollTargets/ScrollTargetElement.js.map +1 -0
- package/dist/production/plugins/element/scrollTargets/withScrollTargets.cjs +9 -0
- package/dist/production/plugins/element/scrollTargets/withScrollTargets.cjs.map +1 -0
- package/dist/production/plugins/element/scrollTargets/withScrollTargets.js +9 -0
- package/dist/production/plugins/element/scrollTargets/withScrollTargets.js.map +1 -0
- package/dist/production/plugins/element/tables/TableCellElement.cjs +39 -0
- package/dist/production/plugins/element/tables/TableCellElement.cjs.map +1 -0
- package/dist/production/plugins/element/tables/TableCellElement.js +39 -0
- package/dist/production/plugins/element/tables/TableCellElement.js.map +1 -0
- package/dist/production/plugins/element/tables/TableElement.cjs +114 -0
- package/dist/production/plugins/element/tables/TableElement.cjs.map +1 -0
- package/dist/production/plugins/element/tables/TableElement.js +114 -0
- package/dist/production/plugins/element/tables/TableElement.js.map +1 -0
- package/dist/production/plugins/element/tables/TableElementSelection.cjs +20 -0
- package/dist/production/plugins/element/tables/TableElementSelection.cjs.map +1 -0
- package/dist/production/plugins/element/tables/TableElementSelection.js +20 -0
- package/dist/production/plugins/element/tables/TableElementSelection.js.map +1 -0
- package/dist/production/plugins/element/tables/TableModifications.cjs +134 -0
- package/dist/production/plugins/element/tables/TableModifications.cjs.map +1 -0
- package/dist/production/plugins/element/tables/TableModifications.js +134 -0
- package/dist/production/plugins/element/tables/TableModifications.js.map +1 -0
- package/dist/production/plugins/element/tables/TableRowElement.cjs +43 -0
- package/dist/production/plugins/element/tables/TableRowElement.cjs.map +1 -0
- package/dist/production/plugins/element/tables/TableRowElement.js +43 -0
- package/dist/production/plugins/element/tables/TableRowElement.js.map +1 -0
- package/dist/production/plugins/element/tables/gaugeTableColumnCount.cjs +25 -0
- package/dist/production/plugins/element/tables/gaugeTableColumnCount.cjs.map +1 -0
- package/dist/production/plugins/element/tables/gaugeTableColumnCount.js +25 -0
- package/dist/production/plugins/element/tables/gaugeTableColumnCount.js.map +1 -0
- package/dist/production/plugins/element/tables/withTables.cjs +281 -0
- package/dist/production/plugins/element/tables/withTables.cjs.map +1 -0
- package/dist/production/plugins/element/tables/withTables.js +281 -0
- package/dist/production/plugins/element/tables/withTables.js.map +1 -0
- package/dist/production/plugins/text/bold/boldMark.cjs +13 -0
- package/dist/production/plugins/text/bold/boldMark.cjs.map +1 -0
- package/dist/production/plugins/text/bold/boldMark.js +13 -0
- package/dist/production/plugins/text/bold/boldMark.js.map +1 -0
- package/dist/production/plugins/text/bold/withBold.cjs +16 -0
- package/dist/production/plugins/text/bold/withBold.cjs.map +1 -0
- package/dist/production/plugins/text/bold/withBold.js +16 -0
- package/dist/production/plugins/text/bold/withBold.js.map +1 -0
- package/dist/production/plugins/text/code/codeMark.cjs +13 -0
- package/dist/production/plugins/text/code/codeMark.cjs.map +1 -0
- package/dist/production/plugins/text/code/codeMark.js +13 -0
- package/dist/production/plugins/text/code/codeMark.js.map +1 -0
- package/dist/production/plugins/text/code/withCode.cjs +9 -0
- package/dist/production/plugins/text/code/withCode.cjs.map +1 -0
- package/dist/production/plugins/text/code/withCode.js +9 -0
- package/dist/production/plugins/text/code/withCode.js.map +1 -0
- package/dist/production/plugins/text/highlight/highlightMark.cjs +13 -0
- package/dist/production/plugins/text/highlight/highlightMark.cjs.map +1 -0
- package/dist/production/plugins/text/highlight/highlightMark.js +13 -0
- package/dist/production/plugins/text/highlight/highlightMark.js.map +1 -0
- package/dist/production/plugins/text/highlight/withHighlight.cjs +9 -0
- package/dist/production/plugins/text/highlight/withHighlight.cjs.map +1 -0
- package/dist/production/plugins/text/highlight/withHighlight.js +9 -0
- package/dist/production/plugins/text/highlight/withHighlight.js.map +1 -0
- package/dist/production/plugins/text/italic/italicMark.cjs +13 -0
- package/dist/production/plugins/text/italic/italicMark.cjs.map +1 -0
- package/dist/production/plugins/text/italic/italicMark.js +13 -0
- package/dist/production/plugins/text/italic/italicMark.js.map +1 -0
- package/dist/production/plugins/text/italic/withItalic.cjs +16 -0
- package/dist/production/plugins/text/italic/withItalic.cjs.map +1 -0
- package/dist/production/plugins/text/italic/withItalic.js +16 -0
- package/dist/production/plugins/text/italic/withItalic.js.map +1 -0
- package/dist/production/plugins/text/newline/withNewline.cjs +15 -0
- package/dist/production/plugins/text/newline/withNewline.cjs.map +1 -0
- package/dist/production/plugins/text/newline/withNewline.js +15 -0
- package/dist/production/plugins/text/newline/withNewline.js.map +1 -0
- package/dist/production/plugins/text/strikeThrough/strikeThroughMark.cjs +13 -0
- package/dist/production/plugins/text/strikeThrough/strikeThroughMark.cjs.map +1 -0
- package/dist/production/plugins/text/strikeThrough/strikeThroughMark.js +13 -0
- package/dist/production/plugins/text/strikeThrough/strikeThroughMark.js.map +1 -0
- package/dist/production/plugins/text/strikeThrough/withStrikeThrough.cjs +17 -0
- package/dist/production/plugins/text/strikeThrough/withStrikeThrough.cjs.map +1 -0
- package/dist/production/plugins/text/strikeThrough/withStrikeThrough.js +17 -0
- package/dist/production/plugins/text/strikeThrough/withStrikeThrough.js.map +1 -0
- package/dist/production/plugins/text/underline/underlineMark.cjs +13 -0
- package/dist/production/plugins/text/underline/underlineMark.cjs.map +1 -0
- package/dist/production/plugins/text/underline/underlineMark.js +13 -0
- package/dist/production/plugins/text/underline/underlineMark.js.map +1 -0
- package/dist/production/plugins/text/underline/withUnderline.cjs +17 -0
- package/dist/production/plugins/text/underline/withUnderline.cjs.map +1 -0
- package/dist/production/plugins/text/underline/withUnderline.js +17 -0
- package/dist/production/plugins/text/underline/withUnderline.js.map +1 -0
- package/dist/production/slate-reexport.cjs +10 -0
- package/dist/production/slate-reexport.cjs.map +1 -0
- package/dist/production/slate-reexport.js +8 -0
- package/dist/production/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 +3 -0
- package/dist/types/editor/methods/addMarks.d.ts.map +1 -0
- package/dist/types/editor/methods/canToggleMark.d.ts +2 -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 +2 -0
- package/dist/types/editor/methods/elementToSpecifics.d.ts.map +1 -0
- package/dist/types/editor/methods/getElementDataAttributes.d.ts +6 -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 +3 -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 +3 -0
- package/dist/types/editor/methods/textToSpecifics.d.ts.map +1 -0
- package/dist/types/editor/methods/toLatestFormat.d.ts +3 -0
- package/dist/types/editor/methods/toLatestFormat.d.ts.map +1 -0
- package/dist/types/editor/methods/topLevelNodes.d.ts +2 -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 +6 -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 +6 -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 +6 -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 +10 -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 +6 -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 +6 -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/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 +10 -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 +59 -0
- package/dist/types/types/plugins.d.ts.map +1 -0
- package/package.json +62 -0
- package/src/components/RichTextEditor.tsx +123 -0
- package/src/components/index.ts +3 -0
- package/src/components/triggers/EditorElementTrigger.tsx +22 -0
- package/src/components/triggers/EditorGenericTrigger.tsx +27 -0
- package/src/components/triggers/EditorMarkTrigger.tsx +21 -0
- package/src/components/triggers/EditorWrapNodeTrigger.tsx +36 -0
- package/src/components/triggers/index.ts +4 -0
- package/src/editor/createEditor.ts +52 -0
- package/src/editor/createEditorWithEssentials.tsx +248 -0
- package/src/editor/index.ts +48 -0
- package/src/editor/methods/addMarks.ts +10 -0
- package/src/editor/methods/canToggleMark.ts +9 -0
- package/src/editor/methods/closest.ts +21 -0
- package/src/editor/methods/closestBlockEntry.ts +14 -0
- package/src/editor/methods/closestViableBlockContainerEntry.ts +14 -0
- package/src/editor/methods/ejectElement.ts +14 -0
- package/src/editor/methods/elementToSpecifics.ts +8 -0
- package/src/editor/methods/getElementDataAttributes.ts +22 -0
- package/src/editor/methods/getPreviousSibling.ts +18 -0
- package/src/editor/methods/hasMarks.ts +30 -0
- package/src/editor/methods/hasParentOfType.ts +18 -0
- package/src/editor/methods/index.ts +19 -0
- package/src/editor/methods/isElementType.ts +29 -0
- package/src/editor/methods/permissivelyDeserializeNodes.ts +30 -0
- package/src/editor/methods/removeMarks.ts +10 -0
- package/src/editor/methods/serializeNodes.ts +18 -0
- package/src/editor/methods/strictlyDeserializeNodes.ts +19 -0
- package/src/editor/methods/textToSpecifics.ts +7 -0
- package/src/editor/methods/toLatestFormat.ts +37 -0
- package/src/editor/methods/topLevelNodes.ts +11 -0
- package/src/index.ts +6 -0
- package/src/internal/components/DefaultElement.tsx +11 -0
- package/src/internal/hooks/useRichTextFieldNodes.ts +38 -0
- package/src/internal/utils/EditorPasteUtils.ts +53 -0
- package/src/internal/utils/index.ts +2 -0
- package/src/internal/utils/parseIframeSrc.ts +13 -0
- package/src/internal/utils/parseUrl.ts +13 -0
- package/src/plugins/attributes/alignment/alignButton.ts +30 -0
- package/src/plugins/attributes/alignment/index.ts +1 -0
- package/src/plugins/attributes/index.ts +1 -0
- package/src/plugins/behaviour/index.ts +1 -0
- package/src/plugins/behaviour/paste/HtmlDeserializer.ts +180 -0
- package/src/plugins/behaviour/paste/createMarkHtmlDeserializer.ts +13 -0
- package/src/plugins/behaviour/paste/index.ts +2 -0
- package/src/plugins/behaviour/paste/withPaste.ts +24 -0
- package/src/plugins/element/anchors/AnchorElement.ts +49 -0
- package/src/plugins/element/anchors/AnchorHtmlDeserializer.ts +18 -0
- package/src/plugins/element/anchors/AnchorModifications.ts +29 -0
- package/src/plugins/element/anchors/index.ts +3 -0
- package/src/plugins/element/anchors/withAnchors.ts +23 -0
- package/src/plugins/element/headings/HeadingElement.ts +52 -0
- package/src/plugins/element/headings/HeadingHtmlDeserializer.ts +20 -0
- package/src/plugins/element/headings/index.ts +3 -0
- package/src/plugins/element/headings/withHeadings.ts +120 -0
- package/src/plugins/element/horizonalRules/HorizontalRuleElement.ts +48 -0
- package/src/plugins/element/horizonalRules/index.ts +2 -0
- package/src/plugins/element/horizonalRules/withHorizontalRules.ts +87 -0
- package/src/plugins/element/index.ts +7 -0
- package/src/plugins/element/lists/ListElement.ts +26 -0
- package/src/plugins/element/lists/ListHtmlDeserializer.ts +113 -0
- package/src/plugins/element/lists/ListItemElement.ts +60 -0
- package/src/plugins/element/lists/OrderedListElement.ts +31 -0
- package/src/plugins/element/lists/UnorderedListElement.ts +31 -0
- package/src/plugins/element/lists/index.ts +5 -0
- package/src/plugins/element/lists/transforms/dedentListItem.ts +70 -0
- package/src/plugins/element/lists/transforms/indentListItem.ts +81 -0
- package/src/plugins/element/lists/transforms/index.ts +4 -0
- package/src/plugins/element/lists/transforms/normalizeListElement.ts +20 -0
- package/src/plugins/element/lists/transforms/toggleListElement.ts +113 -0
- package/src/plugins/element/lists/withLists.ts +202 -0
- package/src/plugins/element/paragraphs/ParagraphElement.ts +59 -0
- package/src/plugins/element/paragraphs/ParagraphHtmlDeserializer.ts +9 -0
- package/src/plugins/element/paragraphs/index.ts +3 -0
- package/src/plugins/element/paragraphs/withParagraphs.ts +70 -0
- package/src/plugins/element/scrollTargets/ScrollTargetElement.ts +61 -0
- package/src/plugins/element/scrollTargets/index.ts +2 -0
- package/src/plugins/element/scrollTargets/withScrollTargets.ts +8 -0
- package/src/plugins/element/tables/TableCellElement.ts +45 -0
- package/src/plugins/element/tables/TableElement.ts +125 -0
- package/src/plugins/element/tables/TableElementSelection.ts +19 -0
- package/src/plugins/element/tables/TableModifications.ts +165 -0
- package/src/plugins/element/tables/TableRowElement.ts +47 -0
- package/src/plugins/element/tables/gaugeTableColumnCount.ts +35 -0
- package/src/plugins/element/tables/index.ts +5 -0
- package/src/plugins/element/tables/withTables.ts +335 -0
- package/src/plugins/index.ts +4 -0
- package/src/plugins/text/bold/boldMark.ts +11 -0
- package/src/plugins/text/bold/index.ts +2 -0
- package/src/plugins/text/bold/withBold.ts +15 -0
- package/src/plugins/text/code/codeMark.ts +11 -0
- package/src/plugins/text/code/index.ts +2 -0
- package/src/plugins/text/code/withCode.ts +10 -0
- package/src/plugins/text/highlight/highlightMark.ts +11 -0
- package/src/plugins/text/highlight/index.ts +2 -0
- package/src/plugins/text/highlight/withHighlight.ts +10 -0
- package/src/plugins/text/index.ts +7 -0
- package/src/plugins/text/italic/index.ts +2 -0
- package/src/plugins/text/italic/italicMark.ts +11 -0
- package/src/plugins/text/italic/withItalic.ts +15 -0
- package/src/plugins/text/newline/index.ts +1 -0
- package/src/plugins/text/newline/withNewline.ts +13 -0
- package/src/plugins/text/strikeThrough/index.ts +2 -0
- package/src/plugins/text/strikeThrough/strikeThroughMark.ts +10 -0
- package/src/plugins/text/strikeThrough/withStrikeThrough.ts +18 -0
- package/src/plugins/text/underline/index.ts +2 -0
- package/src/plugins/text/underline/underlineMark.ts +11 -0
- package/src/plugins/text/underline/withUnderline.ts +17 -0
- package/src/slate-reexport.ts +4 -0
- package/src/slate-types.ts +33 -0
- package/src/tsconfig.json +11 -0
- package/src/types/editor.ts +55 -0
- package/src/types/htmlDeserializer.ts +42 -0
- package/src/types/index.ts +3 -0
- package/src/types/plugins.ts +35 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Element, Editor, Node, Transforms, Range, Path } from "slate";
|
|
2
|
+
import { AnchorModifications } from "./AnchorModifications.js";
|
|
3
|
+
const anchorElementType = "anchor";
|
|
4
|
+
const isAnchorElement = (element) => Element.isElement(element) && element.type === anchorElementType;
|
|
5
|
+
const isAnchorElementActive = (editor) => {
|
|
6
|
+
const [link] = Editor.nodes(editor, { match: isAnchorElement });
|
|
7
|
+
return !!link;
|
|
8
|
+
};
|
|
9
|
+
const anchorElementPlugin = ({ render }) => ({
|
|
10
|
+
type: anchorElementType,
|
|
11
|
+
isInline: true,
|
|
12
|
+
render,
|
|
13
|
+
isActive: ({ editor }) => isAnchorElementActive(editor),
|
|
14
|
+
toggleElement: ({ editor, suchThat }) => {
|
|
15
|
+
if (isAnchorElementActive(editor)) {
|
|
16
|
+
AnchorModifications.unwrapAnchor(editor);
|
|
17
|
+
} else {
|
|
18
|
+
const href = suchThat?.href ?? prompt("Insert the URL:");
|
|
19
|
+
if (!href) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
AnchorModifications.wrapAnchor(editor, href);
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
normalizeNode: ({ element, path, editor, preventDefault }) => {
|
|
26
|
+
if (Node.string(element) === "") {
|
|
27
|
+
const selection = editor.selection;
|
|
28
|
+
Transforms.removeNodes(editor, {
|
|
29
|
+
at: path
|
|
30
|
+
});
|
|
31
|
+
if (selection && Range.isCollapsed(selection) && Path.isCommon(path, selection.focus.path)) {
|
|
32
|
+
Transforms.select(editor, Path.parent(path));
|
|
33
|
+
}
|
|
34
|
+
return preventDefault();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
export {
|
|
39
|
+
anchorElementPlugin,
|
|
40
|
+
anchorElementType,
|
|
41
|
+
isAnchorElement,
|
|
42
|
+
isAnchorElementActive
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=AnchorElement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnchorElement.js","sources":["../../../../../src/plugins/element/anchors/AnchorElement.ts"],"sourcesContent":["import { Editor as SlateEditor, Editor, Element as SlateElement, Node as SlateNode, Path, Range as SlateRange, Transforms } from 'slate'\nimport { AnchorModifications } from './AnchorModifications'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const anchorElementType = 'anchor' as const\n\nexport interface AnchorElement extends SlateElement {\n\ttype: typeof anchorElementType\n\thref: string\n\tchildren: SlateEditor['children']\n}\n\nexport const isAnchorElement = (element: SlateNode): element is AnchorElement => SlateElement.isElement(element) && element.type === anchorElementType\n\nexport const isAnchorElementActive = (editor: Editor) => {\n\tconst [link] = Editor.nodes(editor, { match: isAnchorElement })\n\treturn !!link\n}\n\n\nexport const anchorElementPlugin = ({ render }: { render: ElementRenderer<AnchorElement> }): EditorElementPlugin<AnchorElement> => ({\n\ttype: anchorElementType,\n\tisInline: true,\n\trender,\n\tisActive: ({ editor }) => isAnchorElementActive(editor),\n\ttoggleElement: ({ editor, suchThat }) => {\n\t\tif (isAnchorElementActive(editor)) {\n\t\t\tAnchorModifications.unwrapAnchor(editor)\n\t\t} else {\n\t\t\tconst href = suchThat?.href ?? prompt('Insert the URL:')\n\t\t\tif (!href) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tAnchorModifications.wrapAnchor(editor, href)\n\t\t}\n\t},\n\tnormalizeNode: ({ element, path, editor, preventDefault }) => {\n\t\tif (SlateNode.string(element) === '') {\n\t\t\tconst selection = editor.selection\n\t\t\tTransforms.removeNodes(editor, {\n\t\t\t\tat: path,\n\t\t\t})\n\t\t\tif (selection && SlateRange.isCollapsed(selection) && Path.isCommon(path, selection.focus.path)) {\n\t\t\t\tTransforms.select(editor, Path.parent(path))\n\t\t\t}\n\t\t\treturn preventDefault()\n\t\t}\n\t},\n})\n"],"names":["SlateElement","SlateNode","SlateRange"],"mappings":";;AAIO,MAAM,oBAAoB;AAQpB,MAAA,kBAAkB,CAAC,YAAiDA,QAAa,UAAU,OAAO,KAAK,QAAQ,SAAS;AAExH,MAAA,wBAAwB,CAAC,WAAmB;AAClD,QAAA,CAAC,IAAI,IAAI,OAAO,MAAM,QAAQ,EAAE,OAAO,gBAAA,CAAiB;AAC9D,SAAO,CAAC,CAAC;AACV;AAGO,MAAM,sBAAsB,CAAC,EAAE,cAA8F;AAAA,EACnI,MAAM;AAAA,EACN,UAAU;AAAA,EACV;AAAA,EACA,UAAU,CAAC,EAAE,aAAa,sBAAsB,MAAM;AAAA,EACtD,eAAe,CAAC,EAAE,QAAQ,eAAe;AACpC,QAAA,sBAAsB,MAAM,GAAG;AAClC,0BAAoB,aAAa,MAAM;AAAA,IAAA,OACjC;AACN,YAAM,OAAO,UAAU,QAAQ,OAAO,iBAAiB;AACvD,UAAI,CAAC,MAAM;AACV;AAAA,MACD;AACoB,0BAAA,WAAW,QAAQ,IAAI;AAAA,IAC5C;AAAA,EACD;AAAA,EACA,eAAe,CAAC,EAAE,SAAS,MAAM,QAAQ,qBAAqB;AAC7D,QAAIC,KAAU,OAAO,OAAO,MAAM,IAAI;AACrC,YAAM,YAAY,OAAO;AACzB,iBAAW,YAAY,QAAQ;AAAA,QAC9B,IAAI;AAAA,MAAA,CACJ;AACG,UAAA,aAAaC,MAAW,YAAY,SAAS,KAAK,KAAK,SAAS,MAAM,UAAU,MAAM,IAAI,GAAG;AAChG,mBAAW,OAAO,QAAQ,KAAK,OAAO,IAAI,CAAC;AAAA,MAC5C;AACA,aAAO,eAAe;AAAA,IACvB;AAAA,EACD;AACD;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const anchorHtmlDeserializer = {
|
|
4
|
+
processInlinePaste: ({ element, next, cumulativeTextAttrs }) => {
|
|
5
|
+
if (element.tagName === "A" && element.getAttribute("href")) {
|
|
6
|
+
const href = element.getAttribute("href");
|
|
7
|
+
return [
|
|
8
|
+
{
|
|
9
|
+
type: "anchor",
|
|
10
|
+
href,
|
|
11
|
+
children: next(element.childNodes, cumulativeTextAttrs)
|
|
12
|
+
}
|
|
13
|
+
];
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
exports.anchorHtmlDeserializer = anchorHtmlDeserializer;
|
|
19
|
+
//# sourceMappingURL=AnchorHtmlDeserializer.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnchorHtmlDeserializer.cjs","sources":["../../../../../src/plugins/element/anchors/AnchorHtmlDeserializer.ts"],"sourcesContent":["import { HtmlDeserializerPlugin } from '../../../types'\n\nexport const anchorHtmlDeserializer: HtmlDeserializerPlugin = {\n\tprocessInlinePaste: ({ element, next, cumulativeTextAttrs }) => {\n\t\tif (element.tagName === 'A' && element.getAttribute('href')) {\n\t\t\tconst href = element.getAttribute('href')\n\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: 'anchor',\n\t\t\t\t\thref,\n\t\t\t\t\tchildren: next(element.childNodes, cumulativeTextAttrs),\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\t\treturn null\n\t},\n}\n"],"names":[],"mappings":";;AAEO,MAAM,yBAAkD;AAAA,EAC9D,oBAAoB,CAAC,EAAE,SAAS,MAAM,0BAA0B;AAC/D,QAAI,QAAQ,YAAY,OAAO,QAAQ,aAAa,MAAM,GAAG;AACtD,YAAA,OAAO,QAAQ,aAAa,MAAM;AAEjC,aAAA;AAAA,QACN;AAAA,UACC,MAAM;AAAA,UACN;AAAA,UACA,UAAU,KAAK,QAAQ,YAAY,mBAAmB;AAAA,QACvD;AAAA,MAAA;AAAA,IAEF;AACO,WAAA;AAAA,EACR;AACD;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const anchorHtmlDeserializer = {
|
|
2
|
+
processInlinePaste: ({ element, next, cumulativeTextAttrs }) => {
|
|
3
|
+
if (element.tagName === "A" && element.getAttribute("href")) {
|
|
4
|
+
const href = element.getAttribute("href");
|
|
5
|
+
return [
|
|
6
|
+
{
|
|
7
|
+
type: "anchor",
|
|
8
|
+
href,
|
|
9
|
+
children: next(element.childNodes, cumulativeTextAttrs)
|
|
10
|
+
}
|
|
11
|
+
];
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
anchorHtmlDeserializer
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=AnchorHtmlDeserializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnchorHtmlDeserializer.js","sources":["../../../../../src/plugins/element/anchors/AnchorHtmlDeserializer.ts"],"sourcesContent":["import { HtmlDeserializerPlugin } from '../../../types'\n\nexport const anchorHtmlDeserializer: HtmlDeserializerPlugin = {\n\tprocessInlinePaste: ({ element, next, cumulativeTextAttrs }) => {\n\t\tif (element.tagName === 'A' && element.getAttribute('href')) {\n\t\t\tconst href = element.getAttribute('href')\n\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: 'anchor',\n\t\t\t\t\thref,\n\t\t\t\t\tchildren: next(element.childNodes, cumulativeTextAttrs),\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\t\treturn null\n\t},\n}\n"],"names":[],"mappings":"AAEO,MAAM,yBAAkD;AAAA,EAC9D,oBAAoB,CAAC,EAAE,SAAS,MAAM,0BAA0B;AAC/D,QAAI,QAAQ,YAAY,OAAO,QAAQ,aAAa,MAAM,GAAG;AACtD,YAAA,OAAO,QAAQ,aAAa,MAAM;AAEjC,aAAA;AAAA,QACN;AAAA,UACC,MAAM;AAAA,UACN;AAAA,UACA,UAAU,KAAK,QAAQ,YAAY,mBAAmB;AAAA,QACvD;AAAA,MAAA;AAAA,IAEF;AACO,WAAA;AAAA,EACR;AACD;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const Slate = require("slate");
|
|
4
|
+
const AnchorElement = require("./AnchorElement.cjs");
|
|
5
|
+
class AnchorModifications {
|
|
6
|
+
static unwrapAnchor(editor) {
|
|
7
|
+
Slate.Transforms.unwrapNodes(editor, { match: AnchorElement.isAnchorElement });
|
|
8
|
+
}
|
|
9
|
+
static wrapAnchor(editor, url) {
|
|
10
|
+
if (AnchorElement.isAnchorElementActive(editor)) {
|
|
11
|
+
AnchorModifications.unwrapAnchor(editor);
|
|
12
|
+
}
|
|
13
|
+
const selection = editor.selection;
|
|
14
|
+
const isCollapsed = selection ? Slate.Range.isCollapsed(selection) : false;
|
|
15
|
+
const anchor = {
|
|
16
|
+
type: "anchor",
|
|
17
|
+
href: url,
|
|
18
|
+
children: isCollapsed ? [{ text: url }] : [{ text: "" }]
|
|
19
|
+
};
|
|
20
|
+
if (isCollapsed) {
|
|
21
|
+
Slate.Transforms.insertNodes(editor, anchor);
|
|
22
|
+
} else {
|
|
23
|
+
Slate.Transforms.wrapNodes(editor, anchor, { split: true });
|
|
24
|
+
Slate.Transforms.collapse(editor, { edge: "end" });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.AnchorModifications = AnchorModifications;
|
|
29
|
+
//# sourceMappingURL=AnchorModifications.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnchorModifications.cjs","sources":["../../../../../src/plugins/element/anchors/AnchorModifications.ts"],"sourcesContent":["import { Editor, Range, Transforms } from 'slate'\nimport { AnchorElement, isAnchorElement, isAnchorElementActive } from './AnchorElement'\n\nexport class AnchorModifications {\n\tpublic static unwrapAnchor(editor: Editor) {\n\t\tTransforms.unwrapNodes(editor, { match: isAnchorElement })\n\t}\n\n\tpublic static wrapAnchor(editor: Editor, url: string) {\n\t\tif (isAnchorElementActive(editor)) {\n\t\t\tAnchorModifications.unwrapAnchor(editor)\n\t\t}\n\n\t\tconst selection = editor.selection\n\t\tconst isCollapsed = selection ? Range.isCollapsed(selection!) : false\n\t\tconst anchor: AnchorElement = {\n\t\t\ttype: 'anchor',\n\t\t\thref: url,\n\t\t\tchildren: isCollapsed ? [{ text: url }] : [{ text: '' }],\n\t\t}\n\n\t\tif (isCollapsed) {\n\t\t\tTransforms.insertNodes(editor, anchor)\n\t\t} else {\n\t\t\tTransforms.wrapNodes(editor, anchor, { split: true })\n\t\t\tTransforms.collapse(editor, { edge: 'end' })\n\t\t}\n\t}\n}\n"],"names":["Transforms","isAnchorElement","isAnchorElementActive","Range"],"mappings":";;;;AAGO,MAAM,oBAAoB;AAAA,EAChC,OAAc,aAAa,QAAgB;AAC1CA,UAAA,WAAW,YAAY,QAAQ,EAAE,OAAOC,cAAAA,gBAAiB,CAAA;AAAA,EAC1D;AAAA,EAEA,OAAc,WAAW,QAAgB,KAAa;AACjD,QAAAC,cAAAA,sBAAsB,MAAM,GAAG;AAClC,0BAAoB,aAAa,MAAM;AAAA,IACxC;AAEA,UAAM,YAAY,OAAO;AACzB,UAAM,cAAc,YAAYC,MAAAA,MAAM,YAAY,SAAU,IAAI;AAChE,UAAM,SAAwB;AAAA,MAC7B,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU,cAAc,CAAC,EAAE,MAAM,IAAK,CAAA,IAAI,CAAC,EAAE,MAAM,IAAI;AAAA,IAAA;AAGxD,QAAI,aAAa;AACLH,YAAAA,WAAA,YAAY,QAAQ,MAAM;AAAA,IAAA,OAC/B;AACNA,YAAA,WAAW,UAAU,QAAQ,QAAQ,EAAE,OAAO,MAAM;AACpDA,YAAA,WAAW,SAAS,QAAQ,EAAE,MAAM,MAAO,CAAA;AAAA,IAC5C;AAAA,EACD;AACD;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Transforms, Range } from "slate";
|
|
2
|
+
import { isAnchorElement, isAnchorElementActive } from "./AnchorElement.js";
|
|
3
|
+
class AnchorModifications {
|
|
4
|
+
static unwrapAnchor(editor) {
|
|
5
|
+
Transforms.unwrapNodes(editor, { match: isAnchorElement });
|
|
6
|
+
}
|
|
7
|
+
static wrapAnchor(editor, url) {
|
|
8
|
+
if (isAnchorElementActive(editor)) {
|
|
9
|
+
AnchorModifications.unwrapAnchor(editor);
|
|
10
|
+
}
|
|
11
|
+
const selection = editor.selection;
|
|
12
|
+
const isCollapsed = selection ? Range.isCollapsed(selection) : false;
|
|
13
|
+
const anchor = {
|
|
14
|
+
type: "anchor",
|
|
15
|
+
href: url,
|
|
16
|
+
children: isCollapsed ? [{ text: url }] : [{ text: "" }]
|
|
17
|
+
};
|
|
18
|
+
if (isCollapsed) {
|
|
19
|
+
Transforms.insertNodes(editor, anchor);
|
|
20
|
+
} else {
|
|
21
|
+
Transforms.wrapNodes(editor, anchor, { split: true });
|
|
22
|
+
Transforms.collapse(editor, { edge: "end" });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
AnchorModifications
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=AnchorModifications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnchorModifications.js","sources":["../../../../../src/plugins/element/anchors/AnchorModifications.ts"],"sourcesContent":["import { Editor, Range, Transforms } from 'slate'\nimport { AnchorElement, isAnchorElement, isAnchorElementActive } from './AnchorElement'\n\nexport class AnchorModifications {\n\tpublic static unwrapAnchor(editor: Editor) {\n\t\tTransforms.unwrapNodes(editor, { match: isAnchorElement })\n\t}\n\n\tpublic static wrapAnchor(editor: Editor, url: string) {\n\t\tif (isAnchorElementActive(editor)) {\n\t\t\tAnchorModifications.unwrapAnchor(editor)\n\t\t}\n\n\t\tconst selection = editor.selection\n\t\tconst isCollapsed = selection ? Range.isCollapsed(selection!) : false\n\t\tconst anchor: AnchorElement = {\n\t\t\ttype: 'anchor',\n\t\t\thref: url,\n\t\t\tchildren: isCollapsed ? [{ text: url }] : [{ text: '' }],\n\t\t}\n\n\t\tif (isCollapsed) {\n\t\t\tTransforms.insertNodes(editor, anchor)\n\t\t} else {\n\t\t\tTransforms.wrapNodes(editor, anchor, { split: true })\n\t\t\tTransforms.collapse(editor, { edge: 'end' })\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;AAGO,MAAM,oBAAoB;AAAA,EAChC,OAAc,aAAa,QAAgB;AAC1C,eAAW,YAAY,QAAQ,EAAE,OAAO,gBAAiB,CAAA;AAAA,EAC1D;AAAA,EAEA,OAAc,WAAW,QAAgB,KAAa;AACjD,QAAA,sBAAsB,MAAM,GAAG;AAClC,0BAAoB,aAAa,MAAM;AAAA,IACxC;AAEA,UAAM,YAAY,OAAO;AACzB,UAAM,cAAc,YAAY,MAAM,YAAY,SAAU,IAAI;AAChE,UAAM,SAAwB;AAAA,MAC7B,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU,cAAc,CAAC,EAAE,MAAM,IAAK,CAAA,IAAI,CAAC,EAAE,MAAM,IAAI;AAAA,IAAA;AAGxD,QAAI,aAAa;AACL,iBAAA,YAAY,QAAQ,MAAM;AAAA,IAAA,OAC/B;AACN,iBAAW,UAAU,QAAQ,QAAQ,EAAE,OAAO,MAAM;AACpD,iBAAW,SAAS,QAAQ,EAAE,MAAM,MAAO,CAAA;AAAA,IAC5C;AAAA,EACD;AACD;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const AnchorModifications = require("./AnchorModifications.cjs");
|
|
4
|
+
const AnchorElement = require("./AnchorElement.cjs");
|
|
5
|
+
const AnchorHtmlDeserializer = require("./AnchorHtmlDeserializer.cjs");
|
|
6
|
+
const parseUrl = require("../../../internal/utils/parseUrl.cjs");
|
|
7
|
+
const withAnchors = ({ render }) => (editor) => {
|
|
8
|
+
const { insertText } = editor;
|
|
9
|
+
editor.registerElement(AnchorElement.anchorElementPlugin({ render }));
|
|
10
|
+
editor.htmlDeserializer.registerPlugin(AnchorHtmlDeserializer.anchorHtmlDeserializer);
|
|
11
|
+
editor.insertText = (text) => {
|
|
12
|
+
if (text && parseUrl.parseUrl(text) !== void 0) {
|
|
13
|
+
AnchorModifications.AnchorModifications.wrapAnchor(editor, text);
|
|
14
|
+
} else {
|
|
15
|
+
insertText(text);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
return editor;
|
|
19
|
+
};
|
|
20
|
+
exports.withAnchors = withAnchors;
|
|
21
|
+
//# sourceMappingURL=withAnchors.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withAnchors.cjs","sources":["../../../../../src/plugins/element/anchors/withAnchors.ts"],"sourcesContent":["import { Editor } from 'slate'\nimport { AnchorModifications } from './AnchorModifications'\nimport { AnchorElement, anchorElementPlugin } from './AnchorElement'\nimport { anchorHtmlDeserializer } from './AnchorHtmlDeserializer'\nimport { ElementRenderer } from '../../../types'\nimport { parseUrl } from '../../../internal/utils'\n\nexport const withAnchors = ({ render }: { render: ElementRenderer<AnchorElement> }) => <E extends Editor>(editor: E): E => {\n\tconst { insertText } = editor\n\n\teditor.registerElement(anchorElementPlugin({ render }))\n\teditor.htmlDeserializer.registerPlugin(anchorHtmlDeserializer)\n\n\teditor.insertText = text => {\n\t\tif (text && parseUrl(text) !== undefined) {\n\t\t\tAnchorModifications.wrapAnchor(editor, text)\n\t\t} else {\n\t\t\tinsertText(text)\n\t\t}\n\t}\n\n\treturn editor\n}\n"],"names":["anchorElementPlugin","anchorHtmlDeserializer","parseUrl","AnchorModifications"],"mappings":";;;;;;AAOO,MAAM,cAAc,CAAC,EAAE,OAAO,MAAkD,CAAmB,WAAiB;AACpH,QAAA,EAAE,WAAe,IAAA;AAEvB,SAAO,gBAAgBA,cAAAA,oBAAoB,EAAE,OAAA,CAAQ,CAAC;AAC/C,SAAA,iBAAiB,eAAeC,uBAAAA,sBAAsB;AAE7D,SAAO,aAAa,CAAQ,SAAA;AAC3B,QAAI,QAAQC,SAAA,SAAS,IAAI,MAAM,QAAW;AACrBC,0BAAAA,oBAAA,WAAW,QAAQ,IAAI;AAAA,IAAA,OACrC;AACN,iBAAW,IAAI;AAAA,IAChB;AAAA,EAAA;AAGM,SAAA;AACR;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AnchorModifications } from "./AnchorModifications.js";
|
|
2
|
+
import { anchorElementPlugin } from "./AnchorElement.js";
|
|
3
|
+
import { anchorHtmlDeserializer } from "./AnchorHtmlDeserializer.js";
|
|
4
|
+
import { parseUrl } from "../../../internal/utils/parseUrl.js";
|
|
5
|
+
const withAnchors = ({ render }) => (editor) => {
|
|
6
|
+
const { insertText } = editor;
|
|
7
|
+
editor.registerElement(anchorElementPlugin({ render }));
|
|
8
|
+
editor.htmlDeserializer.registerPlugin(anchorHtmlDeserializer);
|
|
9
|
+
editor.insertText = (text) => {
|
|
10
|
+
if (text && parseUrl(text) !== void 0) {
|
|
11
|
+
AnchorModifications.wrapAnchor(editor, text);
|
|
12
|
+
} else {
|
|
13
|
+
insertText(text);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
return editor;
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
withAnchors
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=withAnchors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withAnchors.js","sources":["../../../../../src/plugins/element/anchors/withAnchors.ts"],"sourcesContent":["import { Editor } from 'slate'\nimport { AnchorModifications } from './AnchorModifications'\nimport { AnchorElement, anchorElementPlugin } from './AnchorElement'\nimport { anchorHtmlDeserializer } from './AnchorHtmlDeserializer'\nimport { ElementRenderer } from '../../../types'\nimport { parseUrl } from '../../../internal/utils'\n\nexport const withAnchors = ({ render }: { render: ElementRenderer<AnchorElement> }) => <E extends Editor>(editor: E): E => {\n\tconst { insertText } = editor\n\n\teditor.registerElement(anchorElementPlugin({ render }))\n\teditor.htmlDeserializer.registerPlugin(anchorHtmlDeserializer)\n\n\teditor.insertText = text => {\n\t\tif (text && parseUrl(text) !== undefined) {\n\t\t\tAnchorModifications.wrapAnchor(editor, text)\n\t\t} else {\n\t\t\tinsertText(text)\n\t\t}\n\t}\n\n\treturn editor\n}\n"],"names":[],"mappings":";;;;AAOO,MAAM,cAAc,CAAC,EAAE,OAAO,MAAkD,CAAmB,WAAiB;AACpH,QAAA,EAAE,WAAe,IAAA;AAEvB,SAAO,gBAAgB,oBAAoB,EAAE,OAAA,CAAQ,CAAC;AAC/C,SAAA,iBAAiB,eAAe,sBAAsB;AAE7D,SAAO,aAAa,CAAQ,SAAA;AAC3B,QAAI,QAAQ,SAAS,IAAI,MAAM,QAAW;AACrB,0BAAA,WAAW,QAAQ,IAAI;AAAA,IAAA,OACrC;AACN,iBAAW,IAAI;AAAA,IAChB;AAAA,EAAA;AAGM,SAAA;AACR;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const Slate = require("slate");
|
|
4
|
+
const index = require("../../../editor/index.cjs");
|
|
5
|
+
const headingElementType = "heading";
|
|
6
|
+
const isHeadingElement = (element, suchThat) => index.ContemberEditor.isElementType(element, headingElementType, suchThat);
|
|
7
|
+
const ejectHeadingElement = (editor, elementPath) => {
|
|
8
|
+
index.ContemberEditor.ejectElement(editor, elementPath);
|
|
9
|
+
Slate.Transforms.setNodes(editor, { type: editor.defaultElementType }, { at: elementPath });
|
|
10
|
+
};
|
|
11
|
+
const headingElementPlugin = ({ render }) => ({
|
|
12
|
+
type: headingElementType,
|
|
13
|
+
render,
|
|
14
|
+
canContainAnyBlocks: false,
|
|
15
|
+
acceptsAttributes: ({ editor, suchThat }) => {
|
|
16
|
+
return "align" in suchThat;
|
|
17
|
+
},
|
|
18
|
+
// TODO in the following function, we need to conditionally trim the selection so that it doesn't potentially
|
|
19
|
+
// include empty strings at the edges of top-level elements.
|
|
20
|
+
toggleElement: ({ editor, suchThat }) => {
|
|
21
|
+
Slate.Editor.withoutNormalizing(editor, () => {
|
|
22
|
+
const headings = Array.from(Slate.Editor.nodes(editor, { match: (it) => isHeadingElement(it, suchThat) }));
|
|
23
|
+
if (headings.length) {
|
|
24
|
+
for (const heading of headings) {
|
|
25
|
+
ejectHeadingElement(editor, heading[1]);
|
|
26
|
+
}
|
|
27
|
+
} else {
|
|
28
|
+
Slate.Transforms.setNodes(editor, {
|
|
29
|
+
...suchThat,
|
|
30
|
+
children: [],
|
|
31
|
+
type: headingElementType
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
exports.ejectHeadingElement = ejectHeadingElement;
|
|
38
|
+
exports.headingElementPlugin = headingElementPlugin;
|
|
39
|
+
exports.headingElementType = headingElementType;
|
|
40
|
+
exports.isHeadingElement = isHeadingElement;
|
|
41
|
+
//# sourceMappingURL=HeadingElement.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeadingElement.cjs","sources":["../../../../../src/plugins/element/headings/HeadingElement.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Element, Node as SlateNode, Path as SlatePath, Transforms } from 'slate'\nimport { ContemberEditor } from '../../../editor'\nimport { AlignDirection } from '../../attributes'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const headingElementType = 'heading' as const\n\nexport interface HeadingElement extends Element {\n\ttype: typeof headingElementType\n\tlevel: 1 | 2 | 3 | 4 | 5 | 6\n\tisNumbered?: boolean\n\talign?: AlignDirection\n\tchildren: SlateEditor['children']\n}\n\nexport const isHeadingElement = (\n\telement: SlateNode,\n\tsuchThat?: Partial<HeadingElement>,\n): element is HeadingElement => ContemberEditor.isElementType(element, headingElementType, suchThat)\n\nexport const ejectHeadingElement = (editor: Editor, elementPath: SlatePath) => {\n\tContemberEditor.ejectElement(editor, elementPath)\n\tTransforms.setNodes(editor, { type: editor.defaultElementType }, { at: elementPath })\n}\n\n\nexport const headingElementPlugin = ({ render }: { render: ElementRenderer<HeadingElement> }): EditorElementPlugin<HeadingElement> => ({\n\ttype: headingElementType,\n\trender,\n\tcanContainAnyBlocks: false,\n\tacceptsAttributes: ({ editor, suchThat }) => {\n\t\treturn 'align' in suchThat\n\t},\n\t// TODO in the following function, we need to conditionally trim the selection so that it doesn't potentially\n\t// \tinclude empty strings at the edges of top-level elements.\n\ttoggleElement: ({ editor, suchThat }) => {\n\t\tSlateEditor.withoutNormalizing(editor, () => {\n\t\t\tconst headings = Array.from(Editor.nodes(editor, { match: it => isHeadingElement(it, suchThat) }))\n\t\t\tif (headings.length) {\n\t\t\t\tfor (const heading of headings) {\n\t\t\t\t\tejectHeadingElement(editor, heading[1])\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tTransforms.setNodes(editor, {\n\t\t\t\t\t...suchThat,\n\t\t\t\t\tchildren: [],\n\t\t\t\t\ttype: headingElementType,\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t},\n})\n"],"names":["ContemberEditor","Transforms","SlateEditor","Editor"],"mappings":";;;;AAKO,MAAM,qBAAqB;AAUrB,MAAA,mBAAmB,CAC/B,SACA,aAC+BA,MAAAA,gBAAgB,cAAc,SAAS,oBAAoB,QAAQ;AAEtF,MAAA,sBAAsB,CAAC,QAAgB,gBAA2B;AAC9DA,QAAAA,gBAAA,aAAa,QAAQ,WAAW;AACrCC,QAAAA,WAAA,SAAS,QAAQ,EAAE,MAAM,OAAO,sBAAsB,EAAE,IAAI,YAAA,CAAa;AACrF;AAGO,MAAM,uBAAuB,CAAC,EAAE,cAAgG;AAAA,EACtI,MAAM;AAAA,EACN;AAAA,EACA,qBAAqB;AAAA,EACrB,mBAAmB,CAAC,EAAE,QAAQ,eAAe;AAC5C,WAAO,WAAW;AAAA,EACnB;AAAA;AAAA;AAAA,EAGA,eAAe,CAAC,EAAE,QAAQ,eAAe;AAC5BC,iBAAA,mBAAmB,QAAQ,MAAM;AAC5C,YAAM,WAAW,MAAM,KAAKC,MAAAA,OAAO,MAAM,QAAQ,EAAE,OAAO,CAAA,OAAM,iBAAiB,IAAI,QAAQ,EAAA,CAAG,CAAC;AACjG,UAAI,SAAS,QAAQ;AACpB,mBAAW,WAAW,UAAU;AACX,8BAAA,QAAQ,QAAQ,CAAC,CAAC;AAAA,QACvC;AAAA,MAAA,OACM;AACNF,cAAA,WAAW,SAAS,QAAQ;AAAA,UAC3B,GAAG;AAAA,UACH,UAAU,CAAC;AAAA,UACX,MAAM;AAAA,QAAA,CACN;AAAA,MACF;AAAA,IAAA,CACA;AAAA,EACF;AACD;;;;;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Transforms, Editor } from "slate";
|
|
2
|
+
import { ContemberEditor } from "../../../editor/index.js";
|
|
3
|
+
const headingElementType = "heading";
|
|
4
|
+
const isHeadingElement = (element, suchThat) => ContemberEditor.isElementType(element, headingElementType, suchThat);
|
|
5
|
+
const ejectHeadingElement = (editor, elementPath) => {
|
|
6
|
+
ContemberEditor.ejectElement(editor, elementPath);
|
|
7
|
+
Transforms.setNodes(editor, { type: editor.defaultElementType }, { at: elementPath });
|
|
8
|
+
};
|
|
9
|
+
const headingElementPlugin = ({ render }) => ({
|
|
10
|
+
type: headingElementType,
|
|
11
|
+
render,
|
|
12
|
+
canContainAnyBlocks: false,
|
|
13
|
+
acceptsAttributes: ({ editor, suchThat }) => {
|
|
14
|
+
return "align" in suchThat;
|
|
15
|
+
},
|
|
16
|
+
// TODO in the following function, we need to conditionally trim the selection so that it doesn't potentially
|
|
17
|
+
// include empty strings at the edges of top-level elements.
|
|
18
|
+
toggleElement: ({ editor, suchThat }) => {
|
|
19
|
+
Editor.withoutNormalizing(editor, () => {
|
|
20
|
+
const headings = Array.from(Editor.nodes(editor, { match: (it) => isHeadingElement(it, suchThat) }));
|
|
21
|
+
if (headings.length) {
|
|
22
|
+
for (const heading of headings) {
|
|
23
|
+
ejectHeadingElement(editor, heading[1]);
|
|
24
|
+
}
|
|
25
|
+
} else {
|
|
26
|
+
Transforms.setNodes(editor, {
|
|
27
|
+
...suchThat,
|
|
28
|
+
children: [],
|
|
29
|
+
type: headingElementType
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
export {
|
|
36
|
+
ejectHeadingElement,
|
|
37
|
+
headingElementPlugin,
|
|
38
|
+
headingElementType,
|
|
39
|
+
isHeadingElement
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=HeadingElement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeadingElement.js","sources":["../../../../../src/plugins/element/headings/HeadingElement.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Element, Node as SlateNode, Path as SlatePath, Transforms } from 'slate'\nimport { ContemberEditor } from '../../../editor'\nimport { AlignDirection } from '../../attributes'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const headingElementType = 'heading' as const\n\nexport interface HeadingElement extends Element {\n\ttype: typeof headingElementType\n\tlevel: 1 | 2 | 3 | 4 | 5 | 6\n\tisNumbered?: boolean\n\talign?: AlignDirection\n\tchildren: SlateEditor['children']\n}\n\nexport const isHeadingElement = (\n\telement: SlateNode,\n\tsuchThat?: Partial<HeadingElement>,\n): element is HeadingElement => ContemberEditor.isElementType(element, headingElementType, suchThat)\n\nexport const ejectHeadingElement = (editor: Editor, elementPath: SlatePath) => {\n\tContemberEditor.ejectElement(editor, elementPath)\n\tTransforms.setNodes(editor, { type: editor.defaultElementType }, { at: elementPath })\n}\n\n\nexport const headingElementPlugin = ({ render }: { render: ElementRenderer<HeadingElement> }): EditorElementPlugin<HeadingElement> => ({\n\ttype: headingElementType,\n\trender,\n\tcanContainAnyBlocks: false,\n\tacceptsAttributes: ({ editor, suchThat }) => {\n\t\treturn 'align' in suchThat\n\t},\n\t// TODO in the following function, we need to conditionally trim the selection so that it doesn't potentially\n\t// \tinclude empty strings at the edges of top-level elements.\n\ttoggleElement: ({ editor, suchThat }) => {\n\t\tSlateEditor.withoutNormalizing(editor, () => {\n\t\t\tconst headings = Array.from(Editor.nodes(editor, { match: it => isHeadingElement(it, suchThat) }))\n\t\t\tif (headings.length) {\n\t\t\t\tfor (const heading of headings) {\n\t\t\t\t\tejectHeadingElement(editor, heading[1])\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tTransforms.setNodes(editor, {\n\t\t\t\t\t...suchThat,\n\t\t\t\t\tchildren: [],\n\t\t\t\t\ttype: headingElementType,\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t},\n})\n"],"names":["SlateEditor"],"mappings":";;AAKO,MAAM,qBAAqB;AAUrB,MAAA,mBAAmB,CAC/B,SACA,aAC+B,gBAAgB,cAAc,SAAS,oBAAoB,QAAQ;AAEtF,MAAA,sBAAsB,CAAC,QAAgB,gBAA2B;AAC9D,kBAAA,aAAa,QAAQ,WAAW;AACrC,aAAA,SAAS,QAAQ,EAAE,MAAM,OAAO,sBAAsB,EAAE,IAAI,YAAA,CAAa;AACrF;AAGO,MAAM,uBAAuB,CAAC,EAAE,cAAgG;AAAA,EACtI,MAAM;AAAA,EACN;AAAA,EACA,qBAAqB;AAAA,EACrB,mBAAmB,CAAC,EAAE,QAAQ,eAAe;AAC5C,WAAO,WAAW;AAAA,EACnB;AAAA;AAAA;AAAA,EAGA,eAAe,CAAC,EAAE,QAAQ,eAAe;AAC5BA,WAAA,mBAAmB,QAAQ,MAAM;AAC5C,YAAM,WAAW,MAAM,KAAK,OAAO,MAAM,QAAQ,EAAE,OAAO,CAAA,OAAM,iBAAiB,IAAI,QAAQ,EAAA,CAAG,CAAC;AACjG,UAAI,SAAS,QAAQ;AACpB,mBAAW,WAAW,UAAU;AACX,8BAAA,QAAQ,QAAQ,CAAC,CAAC;AAAA,QACvC;AAAA,MAAA,OACM;AACN,mBAAW,SAAS,QAAQ;AAAA,UAC3B,GAAG;AAAA,UACH,UAAU,CAAC;AAAA,UACX,MAAM;AAAA,QAAA,CACN;AAAA,MACF;AAAA,IAAA,CACA;AAAA,EACF;AACD;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const HeadingElement = require("./HeadingElement.cjs");
|
|
4
|
+
const EditorPasteUtils = require("../../../internal/utils/EditorPasteUtils.cjs");
|
|
5
|
+
const headingHtmlDeserializer = {
|
|
6
|
+
processBlockPaste: ({ element, next, cumulativeTextAttrs }) => {
|
|
7
|
+
const match = element.nodeName.match(/^H(?<level>[1-6])$/);
|
|
8
|
+
if (match !== null) {
|
|
9
|
+
const isNumbered = (element.getAttribute("style")?.match(/mso-list:\w+ level\d+ \w+/) ?? null) !== null;
|
|
10
|
+
const children = isNumbered ? EditorPasteUtils.EditorPasteUtils.wordPasteListItemContent(element.childNodes) : element.childNodes;
|
|
11
|
+
return {
|
|
12
|
+
type: HeadingElement.headingElementType,
|
|
13
|
+
level: parseInt(match.groups.level),
|
|
14
|
+
children: next(children, cumulativeTextAttrs),
|
|
15
|
+
isNumbered
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.headingHtmlDeserializer = headingHtmlDeserializer;
|
|
22
|
+
//# sourceMappingURL=HeadingHtmlDeserializer.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeadingHtmlDeserializer.cjs","sources":["../../../../../src/plugins/element/headings/HeadingHtmlDeserializer.ts"],"sourcesContent":["import { headingElementType } from './HeadingElement'\nimport { HtmlDeserializerPlugin } from '../../../types'\nimport { EditorPasteUtils } from '../../../internal/utils/EditorPasteUtils'\n\nexport const headingHtmlDeserializer: HtmlDeserializerPlugin = {\n\tprocessBlockPaste: ({ element, next, cumulativeTextAttrs }) => {\n\t\tconst match = element.nodeName.match(/^H(?<level>[1-6])$/)\n\t\tif (match !== null) {\n\t\t\tconst isNumbered = (element.getAttribute('style')?.match(/mso-list:\\w+ level\\d+ \\w+/) ?? null) !== null\n\t\t\tconst children = isNumbered ? EditorPasteUtils.wordPasteListItemContent(element.childNodes) : element.childNodes\n\t\t\treturn {\n\t\t\t\ttype: headingElementType,\n\t\t\t\tlevel: parseInt(match.groups!.level),\n\t\t\t\tchildren: next(children, cumulativeTextAttrs),\n\t\t\t\tisNumbered,\n\t\t\t}\n\t\t}\n\t\treturn null\n\t},\n}\n"],"names":["EditorPasteUtils","headingElementType"],"mappings":";;;;AAIO,MAAM,0BAAkD;AAAA,EAC9D,mBAAmB,CAAC,EAAE,SAAS,MAAM,0BAA0B;AAC9D,UAAM,QAAQ,QAAQ,SAAS,MAAM,oBAAoB;AACzD,QAAI,UAAU,MAAM;AACb,YAAA,cAAc,QAAQ,aAAa,OAAO,GAAG,MAAM,2BAA2B,KAAK,UAAU;AACnG,YAAM,WAAW,aAAaA,kCAAiB,yBAAyB,QAAQ,UAAU,IAAI,QAAQ;AAC/F,aAAA;AAAA,QACN,MAAMC,eAAA;AAAA,QACN,OAAO,SAAS,MAAM,OAAQ,KAAK;AAAA,QACnC,UAAU,KAAK,UAAU,mBAAmB;AAAA,QAC5C;AAAA,MAAA;AAAA,IAEF;AACO,WAAA;AAAA,EACR;AACD;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { headingElementType } from "./HeadingElement.js";
|
|
2
|
+
import { EditorPasteUtils } from "../../../internal/utils/EditorPasteUtils.js";
|
|
3
|
+
const headingHtmlDeserializer = {
|
|
4
|
+
processBlockPaste: ({ element, next, cumulativeTextAttrs }) => {
|
|
5
|
+
const match = element.nodeName.match(/^H(?<level>[1-6])$/);
|
|
6
|
+
if (match !== null) {
|
|
7
|
+
const isNumbered = (element.getAttribute("style")?.match(/mso-list:\w+ level\d+ \w+/) ?? null) !== null;
|
|
8
|
+
const children = isNumbered ? EditorPasteUtils.wordPasteListItemContent(element.childNodes) : element.childNodes;
|
|
9
|
+
return {
|
|
10
|
+
type: headingElementType,
|
|
11
|
+
level: parseInt(match.groups.level),
|
|
12
|
+
children: next(children, cumulativeTextAttrs),
|
|
13
|
+
isNumbered
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
headingHtmlDeserializer
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=HeadingHtmlDeserializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeadingHtmlDeserializer.js","sources":["../../../../../src/plugins/element/headings/HeadingHtmlDeserializer.ts"],"sourcesContent":["import { headingElementType } from './HeadingElement'\nimport { HtmlDeserializerPlugin } from '../../../types'\nimport { EditorPasteUtils } from '../../../internal/utils/EditorPasteUtils'\n\nexport const headingHtmlDeserializer: HtmlDeserializerPlugin = {\n\tprocessBlockPaste: ({ element, next, cumulativeTextAttrs }) => {\n\t\tconst match = element.nodeName.match(/^H(?<level>[1-6])$/)\n\t\tif (match !== null) {\n\t\t\tconst isNumbered = (element.getAttribute('style')?.match(/mso-list:\\w+ level\\d+ \\w+/) ?? null) !== null\n\t\t\tconst children = isNumbered ? EditorPasteUtils.wordPasteListItemContent(element.childNodes) : element.childNodes\n\t\t\treturn {\n\t\t\t\ttype: headingElementType,\n\t\t\t\tlevel: parseInt(match.groups!.level),\n\t\t\t\tchildren: next(children, cumulativeTextAttrs),\n\t\t\t\tisNumbered,\n\t\t\t}\n\t\t}\n\t\treturn null\n\t},\n}\n"],"names":[],"mappings":";;AAIO,MAAM,0BAAkD;AAAA,EAC9D,mBAAmB,CAAC,EAAE,SAAS,MAAM,0BAA0B;AAC9D,UAAM,QAAQ,QAAQ,SAAS,MAAM,oBAAoB;AACzD,QAAI,UAAU,MAAM;AACb,YAAA,cAAc,QAAQ,aAAa,OAAO,GAAG,MAAM,2BAA2B,KAAK,UAAU;AACnG,YAAM,WAAW,aAAa,iBAAiB,yBAAyB,QAAQ,UAAU,IAAI,QAAQ;AAC/F,aAAA;AAAA,QACN,MAAM;AAAA,QACN,OAAO,SAAS,MAAM,OAAQ,KAAK;AAAA,QACnC,UAAU,KAAK,UAAU,mBAAmB;AAAA,QAC5C;AAAA,MAAA;AAAA,IAEF;AACO,WAAA;AAAA,EACR;AACD;"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const Slate = require("slate");
|
|
4
|
+
const index = require("../../../editor/index.cjs");
|
|
5
|
+
const HeadingElement = require("./HeadingElement.cjs");
|
|
6
|
+
const HeadingHtmlDeserializer = require("./HeadingHtmlDeserializer.cjs");
|
|
7
|
+
const withHeadings = ({ render }) => (editor) => {
|
|
8
|
+
const {
|
|
9
|
+
canToggleElement,
|
|
10
|
+
insertBreak,
|
|
11
|
+
deleteBackward
|
|
12
|
+
} = editor;
|
|
13
|
+
editor.registerElement(HeadingElement.headingElementPlugin({ render }));
|
|
14
|
+
editor.htmlDeserializer.registerPlugin(HeadingHtmlDeserializer.headingHtmlDeserializer);
|
|
15
|
+
editor.canToggleElement = (elementType, suchThat) => {
|
|
16
|
+
if (elementType !== HeadingElement.headingElementType) {
|
|
17
|
+
return canToggleElement(elementType, suchThat);
|
|
18
|
+
}
|
|
19
|
+
if (!editor.selection) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
const closestBlockEntry = index.ContemberEditor.closestBlockEntry(editor);
|
|
23
|
+
if (closestBlockEntry === void 0) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
const [closestBlockElement] = closestBlockEntry;
|
|
27
|
+
return Slate.Element.isElement(closestBlockElement) && (editor.isDefaultElement(closestBlockElement) || HeadingElement.isHeadingElement(closestBlockElement));
|
|
28
|
+
};
|
|
29
|
+
editor.insertBreak = () => {
|
|
30
|
+
Slate.Editor.withoutNormalizing(editor, () => {
|
|
31
|
+
insertBreak();
|
|
32
|
+
const { selection } = editor;
|
|
33
|
+
if (selection === null || Slate.Range.isExpanded(selection)) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const [topLevelElement, path] = Slate.Editor.node(editor, selection, {
|
|
37
|
+
depth: 1
|
|
38
|
+
});
|
|
39
|
+
if (HeadingElement.isHeadingElement(topLevelElement) && Slate.Editor.isEmpty(editor, topLevelElement)) {
|
|
40
|
+
HeadingElement.ejectHeadingElement(editor, path);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
editor.deleteBackward = (unit) => {
|
|
45
|
+
const selection = editor.selection;
|
|
46
|
+
if (unit !== "character" || !selection || !Slate.Range.isCollapsed(selection) || selection.focus.offset !== 0) {
|
|
47
|
+
return deleteBackward(unit);
|
|
48
|
+
}
|
|
49
|
+
const closestNumberedEntry = Slate.Editor.above(editor, {
|
|
50
|
+
match: (node) => Slate.Element.isElement(node) && HeadingElement.isHeadingElement(node, { isNumbered: true })
|
|
51
|
+
});
|
|
52
|
+
if (closestNumberedEntry === void 0) {
|
|
53
|
+
return deleteBackward(unit);
|
|
54
|
+
}
|
|
55
|
+
const [, headingPath] = closestNumberedEntry;
|
|
56
|
+
const headingStartPoint = Slate.Editor.start(editor, headingPath);
|
|
57
|
+
if (!Slate.Point.equals(headingStartPoint, selection.focus)) {
|
|
58
|
+
return deleteBackward(unit);
|
|
59
|
+
}
|
|
60
|
+
Slate.Transforms.setNodes(
|
|
61
|
+
editor,
|
|
62
|
+
{ isNumbered: null },
|
|
63
|
+
// null removes the key altogether
|
|
64
|
+
{ at: headingPath }
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
return editor;
|
|
68
|
+
};
|
|
69
|
+
exports.withHeadings = withHeadings;
|
|
70
|
+
//# sourceMappingURL=withHeadings.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withHeadings.cjs","sources":["../../../../../src/plugins/element/headings/withHeadings.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Element as SlateElement, Point, Range as SlateRange, Transforms } from 'slate'\nimport { ContemberEditor } from '../../../editor'\nimport {\n\tejectHeadingElement,\n\tHeadingElement,\n\theadingElementPlugin,\n\theadingElementType,\n\tisHeadingElement,\n} from './HeadingElement'\nimport { headingHtmlDeserializer } from './HeadingHtmlDeserializer'\nimport { ElementRenderer } from '../../../types'\n\nexport const withHeadings = ({ render }: { render: ElementRenderer<HeadingElement> }) => <E extends Editor>(editor: E): E => {\n\tconst {\n\t\tcanToggleElement,\n\t\tinsertBreak,\n\t\tdeleteBackward,\n\t} = editor\n\n\n\teditor.registerElement(headingElementPlugin({ render }))\n\teditor.htmlDeserializer.registerPlugin(headingHtmlDeserializer)\n\n\t// T O D O cache this\n\t// e.getNumberedHeadingSection = function recurse(element): number[] {\n\t// \tconst [topLevelIndex] = ReactEditor.findPath(e, element)\n\t// \tlet previousNumberedHeadingIndex: number = topLevelIndex - 1\n\t//\n\t// \tlet previousNumberedHeading: SlateNode\n\t// \tdo {\n\t// \t\tpreviousNumberedHeading = e.children[previousNumberedHeadingIndex--]\n\t// \t} while (\n\t// \t\tpreviousNumberedHeadingIndex >= 0 &&\n\t// \t\t!(isHeading(previousNumberedHeading) && previousNumberedHeading.isNumbered)\n\t// \t)\n\t//\n\t// \tif (previousNumberedHeadingIndex < 0) {\n\t// \t\treturn Array(element.level).fill(1)\n\t// \t}\n\t// \tconst previousHeadingSection = recurse(previousNumberedHeading as HeadingElement)\n\t//\n\t// \t// Ensures the correct length - this is essentially padRight with zeros\n\t// \tconst normalizedPrevious = previousHeadingSection.concat(Array(element.level).fill(0)).slice(0, element.level)\n\t//\n\t// \tnormalizedPrevious[normalizedPrevious.length - 1]++\n\t//\n\t// \t// The map isn't really necessary for now but would be if we introduced deeper levels\n\t// \treturn normalizedPrevious.map(level => Math.max(level, 1))\n\t// }\n\n\teditor.canToggleElement = (elementType, suchThat) => {\n\t\tif (elementType !== headingElementType) {\n\t\t\treturn canToggleElement(elementType, suchThat)\n\t\t}\n\t\tif (!editor.selection) {\n\t\t\treturn false\n\t\t}\n\t\tconst closestBlockEntry = ContemberEditor.closestBlockEntry(editor)\n\t\tif (closestBlockEntry === undefined) {\n\t\t\treturn true\n\t\t}\n\t\tconst [closestBlockElement] = closestBlockEntry\n\n\t\treturn (\n\t\t\tSlateElement.isElement(closestBlockElement) && (\n\t\t\t\teditor.isDefaultElement(closestBlockElement)\n\t\t\t\t|| isHeadingElement(closestBlockElement)\n\t\t\t)\n\t\t)\n\t}\n\n\n\n\teditor.insertBreak = () => {\n\t\tSlateEditor.withoutNormalizing(editor, () => {\n\t\t\tinsertBreak()\n\n\t\t\tconst { selection } = editor\n\n\t\t\tif (selection === null || SlateRange.isExpanded(selection)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst [topLevelElement, path] = SlateEditor.node(editor, selection, {\n\t\t\t\tdepth: 1,\n\t\t\t})\n\t\t\tif (isHeadingElement(topLevelElement) && SlateEditor.isEmpty(editor, topLevelElement)) {\n\t\t\t\tejectHeadingElement(editor, path)\n\t\t\t}\n\t\t})\n\t}\n\n\teditor.deleteBackward = unit => {\n\t\tconst selection = editor.selection\n\t\tif (unit !== 'character' || !selection || !SlateRange.isCollapsed(selection) || selection.focus.offset !== 0) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\t// The offset being zero doesn't necessarily imply that selection refers to the start of a heading.\n\t\t// It's just a way to early-exit.\n\n\t\tconst closestNumberedEntry = Editor.above<HeadingElement>(editor, {\n\t\t\tmatch: node => SlateElement.isElement(node) && isHeadingElement(node, { isNumbered: true }),\n\t\t})\n\t\tif (closestNumberedEntry === undefined) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\tconst [, headingPath] = closestNumberedEntry\n\t\tconst headingStartPoint = Editor.start(editor, headingPath)\n\n\t\tif (!Point.equals(headingStartPoint, selection.focus)) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\tTransforms.setNodes(\n\t\t\teditor,\n\t\t\t{ isNumbered: null }, // null removes the key altogether\n\t\t\t{ at: headingPath },\n\t\t)\n\t}\n\n\treturn editor\n}\n"],"names":["headingElementPlugin","headingHtmlDeserializer","headingElementType","ContemberEditor","SlateElement","isHeadingElement","SlateEditor","SlateRange","ejectHeadingElement","Editor","Point","Transforms"],"mappings":";;;;;;AAYO,MAAM,eAAe,CAAC,EAAE,OAAO,MAAmD,CAAmB,WAAiB;AACtH,QAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACG,IAAA;AAGJ,SAAO,gBAAgBA,eAAAA,qBAAqB,EAAE,OAAA,CAAQ,CAAC;AAChD,SAAA,iBAAiB,eAAeC,wBAAAA,uBAAuB;AA6BvD,SAAA,mBAAmB,CAAC,aAAa,aAAa;AACpD,QAAI,gBAAgBC,eAAAA,oBAAoB;AAChC,aAAA,iBAAiB,aAAa,QAAQ;AAAA,IAC9C;AACI,QAAA,CAAC,OAAO,WAAW;AACf,aAAA;AAAA,IACR;AACM,UAAA,oBAAoBC,MAAAA,gBAAgB,kBAAkB,MAAM;AAClE,QAAI,sBAAsB,QAAW;AAC7B,aAAA;AAAA,IACR;AACM,UAAA,CAAC,mBAAmB,IAAI;AAG7B,WAAAC,cAAa,UAAU,mBAAmB,MACzC,OAAO,iBAAiB,mBAAmB,KACxCC,eAAAA,iBAAiB,mBAAmB;AAAA,EAAA;AAO1C,SAAO,cAAc,MAAM;AACdC,iBAAA,mBAAmB,QAAQ,MAAM;AAChC;AAEN,YAAA,EAAE,UAAc,IAAA;AAEtB,UAAI,cAAc,QAAQC,MAAW,MAAA,WAAW,SAAS,GAAG;AAC3D;AAAA,MACD;AACA,YAAM,CAAC,iBAAiB,IAAI,IAAID,MAAY,OAAA,KAAK,QAAQ,WAAW;AAAA,QACnE,OAAO;AAAA,MAAA,CACP;AACD,UAAID,eAAAA,iBAAiB,eAAe,KAAKC,MAAAA,OAAY,QAAQ,QAAQ,eAAe,GAAG;AACtFE,2CAAoB,QAAQ,IAAI;AAAA,MACjC;AAAA,IAAA,CACA;AAAA,EAAA;AAGF,SAAO,iBAAiB,CAAQ,SAAA;AAC/B,UAAM,YAAY,OAAO;AACzB,QAAI,SAAS,eAAe,CAAC,aAAa,CAACD,MAAA,MAAW,YAAY,SAAS,KAAK,UAAU,MAAM,WAAW,GAAG;AAC7G,aAAO,eAAe,IAAI;AAAA,IAC3B;AAIM,UAAA,uBAAuBE,MAAAA,OAAO,MAAsB,QAAQ;AAAA,MACjE,OAAO,CAAQ,SAAAL,MAAA,QAAa,UAAU,IAAI,KAAKC,eAAAA,iBAAiB,MAAM,EAAE,YAAY,KAAA,CAAM;AAAA,IAAA,CAC1F;AACD,QAAI,yBAAyB,QAAW;AACvC,aAAO,eAAe,IAAI;AAAA,IAC3B;AACM,UAAA,CAAG,EAAA,WAAW,IAAI;AACxB,UAAM,oBAAoBI,MAAA,OAAO,MAAM,QAAQ,WAAW;AAE1D,QAAI,CAACC,MAAM,MAAA,OAAO,mBAAmB,UAAU,KAAK,GAAG;AACtD,aAAO,eAAe,IAAI;AAAA,IAC3B;AACWC,UAAAA,WAAA;AAAA,MACV;AAAA,MACA,EAAE,YAAY,KAAK;AAAA;AAAA,MACnB,EAAE,IAAI,YAAY;AAAA,IAAA;AAAA,EACnB;AAGM,SAAA;AACR;;"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Element, Editor, Range, Point, Transforms } from "slate";
|
|
2
|
+
import { ContemberEditor } from "../../../editor/index.js";
|
|
3
|
+
import { headingElementPlugin, headingElementType, isHeadingElement, ejectHeadingElement } from "./HeadingElement.js";
|
|
4
|
+
import { headingHtmlDeserializer } from "./HeadingHtmlDeserializer.js";
|
|
5
|
+
const withHeadings = ({ render }) => (editor) => {
|
|
6
|
+
const {
|
|
7
|
+
canToggleElement,
|
|
8
|
+
insertBreak,
|
|
9
|
+
deleteBackward
|
|
10
|
+
} = editor;
|
|
11
|
+
editor.registerElement(headingElementPlugin({ render }));
|
|
12
|
+
editor.htmlDeserializer.registerPlugin(headingHtmlDeserializer);
|
|
13
|
+
editor.canToggleElement = (elementType, suchThat) => {
|
|
14
|
+
if (elementType !== headingElementType) {
|
|
15
|
+
return canToggleElement(elementType, suchThat);
|
|
16
|
+
}
|
|
17
|
+
if (!editor.selection) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
const closestBlockEntry = ContemberEditor.closestBlockEntry(editor);
|
|
21
|
+
if (closestBlockEntry === void 0) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
const [closestBlockElement] = closestBlockEntry;
|
|
25
|
+
return Element.isElement(closestBlockElement) && (editor.isDefaultElement(closestBlockElement) || isHeadingElement(closestBlockElement));
|
|
26
|
+
};
|
|
27
|
+
editor.insertBreak = () => {
|
|
28
|
+
Editor.withoutNormalizing(editor, () => {
|
|
29
|
+
insertBreak();
|
|
30
|
+
const { selection } = editor;
|
|
31
|
+
if (selection === null || Range.isExpanded(selection)) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const [topLevelElement, path] = Editor.node(editor, selection, {
|
|
35
|
+
depth: 1
|
|
36
|
+
});
|
|
37
|
+
if (isHeadingElement(topLevelElement) && Editor.isEmpty(editor, topLevelElement)) {
|
|
38
|
+
ejectHeadingElement(editor, path);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
editor.deleteBackward = (unit) => {
|
|
43
|
+
const selection = editor.selection;
|
|
44
|
+
if (unit !== "character" || !selection || !Range.isCollapsed(selection) || selection.focus.offset !== 0) {
|
|
45
|
+
return deleteBackward(unit);
|
|
46
|
+
}
|
|
47
|
+
const closestNumberedEntry = Editor.above(editor, {
|
|
48
|
+
match: (node) => Element.isElement(node) && isHeadingElement(node, { isNumbered: true })
|
|
49
|
+
});
|
|
50
|
+
if (closestNumberedEntry === void 0) {
|
|
51
|
+
return deleteBackward(unit);
|
|
52
|
+
}
|
|
53
|
+
const [, headingPath] = closestNumberedEntry;
|
|
54
|
+
const headingStartPoint = Editor.start(editor, headingPath);
|
|
55
|
+
if (!Point.equals(headingStartPoint, selection.focus)) {
|
|
56
|
+
return deleteBackward(unit);
|
|
57
|
+
}
|
|
58
|
+
Transforms.setNodes(
|
|
59
|
+
editor,
|
|
60
|
+
{ isNumbered: null },
|
|
61
|
+
// null removes the key altogether
|
|
62
|
+
{ at: headingPath }
|
|
63
|
+
);
|
|
64
|
+
};
|
|
65
|
+
return editor;
|
|
66
|
+
};
|
|
67
|
+
export {
|
|
68
|
+
withHeadings
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=withHeadings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withHeadings.js","sources":["../../../../../src/plugins/element/headings/withHeadings.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Element as SlateElement, Point, Range as SlateRange, Transforms } from 'slate'\nimport { ContemberEditor } from '../../../editor'\nimport {\n\tejectHeadingElement,\n\tHeadingElement,\n\theadingElementPlugin,\n\theadingElementType,\n\tisHeadingElement,\n} from './HeadingElement'\nimport { headingHtmlDeserializer } from './HeadingHtmlDeserializer'\nimport { ElementRenderer } from '../../../types'\n\nexport const withHeadings = ({ render }: { render: ElementRenderer<HeadingElement> }) => <E extends Editor>(editor: E): E => {\n\tconst {\n\t\tcanToggleElement,\n\t\tinsertBreak,\n\t\tdeleteBackward,\n\t} = editor\n\n\n\teditor.registerElement(headingElementPlugin({ render }))\n\teditor.htmlDeserializer.registerPlugin(headingHtmlDeserializer)\n\n\t// T O D O cache this\n\t// e.getNumberedHeadingSection = function recurse(element): number[] {\n\t// \tconst [topLevelIndex] = ReactEditor.findPath(e, element)\n\t// \tlet previousNumberedHeadingIndex: number = topLevelIndex - 1\n\t//\n\t// \tlet previousNumberedHeading: SlateNode\n\t// \tdo {\n\t// \t\tpreviousNumberedHeading = e.children[previousNumberedHeadingIndex--]\n\t// \t} while (\n\t// \t\tpreviousNumberedHeadingIndex >= 0 &&\n\t// \t\t!(isHeading(previousNumberedHeading) && previousNumberedHeading.isNumbered)\n\t// \t)\n\t//\n\t// \tif (previousNumberedHeadingIndex < 0) {\n\t// \t\treturn Array(element.level).fill(1)\n\t// \t}\n\t// \tconst previousHeadingSection = recurse(previousNumberedHeading as HeadingElement)\n\t//\n\t// \t// Ensures the correct length - this is essentially padRight with zeros\n\t// \tconst normalizedPrevious = previousHeadingSection.concat(Array(element.level).fill(0)).slice(0, element.level)\n\t//\n\t// \tnormalizedPrevious[normalizedPrevious.length - 1]++\n\t//\n\t// \t// The map isn't really necessary for now but would be if we introduced deeper levels\n\t// \treturn normalizedPrevious.map(level => Math.max(level, 1))\n\t// }\n\n\teditor.canToggleElement = (elementType, suchThat) => {\n\t\tif (elementType !== headingElementType) {\n\t\t\treturn canToggleElement(elementType, suchThat)\n\t\t}\n\t\tif (!editor.selection) {\n\t\t\treturn false\n\t\t}\n\t\tconst closestBlockEntry = ContemberEditor.closestBlockEntry(editor)\n\t\tif (closestBlockEntry === undefined) {\n\t\t\treturn true\n\t\t}\n\t\tconst [closestBlockElement] = closestBlockEntry\n\n\t\treturn (\n\t\t\tSlateElement.isElement(closestBlockElement) && (\n\t\t\t\teditor.isDefaultElement(closestBlockElement)\n\t\t\t\t|| isHeadingElement(closestBlockElement)\n\t\t\t)\n\t\t)\n\t}\n\n\n\n\teditor.insertBreak = () => {\n\t\tSlateEditor.withoutNormalizing(editor, () => {\n\t\t\tinsertBreak()\n\n\t\t\tconst { selection } = editor\n\n\t\t\tif (selection === null || SlateRange.isExpanded(selection)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst [topLevelElement, path] = SlateEditor.node(editor, selection, {\n\t\t\t\tdepth: 1,\n\t\t\t})\n\t\t\tif (isHeadingElement(topLevelElement) && SlateEditor.isEmpty(editor, topLevelElement)) {\n\t\t\t\tejectHeadingElement(editor, path)\n\t\t\t}\n\t\t})\n\t}\n\n\teditor.deleteBackward = unit => {\n\t\tconst selection = editor.selection\n\t\tif (unit !== 'character' || !selection || !SlateRange.isCollapsed(selection) || selection.focus.offset !== 0) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\t// The offset being zero doesn't necessarily imply that selection refers to the start of a heading.\n\t\t// It's just a way to early-exit.\n\n\t\tconst closestNumberedEntry = Editor.above<HeadingElement>(editor, {\n\t\t\tmatch: node => SlateElement.isElement(node) && isHeadingElement(node, { isNumbered: true }),\n\t\t})\n\t\tif (closestNumberedEntry === undefined) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\tconst [, headingPath] = closestNumberedEntry\n\t\tconst headingStartPoint = Editor.start(editor, headingPath)\n\n\t\tif (!Point.equals(headingStartPoint, selection.focus)) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\tTransforms.setNodes(\n\t\t\teditor,\n\t\t\t{ isNumbered: null }, // null removes the key altogether\n\t\t\t{ at: headingPath },\n\t\t)\n\t}\n\n\treturn editor\n}\n"],"names":["SlateElement","SlateEditor","SlateRange"],"mappings":";;;;AAYO,MAAM,eAAe,CAAC,EAAE,OAAO,MAAmD,CAAmB,WAAiB;AACtH,QAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACG,IAAA;AAGJ,SAAO,gBAAgB,qBAAqB,EAAE,OAAA,CAAQ,CAAC;AAChD,SAAA,iBAAiB,eAAe,uBAAuB;AA6BvD,SAAA,mBAAmB,CAAC,aAAa,aAAa;AACpD,QAAI,gBAAgB,oBAAoB;AAChC,aAAA,iBAAiB,aAAa,QAAQ;AAAA,IAC9C;AACI,QAAA,CAAC,OAAO,WAAW;AACf,aAAA;AAAA,IACR;AACM,UAAA,oBAAoB,gBAAgB,kBAAkB,MAAM;AAClE,QAAI,sBAAsB,QAAW;AAC7B,aAAA;AAAA,IACR;AACM,UAAA,CAAC,mBAAmB,IAAI;AAG7B,WAAAA,QAAa,UAAU,mBAAmB,MACzC,OAAO,iBAAiB,mBAAmB,KACxC,iBAAiB,mBAAmB;AAAA,EAAA;AAO1C,SAAO,cAAc,MAAM;AACdC,WAAA,mBAAmB,QAAQ,MAAM;AAChC;AAEN,YAAA,EAAE,UAAc,IAAA;AAEtB,UAAI,cAAc,QAAQC,MAAW,WAAW,SAAS,GAAG;AAC3D;AAAA,MACD;AACA,YAAM,CAAC,iBAAiB,IAAI,IAAID,OAAY,KAAK,QAAQ,WAAW;AAAA,QACnE,OAAO;AAAA,MAAA,CACP;AACD,UAAI,iBAAiB,eAAe,KAAKA,OAAY,QAAQ,QAAQ,eAAe,GAAG;AACtF,4BAAoB,QAAQ,IAAI;AAAA,MACjC;AAAA,IAAA,CACA;AAAA,EAAA;AAGF,SAAO,iBAAiB,CAAQ,SAAA;AAC/B,UAAM,YAAY,OAAO;AACzB,QAAI,SAAS,eAAe,CAAC,aAAa,CAACC,MAAW,YAAY,SAAS,KAAK,UAAU,MAAM,WAAW,GAAG;AAC7G,aAAO,eAAe,IAAI;AAAA,IAC3B;AAIM,UAAA,uBAAuB,OAAO,MAAsB,QAAQ;AAAA,MACjE,OAAO,CAAQ,SAAAF,QAAa,UAAU,IAAI,KAAK,iBAAiB,MAAM,EAAE,YAAY,KAAA,CAAM;AAAA,IAAA,CAC1F;AACD,QAAI,yBAAyB,QAAW;AACvC,aAAO,eAAe,IAAI;AAAA,IAC3B;AACM,UAAA,CAAG,EAAA,WAAW,IAAI;AACxB,UAAM,oBAAoB,OAAO,MAAM,QAAQ,WAAW;AAE1D,QAAI,CAAC,MAAM,OAAO,mBAAmB,UAAU,KAAK,GAAG;AACtD,aAAO,eAAe,IAAI;AAAA,IAC3B;AACW,eAAA;AAAA,MACV;AAAA,MACA,EAAE,YAAY,KAAK;AAAA;AAAA,MACnB,EAAE,IAAI,YAAY;AAAA,IAAA;AAAA,EACnB;AAGM,SAAA;AACR;"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const Slate = require("slate");
|
|
4
|
+
const horizontalRuleElementType = "horizontalRule";
|
|
5
|
+
const isHorizontalRuleElement = (element) => Slate.Element.isElement(element) && element.type === horizontalRuleElementType;
|
|
6
|
+
const isHorizontalRuleElementActive = (editor) => {
|
|
7
|
+
const [hr] = Slate.Editor.nodes(editor, { match: isHorizontalRuleElement });
|
|
8
|
+
return !!hr;
|
|
9
|
+
};
|
|
10
|
+
const horizontalRuleElementPlugin = ({ render }) => ({
|
|
11
|
+
type: horizontalRuleElementType,
|
|
12
|
+
render,
|
|
13
|
+
isVoid: true,
|
|
14
|
+
toggleElement: ({ editor }) => {
|
|
15
|
+
if (isHorizontalRuleElementActive(editor)) {
|
|
16
|
+
removeHorizontalRule(editor);
|
|
17
|
+
} else {
|
|
18
|
+
insertHorizontalRule(editor);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const removeHorizontalRule = (editor) => {
|
|
23
|
+
Slate.Transforms.removeNodes(editor, { match: isHorizontalRuleElement });
|
|
24
|
+
};
|
|
25
|
+
const insertHorizontalRule = (editor) => {
|
|
26
|
+
const selection = editor.selection;
|
|
27
|
+
const isCollapsed = selection ? Slate.Range.isCollapsed(selection) : false;
|
|
28
|
+
if (!isCollapsed || isHorizontalRuleElementActive(editor)) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const horizontalRule = {
|
|
32
|
+
type: horizontalRuleElementType,
|
|
33
|
+
children: [{ text: "" }]
|
|
34
|
+
};
|
|
35
|
+
Slate.Transforms.insertNodes(editor, horizontalRule);
|
|
36
|
+
};
|
|
37
|
+
exports.horizontalRuleElementPlugin = horizontalRuleElementPlugin;
|
|
38
|
+
exports.horizontalRuleElementType = horizontalRuleElementType;
|
|
39
|
+
exports.isHorizontalRuleElement = isHorizontalRuleElement;
|
|
40
|
+
exports.isHorizontalRuleElementActive = isHorizontalRuleElementActive;
|
|
41
|
+
//# sourceMappingURL=HorizontalRuleElement.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HorizontalRuleElement.cjs","sources":["../../../../../src/plugins/element/horizonalRules/HorizontalRuleElement.ts"],"sourcesContent":["import { Editor as SlateEditor, Editor, Element as SlateElement, Node as SlateNode, Range as SlateRange, Transforms } from 'slate'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const horizontalRuleElementType = 'horizontalRule' as const\n\nexport interface HorizontalRuleElement extends SlateElement {\n\ttype: typeof horizontalRuleElementType\n\tchildren: SlateEditor['children']\n}\n\nexport const isHorizontalRuleElement = (element: SlateNode): element is HorizontalRuleElement =>\n\tSlateElement.isElement(element) && element.type === horizontalRuleElementType\n\nexport const isHorizontalRuleElementActive = (editor: Editor) => {\n\tconst [hr] = Editor.nodes(editor, { match: isHorizontalRuleElement })\n\treturn !!hr\n}\n\nexport const horizontalRuleElementPlugin = ({ render }: { render: ElementRenderer<HorizontalRuleElement> }): EditorElementPlugin<HorizontalRuleElement> => ({\n\ttype: horizontalRuleElementType,\n\trender,\n\tisVoid: true,\n\ttoggleElement: ({ editor }) => {\n\t\tif (isHorizontalRuleElementActive(editor)) {\n\t\t\tremoveHorizontalRule(editor)\n\t\t} else {\n\t\t\tinsertHorizontalRule(editor)\n\t\t}\n\t},\n})\n\nconst removeHorizontalRule = (editor: Editor) => {\n\tTransforms.removeNodes(editor, { match: isHorizontalRuleElement })\n}\n\nconst insertHorizontalRule = (editor: Editor) => {\n\tconst selection = editor.selection\n\tconst isCollapsed = selection ? SlateRange.isCollapsed(selection!) : false\n\n\tif (!isCollapsed || isHorizontalRuleElementActive(editor)) {\n\t\treturn\n\t}\n\tconst horizontalRule: HorizontalRuleElement = {\n\t\ttype: horizontalRuleElementType,\n\t\tchildren: [{ text: '' }],\n\t}\n\tTransforms.insertNodes(editor, horizontalRule)\n}\n"],"names":["SlateElement","Editor","Transforms","SlateRange"],"mappings":";;;AAGO,MAAM,4BAA4B;AAO5B,MAAA,0BAA0B,CAAC,YACvCA,cAAa,UAAU,OAAO,KAAK,QAAQ,SAAS;AAExC,MAAA,gCAAgC,CAAC,WAAmB;AAC1D,QAAA,CAAC,EAAE,IAAIC,aAAO,MAAM,QAAQ,EAAE,OAAO,wBAAA,CAAyB;AACpE,SAAO,CAAC,CAAC;AACV;AAEO,MAAM,8BAA8B,CAAC,EAAE,cAA8G;AAAA,EAC3J,MAAM;AAAA,EACN;AAAA,EACA,QAAQ;AAAA,EACR,eAAe,CAAC,EAAE,aAAa;AAC1B,QAAA,8BAA8B,MAAM,GAAG;AAC1C,2BAAqB,MAAM;AAAA,IAAA,OACrB;AACN,2BAAqB,MAAM;AAAA,IAC5B;AAAA,EACD;AACD;AAEA,MAAM,uBAAuB,CAAC,WAAmB;AAChDC,QAAA,WAAW,YAAY,QAAQ,EAAE,OAAO,wBAAyB,CAAA;AAClE;AAEA,MAAM,uBAAuB,CAAC,WAAmB;AAChD,QAAM,YAAY,OAAO;AACzB,QAAM,cAAc,YAAYC,MAAAA,MAAW,YAAY,SAAU,IAAI;AAErE,MAAI,CAAC,eAAe,8BAA8B,MAAM,GAAG;AAC1D;AAAA,EACD;AACA,QAAM,iBAAwC;AAAA,IAC7C,MAAM;AAAA,IACN,UAAU,CAAC,EAAE,MAAM,IAAI;AAAA,EAAA;AAEbD,QAAAA,WAAA,YAAY,QAAQ,cAAc;AAC9C;;;;;"}
|