@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,227 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const react = require("react");
|
|
4
|
+
const Slate = require("slate");
|
|
5
|
+
const slateHistory = require("slate-history");
|
|
6
|
+
const slateReact = require("slate-react");
|
|
7
|
+
const DefaultElement = require("../internal/components/DefaultElement.cjs");
|
|
8
|
+
const index = require("./index.cjs");
|
|
9
|
+
const withPaste = require("../plugins/behaviour/paste/withPaste.cjs");
|
|
10
|
+
function _interopNamespaceDefault(e) {
|
|
11
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
12
|
+
if (e) {
|
|
13
|
+
for (const k in e) {
|
|
14
|
+
if (k !== "default") {
|
|
15
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: () => e[k]
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
n.default = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
|
+
}
|
|
26
|
+
const Slate__namespace = /* @__PURE__ */ _interopNamespaceDefault(Slate);
|
|
27
|
+
const createEditorWithEssentials = ({ defaultElementType }) => {
|
|
28
|
+
const underlyingEditor = slateHistory.withHistory(slateReact.withReact(Slate.createEditor()));
|
|
29
|
+
const editor = underlyingEditor;
|
|
30
|
+
const { normalizeNode, isInline, isVoid, deleteBackward } = editor;
|
|
31
|
+
const elements = /* @__PURE__ */ new Map();
|
|
32
|
+
const marks = /* @__PURE__ */ new Map();
|
|
33
|
+
Object.assign(editor, {
|
|
34
|
+
slate: Slate__namespace,
|
|
35
|
+
formatVersion: 1,
|
|
36
|
+
defaultElementType,
|
|
37
|
+
isDefaultElement: (element) => "type" in element && element.type === defaultElementType,
|
|
38
|
+
createDefaultElement: (children) => ({
|
|
39
|
+
type: defaultElementType,
|
|
40
|
+
children
|
|
41
|
+
}),
|
|
42
|
+
insertBetweenBlocks: ([element, path], edge) => {
|
|
43
|
+
const edgeOffset = edge === "before" ? 0 : 1;
|
|
44
|
+
const targetPath = path.slice(0, -1).concat(path[path.length - 1] + edgeOffset);
|
|
45
|
+
Slate.Transforms.insertNodes(editor, editor.createDefaultElement([{ text: "" }]), {
|
|
46
|
+
at: targetPath,
|
|
47
|
+
select: true
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
canToggleMarks: () => true,
|
|
51
|
+
canToggleElement: () => true,
|
|
52
|
+
hasMarks: (marks2) => index.ContemberEditor.hasMarks(editor, marks2),
|
|
53
|
+
// TODO in the following function, we need to conditionally trim the selection so that it doesn't potentially
|
|
54
|
+
// include empty strings at the edges of top-level elements.
|
|
55
|
+
isElementActive: (elementType, suchThat) => {
|
|
56
|
+
return elements.get(elementType)?.isActive?.({ editor, suchThat }) ?? Array.from(Slate.Editor.nodes(editor, {
|
|
57
|
+
match: (node) => Slate.Element.isElement(node) && index.ContemberEditor.isElementType(node, elementType, suchThat),
|
|
58
|
+
voids: false
|
|
59
|
+
})).length > 0;
|
|
60
|
+
},
|
|
61
|
+
acceptsAttributes: (elementType, suchThat) => {
|
|
62
|
+
return elements.get(elementType)?.acceptsAttributes?.({ editor, suchThat }) ?? false;
|
|
63
|
+
},
|
|
64
|
+
toggleMarks: (marks2) => {
|
|
65
|
+
if (!editor.canToggleMarks(marks2)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const isActive = editor.hasMarks(marks2);
|
|
69
|
+
if (isActive) {
|
|
70
|
+
index.ContemberEditor.removeMarks(editor, marks2);
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
index.ContemberEditor.addMarks(editor, marks2);
|
|
74
|
+
return true;
|
|
75
|
+
},
|
|
76
|
+
toggleElement: (elementType, suchThat) => {
|
|
77
|
+
elements.get(elementType)?.toggleElement?.({
|
|
78
|
+
editor,
|
|
79
|
+
suchThat
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
isInline: (element) => {
|
|
83
|
+
return elements.get(element.type)?.isInline ?? isInline(element);
|
|
84
|
+
},
|
|
85
|
+
isVoid: (element) => {
|
|
86
|
+
const elIsVoid = elements.get(element.type)?.isVoid;
|
|
87
|
+
if (elIsVoid === void 0) {
|
|
88
|
+
return isVoid(element);
|
|
89
|
+
}
|
|
90
|
+
if (typeof elIsVoid === "boolean") {
|
|
91
|
+
return elIsVoid;
|
|
92
|
+
}
|
|
93
|
+
return elIsVoid({ editor, element });
|
|
94
|
+
},
|
|
95
|
+
canContainAnyBlocks: (element) => {
|
|
96
|
+
if (Slate.Editor.isEditor(element)) {
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
return !editor.isInline(element) && !editor.isVoid(element) && (elements.has(element.type) ? elements.get(element.type).canContainAnyBlocks ?? false : true);
|
|
100
|
+
},
|
|
101
|
+
serializeNodes: (nodes, errorMessage) => index.ContemberEditor.serializeNodes(editor, nodes, errorMessage),
|
|
102
|
+
deserializeNodes: (serializedNodes, errorMessage) => index.ContemberEditor.permissivelyDeserializeNodes(editor, serializedNodes, errorMessage),
|
|
103
|
+
upgradeFormatBySingleVersion: (node, oldVersion) => {
|
|
104
|
+
if (Slate.Element.isElement(node)) {
|
|
105
|
+
return {
|
|
106
|
+
...node,
|
|
107
|
+
children: node.children.map((child) => editor.upgradeFormatBySingleVersion(child, oldVersion))
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
return node;
|
|
111
|
+
},
|
|
112
|
+
renderElement: (props) => {
|
|
113
|
+
const component = elements.get(props.element.type)?.render ?? DefaultElement.DefaultElement;
|
|
114
|
+
return react.createElement(component, props);
|
|
115
|
+
},
|
|
116
|
+
renderLeafChildren: (props) => props.children,
|
|
117
|
+
renderLeaf: (props) => {
|
|
118
|
+
let el = react.createElement("span", props.attributes, editor.renderLeafChildren(props));
|
|
119
|
+
for (const [, mark] of marks) {
|
|
120
|
+
if (props.leaf[mark.type] === true) {
|
|
121
|
+
const markerEl = mark.render({ ...props, children: el });
|
|
122
|
+
if (markerEl !== null) {
|
|
123
|
+
if (!react.isValidElement(markerEl)) {
|
|
124
|
+
throw new Error(`Mark plugin ${mark.type} returned a non-React element`);
|
|
125
|
+
}
|
|
126
|
+
el = markerEl;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return el;
|
|
131
|
+
},
|
|
132
|
+
// Just noop functions so that other plugins can safely bubble-call
|
|
133
|
+
onDOMBeforeInput: () => {
|
|
134
|
+
},
|
|
135
|
+
onKeyDown: (e) => {
|
|
136
|
+
for (const [, mark] of marks) {
|
|
137
|
+
if (mark.isHotKey(e.nativeEvent)) {
|
|
138
|
+
editor.toggleMarks({ [mark.type]: true });
|
|
139
|
+
e.preventDefault();
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (e.key !== "Delete" && e.key !== "Backspace") {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const selection = editor.selection;
|
|
147
|
+
if (selection && Slate.Range.isCollapsed(selection)) {
|
|
148
|
+
const voidEntry = Slate.Editor.void(editor, {
|
|
149
|
+
at: selection,
|
|
150
|
+
mode: "lowest",
|
|
151
|
+
voids: true
|
|
152
|
+
});
|
|
153
|
+
if (!voidEntry) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const [node, nodePath] = voidEntry;
|
|
157
|
+
if (editor.isInline(node)) {
|
|
158
|
+
const adjacentPoint = e.key === "Backspace" ? Slate.Editor.point(editor, Slate.Path.next(nodePath), {
|
|
159
|
+
edge: "start"
|
|
160
|
+
}) : Slate.Editor.point(editor, Slate.Path.previous(nodePath), {
|
|
161
|
+
edge: "end"
|
|
162
|
+
});
|
|
163
|
+
Slate.Transforms.select(editor, adjacentPoint);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
onFocus: () => {
|
|
168
|
+
},
|
|
169
|
+
onBlur: () => {
|
|
170
|
+
},
|
|
171
|
+
normalizeNode: ([node, path]) => {
|
|
172
|
+
if (Slate.Editor.isEditor(node) && node.children.length === 0) {
|
|
173
|
+
Slate.Transforms.insertNodes(editor, editor.createDefaultElement([{ text: "" }]));
|
|
174
|
+
}
|
|
175
|
+
if (!Slate.Element.isElement(node)) {
|
|
176
|
+
normalizeNode([node, path]);
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
let defaultPrevented = false;
|
|
180
|
+
elements.get(node.type)?.normalizeNode?.({
|
|
181
|
+
element: node,
|
|
182
|
+
path,
|
|
183
|
+
editor,
|
|
184
|
+
preventDefault: () => {
|
|
185
|
+
defaultPrevented = true;
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
if (!defaultPrevented) {
|
|
189
|
+
normalizeNode([node, path]);
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
registerElement: (plugin) => {
|
|
193
|
+
elements.set(plugin.type, plugin);
|
|
194
|
+
},
|
|
195
|
+
registerMark: (plugin) => {
|
|
196
|
+
marks.set(plugin.type, plugin);
|
|
197
|
+
},
|
|
198
|
+
deleteBackward: (unit) => {
|
|
199
|
+
const selection = editor.selection;
|
|
200
|
+
if (selection && Slate.Range.isCollapsed(selection)) {
|
|
201
|
+
const [node, nodePath] = Slate.Editor.node(editor, [selection.focus.path[0]]);
|
|
202
|
+
if (Slate.Element.isElement(node) && Slate.Node.string(node) === "") {
|
|
203
|
+
const previous = Slate.Editor.previous(editor, {
|
|
204
|
+
at: nodePath,
|
|
205
|
+
voids: true
|
|
206
|
+
});
|
|
207
|
+
if (previous) {
|
|
208
|
+
const [previousNode] = previous;
|
|
209
|
+
if (Slate.Element.isElement(previousNode) && editor.isVoid(previousNode)) {
|
|
210
|
+
editor.apply({
|
|
211
|
+
type: "remove_node",
|
|
212
|
+
path: nodePath,
|
|
213
|
+
node
|
|
214
|
+
});
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
deleteBackward(unit);
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
withPaste.withPaste(editor);
|
|
224
|
+
return editor;
|
|
225
|
+
};
|
|
226
|
+
exports.createEditorWithEssentials = createEditorWithEssentials;
|
|
227
|
+
//# sourceMappingURL=createEditorWithEssentials.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createEditorWithEssentials.cjs","sources":["../../../src/editor/createEditorWithEssentials.tsx"],"sourcesContent":["import { createElement, isValidElement, ReactElement } from 'react'\nimport { createEditor, Descendant, Editor, Element as SlateElement, Node as SlateNode, Path, Range as SlateRange, Text as SlateText, Transforms } from 'slate'\nimport * as Slate from 'slate'\nimport { withHistory } from 'slate-history'\nimport { ReactEditor, withReact } from 'slate-react'\nimport { EditorElementPlugin, EditorMarkPlugin } from '../types/plugins'\nimport { TextSpecifics } from '../types/editor'\nimport { DefaultElement } from '../internal/components/DefaultElement'\nimport { withPaste } from '../plugins/behaviour'\nimport { ContemberEditor } from './index'\n\nexport const createEditorWithEssentials = ({ defaultElementType }: { defaultElementType: string }): Editor => {\n\tconst underlyingEditor = withHistory(withReact(createEditor() as ReactEditor))\n\n\tconst editor = underlyingEditor as unknown as Editor\n\tconst { normalizeNode, isInline, isVoid, deleteBackward } = editor\n\n\tconst elements = new Map<string, EditorElementPlugin<any>>()\n\tconst marks = new Map<string, EditorMarkPlugin>()\n\n\tObject.assign<Editor, Partial<Editor>>(editor, {\n\t\tslate: Slate,\n\t\tformatVersion: 1,\n\t\tdefaultElementType,\n\t\tisDefaultElement: element => 'type' in element && (element as any).type === defaultElementType,\n\t\tcreateDefaultElement: children => ({\n\t\t\ttype: defaultElementType,\n\t\t\tchildren,\n\t\t}),\n\t\tinsertBetweenBlocks: ([element, path], edge) => {\n\t\t\tconst edgeOffset = edge === 'before' ? 0 : 1\n\t\t\tconst targetPath = path.slice(0, -1).concat(path[path.length - 1] + edgeOffset)\n\t\t\tTransforms.insertNodes(editor, editor.createDefaultElement([{ text: '' }]), {\n\t\t\t\tat: targetPath,\n\t\t\t\tselect: true,\n\t\t\t})\n\t\t},\n\n\t\tcanToggleMarks: () => true,\n\t\tcanToggleElement: <E extends SlateElement>() => true,\n\n\t\thasMarks: <T extends SlateText>(marks: TextSpecifics<T>) => ContemberEditor.hasMarks(editor, marks),\n\n\t\t// TODO in the following function, we need to conditionally trim the selection so that it doesn't potentially\n\t\t// \tinclude empty strings at the edges of top-level elements.\n\t\tisElementActive: <E extends SlateElement>(elementType: E['type'], suchThat?: Partial<E>) => {\n\t\t\treturn (\n\t\t\t\telements.get(elementType)?.isActive?.({ editor, suchThat })\n\t\t\t\t?? Array.from(Editor.nodes(editor, {\n\t\t\t\t\tmatch: node => SlateElement.isElement(node) && ContemberEditor.isElementType(node, elementType, suchThat),\n\t\t\t\t\tvoids: false,\n\t\t\t\t})).length > 0\n\t\t\t)\n\t\t},\n\n\t\tacceptsAttributes: <E extends SlateElement>(elementType: E['type'], suchThat: Partial<E>) => {\n\t\t\treturn elements.get(elementType)?.acceptsAttributes?.({ editor, suchThat }) ?? false\n\t\t},\n\n\t\ttoggleMarks: <T extends SlateText>(marks: TextSpecifics<T>) => {\n\t\t\tif (!editor.canToggleMarks(marks)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst isActive = editor.hasMarks(marks)\n\t\t\tif (isActive) {\n\t\t\t\tContemberEditor.removeMarks(editor, marks)\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tContemberEditor.addMarks(editor, marks)\n\t\t\treturn true\n\t\t},\n\t\ttoggleElement: <E extends SlateElement>(elementType: E['type'], suchThat?: Partial<E>) => {\n\t\t\telements.get(elementType)?.toggleElement?.({\n\t\t\t\teditor,\n\t\t\t\tsuchThat,\n\t\t\t})\n\t\t},\n\n\t\tisInline: element => {\n\t\t\treturn elements.get(element.type)?.isInline ?? isInline(element)\n\t\t},\n\n\t\tisVoid: element => {\n\t\t\tconst elIsVoid = elements.get(element.type)?.isVoid\n\t\t\tif (elIsVoid === undefined) {\n\t\t\t\treturn isVoid(element)\n\t\t\t}\n\t\t\tif (typeof elIsVoid === 'boolean') {\n\t\t\t\treturn elIsVoid\n\t\t\t}\n\t\t\treturn elIsVoid({ editor, element })\n\t\t},\n\n\t\tcanContainAnyBlocks: element => {\n\t\t\tif (Editor.isEditor(element)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn !editor.isInline(element)\n\t\t\t\t&& !editor.isVoid(element)\n\t\t\t\t&& (elements.has(element.type) ? elements.get(element.type)!.canContainAnyBlocks ?? false : true)\n\t\t},\n\n\t\tserializeNodes: (nodes, errorMessage) => ContemberEditor.serializeNodes(editor, nodes, errorMessage),\n\t\tdeserializeNodes: (serializedNodes, errorMessage) =>\n\t\t\tContemberEditor.permissivelyDeserializeNodes(editor, serializedNodes, errorMessage),\n\n\t\tupgradeFormatBySingleVersion: (node, oldVersion) => {\n\t\t\tif (SlateElement.isElement(node)) {\n\t\t\t\treturn {\n\t\t\t\t\t...node,\n\t\t\t\t\tchildren: node.children.map(child => editor.upgradeFormatBySingleVersion(child, oldVersion) as Descendant),\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn node\n\t\t},\n\n\t\trenderElement: props => {\n\t\t\tconst component = elements.get(props.element.type)?.render ?? DefaultElement\n\t\t\treturn createElement(component, props)\n\t\t},\n\n\t\trenderLeafChildren: props => props.children,\n\n\t\trenderLeaf: props => {\n\t\t\tlet el: ReactElement = createElement('span', props.attributes, editor.renderLeafChildren(props))\n\t\t\tfor (const [, mark] of marks) {\n\t\t\t\tif (props.leaf[mark.type] === true) {\n\t\t\t\t\tconst markerEl = mark.render({ ...props, children: el })\n\t\t\t\t\tif (markerEl !== null) {\n\t\t\t\t\t\tif (!isValidElement(markerEl)) {\n\t\t\t\t\t\t\tthrow new Error(`Mark plugin ${mark.type} returned a non-React element`)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tel = markerEl\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn el\n\t\t},\n\n\t\t// Just noop functions so that other plugins can safely bubble-call\n\t\tonDOMBeforeInput: () => {},\n\t\tonKeyDown: e => {\n\t\t\tfor (const [, mark] of marks) {\n\t\t\t\tif (mark.isHotKey(e.nativeEvent)) {\n\t\t\t\t\teditor.toggleMarks({ [mark.type]: true })\n\t\t\t\t\te.preventDefault()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\t// Inline void nodes cannot be deleted by default: https://github.com/ianstormtaylor/slate/issues/3456\n\t\t\t// This is a hack to get around this issue. The problem is that when an inline void node is selected, Slate's\n\t\t\t// beforeInput handler doesn't get triggered. However, when we put the caret right after the inline void\n\t\t\t// and press Backspace (or the other way around with Delete), it works just fine. Furthermore, if we deleted the\n\t\t\t// node directly, either we'd lose the selection state or Slate, not knowing about us deleting, would still\n\t\t\t// try to delete things on its own so as to respond to the user interaction. So we take advantage of this and\n\t\t\t// instead of deleting the void node, we just carefully move the selection and have Slate do the deleting.\n\t\t\tif (e.key !== 'Delete' && e.key !== 'Backspace') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst selection = editor.selection\n\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst voidEntry = Editor.void(editor, {\n\t\t\t\t\tat: selection,\n\t\t\t\t\tmode: 'lowest',\n\t\t\t\t\tvoids: true,\n\t\t\t\t})\n\t\t\t\tif (!voidEntry) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst [node, nodePath] = voidEntry\n\t\t\t\tif (editor.isInline(node)) {\n\t\t\t\t\tconst adjacentPoint =\n\t\t\t\t\t\te.key === 'Backspace'\n\t\t\t\t\t\t\t? Editor.point(editor, Path.next(nodePath), {\n\t\t\t\t\t\t\t\t\tedge: 'start',\n\t\t\t\t\t\t\t })\n\t\t\t\t\t\t\t: Editor.point(editor, Path.previous(nodePath), {\n\t\t\t\t\t\t\t\t\tedge: 'end',\n\t\t\t\t\t\t\t })\n\t\t\t\t\tTransforms.select(editor, adjacentPoint)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tonFocus: () => {},\n\t\tonBlur: () => {},\n\t\tnormalizeNode: ([node, path]) => {\n\t\t\tif (Editor.isEditor(node) && node.children.length === 0) {\n\t\t\t\tTransforms.insertNodes(editor, editor.createDefaultElement([{ text: '' }]))\n\t\t\t}\n\t\t\tif (!SlateElement.isElement(node)) {\n\t\t\t\tnormalizeNode([node, path])\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlet defaultPrevented = false\n\t\t\telements.get(node.type)?.normalizeNode?.({\n\t\t\t\telement: node,\n\t\t\t\tpath,\n\t\t\t\teditor,\n\t\t\t\tpreventDefault: () => {\n\t\t\t\t\tdefaultPrevented = true\n\t\t\t\t},\n\t\t\t})\n\t\t\tif (!defaultPrevented) {\n\t\t\t\tnormalizeNode([node, path])\n\t\t\t}\n\t\t},\n\t\tregisterElement: plugin => {\n\t\t\telements.set(plugin.type, plugin)\n\t\t},\n\t\tregisterMark: plugin => {\n\t\t\tmarks.set(plugin.type, plugin)\n\t\t},\n\n\t\tdeleteBackward: unit => {\n\t\t\tconst selection = editor.selection\n\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst [node, nodePath] = Editor.node(editor, [selection.focus.path[0]])\n\t\t\t\tif (SlateElement.isElement(node) && SlateNode.string(node) === '') {\n\t\t\t\t\tconst previous = Editor.previous(editor, {\n\t\t\t\t\t\tat: nodePath,\n\t\t\t\t\t\tvoids: true,\n\t\t\t\t\t})\n\n\t\t\t\t\tif (previous) {\n\t\t\t\t\t\tconst [previousNode] = previous\n\t\t\t\t\t\tif (SlateElement.isElement(previousNode) && editor.isVoid(previousNode)) {\n\t\t\t\t\t\t\teditor.apply({\n\t\t\t\t\t\t\t\ttype: 'remove_node',\n\t\t\t\t\t\t\t\tpath: nodePath,\n\t\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tdeleteBackward(unit)\n\t\t},\n\t})\n\n\twithPaste(editor)\n\n\treturn editor\n}\n"],"names":["withHistory","withReact","createEditor","Slate","Transforms","marks","ContemberEditor","Editor","SlateElement","DefaultElement","createElement","isValidElement","SlateRange","Path","SlateNode","withPaste"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAWO,MAAM,6BAA6B,CAAC,EAAE,yBAAiE;AAC7G,QAAM,mBAAmBA,aAAA,YAAYC,WAAU,UAAAC,MAAA,aAAA,CAA6B,CAAC;AAE7E,QAAM,SAAS;AACf,QAAM,EAAE,eAAe,UAAU,QAAQ,mBAAmB;AAEtD,QAAA,+BAAe;AACf,QAAA,4BAAY;AAElB,SAAO,OAAgC,QAAQ;AAAA,IAC9C,OAAOC;AAAAA,IACP,eAAe;AAAA,IACf;AAAA,IACA,kBAAkB,CAAA,YAAW,UAA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,cAAM,CAAC,MAAM,QAAQ,IAAIL,MAAAA,OAAO,KAAK,QAAQ,CAAC,UAAU,MAAM,KAAK,CAAC,CAAC,CAAC;AAClE,YAAAC,MAAA,QAAa,UAAU,IAAI,KAAKM,WAAU,OAAO,IAAI,MAAM,IAAI;AAC5D,gBAAA,WAAWP,MAAAA,OAAO,SAAS,QAAQ;AAAA,YACxC,IAAI;AAAA,YACJ,OAAO;AAAA,UAAA,CACP;AAED,cAAI,UAAU;AACP,kBAAA,CAAC,YAAY,IAAI;AACvB,gBAAIC,MAAAA,QAAa,UAAU,YAAY,KAAK,OAAO,OAAO,YAAY,GAAG;AACxE,qBAAO,MAAM;AAAA,gBACZ,MAAM;AAAA,gBACN,MAAM;AAAA,gBACN;AAAA,cAAA,CACA;AACD;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,MACD;AACA,qBAAe,IAAI;AAAA,IACpB;AAAA,EAAA,CACA;AAEDO,YAAA,UAAU,MAAM;AAET,SAAA;AACR;;"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { createElement, isValidElement } from "react";
|
|
2
|
+
import * as Slate from "slate";
|
|
3
|
+
import { createEditor, Transforms, Editor, Element, Range, Path, Node } from "slate";
|
|
4
|
+
import { withHistory } from "slate-history";
|
|
5
|
+
import { withReact } from "slate-react";
|
|
6
|
+
import { DefaultElement } from "../internal/components/DefaultElement.js";
|
|
7
|
+
import { ContemberEditor } from "./index.js";
|
|
8
|
+
import { withPaste } from "../plugins/behaviour/paste/withPaste.js";
|
|
9
|
+
const createEditorWithEssentials = ({ defaultElementType }) => {
|
|
10
|
+
const underlyingEditor = withHistory(withReact(createEditor()));
|
|
11
|
+
const editor = underlyingEditor;
|
|
12
|
+
const { normalizeNode, isInline, isVoid, deleteBackward } = editor;
|
|
13
|
+
const elements = /* @__PURE__ */ new Map();
|
|
14
|
+
const marks = /* @__PURE__ */ new Map();
|
|
15
|
+
Object.assign(editor, {
|
|
16
|
+
slate: Slate,
|
|
17
|
+
formatVersion: 1,
|
|
18
|
+
defaultElementType,
|
|
19
|
+
isDefaultElement: (element) => "type" in element && element.type === defaultElementType,
|
|
20
|
+
createDefaultElement: (children) => ({
|
|
21
|
+
type: defaultElementType,
|
|
22
|
+
children
|
|
23
|
+
}),
|
|
24
|
+
insertBetweenBlocks: ([element, path], edge) => {
|
|
25
|
+
const edgeOffset = edge === "before" ? 0 : 1;
|
|
26
|
+
const targetPath = path.slice(0, -1).concat(path[path.length - 1] + edgeOffset);
|
|
27
|
+
Transforms.insertNodes(editor, editor.createDefaultElement([{ text: "" }]), {
|
|
28
|
+
at: targetPath,
|
|
29
|
+
select: true
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
canToggleMarks: () => true,
|
|
33
|
+
canToggleElement: () => true,
|
|
34
|
+
hasMarks: (marks2) => ContemberEditor.hasMarks(editor, marks2),
|
|
35
|
+
// TODO in the following function, we need to conditionally trim the selection so that it doesn't potentially
|
|
36
|
+
// include empty strings at the edges of top-level elements.
|
|
37
|
+
isElementActive: (elementType, suchThat) => {
|
|
38
|
+
return elements.get(elementType)?.isActive?.({ editor, suchThat }) ?? Array.from(Editor.nodes(editor, {
|
|
39
|
+
match: (node) => Element.isElement(node) && ContemberEditor.isElementType(node, elementType, suchThat),
|
|
40
|
+
voids: false
|
|
41
|
+
})).length > 0;
|
|
42
|
+
},
|
|
43
|
+
acceptsAttributes: (elementType, suchThat) => {
|
|
44
|
+
return elements.get(elementType)?.acceptsAttributes?.({ editor, suchThat }) ?? false;
|
|
45
|
+
},
|
|
46
|
+
toggleMarks: (marks2) => {
|
|
47
|
+
if (!editor.canToggleMarks(marks2)) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const isActive = editor.hasMarks(marks2);
|
|
51
|
+
if (isActive) {
|
|
52
|
+
ContemberEditor.removeMarks(editor, marks2);
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
ContemberEditor.addMarks(editor, marks2);
|
|
56
|
+
return true;
|
|
57
|
+
},
|
|
58
|
+
toggleElement: (elementType, suchThat) => {
|
|
59
|
+
elements.get(elementType)?.toggleElement?.({
|
|
60
|
+
editor,
|
|
61
|
+
suchThat
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
isInline: (element) => {
|
|
65
|
+
return elements.get(element.type)?.isInline ?? isInline(element);
|
|
66
|
+
},
|
|
67
|
+
isVoid: (element) => {
|
|
68
|
+
const elIsVoid = elements.get(element.type)?.isVoid;
|
|
69
|
+
if (elIsVoid === void 0) {
|
|
70
|
+
return isVoid(element);
|
|
71
|
+
}
|
|
72
|
+
if (typeof elIsVoid === "boolean") {
|
|
73
|
+
return elIsVoid;
|
|
74
|
+
}
|
|
75
|
+
return elIsVoid({ editor, element });
|
|
76
|
+
},
|
|
77
|
+
canContainAnyBlocks: (element) => {
|
|
78
|
+
if (Editor.isEditor(element)) {
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
return !editor.isInline(element) && !editor.isVoid(element) && (elements.has(element.type) ? elements.get(element.type).canContainAnyBlocks ?? false : true);
|
|
82
|
+
},
|
|
83
|
+
serializeNodes: (nodes, errorMessage) => ContemberEditor.serializeNodes(editor, nodes, errorMessage),
|
|
84
|
+
deserializeNodes: (serializedNodes, errorMessage) => ContemberEditor.permissivelyDeserializeNodes(editor, serializedNodes, errorMessage),
|
|
85
|
+
upgradeFormatBySingleVersion: (node, oldVersion) => {
|
|
86
|
+
if (Element.isElement(node)) {
|
|
87
|
+
return {
|
|
88
|
+
...node,
|
|
89
|
+
children: node.children.map((child) => editor.upgradeFormatBySingleVersion(child, oldVersion))
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return node;
|
|
93
|
+
},
|
|
94
|
+
renderElement: (props) => {
|
|
95
|
+
const component = elements.get(props.element.type)?.render ?? DefaultElement;
|
|
96
|
+
return createElement(component, props);
|
|
97
|
+
},
|
|
98
|
+
renderLeafChildren: (props) => props.children,
|
|
99
|
+
renderLeaf: (props) => {
|
|
100
|
+
let el = createElement("span", props.attributes, editor.renderLeafChildren(props));
|
|
101
|
+
for (const [, mark] of marks) {
|
|
102
|
+
if (props.leaf[mark.type] === true) {
|
|
103
|
+
const markerEl = mark.render({ ...props, children: el });
|
|
104
|
+
if (markerEl !== null) {
|
|
105
|
+
if (!isValidElement(markerEl)) {
|
|
106
|
+
throw new Error(`Mark plugin ${mark.type} returned a non-React element`);
|
|
107
|
+
}
|
|
108
|
+
el = markerEl;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return el;
|
|
113
|
+
},
|
|
114
|
+
// Just noop functions so that other plugins can safely bubble-call
|
|
115
|
+
onDOMBeforeInput: () => {
|
|
116
|
+
},
|
|
117
|
+
onKeyDown: (e) => {
|
|
118
|
+
for (const [, mark] of marks) {
|
|
119
|
+
if (mark.isHotKey(e.nativeEvent)) {
|
|
120
|
+
editor.toggleMarks({ [mark.type]: true });
|
|
121
|
+
e.preventDefault();
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (e.key !== "Delete" && e.key !== "Backspace") {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const selection = editor.selection;
|
|
129
|
+
if (selection && Range.isCollapsed(selection)) {
|
|
130
|
+
const voidEntry = Editor.void(editor, {
|
|
131
|
+
at: selection,
|
|
132
|
+
mode: "lowest",
|
|
133
|
+
voids: true
|
|
134
|
+
});
|
|
135
|
+
if (!voidEntry) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const [node, nodePath] = voidEntry;
|
|
139
|
+
if (editor.isInline(node)) {
|
|
140
|
+
const adjacentPoint = e.key === "Backspace" ? Editor.point(editor, Path.next(nodePath), {
|
|
141
|
+
edge: "start"
|
|
142
|
+
}) : Editor.point(editor, Path.previous(nodePath), {
|
|
143
|
+
edge: "end"
|
|
144
|
+
});
|
|
145
|
+
Transforms.select(editor, adjacentPoint);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
onFocus: () => {
|
|
150
|
+
},
|
|
151
|
+
onBlur: () => {
|
|
152
|
+
},
|
|
153
|
+
normalizeNode: ([node, path]) => {
|
|
154
|
+
if (Editor.isEditor(node) && node.children.length === 0) {
|
|
155
|
+
Transforms.insertNodes(editor, editor.createDefaultElement([{ text: "" }]));
|
|
156
|
+
}
|
|
157
|
+
if (!Element.isElement(node)) {
|
|
158
|
+
normalizeNode([node, path]);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
let defaultPrevented = false;
|
|
162
|
+
elements.get(node.type)?.normalizeNode?.({
|
|
163
|
+
element: node,
|
|
164
|
+
path,
|
|
165
|
+
editor,
|
|
166
|
+
preventDefault: () => {
|
|
167
|
+
defaultPrevented = true;
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
if (!defaultPrevented) {
|
|
171
|
+
normalizeNode([node, path]);
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
registerElement: (plugin) => {
|
|
175
|
+
elements.set(plugin.type, plugin);
|
|
176
|
+
},
|
|
177
|
+
registerMark: (plugin) => {
|
|
178
|
+
marks.set(plugin.type, plugin);
|
|
179
|
+
},
|
|
180
|
+
deleteBackward: (unit) => {
|
|
181
|
+
const selection = editor.selection;
|
|
182
|
+
if (selection && Range.isCollapsed(selection)) {
|
|
183
|
+
const [node, nodePath] = Editor.node(editor, [selection.focus.path[0]]);
|
|
184
|
+
if (Element.isElement(node) && Node.string(node) === "") {
|
|
185
|
+
const previous = Editor.previous(editor, {
|
|
186
|
+
at: nodePath,
|
|
187
|
+
voids: true
|
|
188
|
+
});
|
|
189
|
+
if (previous) {
|
|
190
|
+
const [previousNode] = previous;
|
|
191
|
+
if (Element.isElement(previousNode) && editor.isVoid(previousNode)) {
|
|
192
|
+
editor.apply({
|
|
193
|
+
type: "remove_node",
|
|
194
|
+
path: nodePath,
|
|
195
|
+
node
|
|
196
|
+
});
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
deleteBackward(unit);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
withPaste(editor);
|
|
206
|
+
return editor;
|
|
207
|
+
};
|
|
208
|
+
export {
|
|
209
|
+
createEditorWithEssentials
|
|
210
|
+
};
|
|
211
|
+
//# sourceMappingURL=createEditorWithEssentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createEditorWithEssentials.js","sources":["../../../src/editor/createEditorWithEssentials.tsx"],"sourcesContent":["import { createElement, isValidElement, ReactElement } from 'react'\nimport { createEditor, Descendant, Editor, Element as SlateElement, Node as SlateNode, Path, Range as SlateRange, Text as SlateText, Transforms } from 'slate'\nimport * as Slate from 'slate'\nimport { withHistory } from 'slate-history'\nimport { ReactEditor, withReact } from 'slate-react'\nimport { EditorElementPlugin, EditorMarkPlugin } from '../types/plugins'\nimport { TextSpecifics } from '../types/editor'\nimport { DefaultElement } from '../internal/components/DefaultElement'\nimport { withPaste } from '../plugins/behaviour'\nimport { ContemberEditor } from './index'\n\nexport const createEditorWithEssentials = ({ defaultElementType }: { defaultElementType: string }): Editor => {\n\tconst underlyingEditor = withHistory(withReact(createEditor() as ReactEditor))\n\n\tconst editor = underlyingEditor as unknown as Editor\n\tconst { normalizeNode, isInline, isVoid, deleteBackward } = editor\n\n\tconst elements = new Map<string, EditorElementPlugin<any>>()\n\tconst marks = new Map<string, EditorMarkPlugin>()\n\n\tObject.assign<Editor, Partial<Editor>>(editor, {\n\t\tslate: Slate,\n\t\tformatVersion: 1,\n\t\tdefaultElementType,\n\t\tisDefaultElement: element => 'type' in element && (element as any).type === defaultElementType,\n\t\tcreateDefaultElement: children => ({\n\t\t\ttype: defaultElementType,\n\t\t\tchildren,\n\t\t}),\n\t\tinsertBetweenBlocks: ([element, path], edge) => {\n\t\t\tconst edgeOffset = edge === 'before' ? 0 : 1\n\t\t\tconst targetPath = path.slice(0, -1).concat(path[path.length - 1] + edgeOffset)\n\t\t\tTransforms.insertNodes(editor, editor.createDefaultElement([{ text: '' }]), {\n\t\t\t\tat: targetPath,\n\t\t\t\tselect: true,\n\t\t\t})\n\t\t},\n\n\t\tcanToggleMarks: () => true,\n\t\tcanToggleElement: <E extends SlateElement>() => true,\n\n\t\thasMarks: <T extends SlateText>(marks: TextSpecifics<T>) => ContemberEditor.hasMarks(editor, marks),\n\n\t\t// TODO in the following function, we need to conditionally trim the selection so that it doesn't potentially\n\t\t// \tinclude empty strings at the edges of top-level elements.\n\t\tisElementActive: <E extends SlateElement>(elementType: E['type'], suchThat?: Partial<E>) => {\n\t\t\treturn (\n\t\t\t\telements.get(elementType)?.isActive?.({ editor, suchThat })\n\t\t\t\t?? Array.from(Editor.nodes(editor, {\n\t\t\t\t\tmatch: node => SlateElement.isElement(node) && ContemberEditor.isElementType(node, elementType, suchThat),\n\t\t\t\t\tvoids: false,\n\t\t\t\t})).length > 0\n\t\t\t)\n\t\t},\n\n\t\tacceptsAttributes: <E extends SlateElement>(elementType: E['type'], suchThat: Partial<E>) => {\n\t\t\treturn elements.get(elementType)?.acceptsAttributes?.({ editor, suchThat }) ?? false\n\t\t},\n\n\t\ttoggleMarks: <T extends SlateText>(marks: TextSpecifics<T>) => {\n\t\t\tif (!editor.canToggleMarks(marks)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst isActive = editor.hasMarks(marks)\n\t\t\tif (isActive) {\n\t\t\t\tContemberEditor.removeMarks(editor, marks)\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tContemberEditor.addMarks(editor, marks)\n\t\t\treturn true\n\t\t},\n\t\ttoggleElement: <E extends SlateElement>(elementType: E['type'], suchThat?: Partial<E>) => {\n\t\t\telements.get(elementType)?.toggleElement?.({\n\t\t\t\teditor,\n\t\t\t\tsuchThat,\n\t\t\t})\n\t\t},\n\n\t\tisInline: element => {\n\t\t\treturn elements.get(element.type)?.isInline ?? isInline(element)\n\t\t},\n\n\t\tisVoid: element => {\n\t\t\tconst elIsVoid = elements.get(element.type)?.isVoid\n\t\t\tif (elIsVoid === undefined) {\n\t\t\t\treturn isVoid(element)\n\t\t\t}\n\t\t\tif (typeof elIsVoid === 'boolean') {\n\t\t\t\treturn elIsVoid\n\t\t\t}\n\t\t\treturn elIsVoid({ editor, element })\n\t\t},\n\n\t\tcanContainAnyBlocks: element => {\n\t\t\tif (Editor.isEditor(element)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn !editor.isInline(element)\n\t\t\t\t&& !editor.isVoid(element)\n\t\t\t\t&& (elements.has(element.type) ? elements.get(element.type)!.canContainAnyBlocks ?? false : true)\n\t\t},\n\n\t\tserializeNodes: (nodes, errorMessage) => ContemberEditor.serializeNodes(editor, nodes, errorMessage),\n\t\tdeserializeNodes: (serializedNodes, errorMessage) =>\n\t\t\tContemberEditor.permissivelyDeserializeNodes(editor, serializedNodes, errorMessage),\n\n\t\tupgradeFormatBySingleVersion: (node, oldVersion) => {\n\t\t\tif (SlateElement.isElement(node)) {\n\t\t\t\treturn {\n\t\t\t\t\t...node,\n\t\t\t\t\tchildren: node.children.map(child => editor.upgradeFormatBySingleVersion(child, oldVersion) as Descendant),\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn node\n\t\t},\n\n\t\trenderElement: props => {\n\t\t\tconst component = elements.get(props.element.type)?.render ?? DefaultElement\n\t\t\treturn createElement(component, props)\n\t\t},\n\n\t\trenderLeafChildren: props => props.children,\n\n\t\trenderLeaf: props => {\n\t\t\tlet el: ReactElement = createElement('span', props.attributes, editor.renderLeafChildren(props))\n\t\t\tfor (const [, mark] of marks) {\n\t\t\t\tif (props.leaf[mark.type] === true) {\n\t\t\t\t\tconst markerEl = mark.render({ ...props, children: el })\n\t\t\t\t\tif (markerEl !== null) {\n\t\t\t\t\t\tif (!isValidElement(markerEl)) {\n\t\t\t\t\t\t\tthrow new Error(`Mark plugin ${mark.type} returned a non-React element`)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tel = markerEl\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn el\n\t\t},\n\n\t\t// Just noop functions so that other plugins can safely bubble-call\n\t\tonDOMBeforeInput: () => {},\n\t\tonKeyDown: e => {\n\t\t\tfor (const [, mark] of marks) {\n\t\t\t\tif (mark.isHotKey(e.nativeEvent)) {\n\t\t\t\t\teditor.toggleMarks({ [mark.type]: true })\n\t\t\t\t\te.preventDefault()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\t// Inline void nodes cannot be deleted by default: https://github.com/ianstormtaylor/slate/issues/3456\n\t\t\t// This is a hack to get around this issue. The problem is that when an inline void node is selected, Slate's\n\t\t\t// beforeInput handler doesn't get triggered. However, when we put the caret right after the inline void\n\t\t\t// and press Backspace (or the other way around with Delete), it works just fine. Furthermore, if we deleted the\n\t\t\t// node directly, either we'd lose the selection state or Slate, not knowing about us deleting, would still\n\t\t\t// try to delete things on its own so as to respond to the user interaction. So we take advantage of this and\n\t\t\t// instead of deleting the void node, we just carefully move the selection and have Slate do the deleting.\n\t\t\tif (e.key !== 'Delete' && e.key !== 'Backspace') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst selection = editor.selection\n\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst voidEntry = Editor.void(editor, {\n\t\t\t\t\tat: selection,\n\t\t\t\t\tmode: 'lowest',\n\t\t\t\t\tvoids: true,\n\t\t\t\t})\n\t\t\t\tif (!voidEntry) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst [node, nodePath] = voidEntry\n\t\t\t\tif (editor.isInline(node)) {\n\t\t\t\t\tconst adjacentPoint =\n\t\t\t\t\t\te.key === 'Backspace'\n\t\t\t\t\t\t\t? Editor.point(editor, Path.next(nodePath), {\n\t\t\t\t\t\t\t\t\tedge: 'start',\n\t\t\t\t\t\t\t })\n\t\t\t\t\t\t\t: Editor.point(editor, Path.previous(nodePath), {\n\t\t\t\t\t\t\t\t\tedge: 'end',\n\t\t\t\t\t\t\t })\n\t\t\t\t\tTransforms.select(editor, adjacentPoint)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tonFocus: () => {},\n\t\tonBlur: () => {},\n\t\tnormalizeNode: ([node, path]) => {\n\t\t\tif (Editor.isEditor(node) && node.children.length === 0) {\n\t\t\t\tTransforms.insertNodes(editor, editor.createDefaultElement([{ text: '' }]))\n\t\t\t}\n\t\t\tif (!SlateElement.isElement(node)) {\n\t\t\t\tnormalizeNode([node, path])\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlet defaultPrevented = false\n\t\t\telements.get(node.type)?.normalizeNode?.({\n\t\t\t\telement: node,\n\t\t\t\tpath,\n\t\t\t\teditor,\n\t\t\t\tpreventDefault: () => {\n\t\t\t\t\tdefaultPrevented = true\n\t\t\t\t},\n\t\t\t})\n\t\t\tif (!defaultPrevented) {\n\t\t\t\tnormalizeNode([node, path])\n\t\t\t}\n\t\t},\n\t\tregisterElement: plugin => {\n\t\t\telements.set(plugin.type, plugin)\n\t\t},\n\t\tregisterMark: plugin => {\n\t\t\tmarks.set(plugin.type, plugin)\n\t\t},\n\n\t\tdeleteBackward: unit => {\n\t\t\tconst selection = editor.selection\n\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst [node, nodePath] = Editor.node(editor, [selection.focus.path[0]])\n\t\t\t\tif (SlateElement.isElement(node) && SlateNode.string(node) === '') {\n\t\t\t\t\tconst previous = Editor.previous(editor, {\n\t\t\t\t\t\tat: nodePath,\n\t\t\t\t\t\tvoids: true,\n\t\t\t\t\t})\n\n\t\t\t\t\tif (previous) {\n\t\t\t\t\t\tconst [previousNode] = previous\n\t\t\t\t\t\tif (SlateElement.isElement(previousNode) && editor.isVoid(previousNode)) {\n\t\t\t\t\t\t\teditor.apply({\n\t\t\t\t\t\t\t\ttype: 'remove_node',\n\t\t\t\t\t\t\t\tpath: nodePath,\n\t\t\t\t\t\t\t\tnode,\n\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D,UAAI,CAAC,kBAAkB;AACR,sBAAA,CAAC,MAAM,IAAI,CAAC;AAAA,MAC3B;AAAA,IACD;AAAA,IACA,iBAAiB,CAAU,WAAA;AACjB,eAAA,IAAI,OAAO,MAAM,MAAM;AAAA,IACjC;AAAA,IACA,cAAc,CAAU,WAAA;AACjB,YAAA,IAAI,OAAO,MAAM,MAAM;AAAA,IAC9B;AAAA,IAEA,gBAAgB,CAAQ,SAAA;AACvB,YAAM,YAAY,OAAO;AAEzB,UAAI,aAAaC,MAAW,YAAY,SAAS,GAAG;AACnD,cAAM,CAAC,MAAM,QAAQ,IAAI,OAAO,KAAK,QAAQ,CAAC,UAAU,MAAM,KAAK,CAAC,CAAC,CAAC;AAClE,YAAAD,QAAa,UAAU,IAAI,KAAKE,KAAU,OAAO,IAAI,MAAM,IAAI;AAC5D,gBAAA,WAAW,OAAO,SAAS,QAAQ;AAAA,YACxC,IAAI;AAAA,YACJ,OAAO;AAAA,UAAA,CACP;AAED,cAAI,UAAU;AACP,kBAAA,CAAC,YAAY,IAAI;AACvB,gBAAIF,QAAa,UAAU,YAAY,KAAK,OAAO,OAAO,YAAY,GAAG;AACxE,qBAAO,MAAM;AAAA,gBACZ,MAAM;AAAA,gBACN,MAAM;AAAA,gBACN;AAAA,cAAA,CACA;AACD;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,MACD;AACA,qBAAe,IAAI;AAAA,IACpB;AAAA,EAAA,CACA;AAED,YAAU,MAAM;AAET,SAAA;AACR;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const addMarks = require("./methods/addMarks.cjs");
|
|
4
|
+
const canToggleMark = require("./methods/canToggleMark.cjs");
|
|
5
|
+
const closest = require("./methods/closest.cjs");
|
|
6
|
+
const closestBlockEntry = require("./methods/closestBlockEntry.cjs");
|
|
7
|
+
const closestViableBlockContainerEntry = require("./methods/closestViableBlockContainerEntry.cjs");
|
|
8
|
+
const ejectElement = require("./methods/ejectElement.cjs");
|
|
9
|
+
const elementToSpecifics = require("./methods/elementToSpecifics.cjs");
|
|
10
|
+
const getElementDataAttributes = require("./methods/getElementDataAttributes.cjs");
|
|
11
|
+
const getPreviousSibling = require("./methods/getPreviousSibling.cjs");
|
|
12
|
+
const hasMarks = require("./methods/hasMarks.cjs");
|
|
13
|
+
const hasParentOfType = require("./methods/hasParentOfType.cjs");
|
|
14
|
+
const isElementType = require("./methods/isElementType.cjs");
|
|
15
|
+
const permissivelyDeserializeNodes = require("./methods/permissivelyDeserializeNodes.cjs");
|
|
16
|
+
const removeMarks = require("./methods/removeMarks.cjs");
|
|
17
|
+
const serializeNodes = require("./methods/serializeNodes.cjs");
|
|
18
|
+
const strictlyDeserializeNodes = require("./methods/strictlyDeserializeNodes.cjs");
|
|
19
|
+
const textToSpecifics = require("./methods/textToSpecifics.cjs");
|
|
20
|
+
const toLatestFormat = require("./methods/toLatestFormat.cjs");
|
|
21
|
+
const topLevelNodes = require("./methods/topLevelNodes.cjs");
|
|
22
|
+
const ContemberEditor = {
|
|
23
|
+
addMarks: addMarks.addMarks,
|
|
24
|
+
canToggleMark: canToggleMark.canToggleMark,
|
|
25
|
+
closest: closest.closest,
|
|
26
|
+
closestBlockEntry: closestBlockEntry.closestBlockEntry,
|
|
27
|
+
closestViableBlockContainerEntry: closestViableBlockContainerEntry.closestViableBlockContainerEntry,
|
|
28
|
+
ejectElement: ejectElement.ejectElement,
|
|
29
|
+
elementToSpecifics: elementToSpecifics.elementToSpecifics,
|
|
30
|
+
getElementDataAttributes: getElementDataAttributes.getElementDataAttributes,
|
|
31
|
+
getPreviousSibling: getPreviousSibling.getPreviousSibling,
|
|
32
|
+
hasMarks: hasMarks.hasMarks,
|
|
33
|
+
hasParentOfType: hasParentOfType.hasParentOfType,
|
|
34
|
+
isElementType: isElementType.isElementType,
|
|
35
|
+
permissivelyDeserializeNodes: permissivelyDeserializeNodes.permissivelyDeserializeNodes,
|
|
36
|
+
removeMarks: removeMarks.removeMarks,
|
|
37
|
+
serializeNodes: serializeNodes.serializeNodes,
|
|
38
|
+
strictlyDeserializeNodes: strictlyDeserializeNodes.strictlyDeserializeNodes,
|
|
39
|
+
textToSpecifics: textToSpecifics.textToSpecifics,
|
|
40
|
+
toLatestFormat: toLatestFormat.toLatestFormat,
|
|
41
|
+
topLevelNodes: topLevelNodes.topLevelNodes
|
|
42
|
+
};
|
|
43
|
+
exports.ContemberEditor = ContemberEditor;
|
|
44
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/editor/index.ts"],"sourcesContent":["import {\n\taddMarks,\n\tcanToggleMark,\n\tclosest,\n\tclosestBlockEntry,\n\tclosestViableBlockContainerEntry,\n\tejectElement,\n\telementToSpecifics,\n\tgetElementDataAttributes,\n\tgetPreviousSibling,\n\thasMarks,\n\thasParentOfType,\n\tisElementType,\n\tpermissivelyDeserializeNodes,\n\tremoveMarks,\n\tserializeNodes,\n\tstrictlyDeserializeNodes,\n\ttextToSpecifics,\n\ttoLatestFormat,\n\ttopLevelNodes,\n} from './methods'\n\nexport type { ElementDataAttributes } from './methods'\n\n// TODO use export * as ContemberEditor from './methods' once the tooling is ready.\nexport const ContemberEditor = {\n\taddMarks,\n\tcanToggleMark,\n\tclosest,\n\tclosestBlockEntry,\n\tclosestViableBlockContainerEntry,\n\tejectElement,\n\telementToSpecifics,\n\tgetElementDataAttributes,\n\tgetPreviousSibling,\n\thasMarks,\n\thasParentOfType,\n\tisElementType,\n\tpermissivelyDeserializeNodes,\n\tremoveMarks,\n\tserializeNodes,\n\tstrictlyDeserializeNodes,\n\ttextToSpecifics,\n\ttoLatestFormat,\n\ttopLevelNodes,\n}\n\nexport * from './createEditor'\n"],"names":["addMarks","canToggleMark","closest","closestBlockEntry","closestViableBlockContainerEntry","ejectElement","elementToSpecifics","getElementDataAttributes","getPreviousSibling","hasMarks","hasParentOfType","isElementType","permissivelyDeserializeNodes","removeMarks","serializeNodes","strictlyDeserializeNodes","textToSpecifics","toLatestFormat","topLevelNodes"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAyBO,MAAM,kBAAkB;AAAA,EAAA,UAC9BA,SAAA;AAAA,EAAA,eACAC,cAAA;AAAA,EAAA,SACAC,QAAA;AAAA,EAAA,mBACAC,kBAAA;AAAA,EAAA,kCACAC,iCAAA;AAAA,EAAA,cACAC,aAAA;AAAA,EAAA,oBACAC,mBAAA;AAAA,EAAA,0BACAC,yBAAA;AAAA,EAAA,oBACAC,mBAAA;AAAA,EAAA,UACAC,SAAA;AAAA,EAAA,iBACAC,gBAAA;AAAA,EAAA,eACAC,cAAA;AAAA,EAAA,8BACAC,6BAAA;AAAA,EAAA,aACAC,YAAA;AAAA,EAAA,gBACAC,eAAA;AAAA,EAAA,0BACAC,yBAAA;AAAA,EAAA,iBACAC,gBAAA;AAAA,EAAA,gBACAC,eAAA;AAAA,EAAA,eACAC,cAAA;AACD;;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { addMarks } from "./methods/addMarks.js";
|
|
2
|
+
import { canToggleMark } from "./methods/canToggleMark.js";
|
|
3
|
+
import { closest } from "./methods/closest.js";
|
|
4
|
+
import { closestBlockEntry } from "./methods/closestBlockEntry.js";
|
|
5
|
+
import { closestViableBlockContainerEntry } from "./methods/closestViableBlockContainerEntry.js";
|
|
6
|
+
import { ejectElement } from "./methods/ejectElement.js";
|
|
7
|
+
import { elementToSpecifics } from "./methods/elementToSpecifics.js";
|
|
8
|
+
import { getElementDataAttributes } from "./methods/getElementDataAttributes.js";
|
|
9
|
+
import { getPreviousSibling } from "./methods/getPreviousSibling.js";
|
|
10
|
+
import { hasMarks } from "./methods/hasMarks.js";
|
|
11
|
+
import { hasParentOfType } from "./methods/hasParentOfType.js";
|
|
12
|
+
import { isElementType } from "./methods/isElementType.js";
|
|
13
|
+
import { permissivelyDeserializeNodes } from "./methods/permissivelyDeserializeNodes.js";
|
|
14
|
+
import { removeMarks } from "./methods/removeMarks.js";
|
|
15
|
+
import { serializeNodes } from "./methods/serializeNodes.js";
|
|
16
|
+
import { strictlyDeserializeNodes } from "./methods/strictlyDeserializeNodes.js";
|
|
17
|
+
import { textToSpecifics } from "./methods/textToSpecifics.js";
|
|
18
|
+
import { toLatestFormat } from "./methods/toLatestFormat.js";
|
|
19
|
+
import { topLevelNodes } from "./methods/topLevelNodes.js";
|
|
20
|
+
const ContemberEditor = {
|
|
21
|
+
addMarks,
|
|
22
|
+
canToggleMark,
|
|
23
|
+
closest,
|
|
24
|
+
closestBlockEntry,
|
|
25
|
+
closestViableBlockContainerEntry,
|
|
26
|
+
ejectElement,
|
|
27
|
+
elementToSpecifics,
|
|
28
|
+
getElementDataAttributes,
|
|
29
|
+
getPreviousSibling,
|
|
30
|
+
hasMarks,
|
|
31
|
+
hasParentOfType,
|
|
32
|
+
isElementType,
|
|
33
|
+
permissivelyDeserializeNodes,
|
|
34
|
+
removeMarks,
|
|
35
|
+
serializeNodes,
|
|
36
|
+
strictlyDeserializeNodes,
|
|
37
|
+
textToSpecifics,
|
|
38
|
+
toLatestFormat,
|
|
39
|
+
topLevelNodes
|
|
40
|
+
};
|
|
41
|
+
export {
|
|
42
|
+
ContemberEditor
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/editor/index.ts"],"sourcesContent":["import {\n\taddMarks,\n\tcanToggleMark,\n\tclosest,\n\tclosestBlockEntry,\n\tclosestViableBlockContainerEntry,\n\tejectElement,\n\telementToSpecifics,\n\tgetElementDataAttributes,\n\tgetPreviousSibling,\n\thasMarks,\n\thasParentOfType,\n\tisElementType,\n\tpermissivelyDeserializeNodes,\n\tremoveMarks,\n\tserializeNodes,\n\tstrictlyDeserializeNodes,\n\ttextToSpecifics,\n\ttoLatestFormat,\n\ttopLevelNodes,\n} from './methods'\n\nexport type { ElementDataAttributes } from './methods'\n\n// TODO use export * as ContemberEditor from './methods' once the tooling is ready.\nexport const ContemberEditor = {\n\taddMarks,\n\tcanToggleMark,\n\tclosest,\n\tclosestBlockEntry,\n\tclosestViableBlockContainerEntry,\n\tejectElement,\n\telementToSpecifics,\n\tgetElementDataAttributes,\n\tgetPreviousSibling,\n\thasMarks,\n\thasParentOfType,\n\tisElementType,\n\tpermissivelyDeserializeNodes,\n\tremoveMarks,\n\tserializeNodes,\n\tstrictlyDeserializeNodes,\n\ttextToSpecifics,\n\ttoLatestFormat,\n\ttopLevelNodes,\n}\n\nexport * from './createEditor'\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAyBO,MAAM,kBAAkB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const Slate = require("slate");
|
|
4
|
+
const addMarks = (editor, marks) => {
|
|
5
|
+
Slate.Editor.withoutNormalizing(editor, () => {
|
|
6
|
+
for (const mark in marks) {
|
|
7
|
+
Slate.Editor.addMark(editor, mark, marks[mark]);
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
exports.addMarks = addMarks;
|
|
12
|
+
//# sourceMappingURL=addMarks.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addMarks.cjs","sources":["../../../../src/editor/methods/addMarks.ts"],"sourcesContent":["import { Editor as SlateEditor, Editor, Text as SlateText } from 'slate'\nimport { TextSpecifics } from '../../types/editor'\n\nexport const addMarks = <T extends SlateText, E extends SlateEditor>(editor: E, marks: TextSpecifics<T>) => {\n\tEditor.withoutNormalizing(editor, () => {\n\t\tfor (const mark in marks) {\n\t\t\tEditor.addMark(editor, mark, (marks as any)[mark])\n\t\t}\n\t})\n}\n"],"names":["Editor"],"mappings":";;;AAGa,MAAA,WAAW,CAA6C,QAAW,UAA4B;AACpGA,eAAA,mBAAmB,QAAQ,MAAM;AACvC,eAAW,QAAQ,OAAO;AACzBA,YAAA,OAAO,QAAQ,QAAQ,MAAO,MAAc,IAAI,CAAC;AAAA,IAClD;AAAA,EAAA,CACA;AACF;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Editor } from "slate";
|
|
2
|
+
const addMarks = (editor, marks) => {
|
|
3
|
+
Editor.withoutNormalizing(editor, () => {
|
|
4
|
+
for (const mark in marks) {
|
|
5
|
+
Editor.addMark(editor, mark, marks[mark]);
|
|
6
|
+
}
|
|
7
|
+
});
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
addMarks
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=addMarks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addMarks.js","sources":["../../../../src/editor/methods/addMarks.ts"],"sourcesContent":["import { Editor as SlateEditor, Editor, Text as SlateText } from 'slate'\nimport { TextSpecifics } from '../../types/editor'\n\nexport const addMarks = <T extends SlateText, E extends SlateEditor>(editor: E, marks: TextSpecifics<T>) => {\n\tEditor.withoutNormalizing(editor, () => {\n\t\tfor (const mark in marks) {\n\t\t\tEditor.addMark(editor, mark, (marks as any)[mark])\n\t\t}\n\t})\n}\n"],"names":[],"mappings":";AAGa,MAAA,WAAW,CAA6C,QAAW,UAA4B;AACpG,SAAA,mBAAmB,QAAQ,MAAM;AACvC,eAAW,QAAQ,OAAO;AACzB,aAAO,QAAQ,QAAQ,MAAO,MAAc,IAAI,CAAC;AAAA,IAClD;AAAA,EAAA,CACA;AACF;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const canToggleMark = (editor, markName, markValue = true) => {
|
|
4
|
+
return editor.canToggleMarks({ [markName]: markValue });
|
|
5
|
+
};
|
|
6
|
+
exports.canToggleMark = canToggleMark;
|
|
7
|
+
//# sourceMappingURL=canToggleMark.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canToggleMark.cjs","sources":["../../../../src/editor/methods/canToggleMark.ts"],"sourcesContent":["import { Editor as SlateEditor, Text as SlateText } from 'slate'\n\nexport const canToggleMark = <T extends SlateText, E extends SlateEditor>(\n\teditor: E,\n\tmarkName: string,\n\tmarkValue: unknown = true,\n) => {\n\treturn editor.canToggleMarks({ [markName]: markValue })\n}\n"],"names":[],"mappings":";;AAEO,MAAM,gBAAgB,CAC5B,QACA,UACA,YAAqB,SACjB;AACJ,SAAO,OAAO,eAAe,EAAE,CAAC,QAAQ,GAAG,UAAW,CAAA;AACvD;;"}
|