@contember/react-slate-editor-base 2.1.0-beta.2 → 2.2.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (530) hide show
  1. package/dist/development/src/components/RichTextEditor.cjs.map +1 -1
  2. package/dist/development/src/components/RichTextEditor.js.map +1 -1
  3. package/dist/development/src/components/triggers/EditorWrapNodeTrigger.cjs.map +1 -1
  4. package/dist/development/src/components/triggers/EditorWrapNodeTrigger.js.map +1 -1
  5. package/dist/development/src/editor/createEditor.cjs.map +1 -1
  6. package/dist/development/src/editor/createEditor.js.map +1 -1
  7. package/dist/development/src/editor/createEditorWithEssentials.cjs.map +1 -1
  8. package/dist/development/src/editor/createEditorWithEssentials.js.map +1 -1
  9. package/dist/development/src/editor/index.cjs.map +1 -1
  10. package/dist/development/src/editor/index.js.map +1 -1
  11. package/dist/development/src/editor/methods/addMarks.cjs.map +1 -1
  12. package/dist/development/src/editor/methods/addMarks.js.map +1 -1
  13. package/dist/development/src/editor/methods/closestBlockEntry.cjs.map +1 -1
  14. package/dist/development/src/editor/methods/closestBlockEntry.js.map +1 -1
  15. package/dist/development/src/editor/methods/closestViableBlockContainerEntry.cjs.map +1 -1
  16. package/dist/development/src/editor/methods/closestViableBlockContainerEntry.js.map +1 -1
  17. package/dist/development/src/editor/methods/hasMarks.cjs.map +1 -1
  18. package/dist/development/src/editor/methods/hasMarks.js.map +1 -1
  19. package/dist/development/src/editor/methods/hasParentOfType.cjs.map +1 -1
  20. package/dist/development/src/editor/methods/hasParentOfType.js.map +1 -1
  21. package/dist/development/src/editor/methods/permissivelyDeserializeNodes.cjs.map +1 -1
  22. package/dist/development/src/editor/methods/permissivelyDeserializeNodes.js.map +1 -1
  23. package/dist/development/src/editor/methods/removeMarks.cjs.map +1 -1
  24. package/dist/development/src/editor/methods/removeMarks.js.map +1 -1
  25. package/dist/development/src/editor/methods/serializeNodes.cjs.map +1 -1
  26. package/dist/development/src/editor/methods/serializeNodes.js.map +1 -1
  27. package/dist/development/src/editor/methods/strictlyDeserializeNodes.cjs.map +1 -1
  28. package/dist/development/src/editor/methods/strictlyDeserializeNodes.js.map +1 -1
  29. package/dist/development/src/editor/methods/textToSpecifics.cjs.map +1 -1
  30. package/dist/development/src/editor/methods/textToSpecifics.js.map +1 -1
  31. package/dist/development/src/editor/methods/toLatestFormat.cjs.map +1 -1
  32. package/dist/development/src/editor/methods/toLatestFormat.js.map +1 -1
  33. package/dist/development/src/internal/utils/EditorPasteUtils.cjs.map +1 -1
  34. package/dist/development/src/internal/utils/EditorPasteUtils.js.map +1 -1
  35. package/dist/development/src/plugins/behaviour/paste/HtmlDeserializer.cjs.map +1 -1
  36. package/dist/development/src/plugins/behaviour/paste/HtmlDeserializer.js.map +1 -1
  37. package/dist/development/src/plugins/behaviour/paste/createMarkHtmlDeserializer.cjs.map +1 -1
  38. package/dist/development/src/plugins/behaviour/paste/createMarkHtmlDeserializer.js.map +1 -1
  39. package/dist/development/src/plugins/behaviour/paste/withPaste.cjs.map +1 -1
  40. package/dist/development/src/plugins/behaviour/paste/withPaste.js.map +1 -1
  41. package/dist/development/src/plugins/element/anchors/AnchorElement.cjs.map +1 -1
  42. package/dist/development/src/plugins/element/anchors/AnchorElement.js.map +1 -1
  43. package/dist/development/src/plugins/element/anchors/AnchorHtmlDeserializer.cjs.map +1 -1
  44. package/dist/development/src/plugins/element/anchors/AnchorHtmlDeserializer.js.map +1 -1
  45. package/dist/development/src/plugins/element/anchors/AnchorModifications.cjs.map +1 -1
  46. package/dist/development/src/plugins/element/anchors/AnchorModifications.js.map +1 -1
  47. package/dist/development/src/plugins/element/anchors/withAnchors.cjs.map +1 -1
  48. package/dist/development/src/plugins/element/anchors/withAnchors.js.map +1 -1
  49. package/dist/development/src/plugins/element/headings/HeadingElement.cjs.map +1 -1
  50. package/dist/development/src/plugins/element/headings/HeadingElement.js.map +1 -1
  51. package/dist/development/src/plugins/element/headings/HeadingHtmlDeserializer.cjs.map +1 -1
  52. package/dist/development/src/plugins/element/headings/HeadingHtmlDeserializer.js.map +1 -1
  53. package/dist/development/src/plugins/element/headings/withHeadings.cjs.map +1 -1
  54. package/dist/development/src/plugins/element/headings/withHeadings.js.map +1 -1
  55. package/dist/development/src/plugins/element/horizonalRules/HorizontalRuleElement.cjs.map +1 -1
  56. package/dist/development/src/plugins/element/horizonalRules/HorizontalRuleElement.js.map +1 -1
  57. package/dist/development/src/plugins/element/horizonalRules/withHorizontalRules.cjs.map +1 -1
  58. package/dist/development/src/plugins/element/horizonalRules/withHorizontalRules.js.map +1 -1
  59. package/dist/development/src/plugins/element/lists/ListElement.cjs.map +1 -1
  60. package/dist/development/src/plugins/element/lists/ListElement.js.map +1 -1
  61. package/dist/development/src/plugins/element/lists/ListHtmlDeserializer.cjs.map +1 -1
  62. package/dist/development/src/plugins/element/lists/ListHtmlDeserializer.js.map +1 -1
  63. package/dist/development/src/plugins/element/lists/ListItemElement.cjs.map +1 -1
  64. package/dist/development/src/plugins/element/lists/ListItemElement.js.map +1 -1
  65. package/dist/development/src/plugins/element/lists/OrderedListElement.cjs.map +1 -1
  66. package/dist/development/src/plugins/element/lists/OrderedListElement.js.map +1 -1
  67. package/dist/development/src/plugins/element/lists/UnorderedListElement.cjs.map +1 -1
  68. package/dist/development/src/plugins/element/lists/UnorderedListElement.js.map +1 -1
  69. package/dist/development/src/plugins/element/lists/transforms/dedentListItem.cjs.map +1 -1
  70. package/dist/development/src/plugins/element/lists/transforms/dedentListItem.js.map +1 -1
  71. package/dist/development/src/plugins/element/lists/transforms/indentListItem.cjs.map +1 -1
  72. package/dist/development/src/plugins/element/lists/transforms/indentListItem.js.map +1 -1
  73. package/dist/development/src/plugins/element/lists/transforms/normalizeListElement.cjs.map +1 -1
  74. package/dist/development/src/plugins/element/lists/transforms/normalizeListElement.js.map +1 -1
  75. package/dist/development/src/plugins/element/lists/transforms/toggleListElement.cjs.map +1 -1
  76. package/dist/development/src/plugins/element/lists/transforms/toggleListElement.js.map +1 -1
  77. package/dist/development/src/plugins/element/lists/withLists.cjs.map +1 -1
  78. package/dist/development/src/plugins/element/lists/withLists.js.map +1 -1
  79. package/dist/development/src/plugins/element/paragraphs/ParagraphElement.cjs.map +1 -1
  80. package/dist/development/src/plugins/element/paragraphs/ParagraphElement.js.map +1 -1
  81. package/dist/development/src/plugins/element/paragraphs/ParagraphHtmlDeserializer.cjs.map +1 -1
  82. package/dist/development/src/plugins/element/paragraphs/ParagraphHtmlDeserializer.js.map +1 -1
  83. package/dist/development/src/plugins/element/paragraphs/withParagraphs.cjs.map +1 -1
  84. package/dist/development/src/plugins/element/paragraphs/withParagraphs.js.map +1 -1
  85. package/dist/development/src/plugins/element/scrollTargets/ScrollTargetElement.cjs.map +1 -1
  86. package/dist/development/src/plugins/element/scrollTargets/ScrollTargetElement.js.map +1 -1
  87. package/dist/development/src/plugins/element/scrollTargets/withScrollTargets.cjs.map +1 -1
  88. package/dist/development/src/plugins/element/scrollTargets/withScrollTargets.js.map +1 -1
  89. package/dist/development/src/plugins/element/tables/TableCellElement.cjs.map +1 -1
  90. package/dist/development/src/plugins/element/tables/TableCellElement.js.map +1 -1
  91. package/dist/development/src/plugins/element/tables/TableElement.cjs.map +1 -1
  92. package/dist/development/src/plugins/element/tables/TableElement.js.map +1 -1
  93. package/dist/development/src/plugins/element/tables/TableElementSelection.cjs.map +1 -1
  94. package/dist/development/src/plugins/element/tables/TableElementSelection.js.map +1 -1
  95. package/dist/development/src/plugins/element/tables/TableHtmlDeserializer.cjs.map +1 -1
  96. package/dist/development/src/plugins/element/tables/TableHtmlDeserializer.js.map +1 -1
  97. package/dist/development/src/plugins/element/tables/TableModifications.cjs.map +1 -1
  98. package/dist/development/src/plugins/element/tables/TableModifications.js.map +1 -1
  99. package/dist/development/src/plugins/element/tables/TableRowElement.cjs.map +1 -1
  100. package/dist/development/src/plugins/element/tables/TableRowElement.js.map +1 -1
  101. package/dist/development/src/plugins/element/tables/gaugeTableColumnCount.cjs.map +1 -1
  102. package/dist/development/src/plugins/element/tables/gaugeTableColumnCount.js.map +1 -1
  103. package/dist/development/src/plugins/element/tables/withTables.cjs.map +1 -1
  104. package/dist/development/src/plugins/element/tables/withTables.js.map +1 -1
  105. package/dist/development/src/plugins/text/bold/boldMark.cjs.map +1 -1
  106. package/dist/development/src/plugins/text/bold/boldMark.js.map +1 -1
  107. package/dist/development/src/plugins/text/bold/withBold.cjs.map +1 -1
  108. package/dist/development/src/plugins/text/bold/withBold.js.map +1 -1
  109. package/dist/development/src/plugins/text/code/codeMark.cjs.map +1 -1
  110. package/dist/development/src/plugins/text/code/codeMark.js.map +1 -1
  111. package/dist/development/src/plugins/text/code/withCode.cjs.map +1 -1
  112. package/dist/development/src/plugins/text/code/withCode.js.map +1 -1
  113. package/dist/development/src/plugins/text/highlight/highlightMark.cjs.map +1 -1
  114. package/dist/development/src/plugins/text/highlight/highlightMark.js.map +1 -1
  115. package/dist/development/src/plugins/text/highlight/withHighlight.cjs.map +1 -1
  116. package/dist/development/src/plugins/text/highlight/withHighlight.js.map +1 -1
  117. package/dist/development/src/plugins/text/italic/italicMark.cjs.map +1 -1
  118. package/dist/development/src/plugins/text/italic/italicMark.js.map +1 -1
  119. package/dist/development/src/plugins/text/italic/withItalic.cjs.map +1 -1
  120. package/dist/development/src/plugins/text/italic/withItalic.js.map +1 -1
  121. package/dist/development/src/plugins/text/newline/withNewline.cjs.map +1 -1
  122. package/dist/development/src/plugins/text/newline/withNewline.js.map +1 -1
  123. package/dist/development/src/plugins/text/strikeThrough/strikeThroughMark.cjs.map +1 -1
  124. package/dist/development/src/plugins/text/strikeThrough/strikeThroughMark.js.map +1 -1
  125. package/dist/development/src/plugins/text/strikeThrough/withStrikeThrough.cjs.map +1 -1
  126. package/dist/development/src/plugins/text/strikeThrough/withStrikeThrough.js.map +1 -1
  127. package/dist/development/src/plugins/text/underline/underlineMark.cjs.map +1 -1
  128. package/dist/development/src/plugins/text/underline/underlineMark.js.map +1 -1
  129. package/dist/development/src/plugins/text/underline/withUnderline.cjs.map +1 -1
  130. package/dist/development/src/plugins/text/underline/withUnderline.js.map +1 -1
  131. package/dist/production/src/components/RichTextEditor.cjs.map +1 -1
  132. package/dist/production/src/components/RichTextEditor.js.map +1 -1
  133. package/dist/production/src/components/triggers/EditorWrapNodeTrigger.cjs.map +1 -1
  134. package/dist/production/src/components/triggers/EditorWrapNodeTrigger.js.map +1 -1
  135. package/dist/production/src/editor/createEditor.cjs.map +1 -1
  136. package/dist/production/src/editor/createEditor.js.map +1 -1
  137. package/dist/production/src/editor/createEditorWithEssentials.cjs.map +1 -1
  138. package/dist/production/src/editor/createEditorWithEssentials.js.map +1 -1
  139. package/dist/production/src/editor/index.cjs.map +1 -1
  140. package/dist/production/src/editor/index.js.map +1 -1
  141. package/dist/production/src/editor/methods/addMarks.cjs.map +1 -1
  142. package/dist/production/src/editor/methods/addMarks.js.map +1 -1
  143. package/dist/production/src/editor/methods/closestBlockEntry.cjs.map +1 -1
  144. package/dist/production/src/editor/methods/closestBlockEntry.js.map +1 -1
  145. package/dist/production/src/editor/methods/closestViableBlockContainerEntry.cjs.map +1 -1
  146. package/dist/production/src/editor/methods/closestViableBlockContainerEntry.js.map +1 -1
  147. package/dist/production/src/editor/methods/hasMarks.cjs.map +1 -1
  148. package/dist/production/src/editor/methods/hasMarks.js.map +1 -1
  149. package/dist/production/src/editor/methods/hasParentOfType.cjs.map +1 -1
  150. package/dist/production/src/editor/methods/hasParentOfType.js.map +1 -1
  151. package/dist/production/src/editor/methods/permissivelyDeserializeNodes.cjs.map +1 -1
  152. package/dist/production/src/editor/methods/permissivelyDeserializeNodes.js.map +1 -1
  153. package/dist/production/src/editor/methods/removeMarks.cjs.map +1 -1
  154. package/dist/production/src/editor/methods/removeMarks.js.map +1 -1
  155. package/dist/production/src/editor/methods/serializeNodes.cjs.map +1 -1
  156. package/dist/production/src/editor/methods/serializeNodes.js.map +1 -1
  157. package/dist/production/src/editor/methods/strictlyDeserializeNodes.cjs.map +1 -1
  158. package/dist/production/src/editor/methods/strictlyDeserializeNodes.js.map +1 -1
  159. package/dist/production/src/editor/methods/textToSpecifics.cjs.map +1 -1
  160. package/dist/production/src/editor/methods/textToSpecifics.js.map +1 -1
  161. package/dist/production/src/editor/methods/toLatestFormat.cjs.map +1 -1
  162. package/dist/production/src/editor/methods/toLatestFormat.js.map +1 -1
  163. package/dist/production/src/internal/utils/EditorPasteUtils.cjs.map +1 -1
  164. package/dist/production/src/internal/utils/EditorPasteUtils.js.map +1 -1
  165. package/dist/production/src/plugins/behaviour/paste/HtmlDeserializer.cjs.map +1 -1
  166. package/dist/production/src/plugins/behaviour/paste/HtmlDeserializer.js.map +1 -1
  167. package/dist/production/src/plugins/behaviour/paste/createMarkHtmlDeserializer.cjs.map +1 -1
  168. package/dist/production/src/plugins/behaviour/paste/createMarkHtmlDeserializer.js.map +1 -1
  169. package/dist/production/src/plugins/behaviour/paste/withPaste.cjs.map +1 -1
  170. package/dist/production/src/plugins/behaviour/paste/withPaste.js.map +1 -1
  171. package/dist/production/src/plugins/element/anchors/AnchorElement.cjs.map +1 -1
  172. package/dist/production/src/plugins/element/anchors/AnchorElement.js.map +1 -1
  173. package/dist/production/src/plugins/element/anchors/AnchorHtmlDeserializer.cjs.map +1 -1
  174. package/dist/production/src/plugins/element/anchors/AnchorHtmlDeserializer.js.map +1 -1
  175. package/dist/production/src/plugins/element/anchors/AnchorModifications.cjs.map +1 -1
  176. package/dist/production/src/plugins/element/anchors/AnchorModifications.js.map +1 -1
  177. package/dist/production/src/plugins/element/anchors/withAnchors.cjs.map +1 -1
  178. package/dist/production/src/plugins/element/anchors/withAnchors.js.map +1 -1
  179. package/dist/production/src/plugins/element/headings/HeadingElement.cjs.map +1 -1
  180. package/dist/production/src/plugins/element/headings/HeadingElement.js.map +1 -1
  181. package/dist/production/src/plugins/element/headings/HeadingHtmlDeserializer.cjs.map +1 -1
  182. package/dist/production/src/plugins/element/headings/HeadingHtmlDeserializer.js.map +1 -1
  183. package/dist/production/src/plugins/element/headings/withHeadings.cjs.map +1 -1
  184. package/dist/production/src/plugins/element/headings/withHeadings.js.map +1 -1
  185. package/dist/production/src/plugins/element/horizonalRules/HorizontalRuleElement.cjs.map +1 -1
  186. package/dist/production/src/plugins/element/horizonalRules/HorizontalRuleElement.js.map +1 -1
  187. package/dist/production/src/plugins/element/horizonalRules/withHorizontalRules.cjs.map +1 -1
  188. package/dist/production/src/plugins/element/horizonalRules/withHorizontalRules.js.map +1 -1
  189. package/dist/production/src/plugins/element/lists/ListElement.cjs.map +1 -1
  190. package/dist/production/src/plugins/element/lists/ListElement.js.map +1 -1
  191. package/dist/production/src/plugins/element/lists/ListHtmlDeserializer.cjs.map +1 -1
  192. package/dist/production/src/plugins/element/lists/ListHtmlDeserializer.js.map +1 -1
  193. package/dist/production/src/plugins/element/lists/ListItemElement.cjs.map +1 -1
  194. package/dist/production/src/plugins/element/lists/ListItemElement.js.map +1 -1
  195. package/dist/production/src/plugins/element/lists/OrderedListElement.cjs.map +1 -1
  196. package/dist/production/src/plugins/element/lists/OrderedListElement.js.map +1 -1
  197. package/dist/production/src/plugins/element/lists/UnorderedListElement.cjs.map +1 -1
  198. package/dist/production/src/plugins/element/lists/UnorderedListElement.js.map +1 -1
  199. package/dist/production/src/plugins/element/lists/transforms/dedentListItem.cjs.map +1 -1
  200. package/dist/production/src/plugins/element/lists/transforms/dedentListItem.js.map +1 -1
  201. package/dist/production/src/plugins/element/lists/transforms/indentListItem.cjs.map +1 -1
  202. package/dist/production/src/plugins/element/lists/transforms/indentListItem.js.map +1 -1
  203. package/dist/production/src/plugins/element/lists/transforms/normalizeListElement.cjs.map +1 -1
  204. package/dist/production/src/plugins/element/lists/transforms/normalizeListElement.js.map +1 -1
  205. package/dist/production/src/plugins/element/lists/transforms/toggleListElement.cjs.map +1 -1
  206. package/dist/production/src/plugins/element/lists/transforms/toggleListElement.js.map +1 -1
  207. package/dist/production/src/plugins/element/lists/withLists.cjs.map +1 -1
  208. package/dist/production/src/plugins/element/lists/withLists.js.map +1 -1
  209. package/dist/production/src/plugins/element/paragraphs/ParagraphElement.cjs.map +1 -1
  210. package/dist/production/src/plugins/element/paragraphs/ParagraphElement.js.map +1 -1
  211. package/dist/production/src/plugins/element/paragraphs/ParagraphHtmlDeserializer.cjs.map +1 -1
  212. package/dist/production/src/plugins/element/paragraphs/ParagraphHtmlDeserializer.js.map +1 -1
  213. package/dist/production/src/plugins/element/paragraphs/withParagraphs.cjs.map +1 -1
  214. package/dist/production/src/plugins/element/paragraphs/withParagraphs.js.map +1 -1
  215. package/dist/production/src/plugins/element/scrollTargets/ScrollTargetElement.cjs.map +1 -1
  216. package/dist/production/src/plugins/element/scrollTargets/ScrollTargetElement.js.map +1 -1
  217. package/dist/production/src/plugins/element/scrollTargets/withScrollTargets.cjs.map +1 -1
  218. package/dist/production/src/plugins/element/scrollTargets/withScrollTargets.js.map +1 -1
  219. package/dist/production/src/plugins/element/tables/TableCellElement.cjs.map +1 -1
  220. package/dist/production/src/plugins/element/tables/TableCellElement.js.map +1 -1
  221. package/dist/production/src/plugins/element/tables/TableElement.cjs.map +1 -1
  222. package/dist/production/src/plugins/element/tables/TableElement.js.map +1 -1
  223. package/dist/production/src/plugins/element/tables/TableElementSelection.cjs.map +1 -1
  224. package/dist/production/src/plugins/element/tables/TableElementSelection.js.map +1 -1
  225. package/dist/production/src/plugins/element/tables/TableHtmlDeserializer.cjs.map +1 -1
  226. package/dist/production/src/plugins/element/tables/TableHtmlDeserializer.js.map +1 -1
  227. package/dist/production/src/plugins/element/tables/TableModifications.cjs.map +1 -1
  228. package/dist/production/src/plugins/element/tables/TableModifications.js.map +1 -1
  229. package/dist/production/src/plugins/element/tables/TableRowElement.cjs.map +1 -1
  230. package/dist/production/src/plugins/element/tables/TableRowElement.js.map +1 -1
  231. package/dist/production/src/plugins/element/tables/gaugeTableColumnCount.cjs.map +1 -1
  232. package/dist/production/src/plugins/element/tables/gaugeTableColumnCount.js.map +1 -1
  233. package/dist/production/src/plugins/element/tables/withTables.cjs.map +1 -1
  234. package/dist/production/src/plugins/element/tables/withTables.js.map +1 -1
  235. package/dist/production/src/plugins/text/bold/boldMark.cjs.map +1 -1
  236. package/dist/production/src/plugins/text/bold/boldMark.js.map +1 -1
  237. package/dist/production/src/plugins/text/bold/withBold.cjs.map +1 -1
  238. package/dist/production/src/plugins/text/bold/withBold.js.map +1 -1
  239. package/dist/production/src/plugins/text/code/codeMark.cjs.map +1 -1
  240. package/dist/production/src/plugins/text/code/codeMark.js.map +1 -1
  241. package/dist/production/src/plugins/text/code/withCode.cjs.map +1 -1
  242. package/dist/production/src/plugins/text/code/withCode.js.map +1 -1
  243. package/dist/production/src/plugins/text/highlight/highlightMark.cjs.map +1 -1
  244. package/dist/production/src/plugins/text/highlight/highlightMark.js.map +1 -1
  245. package/dist/production/src/plugins/text/highlight/withHighlight.cjs.map +1 -1
  246. package/dist/production/src/plugins/text/highlight/withHighlight.js.map +1 -1
  247. package/dist/production/src/plugins/text/italic/italicMark.cjs.map +1 -1
  248. package/dist/production/src/plugins/text/italic/italicMark.js.map +1 -1
  249. package/dist/production/src/plugins/text/italic/withItalic.cjs.map +1 -1
  250. package/dist/production/src/plugins/text/italic/withItalic.js.map +1 -1
  251. package/dist/production/src/plugins/text/newline/withNewline.cjs.map +1 -1
  252. package/dist/production/src/plugins/text/newline/withNewline.js.map +1 -1
  253. package/dist/production/src/plugins/text/strikeThrough/strikeThroughMark.cjs.map +1 -1
  254. package/dist/production/src/plugins/text/strikeThrough/strikeThroughMark.js.map +1 -1
  255. package/dist/production/src/plugins/text/strikeThrough/withStrikeThrough.cjs.map +1 -1
  256. package/dist/production/src/plugins/text/strikeThrough/withStrikeThrough.js.map +1 -1
  257. package/dist/production/src/plugins/text/underline/underlineMark.cjs.map +1 -1
  258. package/dist/production/src/plugins/text/underline/underlineMark.js.map +1 -1
  259. package/dist/production/src/plugins/text/underline/withUnderline.cjs.map +1 -1
  260. package/dist/production/src/plugins/text/underline/withUnderline.js.map +1 -1
  261. package/dist/types/components/RichTextEditor.d.ts +1 -1
  262. package/dist/types/components/RichTextEditor.d.ts.map +1 -1
  263. package/dist/types/components/index.d.ts +2 -2
  264. package/dist/types/components/index.d.ts.map +1 -1
  265. package/dist/types/components/triggers/index.d.ts +4 -4
  266. package/dist/types/components/triggers/index.d.ts.map +1 -1
  267. package/dist/types/editor/createEditor.d.ts +1 -1
  268. package/dist/types/editor/createEditor.d.ts.map +1 -1
  269. package/dist/types/editor/index.d.ts +11 -11
  270. package/dist/types/editor/index.d.ts.map +1 -1
  271. package/dist/types/editor/methods/addMarks.d.ts +1 -1
  272. package/dist/types/editor/methods/addMarks.d.ts.map +1 -1
  273. package/dist/types/editor/methods/closestBlockEntry.d.ts +1 -1
  274. package/dist/types/editor/methods/closestBlockEntry.d.ts.map +1 -1
  275. package/dist/types/editor/methods/hasMarks.d.ts +1 -1
  276. package/dist/types/editor/methods/hasMarks.d.ts.map +1 -1
  277. package/dist/types/editor/methods/index.d.ts +19 -19
  278. package/dist/types/editor/methods/index.d.ts.map +1 -1
  279. package/dist/types/editor/methods/removeMarks.d.ts +1 -1
  280. package/dist/types/editor/methods/removeMarks.d.ts.map +1 -1
  281. package/dist/types/editor/methods/textToSpecifics.d.ts +1 -1
  282. package/dist/types/editor/methods/textToSpecifics.d.ts.map +1 -1
  283. package/dist/types/editor/methods/toLatestFormat.d.ts +1 -1
  284. package/dist/types/editor/methods/toLatestFormat.d.ts.map +1 -1
  285. package/dist/types/index.d.ts +6 -6
  286. package/dist/types/index.d.ts.map +1 -1
  287. package/dist/types/internal/utils/EditorPasteUtils.d.ts +2 -2
  288. package/dist/types/internal/utils/EditorPasteUtils.d.ts.map +1 -1
  289. package/dist/types/internal/utils/index.d.ts +2 -2
  290. package/dist/types/internal/utils/index.d.ts.map +1 -1
  291. package/dist/types/plugins/attributes/alignment/index.d.ts +1 -1
  292. package/dist/types/plugins/attributes/alignment/index.d.ts.map +1 -1
  293. package/dist/types/plugins/attributes/index.d.ts +1 -1
  294. package/dist/types/plugins/attributes/index.d.ts.map +1 -1
  295. package/dist/types/plugins/behaviour/index.d.ts +1 -1
  296. package/dist/types/plugins/behaviour/index.d.ts.map +1 -1
  297. package/dist/types/plugins/behaviour/paste/HtmlDeserializer.d.ts +2 -2
  298. package/dist/types/plugins/behaviour/paste/HtmlDeserializer.d.ts.map +1 -1
  299. package/dist/types/plugins/behaviour/paste/createMarkHtmlDeserializer.d.ts +1 -1
  300. package/dist/types/plugins/behaviour/paste/createMarkHtmlDeserializer.d.ts.map +1 -1
  301. package/dist/types/plugins/behaviour/paste/index.d.ts +2 -2
  302. package/dist/types/plugins/behaviour/paste/index.d.ts.map +1 -1
  303. package/dist/types/plugins/element/anchors/AnchorElement.d.ts +1 -1
  304. package/dist/types/plugins/element/anchors/AnchorElement.d.ts.map +1 -1
  305. package/dist/types/plugins/element/anchors/AnchorHtmlDeserializer.d.ts +1 -1
  306. package/dist/types/plugins/element/anchors/AnchorHtmlDeserializer.d.ts.map +1 -1
  307. package/dist/types/plugins/element/anchors/index.d.ts +3 -3
  308. package/dist/types/plugins/element/anchors/index.d.ts.map +1 -1
  309. package/dist/types/plugins/element/anchors/withAnchors.d.ts +2 -2
  310. package/dist/types/plugins/element/anchors/withAnchors.d.ts.map +1 -1
  311. package/dist/types/plugins/element/headings/HeadingElement.d.ts +2 -2
  312. package/dist/types/plugins/element/headings/HeadingElement.d.ts.map +1 -1
  313. package/dist/types/plugins/element/headings/HeadingHtmlDeserializer.d.ts +1 -1
  314. package/dist/types/plugins/element/headings/HeadingHtmlDeserializer.d.ts.map +1 -1
  315. package/dist/types/plugins/element/headings/index.d.ts +3 -3
  316. package/dist/types/plugins/element/headings/index.d.ts.map +1 -1
  317. package/dist/types/plugins/element/headings/withHeadings.d.ts +2 -2
  318. package/dist/types/plugins/element/headings/withHeadings.d.ts.map +1 -1
  319. package/dist/types/plugins/element/horizonalRules/HorizontalRuleElement.d.ts +1 -1
  320. package/dist/types/plugins/element/horizonalRules/HorizontalRuleElement.d.ts.map +1 -1
  321. package/dist/types/plugins/element/horizonalRules/index.d.ts +2 -2
  322. package/dist/types/plugins/element/horizonalRules/index.d.ts.map +1 -1
  323. package/dist/types/plugins/element/horizonalRules/withHorizontalRules.d.ts +2 -2
  324. package/dist/types/plugins/element/horizonalRules/withHorizontalRules.d.ts.map +1 -1
  325. package/dist/types/plugins/element/index.d.ts +7 -7
  326. package/dist/types/plugins/element/index.d.ts.map +1 -1
  327. package/dist/types/plugins/element/lists/ListElement.d.ts +2 -2
  328. package/dist/types/plugins/element/lists/ListElement.d.ts.map +1 -1
  329. package/dist/types/plugins/element/lists/ListHtmlDeserializer.d.ts +1 -1
  330. package/dist/types/plugins/element/lists/ListHtmlDeserializer.d.ts.map +1 -1
  331. package/dist/types/plugins/element/lists/ListItemElement.d.ts +1 -1
  332. package/dist/types/plugins/element/lists/ListItemElement.d.ts.map +1 -1
  333. package/dist/types/plugins/element/lists/OrderedListElement.d.ts +1 -1
  334. package/dist/types/plugins/element/lists/OrderedListElement.d.ts.map +1 -1
  335. package/dist/types/plugins/element/lists/UnorderedListElement.d.ts +1 -1
  336. package/dist/types/plugins/element/lists/UnorderedListElement.d.ts.map +1 -1
  337. package/dist/types/plugins/element/lists/index.d.ts +5 -5
  338. package/dist/types/plugins/element/lists/index.d.ts.map +1 -1
  339. package/dist/types/plugins/element/lists/transforms/dedentListItem.d.ts +1 -1
  340. package/dist/types/plugins/element/lists/transforms/dedentListItem.d.ts.map +1 -1
  341. package/dist/types/plugins/element/lists/transforms/indentListItem.d.ts +1 -1
  342. package/dist/types/plugins/element/lists/transforms/indentListItem.d.ts.map +1 -1
  343. package/dist/types/plugins/element/lists/transforms/index.d.ts +4 -4
  344. package/dist/types/plugins/element/lists/transforms/index.d.ts.map +1 -1
  345. package/dist/types/plugins/element/lists/transforms/toggleListElement.d.ts +2 -2
  346. package/dist/types/plugins/element/lists/transforms/toggleListElement.d.ts.map +1 -1
  347. package/dist/types/plugins/element/lists/withLists.d.ts +4 -4
  348. package/dist/types/plugins/element/lists/withLists.d.ts.map +1 -1
  349. package/dist/types/plugins/element/paragraphs/ParagraphElement.d.ts +2 -2
  350. package/dist/types/plugins/element/paragraphs/ParagraphElement.d.ts.map +1 -1
  351. package/dist/types/plugins/element/paragraphs/ParagraphHtmlDeserializer.d.ts +1 -1
  352. package/dist/types/plugins/element/paragraphs/ParagraphHtmlDeserializer.d.ts.map +1 -1
  353. package/dist/types/plugins/element/paragraphs/index.d.ts +3 -3
  354. package/dist/types/plugins/element/paragraphs/index.d.ts.map +1 -1
  355. package/dist/types/plugins/element/paragraphs/withParagraphs.d.ts +2 -2
  356. package/dist/types/plugins/element/paragraphs/withParagraphs.d.ts.map +1 -1
  357. package/dist/types/plugins/element/scrollTargets/ScrollTargetElement.d.ts +1 -1
  358. package/dist/types/plugins/element/scrollTargets/ScrollTargetElement.d.ts.map +1 -1
  359. package/dist/types/plugins/element/scrollTargets/index.d.ts +2 -2
  360. package/dist/types/plugins/element/scrollTargets/index.d.ts.map +1 -1
  361. package/dist/types/plugins/element/scrollTargets/withScrollTargets.d.ts +2 -2
  362. package/dist/types/plugins/element/scrollTargets/withScrollTargets.d.ts.map +1 -1
  363. package/dist/types/plugins/element/tables/TableCellElement.d.ts +1 -1
  364. package/dist/types/plugins/element/tables/TableCellElement.d.ts.map +1 -1
  365. package/dist/types/plugins/element/tables/TableElement.d.ts +1 -1
  366. package/dist/types/plugins/element/tables/TableElement.d.ts.map +1 -1
  367. package/dist/types/plugins/element/tables/TableElementSelection.d.ts +2 -2
  368. package/dist/types/plugins/element/tables/TableElementSelection.d.ts.map +1 -1
  369. package/dist/types/plugins/element/tables/TableHtmlDeserializer.d.ts +1 -1
  370. package/dist/types/plugins/element/tables/TableHtmlDeserializer.d.ts.map +1 -1
  371. package/dist/types/plugins/element/tables/TableModifications.d.ts +3 -3
  372. package/dist/types/plugins/element/tables/TableModifications.d.ts.map +1 -1
  373. package/dist/types/plugins/element/tables/TableRowElement.d.ts +1 -1
  374. package/dist/types/plugins/element/tables/TableRowElement.d.ts.map +1 -1
  375. package/dist/types/plugins/element/tables/gaugeTableColumnCount.d.ts +1 -1
  376. package/dist/types/plugins/element/tables/gaugeTableColumnCount.d.ts.map +1 -1
  377. package/dist/types/plugins/element/tables/index.d.ts +5 -5
  378. package/dist/types/plugins/element/tables/index.d.ts.map +1 -1
  379. package/dist/types/plugins/element/tables/withTables.d.ts +4 -4
  380. package/dist/types/plugins/element/tables/withTables.d.ts.map +1 -1
  381. package/dist/types/plugins/index.d.ts +4 -4
  382. package/dist/types/plugins/index.d.ts.map +1 -1
  383. package/dist/types/plugins/text/bold/boldMark.d.ts +1 -1
  384. package/dist/types/plugins/text/bold/boldMark.d.ts.map +1 -1
  385. package/dist/types/plugins/text/bold/index.d.ts +2 -2
  386. package/dist/types/plugins/text/bold/index.d.ts.map +1 -1
  387. package/dist/types/plugins/text/bold/withBold.d.ts +1 -1
  388. package/dist/types/plugins/text/bold/withBold.d.ts.map +1 -1
  389. package/dist/types/plugins/text/code/codeMark.d.ts +1 -1
  390. package/dist/types/plugins/text/code/codeMark.d.ts.map +1 -1
  391. package/dist/types/plugins/text/code/index.d.ts +2 -2
  392. package/dist/types/plugins/text/code/index.d.ts.map +1 -1
  393. package/dist/types/plugins/text/code/withCode.d.ts +1 -1
  394. package/dist/types/plugins/text/code/withCode.d.ts.map +1 -1
  395. package/dist/types/plugins/text/highlight/highlightMark.d.ts +1 -1
  396. package/dist/types/plugins/text/highlight/highlightMark.d.ts.map +1 -1
  397. package/dist/types/plugins/text/highlight/index.d.ts +2 -2
  398. package/dist/types/plugins/text/highlight/index.d.ts.map +1 -1
  399. package/dist/types/plugins/text/highlight/withHighlight.d.ts +1 -1
  400. package/dist/types/plugins/text/highlight/withHighlight.d.ts.map +1 -1
  401. package/dist/types/plugins/text/index.d.ts +7 -7
  402. package/dist/types/plugins/text/index.d.ts.map +1 -1
  403. package/dist/types/plugins/text/italic/index.d.ts +2 -2
  404. package/dist/types/plugins/text/italic/index.d.ts.map +1 -1
  405. package/dist/types/plugins/text/italic/italicMark.d.ts +1 -1
  406. package/dist/types/plugins/text/italic/italicMark.d.ts.map +1 -1
  407. package/dist/types/plugins/text/italic/withItalic.d.ts +1 -1
  408. package/dist/types/plugins/text/italic/withItalic.d.ts.map +1 -1
  409. package/dist/types/plugins/text/newline/index.d.ts +1 -1
  410. package/dist/types/plugins/text/newline/index.d.ts.map +1 -1
  411. package/dist/types/plugins/text/newline/withNewline.d.ts +1 -1
  412. package/dist/types/plugins/text/newline/withNewline.d.ts.map +1 -1
  413. package/dist/types/plugins/text/strikeThrough/index.d.ts +2 -2
  414. package/dist/types/plugins/text/strikeThrough/index.d.ts.map +1 -1
  415. package/dist/types/plugins/text/strikeThrough/strikeThroughMark.d.ts +1 -1
  416. package/dist/types/plugins/text/strikeThrough/strikeThroughMark.d.ts.map +1 -1
  417. package/dist/types/plugins/text/strikeThrough/withStrikeThrough.d.ts +1 -1
  418. package/dist/types/plugins/text/strikeThrough/withStrikeThrough.d.ts.map +1 -1
  419. package/dist/types/plugins/text/underline/index.d.ts +2 -2
  420. package/dist/types/plugins/text/underline/index.d.ts.map +1 -1
  421. package/dist/types/plugins/text/underline/underlineMark.d.ts +1 -1
  422. package/dist/types/plugins/text/underline/underlineMark.d.ts.map +1 -1
  423. package/dist/types/plugins/text/underline/withUnderline.d.ts +1 -1
  424. package/dist/types/plugins/text/underline/withUnderline.d.ts.map +1 -1
  425. package/dist/types/slate-types.d.ts +1 -1
  426. package/dist/types/slate-types.d.ts.map +1 -1
  427. package/dist/types/tsconfig.tsbuildinfo +1 -1
  428. package/dist/types/types/editor.d.ts +2 -2
  429. package/dist/types/types/editor.d.ts.map +1 -1
  430. package/dist/types/types/htmlDeserializer.d.ts +1 -1
  431. package/dist/types/types/htmlDeserializer.d.ts.map +1 -1
  432. package/dist/types/types/index.d.ts +3 -3
  433. package/dist/types/types/index.d.ts.map +1 -1
  434. package/package.json +3 -3
  435. package/src/components/RichTextEditor.tsx +3 -3
  436. package/src/components/index.ts +2 -2
  437. package/src/components/triggers/EditorWrapNodeTrigger.tsx +1 -1
  438. package/src/components/triggers/index.ts +4 -4
  439. package/src/editor/createEditor.ts +2 -2
  440. package/src/editor/createEditorWithEssentials.tsx +5 -5
  441. package/src/editor/index.ts +4 -4
  442. package/src/editor/methods/addMarks.ts +1 -1
  443. package/src/editor/methods/closestBlockEntry.ts +1 -1
  444. package/src/editor/methods/closestViableBlockContainerEntry.ts +1 -1
  445. package/src/editor/methods/hasMarks.ts +1 -1
  446. package/src/editor/methods/hasParentOfType.ts +1 -1
  447. package/src/editor/methods/index.ts +19 -19
  448. package/src/editor/methods/permissivelyDeserializeNodes.ts +2 -2
  449. package/src/editor/methods/removeMarks.ts +1 -1
  450. package/src/editor/methods/serializeNodes.ts +1 -1
  451. package/src/editor/methods/strictlyDeserializeNodes.ts +2 -2
  452. package/src/editor/methods/textToSpecifics.ts +1 -1
  453. package/src/editor/methods/toLatestFormat.ts +1 -1
  454. package/src/index.ts +6 -6
  455. package/src/internal/utils/EditorPasteUtils.ts +2 -2
  456. package/src/internal/utils/index.ts +2 -2
  457. package/src/plugins/attributes/alignment/index.ts +1 -1
  458. package/src/plugins/attributes/index.ts +1 -1
  459. package/src/plugins/behaviour/index.ts +1 -1
  460. package/src/plugins/behaviour/paste/HtmlDeserializer.ts +2 -2
  461. package/src/plugins/behaviour/paste/createMarkHtmlDeserializer.ts +1 -1
  462. package/src/plugins/behaviour/paste/index.ts +2 -2
  463. package/src/plugins/behaviour/paste/withPaste.ts +3 -3
  464. package/src/plugins/element/anchors/AnchorElement.ts +2 -2
  465. package/src/plugins/element/anchors/AnchorHtmlDeserializer.ts +1 -1
  466. package/src/plugins/element/anchors/AnchorModifications.ts +1 -1
  467. package/src/plugins/element/anchors/index.ts +3 -3
  468. package/src/plugins/element/anchors/withAnchors.ts +5 -5
  469. package/src/plugins/element/headings/HeadingElement.ts +3 -3
  470. package/src/plugins/element/headings/HeadingHtmlDeserializer.ts +3 -3
  471. package/src/plugins/element/headings/index.ts +3 -3
  472. package/src/plugins/element/headings/withHeadings.ts +4 -4
  473. package/src/plugins/element/horizonalRules/HorizontalRuleElement.ts +1 -1
  474. package/src/plugins/element/horizonalRules/index.ts +2 -2
  475. package/src/plugins/element/horizonalRules/withHorizontalRules.ts +2 -2
  476. package/src/plugins/element/index.ts +7 -7
  477. package/src/plugins/element/lists/ListElement.ts +4 -4
  478. package/src/plugins/element/lists/ListHtmlDeserializer.ts +6 -6
  479. package/src/plugins/element/lists/ListItemElement.ts +3 -3
  480. package/src/plugins/element/lists/OrderedListElement.ts +5 -5
  481. package/src/plugins/element/lists/UnorderedListElement.ts +5 -5
  482. package/src/plugins/element/lists/index.ts +5 -5
  483. package/src/plugins/element/lists/transforms/dedentListItem.ts +5 -5
  484. package/src/plugins/element/lists/transforms/indentListItem.ts +4 -4
  485. package/src/plugins/element/lists/transforms/index.ts +4 -4
  486. package/src/plugins/element/lists/transforms/normalizeListElement.ts +2 -2
  487. package/src/plugins/element/lists/transforms/toggleListElement.ts +5 -5
  488. package/src/plugins/element/lists/withLists.ts +8 -8
  489. package/src/plugins/element/paragraphs/ParagraphElement.ts +3 -3
  490. package/src/plugins/element/paragraphs/ParagraphHtmlDeserializer.ts +2 -2
  491. package/src/plugins/element/paragraphs/index.ts +3 -3
  492. package/src/plugins/element/paragraphs/withParagraphs.ts +4 -4
  493. package/src/plugins/element/scrollTargets/ScrollTargetElement.ts +1 -1
  494. package/src/plugins/element/scrollTargets/index.ts +2 -2
  495. package/src/plugins/element/scrollTargets/withScrollTargets.ts +2 -2
  496. package/src/plugins/element/tables/TableCellElement.ts +3 -3
  497. package/src/plugins/element/tables/TableElement.ts +5 -5
  498. package/src/plugins/element/tables/TableElementSelection.ts +2 -2
  499. package/src/plugins/element/tables/TableHtmlDeserializer.ts +4 -4
  500. package/src/plugins/element/tables/TableModifications.ts +4 -4
  501. package/src/plugins/element/tables/TableRowElement.ts +4 -4
  502. package/src/plugins/element/tables/gaugeTableColumnCount.ts +2 -2
  503. package/src/plugins/element/tables/index.ts +5 -5
  504. package/src/plugins/element/tables/withTables.ts +8 -8
  505. package/src/plugins/index.ts +4 -4
  506. package/src/plugins/text/bold/boldMark.ts +1 -1
  507. package/src/plugins/text/bold/index.ts +2 -2
  508. package/src/plugins/text/bold/withBold.ts +3 -3
  509. package/src/plugins/text/code/codeMark.ts +1 -1
  510. package/src/plugins/text/code/index.ts +2 -2
  511. package/src/plugins/text/code/withCode.ts +2 -2
  512. package/src/plugins/text/highlight/highlightMark.ts +1 -1
  513. package/src/plugins/text/highlight/index.ts +2 -2
  514. package/src/plugins/text/highlight/withHighlight.ts +2 -2
  515. package/src/plugins/text/index.ts +7 -7
  516. package/src/plugins/text/italic/index.ts +2 -2
  517. package/src/plugins/text/italic/italicMark.ts +1 -1
  518. package/src/plugins/text/italic/withItalic.ts +3 -3
  519. package/src/plugins/text/newline/index.ts +1 -1
  520. package/src/plugins/text/newline/withNewline.ts +1 -1
  521. package/src/plugins/text/strikeThrough/index.ts +2 -2
  522. package/src/plugins/text/strikeThrough/strikeThroughMark.ts +1 -1
  523. package/src/plugins/text/strikeThrough/withStrikeThrough.ts +3 -3
  524. package/src/plugins/text/underline/index.ts +2 -2
  525. package/src/plugins/text/underline/underlineMark.ts +1 -1
  526. package/src/plugins/text/underline/withUnderline.ts +3 -3
  527. package/src/slate-types.ts +1 -1
  528. package/src/types/editor.ts +2 -2
  529. package/src/types/htmlDeserializer.ts +1 -1
  530. package/src/types/index.ts +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"HtmlDeserializer.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/behaviour/paste/HtmlDeserializer.ts"],"sourcesContent":["import { Descendant, Element as SlateElement, Text as SlateText } from 'slate'\nimport { HtmlDeserializerNextCallback, HtmlDeserializerPlugin } from '../../../types/htmlDeserializer'\nimport { EditorDefaultElementFactory } from '../../../types/editor'\n\nconst ignoredElements = ['SCRIPT', 'STYLE', 'TEMPLATE']\n\nexport interface TextAttrs {\n\t[key: string]: any\n}\n\nexport type NodesWithTypeFiltered =\n\t| { texts: Descendant[]; elements?: undefined }\n\t| { elements: SlateElement[]; texts?: undefined }\n\nexport type NodesWithType = NodesWithTypeFiltered | null\n\nexport class HtmlDeserializer {\n\tconstructor(\n\t\tpublic createDefaultElement: EditorDefaultElementFactory,\n\t\tprivate plugins: HtmlDeserializerPlugin[],\n\t) {\n\t}\n\n\tregisterPlugin(plugin: HtmlDeserializerPlugin, prepend: boolean = true) {\n\t\tprepend ? this.plugins.unshift(plugin) : this.plugins.push(plugin)\n\t}\n\n\tpublic processNodeListPaste(nodeList: Node[], cumulativeTextAttrs: TextAttrs) {\n\t\tfor (const plugin of this.plugins) {\n\t\t\tconst result = plugin.processNodeListPaste?.({ nodeList, cumulativeTextAttrs, deserializer: this }) ?? null\n\t\t\tif (result !== null) {\n\t\t\t\treturn result\n\t\t\t}\n\t\t}\n\t\tconst processed: (\n\t\t\t| { text: SlateText | SlateElement; element?: undefined; isWhiteSpace: boolean }\n\t\t\t| { element: SlateElement; text?: undefined }\n\t\t)[] = []\n\n\t\tfor (const childNode of nodeList) {\n\t\t\tconst isWhiteSpace = childNode.nodeType === Node.TEXT_NODE && childNode.textContent?.match(/^\\s*$/) !== null\n\n\t\t\t// Block\n\t\t\tconst attrs = this.processWithAttributeProcessor(childNode, cumulativeTextAttrs)\n\t\t\tconst result = childNode instanceof HTMLElement\n\t\t\t\t? this.processBlockPaste(\n\t\t\t\t\tchildNode,\n\t\t\t\t\tcumulativeTextAttrs,\n\t\t\t\t)\n\t\t\t\t: null\n\t\t\tif (result !== null) {\n\t\t\t\tprocessed.push(...(Array.isArray(result) ? result : [result]).map(element => ({ element })))\n\t\t\t} else {\n\t\t\t\t// Inline\n\t\t\t\tconst result = this.deserializeTextNode(childNode, cumulativeTextAttrs)\n\t\t\t\tif (result !== null) {\n\t\t\t\t\tprocessed.push(...result.map(text => ({ text, isWhiteSpace })))\n\t\t\t\t} else {\n\t\t\t\t\t// Unknown element\n\t\t\t\t\tconst deserializedChildren = this.processNodeListPaste(\n\t\t\t\t\t\tArray.from(childNode.childNodes),\n\t\t\t\t\t\tattrs,\n\t\t\t\t\t)\n\t\t\t\t\tprocessed.push(\n\t\t\t\t\t\t...(deserializedChildren === null\n\t\t\t\t\t\t\t? []\n\t\t\t\t\t\t\t: deserializedChildren.texts !== undefined\n\t\t\t\t\t\t\t? deserializedChildren.texts.map(text => ({ text, isWhiteSpace }))\n\t\t\t\t\t\t\t: deserializedChildren.elements.map(element => ({ element }))),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (processed.length === 0) {\n\t\t\treturn null\n\t\t}\n\n\t\tconst containsBlock = processed.find(({ element }) => element !== undefined) !== undefined\n\n\t\tif (containsBlock) {\n\t\t\treturn {\n\t\t\t\telements: processed.flatMap(item => {\n\t\t\t\t\tif (item.text !== undefined) {\n\t\t\t\t\t\treturn item.isWhiteSpace ? [] : [this.createDefaultElement([item.text])]\n\t\t\t\t\t} else if (item.element !== undefined) {\n\t\t\t\t\t\treturn [item.element]\n\t\t\t\t\t}\n\t\t\t\t\treturn []\n\t\t\t\t}),\n\t\t\t}\n\t\t} else {\n\t\t\treturn { texts: processed.map(item => item.text as SlateText) }\n\t\t}\n\t}\n\n\tdeserializeInline(list: NodeList | Node[], cumulativeTextAttrs: TextAttrs): Descendant[] {\n\t\treturn Array.from(list).flatMap(childNode => {\n\t\t\tconst result = this.deserializeTextNode(childNode, cumulativeTextAttrs)\n\t\t\tif (result !== null) {\n\t\t\t\treturn result\n\t\t\t} else {\n\t\t\t\tconst attrs = this.processWithAttributeProcessor(childNode, cumulativeTextAttrs)\n\t\t\t\treturn this.deserializeInline(childNode.childNodes, attrs)\n\t\t\t}\n\t\t})\n\t}\n\n\tdeserializeBlocks(list: Node[], cumulativeTextAttrs: TextAttrs): Descendant[] {\n\t\tconst result = this.processNodeListPaste(list, cumulativeTextAttrs)\n\t\treturn result?.texts ?? result?.elements ?? []\n\t}\n\n\tprivate deserializeTextNode(node: Node, cumulativeTextAttrs: TextAttrs): Descendant[] | null {\n\t\tif (node.nodeType === Node.TEXT_NODE) {\n\t\t\tconst text = node.textContent ?? ''\n\t\t\treturn [{ ...cumulativeTextAttrs, text: text.replace(/[ \\t]*(?:\\r?\\n[ \\t]*)+/g, ' ') }]\n\t\t} else if (node instanceof HTMLElement) {\n\t\t\tconst result = this.processInlinePaste(\n\t\t\t\tnode,\n\t\t\t\tcumulativeTextAttrs,\n\t\t\t)\n\t\t\tif (result !== null) {\n\t\t\t\treturn Array.isArray(result) ? result : [result]\n\t\t\t}\n\t\t}\n\n\t\treturn null\n\t}\n\n\tprivate processInlinePaste(element: HTMLElement, cumulativeTextAttrs: TextAttrs): (SlateElement | SlateText)[] | SlateElement | SlateText | null {\n\t\tif (ignoredElements.includes(element.tagName)) {\n\t\t\treturn []\n\t\t}\n\t\tif (element.tagName === 'BR') {\n\t\t\treturn { ...cumulativeTextAttrs, text: ' ' }\n\t\t}\n\t\tconst next: HtmlDeserializerNextCallback = (list, cta) => {\n\t\t\tconst attrs = this.processWithAttributeProcessor(element, cta)\n\t\t\treturn this.deserializeInline(list, attrs)\n\t\t}\n\t\tfor (const plugin of this.plugins) {\n\t\t\tconst result = plugin.processInlinePaste?.({ element, next, cumulativeTextAttrs, deserializer: this }) ?? null\n\t\t\tif (result !== null) {\n\t\t\t\treturn result\n\t\t\t}\n\t\t}\n\t\treturn null\n\t}\n\n\tprivate processWithAttributeProcessor(element: Node, cumulativeTextAttrs: TextAttrs): TextAttrs {\n\t\tif (!(element instanceof HTMLElement)) {\n\t\t\treturn {}\n\t\t}\n\t\treturn this.plugins.reduce(\n\t\t\t(cta, plugin) => plugin.processAttributesPaste?.({ element, cumulativeTextAttrs, deserializer: this }) ?? cta,\n\t\t\tcumulativeTextAttrs,\n\t\t)\n\t}\n\n\tprivate processBlockPaste(element: HTMLElement, cumulativeTextAttrs: TextAttrs): SlateElement[] | SlateElement | null {\n\t\tif (ignoredElements.includes(element.tagName)) {\n\t\t\treturn []\n\t\t}\n\t\tconst next: HtmlDeserializerNextCallback = (list, cta) => this.deserializeBlocks(Array.from(list), { ...cumulativeTextAttrs, ...cta })\n\n\t\tfor (const plugin of this.plugins) {\n\t\t\tconst result = plugin.processBlockPaste?.({ element, next, cumulativeTextAttrs, deserializer: this }) ?? null\n\t\t\tif (result !== null) {\n\t\t\t\treturn result\n\t\t\t}\n\t\t}\n\t\treturn null\n\t}\n}\n"],"names":["result"],"mappings":";;AAIA,MAAM,kBAAkB,CAAC,UAAU,SAAS,UAAU;AAY/C,MAAM,iBAAiB;AAAA,EAC7B,YACQ,sBACC,SACP;AAFM,SAAA,uBAAA;AACC,SAAA,UAAA;AAAA,EAET;AAAA,EAEA,eAAe,QAAgC,UAAmB,MAAM;AACvE,cAAU,KAAK,QAAQ,QAAQ,MAAM,IAAI,KAAK,QAAQ,KAAK,MAAM;AAAA,EAClE;AAAA,EAEO,qBAAqB,UAAkB,qBAAgC;AAC7E,eAAW,UAAU,KAAK,SAAS;AAClC,YAAM,SAAS,OAAO,uBAAuB,EAAE,UAAU,qBAAqB,cAAc,KAAA,CAAM,KAAK;AACvG,UAAI,WAAW,MAAM;AACpB,eAAO;AAAA,MACR;AAAA,IACD;AACA,UAAM,YAGA,CAAA;AAEN,eAAW,aAAa,UAAU;AACjC,YAAM,eAAe,UAAU,aAAa,KAAK,aAAa,UAAU,aAAa,MAAM,OAAO,MAAM;AAGxG,YAAM,QAAQ,KAAK,8BAA8B,WAAW,mBAAmB;AAC/E,YAAM,SAAS,qBAAqB,cACjC,KAAK;AAAA,QACN;AAAA,QACA;AAAA,MAAA,IAEC;AACH,UAAI,WAAW,MAAM;AACpB,kBAAU,KAAK,IAAI,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC,MAAM,GAAG,IAAI,CAAA,aAAY,EAAE,QAAA,EAAU,CAAC;AAAA,MAC5F,OAAO;AAEN,cAAMA,UAAS,KAA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cAAc;AACtC,aAAO,CAAA;AAAA,IACR;AACA,WAAO,KAAK,QAAQ;AAAA,MACnB,CAAC,KAAK,WAAW,OAAO,yBAAyB,EAAE,SAAS,qBAAqB,cAAc,KAAA,CAAM,KAAK;AAAA,MAC1G;AAAA,IAAA;AAAA,EAEF;AAAA,EAEQ,kBAAkB,SAAsB,qBAAsE;AACrH,QAAI,gBAAgB,SAAS,QAAQ,OAAO,GAAG;AAC9C,aAAO,CAAA;AAAA,IACR;AACA,UAAM,OAAqC,CAAC,MAAM,QAAQ,KAAK,kBAAkB,MAAM,KAAK,IAAI,GAAG,EAAE,GAAG,qBAAqB,GAAG,KAAK;AAErI,eAAW,UAAU,KAAK,SAAS;AAClC,YAAM,SAAS,OAAO,oBAAoB,EAAE,SAAS,MAAM,qBAAqB,cAAc,KAAA,CAAM,KAAK;AACzG,UAAI,WAAW,MAAM;AACpB,eAAO;AAAA,MACR;AAAA,IACD;AACA,WAAO;AAAA,EACR;AACD;;"}
1
+ {"version":3,"file":"HtmlDeserializer.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/behaviour/paste/HtmlDeserializer.ts"],"sourcesContent":["import { Descendant, Element as SlateElement, Text as SlateText } from 'slate'\nimport { HtmlDeserializerNextCallback, HtmlDeserializerPlugin } from '../../../types/htmlDeserializer.js'\nimport { EditorDefaultElementFactory } from '../../../types/editor.js'\n\nconst ignoredElements = ['SCRIPT', 'STYLE', 'TEMPLATE']\n\nexport interface TextAttrs {\n\t[key: string]: any\n}\n\nexport type NodesWithTypeFiltered =\n\t| { texts: Descendant[]; elements?: undefined }\n\t| { elements: SlateElement[]; texts?: undefined }\n\nexport type NodesWithType = NodesWithTypeFiltered | null\n\nexport class HtmlDeserializer {\n\tconstructor(\n\t\tpublic createDefaultElement: EditorDefaultElementFactory,\n\t\tprivate plugins: HtmlDeserializerPlugin[],\n\t) {\n\t}\n\n\tregisterPlugin(plugin: HtmlDeserializerPlugin, prepend: boolean = true) {\n\t\tprepend ? this.plugins.unshift(plugin) : this.plugins.push(plugin)\n\t}\n\n\tpublic processNodeListPaste(nodeList: Node[], cumulativeTextAttrs: TextAttrs) {\n\t\tfor (const plugin of this.plugins) {\n\t\t\tconst result = plugin.processNodeListPaste?.({ nodeList, cumulativeTextAttrs, deserializer: this }) ?? null\n\t\t\tif (result !== null) {\n\t\t\t\treturn result\n\t\t\t}\n\t\t}\n\t\tconst processed: (\n\t\t\t| { text: SlateText | SlateElement; element?: undefined; isWhiteSpace: boolean }\n\t\t\t| { element: SlateElement; text?: undefined }\n\t\t)[] = []\n\n\t\tfor (const childNode of nodeList) {\n\t\t\tconst isWhiteSpace = childNode.nodeType === Node.TEXT_NODE && childNode.textContent?.match(/^\\s*$/) !== null\n\n\t\t\t// Block\n\t\t\tconst attrs = this.processWithAttributeProcessor(childNode, cumulativeTextAttrs)\n\t\t\tconst result = childNode instanceof HTMLElement\n\t\t\t\t? this.processBlockPaste(\n\t\t\t\t\tchildNode,\n\t\t\t\t\tcumulativeTextAttrs,\n\t\t\t\t)\n\t\t\t\t: null\n\t\t\tif (result !== null) {\n\t\t\t\tprocessed.push(...(Array.isArray(result) ? result : [result]).map(element => ({ element })))\n\t\t\t} else {\n\t\t\t\t// Inline\n\t\t\t\tconst result = this.deserializeTextNode(childNode, cumulativeTextAttrs)\n\t\t\t\tif (result !== null) {\n\t\t\t\t\tprocessed.push(...result.map(text => ({ text, isWhiteSpace })))\n\t\t\t\t} else {\n\t\t\t\t\t// Unknown element\n\t\t\t\t\tconst deserializedChildren = this.processNodeListPaste(\n\t\t\t\t\t\tArray.from(childNode.childNodes),\n\t\t\t\t\t\tattrs,\n\t\t\t\t\t)\n\t\t\t\t\tprocessed.push(\n\t\t\t\t\t\t...(deserializedChildren === null\n\t\t\t\t\t\t\t? []\n\t\t\t\t\t\t\t: deserializedChildren.texts !== undefined\n\t\t\t\t\t\t\t? deserializedChildren.texts.map(text => ({ text, isWhiteSpace }))\n\t\t\t\t\t\t\t: deserializedChildren.elements.map(element => ({ element }))),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (processed.length === 0) {\n\t\t\treturn null\n\t\t}\n\n\t\tconst containsBlock = processed.find(({ element }) => element !== undefined) !== undefined\n\n\t\tif (containsBlock) {\n\t\t\treturn {\n\t\t\t\telements: processed.flatMap(item => {\n\t\t\t\t\tif (item.text !== undefined) {\n\t\t\t\t\t\treturn item.isWhiteSpace ? [] : [this.createDefaultElement([item.text])]\n\t\t\t\t\t} else if (item.element !== undefined) {\n\t\t\t\t\t\treturn [item.element]\n\t\t\t\t\t}\n\t\t\t\t\treturn []\n\t\t\t\t}),\n\t\t\t}\n\t\t} else {\n\t\t\treturn { texts: processed.map(item => item.text as SlateText) }\n\t\t}\n\t}\n\n\tdeserializeInline(list: NodeList | Node[], cumulativeTextAttrs: TextAttrs): Descendant[] {\n\t\treturn Array.from(list).flatMap(childNode => {\n\t\t\tconst result = this.deserializeTextNode(childNode, cumulativeTextAttrs)\n\t\t\tif (result !== null) {\n\t\t\t\treturn result\n\t\t\t} else {\n\t\t\t\tconst attrs = this.processWithAttributeProcessor(childNode, cumulativeTextAttrs)\n\t\t\t\treturn this.deserializeInline(childNode.childNodes, attrs)\n\t\t\t}\n\t\t})\n\t}\n\n\tdeserializeBlocks(list: Node[], cumulativeTextAttrs: TextAttrs): Descendant[] {\n\t\tconst result = this.processNodeListPaste(list, cumulativeTextAttrs)\n\t\treturn result?.texts ?? result?.elements ?? []\n\t}\n\n\tprivate deserializeTextNode(node: Node, cumulativeTextAttrs: TextAttrs): Descendant[] | null {\n\t\tif (node.nodeType === Node.TEXT_NODE) {\n\t\t\tconst text = node.textContent ?? ''\n\t\t\treturn [{ ...cumulativeTextAttrs, text: text.replace(/[ \\t]*(?:\\r?\\n[ \\t]*)+/g, ' ') }]\n\t\t} else if (node instanceof HTMLElement) {\n\t\t\tconst result = this.processInlinePaste(\n\t\t\t\tnode,\n\t\t\t\tcumulativeTextAttrs,\n\t\t\t)\n\t\t\tif (result !== null) {\n\t\t\t\treturn Array.isArray(result) ? result : [result]\n\t\t\t}\n\t\t}\n\n\t\treturn null\n\t}\n\n\tprivate processInlinePaste(element: HTMLElement, cumulativeTextAttrs: TextAttrs): (SlateElement | SlateText)[] | SlateElement | SlateText | null {\n\t\tif (ignoredElements.includes(element.tagName)) {\n\t\t\treturn []\n\t\t}\n\t\tif (element.tagName === 'BR') {\n\t\t\treturn { ...cumulativeTextAttrs, text: ' ' }\n\t\t}\n\t\tconst next: HtmlDeserializerNextCallback = (list, cta) => {\n\t\t\tconst attrs = this.processWithAttributeProcessor(element, cta)\n\t\t\treturn this.deserializeInline(list, attrs)\n\t\t}\n\t\tfor (const plugin of this.plugins) {\n\t\t\tconst result = plugin.processInlinePaste?.({ element, next, cumulativeTextAttrs, deserializer: this }) ?? null\n\t\t\tif (result !== null) {\n\t\t\t\treturn result\n\t\t\t}\n\t\t}\n\t\treturn null\n\t}\n\n\tprivate processWithAttributeProcessor(element: Node, cumulativeTextAttrs: TextAttrs): TextAttrs {\n\t\tif (!(element instanceof HTMLElement)) {\n\t\t\treturn {}\n\t\t}\n\t\treturn this.plugins.reduce(\n\t\t\t(cta, plugin) => plugin.processAttributesPaste?.({ element, cumulativeTextAttrs, deserializer: this }) ?? cta,\n\t\t\tcumulativeTextAttrs,\n\t\t)\n\t}\n\n\tprivate processBlockPaste(element: HTMLElement, cumulativeTextAttrs: TextAttrs): SlateElement[] | SlateElement | null {\n\t\tif (ignoredElements.includes(element.tagName)) {\n\t\t\treturn []\n\t\t}\n\t\tconst next: HtmlDeserializerNextCallback = (list, cta) => this.deserializeBlocks(Array.from(list), { ...cumulativeTextAttrs, ...cta })\n\n\t\tfor (const plugin of this.plugins) {\n\t\t\tconst result = plugin.processBlockPaste?.({ element, next, cumulativeTextAttrs, deserializer: this }) ?? null\n\t\t\tif (result !== null) {\n\t\t\t\treturn result\n\t\t\t}\n\t\t}\n\t\treturn null\n\t}\n}\n"],"names":["result"],"mappings":";;A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AK,kBAAkB,MAAM,KAAK,IAAI,GAAG,EAAE,GAAG,qBAAqB,GAAG,KAAK;AAErI,eAAW,UAAU,KAAK,SAAS;AAClC,YAAM,SAAS,OAAO,oBAAoB,EAAE,SAAS,MAAM,qBAAqB,cAAc,KAAA,CAAM,KAAK;AACzG,UAAI,WAAW,MAAM;AACpB,eAAO;AAAA,MACR;AAAA,IACD;AACA,WAAO;AAAA,EACR;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"HtmlDeserializer.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/behaviour/paste/HtmlDeserializer.ts"],"sourcesContent":["import { Descendant, Element as SlateElement, Text as SlateText } from 'slate'\nimport { HtmlDeserializerNextCallback, HtmlDeserializerPlugin } from '../../../types/htmlDeserializer'\nimport { EditorDefaultElementFactory } from '../../../types/editor'\n\nconst ignoredElements = ['SCRIPT', 'STYLE', 'TEMPLATE']\n\nexport interface TextAttrs {\n\t[key: string]: any\n}\n\nexport type NodesWithTypeFiltered =\n\t| { texts: Descendant[]; elements?: undefined }\n\t| { elements: SlateElement[]; texts?: undefined }\n\nexport type NodesWithType = NodesWithTypeFiltered | null\n\nexport class HtmlDeserializer {\n\tconstructor(\n\t\tpublic createDefaultElement: EditorDefaultElementFactory,\n\t\tprivate plugins: HtmlDeserializerPlugin[],\n\t) {\n\t}\n\n\tregisterPlugin(plugin: HtmlDeserializerPlugin, prepend: boolean = true) {\n\t\tprepend ? this.plugins.unshift(plugin) : this.plugins.push(plugin)\n\t}\n\n\tpublic processNodeListPaste(nodeList: Node[], cumulativeTextAttrs: TextAttrs) {\n\t\tfor (const plugin of this.plugins) {\n\t\t\tconst result = plugin.processNodeListPaste?.({ nodeList, cumulativeTextAttrs, deserializer: this }) ?? null\n\t\t\tif (result !== null) {\n\t\t\t\treturn result\n\t\t\t}\n\t\t}\n\t\tconst processed: (\n\t\t\t| { text: SlateText | SlateElement; element?: undefined; isWhiteSpace: boolean }\n\t\t\t| { element: SlateElement; text?: undefined }\n\t\t)[] = []\n\n\t\tfor (const childNode of nodeList) {\n\t\t\tconst isWhiteSpace = childNode.nodeType === Node.TEXT_NODE && childNode.textContent?.match(/^\\s*$/) !== null\n\n\t\t\t// Block\n\t\t\tconst attrs = this.processWithAttributeProcessor(childNode, cumulativeTextAttrs)\n\t\t\tconst result = childNode instanceof HTMLElement\n\t\t\t\t? this.processBlockPaste(\n\t\t\t\t\tchildNode,\n\t\t\t\t\tcumulativeTextAttrs,\n\t\t\t\t)\n\t\t\t\t: null\n\t\t\tif (result !== null) {\n\t\t\t\tprocessed.push(...(Array.isArray(result) ? result : [result]).map(element => ({ element })))\n\t\t\t} else {\n\t\t\t\t// Inline\n\t\t\t\tconst result = this.deserializeTextNode(childNode, cumulativeTextAttrs)\n\t\t\t\tif (result !== null) {\n\t\t\t\t\tprocessed.push(...result.map(text => ({ text, isWhiteSpace })))\n\t\t\t\t} else {\n\t\t\t\t\t// Unknown element\n\t\t\t\t\tconst deserializedChildren = this.processNodeListPaste(\n\t\t\t\t\t\tArray.from(childNode.childNodes),\n\t\t\t\t\t\tattrs,\n\t\t\t\t\t)\n\t\t\t\t\tprocessed.push(\n\t\t\t\t\t\t...(deserializedChildren === null\n\t\t\t\t\t\t\t? []\n\t\t\t\t\t\t\t: deserializedChildren.texts !== undefined\n\t\t\t\t\t\t\t? deserializedChildren.texts.map(text => ({ text, isWhiteSpace }))\n\t\t\t\t\t\t\t: deserializedChildren.elements.map(element => ({ element }))),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (processed.length === 0) {\n\t\t\treturn null\n\t\t}\n\n\t\tconst containsBlock = processed.find(({ element }) => element !== undefined) !== undefined\n\n\t\tif (containsBlock) {\n\t\t\treturn {\n\t\t\t\telements: processed.flatMap(item => {\n\t\t\t\t\tif (item.text !== undefined) {\n\t\t\t\t\t\treturn item.isWhiteSpace ? [] : [this.createDefaultElement([item.text])]\n\t\t\t\t\t} else if (item.element !== undefined) {\n\t\t\t\t\t\treturn [item.element]\n\t\t\t\t\t}\n\t\t\t\t\treturn []\n\t\t\t\t}),\n\t\t\t}\n\t\t} else {\n\t\t\treturn { texts: processed.map(item => item.text as SlateText) }\n\t\t}\n\t}\n\n\tdeserializeInline(list: NodeList | Node[], cumulativeTextAttrs: TextAttrs): Descendant[] {\n\t\treturn Array.from(list).flatMap(childNode => {\n\t\t\tconst result = this.deserializeTextNode(childNode, cumulativeTextAttrs)\n\t\t\tif (result !== null) {\n\t\t\t\treturn result\n\t\t\t} else {\n\t\t\t\tconst attrs = this.processWithAttributeProcessor(childNode, cumulativeTextAttrs)\n\t\t\t\treturn this.deserializeInline(childNode.childNodes, attrs)\n\t\t\t}\n\t\t})\n\t}\n\n\tdeserializeBlocks(list: Node[], cumulativeTextAttrs: TextAttrs): Descendant[] {\n\t\tconst result = this.processNodeListPaste(list, cumulativeTextAttrs)\n\t\treturn result?.texts ?? result?.elements ?? []\n\t}\n\n\tprivate deserializeTextNode(node: Node, cumulativeTextAttrs: TextAttrs): Descendant[] | null {\n\t\tif (node.nodeType === Node.TEXT_NODE) {\n\t\t\tconst text = node.textContent ?? ''\n\t\t\treturn [{ ...cumulativeTextAttrs, text: text.replace(/[ \\t]*(?:\\r?\\n[ \\t]*)+/g, ' ') }]\n\t\t} else if (node instanceof HTMLElement) {\n\t\t\tconst result = this.processInlinePaste(\n\t\t\t\tnode,\n\t\t\t\tcumulativeTextAttrs,\n\t\t\t)\n\t\t\tif (result !== null) {\n\t\t\t\treturn Array.isArray(result) ? result : [result]\n\t\t\t}\n\t\t}\n\n\t\treturn null\n\t}\n\n\tprivate processInlinePaste(element: HTMLElement, cumulativeTextAttrs: TextAttrs): (SlateElement | SlateText)[] | SlateElement | SlateText | null {\n\t\tif (ignoredElements.includes(element.tagName)) {\n\t\t\treturn []\n\t\t}\n\t\tif (element.tagName === 'BR') {\n\t\t\treturn { ...cumulativeTextAttrs, text: ' ' }\n\t\t}\n\t\tconst next: HtmlDeserializerNextCallback = (list, cta) => {\n\t\t\tconst attrs = this.processWithAttributeProcessor(element, cta)\n\t\t\treturn this.deserializeInline(list, attrs)\n\t\t}\n\t\tfor (const plugin of this.plugins) {\n\t\t\tconst result = plugin.processInlinePaste?.({ element, next, cumulativeTextAttrs, deserializer: this }) ?? null\n\t\t\tif (result !== null) {\n\t\t\t\treturn result\n\t\t\t}\n\t\t}\n\t\treturn null\n\t}\n\n\tprivate processWithAttributeProcessor(element: Node, cumulativeTextAttrs: TextAttrs): TextAttrs {\n\t\tif (!(element instanceof HTMLElement)) {\n\t\t\treturn {}\n\t\t}\n\t\treturn this.plugins.reduce(\n\t\t\t(cta, plugin) => plugin.processAttributesPaste?.({ element, cumulativeTextAttrs, deserializer: this }) ?? cta,\n\t\t\tcumulativeTextAttrs,\n\t\t)\n\t}\n\n\tprivate processBlockPaste(element: HTMLElement, cumulativeTextAttrs: TextAttrs): SlateElement[] | SlateElement | null {\n\t\tif (ignoredElements.includes(element.tagName)) {\n\t\t\treturn []\n\t\t}\n\t\tconst next: HtmlDeserializerNextCallback = (list, cta) => this.deserializeBlocks(Array.from(list), { ...cumulativeTextAttrs, ...cta })\n\n\t\tfor (const plugin of this.plugins) {\n\t\t\tconst result = plugin.processBlockPaste?.({ element, next, cumulativeTextAttrs, deserializer: this }) ?? null\n\t\t\tif (result !== null) {\n\t\t\t\treturn result\n\t\t\t}\n\t\t}\n\t\treturn null\n\t}\n}\n"],"names":["result"],"mappings":"AAIA,MAAM,kBAAkB,CAAC,UAAU,SAAS,UAAU;AAY/C,MAAM,iBAAiB;AAAA,EAC7B,YACQ,sBACC,SACP;AAFM,SAAA,uBAAA;AACC,SAAA,UAAA;AAAA,EAET;AAAA,EAEA,eAAe,QAAgC,UAAmB,MAAM;AACvE,cAAU,KAAK,QAAQ,QAAQ,MAAM,IAAI,KAAK,QAAQ,KAAK,MAAM;AAAA,EAClE;AAAA,EAEO,qBAAqB,UAAkB,qBAAgC;AAC7E,eAAW,UAAU,KAAK,SAAS;AACl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ugins/behaviour/paste/HtmlDeserializer.ts"],"sourcesContent":["import { Descendant, Element as SlateElement, Text as SlateText } from 'slate'\nimport { HtmlDeserializerNextCallback, HtmlDeserializerPlugin } from '../../../types/htmlDeserializer.js'\nimport { EditorDefaultElementFactory } from '../../../types/editor.js'\n\nconst ignoredElements = ['SCRIPT', 'STYLE', 'TEMPLATE']\n\nexport interface TextAttrs {\n\t[key: string]: any\n}\n\nexport type NodesWithTypeFiltered =\n\t| { texts: Descendant[]; elements?: undefined }\n\t| { elements: SlateElement[]; texts?: undefined }\n\nexport type NodesWithType = NodesWithTypeFiltered | null\n\nexport class HtmlDeserializer {\n\tconstructor(\n\t\tpublic createDefaultElement: EditorDefaultElementFactory,\n\t\tprivate plugins: HtmlDeserializerPlugin[],\n\t) {\n\t}\n\n\tregisterPlugin(plugin: HtmlDeserializerPlugin, prepend: boolean = true) {\n\t\tprepend ? this.plugins.unshift(plugin) : this.plugins.push(plugin)\n\t}\n\n\tpublic processNodeListPaste(nodeList: Node[], cumulativeTextAttrs: TextAttrs) {\n\t\tfor (const plugin of this.plugins) {\n\t\t\tconst result = plugin.processNodeListPaste?.({ nodeList, cumulativeTextAttrs, deserializer: this }) ?? null\n\t\t\tif (result !== null) {\n\t\t\t\treturn result\n\t\t\t}\n\t\t}\n\t\tconst processed: (\n\t\t\t| { text: SlateText | SlateElement; element?: undefined; isWhiteSpace: boolean }\n\t\t\t| { element: SlateElement; text?: undefined }\n\t\t)[] = []\n\n\t\tfor (const childNode of nodeList) {\n\t\t\tconst isWhiteSpace = childNode.nodeType === Node.TEXT_NODE && childNode.textContent?.match(/^\\s*$/) !== null\n\n\t\t\t// Block\n\t\t\tconst attrs = this.processWithAttributeProcessor(childNode, cumulativeTextAttrs)\n\t\t\tconst result = childNode instanceof HTMLElement\n\t\t\t\t? this.processBlockPaste(\n\t\t\t\t\tchildNode,\n\t\t\t\t\tcumulativeTextAttrs,\n\t\t\t\t)\n\t\t\t\t: null\n\t\t\tif (result !== null) {\n\t\t\t\tprocessed.push(...(Array.isArray(result) ? result : [result]).map(element => ({ element })))\n\t\t\t} else {\n\t\t\t\t// Inline\n\t\t\t\tconst result = this.deserializeTextNode(childNode, cumulativeTextAttrs)\n\t\t\t\tif (result !== null) {\n\t\t\t\t\tprocessed.push(...result.map(text => ({ text, isWhiteSpace })))\n\t\t\t\t} else {\n\t\t\t\t\t// Unknown element\n\t\t\t\t\tconst deserializedChildren = this.processNodeListPaste(\n\t\t\t\t\t\tArray.from(childNode.childNodes),\n\t\t\t\t\t\tattrs,\n\t\t\t\t\t)\n\t\t\t\t\tprocessed.push(\n\t\t\t\t\t\t...(deserializedChildren === null\n\t\t\t\t\t\t\t? []\n\t\t\t\t\t\t\t: deserializedChildren.texts !== undefined\n\t\t\t\t\t\t\t? deserializedChildren.texts.map(text => ({ text, isWhiteSpace }))\n\t\t\t\t\t\t\t: deserializedChildren.elements.map(element => ({ element }))),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (processed.length === 0) {\n\t\t\treturn null\n\t\t}\n\n\t\tconst containsBlock = processed.find(({ element }) => element !== undefined) !== undefined\n\n\t\tif (containsBlock) {\n\t\t\treturn {\n\t\t\t\telements: processed.flatMap(item => {\n\t\t\t\t\tif (item.text !== undefined) {\n\t\t\t\t\t\treturn item.isWhiteSpace ? [] : [this.createDefaultElement([item.text])]\n\t\t\t\t\t} else if (item.element !== undefined) {\n\t\t\t\t\t\treturn [item.element]\n\t\t\t\t\t}\n\t\t\t\t\treturn []\n\t\t\t\t}),\n\t\t\t}\n\t\t} else {\n\t\t\treturn { texts: processed.map(item => item.text as SlateText) }\n\t\t}\n\t}\n\n\tdeserializeInline(list: NodeList | Node[], cumulativeTextAttrs: TextAttrs): Descendant[] {\n\t\treturn Array.from(list).flatMap(childNode => {\n\t\t\tconst result = this.deserializeTextNode(childNode, cumulativeTextAttrs)\n\t\t\tif (result !== null) {\n\t\t\t\treturn result\n\t\t\t} else {\n\t\t\t\tconst attrs = this.processWithAttributeProcessor(childNode, cumulativeTextAttrs)\n\t\t\t\treturn this.deserializeInline(childNode.childNodes, attrs)\n\t\t\t}\n\t\t})\n\t}\n\n\tdeserializeBlocks(list: Node[], cumulativeTextAttrs: TextAttrs): Descendant[] {\n\t\tconst result = this.processNodeListPaste(list, cumulativeTextAttrs)\n\t\treturn result?.texts ?? result?.elements ?? []\n\t}\n\n\tprivate deserializeTextNode(node: Node, cumulativeTextAttrs: TextAttrs): Descendant[] | null {\n\t\tif (node.nodeType === Node.TEXT_NODE) {\n\t\t\tconst text = node.textContent ?? ''\n\t\t\treturn [{ ...cumulativeTextAttrs, text: text.replace(/[ \\t]*(?:\\r?\\n[ \\t]*)+/g, ' ') }]\n\t\t} else if (node instanceof HTMLElement) {\n\t\t\tconst result = this.processInlinePaste(\n\t\t\t\tnode,\n\t\t\t\tcumulativeTextAttrs,\n\t\t\t)\n\t\t\tif (result !== null) {\n\t\t\t\treturn Array.isArray(result) ? result : [result]\n\t\t\t}\n\t\t}\n\n\t\treturn null\n\t}\n\n\tprivate processInlinePaste(element: HTMLElement, cumulativeTextAttrs: TextAttrs): (SlateElement | SlateText)[] | SlateElement | SlateText | null {\n\t\tif (ignoredElements.includes(element.tagName)) {\n\t\t\treturn []\n\t\t}\n\t\tif (element.tagName === 'BR') {\n\t\t\treturn { ...cumulativeTextAttrs, text: ' ' }\n\t\t}\n\t\tconst next: HtmlDeserializerNextCallback = (list, cta) => {\n\t\t\tconst attrs = this.processWithAttributeProcessor(element, cta)\n\t\t\treturn this.deserializeInline(list, attrs)\n\t\t}\n\t\tfor (const plugin of this.plugins) {\n\t\t\tconst result = plugin.processInlinePaste?.({ element, next, cumulativeTextAttrs, deserializer: this }) ?? null\n\t\t\tif (result !== null) {\n\t\t\t\treturn result\n\t\t\t}\n\t\t}\n\t\treturn null\n\t}\n\n\tprivate processWithAttributeProcessor(element: Node, cumulativeTextAttrs: TextAttrs): TextAttrs {\n\t\tif (!(element instanceof HTMLElement)) {\n\t\t\treturn {}\n\t\t}\n\t\treturn this.plugins.reduce(\n\t\t\t(cta, plugin) => plugin.processAttributesPaste?.({ element, cumulativeTextAttrs, deserializer: this }) ?? cta,\n\t\t\tcumulativeTextAttrs,\n\t\t)\n\t}\n\n\tprivate processBlockPaste(element: HTMLElement, cumulativeTextAttrs: TextAttrs): SlateElement[] | SlateElement | null {\n\t\tif (ignoredElements.includes(element.tagName)) {\n\t\t\treturn []\n\t\t}\n\t\tconst next: HtmlDeserializerNextCallback = (list, cta) => this.deserializeBlocks(Array.from(list), { ...cumulativeTextAttrs, ...cta })\n\n\t\tfor (const plugin of this.plugins) {\n\t\t\tconst result = plugin.processBlockPaste?.({ element, next, cumulativeTextAttrs, deserializer: this }) ?? null\n\t\t\tif (result !== null) {\n\t\t\t\treturn result\n\t\t\t}\n\t\t}\n\t\treturn null\n\t}\n}\n"],"names":["result"],"mappings":"AAIA,MAAM,kBAAkB,CAAC,UAAU,SAAS,UAAU;AAY/C,MAAM,iBAAiB;AAAA,EAC7B,YACQ,sBACC,SACP;AAFM,SAAA,uBAAA;AACC,SAAA,UAAA;AAAA,EAET;AAAA,EAEA,eAAe,QAAgC,UAAmB,MAAM;AACvE,cAAU,KAAK,QAAQ,QAAQ,MAAM,IAAI,KAAK,QAAQ,KAAK,MAAM;AAAA,EAClE;AAAA,EAEO,qBAAqB,UAAkB,qBAAgC;AAC7E,eAAW,UAAU,KAAK,SAAS;AAClC,YAAM,SAAS,OAAO,uBAAuB,EAAE,UAAU,qBAAqB,cAAc,KAAA,CAAM,KAAK;AACvG,UAAI,WAAW,MAAM;AACpB,eAAO;AAAA,MACR;AAAA,IACD;AACA,UAAM,YAGA,CAAA;AAEN,eAAW,aAAa,UAAU;AACjC,YAAM,eAAe,UAAU,aAAa,KAAK,aAAa,UAAU,aAAa,MAAM,OAAO,MAAM;AAGxG,YAAM,QAAQ,KAAK,8BAA8B,WAAW,mBAAmB;AAC/E,YAAM,SAAS,qBAAqB,cACjC,KAAK;AAA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M,SAAS,OAAO,qBAAqB,EAAE,SAAS,MAAM,qBAAqB,cAAc,KAAA,CAAM,KAAK;AAC1G,UAAI,WAAW,MAAM;AACpB,eAAO;AAAA,MACR;AAAA,IACD;AACA,WAAO;AAAA,EACR;AAAA,EAEQ,8BAA8B,SAAe,qBAA2C;AAC/F,QAAI,EAAE,mBAAmB,cAAc;AACtC,aAAO,CAAA;AAAA,IACR;AACA,WAAO,KAAK,QAAQ;AAAA,MACnB,CAAC,KAAK,WAAW,OAAO,yBAAyB,EAAE,SAAS,qBAAqB,cAAc,KAAA,CAAM,KAAK;AAAA,MAC1G;AAAA,IAAA;AAAA,EAEF;AAAA,EAEQ,kBAAkB,SAAsB,qBAAsE;AACrH,QAAI,gBAAgB,SAAS,QAAQ,OAAO,GAAG;AAC9C,aAAO,CAAA;AAAA,IACR;AACA,UAAM,OAAqC,CAAC,MAAM,QAAQ,KAAK,kBAAkB,MAAM,KAAK,IAAI,GAAG,EAAE,GAAG,qBAAqB,GAAG,KAAK;AAErI,eAAW,UAAU,KAAK,SAAS;AAClC,YAAM,SAAS,OAAO,oBAAoB,EAAE,SAAS,MAAM,qBAAqB,cAAc,KAAA,CAAM,KAAK;AACzG,UAAI,WAAW,MAAM;AACpB,eAAO;AAAA,MACR;AAAA,IACD;AACA,WAAO;AAAA,EACR;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"createMarkHtmlDeserializer.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/behaviour/paste/createMarkHtmlDeserializer.ts"],"sourcesContent":["import { HtmlDeserializerPlugin } from '../../../types/htmlDeserializer'\n\nexport const createMarkHtmlDeserializer = (\n\tmarkType: string,\n\ttagMatcher: (el: HTMLElement) => boolean,\n\tattributeMatcher: (el: HTMLElement) => boolean,\n): HtmlDeserializerPlugin => ({\n\tprocessAttributesPaste: ({ element, cumulativeTextAttrs: cta }) => {\n\t\treturn attributeMatcher(element) ? { ...cta, [markType]: true } : cta\n\t},\n\tprocessInlinePaste: ({ element, next, cumulativeTextAttrs }) => {\n\t\tif (tagMatcher(element)) {\n\t\t\treturn next(element.childNodes, { ...cumulativeTextAttrs, [markType]: true })\n\t\t}\n\t\treturn null\n\t},\n})\n"],"names":[],"mappings":";;AAEO,MAAM,6BAA6B,CACzC,UACA,YACA,sBAC6B;AAAA,EAC7B,wBAAwB,CAAC,EAAE,SAAS,qBAAqB,UAAU;AAClE,WAAO,iBAAiB,OAAO,IAAI,EAAE,GAAG,KAAK,CAAC,QAAQ,GAAG,KAAA,IAAS;AAAA,EACnE;AAAA,EACA,oBAAoB,CAAC,EAAE,SAAS,MAAM,0BAA0B;AAC/D,QAAI,WAAW,OAAO,GAAG;AACxB,aAAO,KAAK,QAAQ,YAAY,EAAE,GAAG,qBAAqB,CAAC,QAAQ,GAAG,MAAM;AAAA,IAC7E;AACA,WAAO;AAAA,EACR;AACD;;"}
1
+ {"version":3,"file":"createMarkHtmlDeserializer.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/behaviour/paste/createMarkHtmlDeserializer.ts"],"sourcesContent":["import { HtmlDeserializerPlugin } from '../../../types/htmlDeserializer.js'\n\nexport const createMarkHtmlDeserializer = (\n\tmarkType: string,\n\ttagMatcher: (el: HTMLElement) => boolean,\n\tattributeMatcher: (el: HTMLElement) => boolean,\n): HtmlDeserializerPlugin => ({\n\tprocessAttributesPaste: ({ element, cumulativeTextAttrs: cta }) => {\n\t\treturn attributeMatcher(element) ? { ...cta, [markType]: true } : cta\n\t},\n\tprocessInlinePaste: ({ element, next, cumulativeTextAttrs }) => {\n\t\tif (tagMatcher(element)) {\n\t\t\treturn next(element.childNodes, { ...cumulativeTextAttrs, [markType]: true })\n\t\t}\n\t\treturn null\n\t},\n})\n"],"names":[],"mappings":";;AAEO,MAAM,6BAA6B,CACzC,UACA,YACA,sBAC6B;AAAA,EAC7B,wBAAwB,CAAC,EAAE,SAAS,qBAAqB,UAAU;AAClE,WAAO,iBAAiB,OAAO,IAAI,EAAE,GAAG,KAAK,CAAC,QAAQ,GAAG,KAAA,IAAS;AAAA,EACnE;AAAA,EACA,oBAAoB,CAAC,EAAE,SAAS,MAAM,0BAA0B;AAC/D,QAAI,WAAW,OAAO,GAAG;AACxB,aAAO,KAAK,QAAQ,YAAY,EAAE,GAAG,qBAAqB,CAAC,QAAQ,GAAG,MAAM;AAAA,IAC7E;AACA,WAAO;AAAA,EACR;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"createMarkHtmlDeserializer.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/behaviour/paste/createMarkHtmlDeserializer.ts"],"sourcesContent":["import { HtmlDeserializerPlugin } from '../../../types/htmlDeserializer'\n\nexport const createMarkHtmlDeserializer = (\n\tmarkType: string,\n\ttagMatcher: (el: HTMLElement) => boolean,\n\tattributeMatcher: (el: HTMLElement) => boolean,\n): HtmlDeserializerPlugin => ({\n\tprocessAttributesPaste: ({ element, cumulativeTextAttrs: cta }) => {\n\t\treturn attributeMatcher(element) ? { ...cta, [markType]: true } : cta\n\t},\n\tprocessInlinePaste: ({ element, next, cumulativeTextAttrs }) => {\n\t\tif (tagMatcher(element)) {\n\t\t\treturn next(element.childNodes, { ...cumulativeTextAttrs, [markType]: true })\n\t\t}\n\t\treturn null\n\t},\n})\n"],"names":[],"mappings":"AAEO,MAAM,6BAA6B,CACzC,UACA,YACA,sBAC6B;AAAA,EAC7B,wBAAwB,CAAC,EAAE,SAAS,qBAAqB,UAAU;AAClE,WAAO,iBAAiB,OAAO,IAAI,EAAE,GAAG,KAAK,CAAC,QAAQ,GAAG,KAAA,IAAS;AAAA,EACnE;AAAA,EACA,oBAAoB,CAAC,EAAE,SAAS,MAAM,0BAA0B;AAC/D,QAAI,WAAW,OAAO,GAAG;AACxB,aAAO,KAAK,QAAQ,YAAY,EAAE,GAAG,qBAAqB,CAAC,QAAQ,GAAG,MAAM;AAAA,IAC7E;AACA,WAAO;AAAA,EACR;AACD;"}
1
+ {"version":3,"file":"createMarkHtmlDeserializer.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/behaviour/paste/createMarkHtmlDeserializer.ts"],"sourcesContent":["import { HtmlDeserializerPlugin } from '../../../types/htmlDeserializer.js'\n\nexport const createMarkHtmlDeserializer = (\n\tmarkType: string,\n\ttagMatcher: (el: HTMLElement) => boolean,\n\tattributeMatcher: (el: HTMLElement) => boolean,\n): HtmlDeserializerPlugin => ({\n\tprocessAttributesPaste: ({ element, cumulativeTextAttrs: cta }) => {\n\t\treturn attributeMatcher(element) ? { ...cta, [markType]: true } : cta\n\t},\n\tprocessInlinePaste: ({ element, next, cumulativeTextAttrs }) => {\n\t\tif (tagMatcher(element)) {\n\t\t\treturn next(element.childNodes, { ...cumulativeTextAttrs, [markType]: true })\n\t\t}\n\t\treturn null\n\t},\n})\n"],"names":[],"mappings":"AAEO,MAAM,6BAA6B,CACzC,UACA,YACA,sBAC6B;AAAA,EAC7B,wBAAwB,CAAC,EAAE,SAAS,qBAAqB,UAAU;AAClE,WAAO,iBAAiB,OAAO,IAAI,EAAE,GAAG,KAAK,CAAC,QAAQ,GAAG,KAAA,IAAS;AAAA,EACnE;AAAA,EACA,oBAAoB,CAAC,EAAE,SAAS,MAAM,0BAA0B;AAC/D,QAAI,WAAW,OAAO,GAAG;AACxB,aAAO,KAAK,QAAQ,YAAY,EAAE,GAAG,qBAAqB,CAAC,QAAQ,GAAG,MAAM;AAAA,IAC7E;AACA,WAAO;AAAA,EACR;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"withPaste.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/behaviour/paste/withPaste.ts"],"sourcesContent":["import { Editor, Transforms } from 'slate'\nimport { EditorPlugin } from '../../../types/plugins'\nimport { HtmlDeserializer } from './HtmlDeserializer'\nimport { HtmlDeserializerPlugin } from '../../../types/htmlDeserializer'\n\nexport const withPaste = (editor: Editor) => {\n\tconst { insertData } = editor\n\tconst htmlDeserializer = new HtmlDeserializer(editor.createDefaultElement, [])\n\teditor.insertData = data => {\n\t\tif (data.getData('application/x-slate-fragment')) {\n\t\t\treturn insertData(data)\n\t\t}\n\t\tconst html = data.getData('text/html')\n\t\tif (!html) {\n\t\t\treturn insertData(data)\n\t\t}\n\t\tconst document = new DOMParser().parseFromString(html, 'text/html')\n\t\tconst nodes = Array.from(document.body.childNodes)\n\t\tconst result = htmlDeserializer.deserializeBlocks(nodes, {})\n\t\tTransforms.insertFragment(editor, result)\n\t}\n\teditor.htmlDeserializer = htmlDeserializer\n}\n"],"names":["HtmlDeserializer","Transforms"],"mappings":";;;;AAKO,MAAM,YAAY,CAAC,WAAmB;AAC5C,QAAM,EAAE,eAAe;AACvB,QAAM,mBAAmB,IAAIA,iBAAAA,iBAAiB,OAAO,sBAAsB,CAAA,CAAE;AAC7E,SAAO,aAAa,CAAA,SAAQ;AAC3B,QAAI,KAAK,QAAQ,8BAA8B,GAAG;AACjD,aAAO,WAAW,IAAI;AAAA,IACvB;AACA,UAAM,OAAO,KAAK,QAAQ,WAAW;AACrC,QAAI,CAAC,MAAM;AACV,aAAO,WAAW,IAAI;AAAA,IACvB;AACA,UAAM,WAAW,IAAI,UAAA,EAAY,gBAAgB,MAAM,WAAW;AAClE,UAAM,QAAQ,MAAM,KAAK,SAAS,KAAK,UAAU;AACjD,UAAM,SAAS,iBAAiB,kBAAkB,OAAO,CAAA,CAAE;AAC3DC,qBAAW,eAAe,QAAQ,MAAM;AAAA,EACzC;AACA,SAAO,mBAAmB;AAC3B;;"}
1
+ {"version":3,"file":"withPaste.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/behaviour/paste/withPaste.ts"],"sourcesContent":["import { Editor, Transforms } from 'slate'\nimport { EditorPlugin } from '../../../types/plugins.js'\nimport { HtmlDeserializer } from './HtmlDeserializer.js'\nimport { HtmlDeserializerPlugin } from '../../../types/htmlDeserializer.js'\n\nexport const withPaste = (editor: Editor) => {\n\tconst { insertData } = editor\n\tconst htmlDeserializer = new HtmlDeserializer(editor.createDefaultElement, [])\n\teditor.insertData = data => {\n\t\tif (data.getData('application/x-slate-fragment')) {\n\t\t\treturn insertData(data)\n\t\t}\n\t\tconst html = data.getData('text/html')\n\t\tif (!html) {\n\t\t\treturn insertData(data)\n\t\t}\n\t\tconst document = new DOMParser().parseFromString(html, 'text/html')\n\t\tconst nodes = Array.from(document.body.childNodes)\n\t\tconst result = htmlDeserializer.deserializeBlocks(nodes, {})\n\t\tTransforms.insertFragment(editor, result)\n\t}\n\teditor.htmlDeserializer = htmlDeserializer\n}\n"],"names":["HtmlDeserializer","Transforms"],"mappings":";;;;AAKO,MAAM,YAAY,CAAC,WAAmB;AAC5C,QAAM,EAAE,eAAe;AACvB,QAAM,mBAAmB,IAAIA,iBAAAA,iBAAiB,OAAO,sBAAsB,CAAA,CAAE;AAC7E,SAAO,aAAa,CAAA,SAAQ;AAC3B,QAAI,KAAK,QAAQ,8BAA8B,GAAG;AACjD,aAAO,WAAW,IAAI;AAAA,IACvB;AACA,UAAM,OAAO,KAAK,QAAQ,WAAW;AACrC,QAAI,CAAC,MAAM;AACV,aAAO,WAAW,IAAI;AAAA,IACvB;AACA,UAAM,WAAW,IAAI,UAAA,EAAY,gBAAgB,MAAM,WAAW;AAClE,UAAM,QAAQ,MAAM,KAAK,SAAS,KAAK,UAAU;AACjD,UAAM,SAAS,iBAAiB,kBAAkB,OAAO,CAAA,CAAE;AAC3DC,qBAAW,eAAe,QAAQ,MAAM;AAAA,EACzC;AACA,SAAO,mBAAmB;AAC3B;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"withPaste.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/behaviour/paste/withPaste.ts"],"sourcesContent":["import { Editor, Transforms } from 'slate'\nimport { EditorPlugin } from '../../../types/plugins'\nimport { HtmlDeserializer } from './HtmlDeserializer'\nimport { HtmlDeserializerPlugin } from '../../../types/htmlDeserializer'\n\nexport const withPaste = (editor: Editor) => {\n\tconst { insertData } = editor\n\tconst htmlDeserializer = new HtmlDeserializer(editor.createDefaultElement, [])\n\teditor.insertData = data => {\n\t\tif (data.getData('application/x-slate-fragment')) {\n\t\t\treturn insertData(data)\n\t\t}\n\t\tconst html = data.getData('text/html')\n\t\tif (!html) {\n\t\t\treturn insertData(data)\n\t\t}\n\t\tconst document = new DOMParser().parseFromString(html, 'text/html')\n\t\tconst nodes = Array.from(document.body.childNodes)\n\t\tconst result = htmlDeserializer.deserializeBlocks(nodes, {})\n\t\tTransforms.insertFragment(editor, result)\n\t}\n\teditor.htmlDeserializer = htmlDeserializer\n}\n"],"names":[],"mappings":";;AAKO,MAAM,YAAY,CAAC,WAAmB;AAC5C,QAAM,EAAE,eAAe;AACvB,QAAM,mBAAmB,IAAI,iBAAiB,OAAO,sBAAsB,CAAA,CAAE;AAC7E,SAAO,aAAa,CAAA,SAAQ;AAC3B,QAAI,KAAK,QAAQ,8BAA8B,GAAG;AACjD,aAAO,WAAW,IAAI;AAAA,IACvB;AACA,UAAM,OAAO,KAAK,QAAQ,WAAW;AACrC,QAAI,CAAC,MAAM;AACV,aAAO,WAAW,IAAI;AAAA,IACvB;AACA,UAAM,WAAW,IAAI,UAAA,EAAY,gBAAgB,MAAM,WAAW;AAClE,UAAM,QAAQ,MAAM,KAAK,SAAS,KAAK,UAAU;AACjD,UAAM,SAAS,iBAAiB,kBAAkB,OAAO,CAAA,CAAE;AAC3D,eAAW,eAAe,QAAQ,MAAM;AAAA,EACzC;AACA,SAAO,mBAAmB;AAC3B;"}
1
+ {"version":3,"file":"withPaste.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/behaviour/paste/withPaste.ts"],"sourcesContent":["import { Editor, Transforms } from 'slate'\nimport { EditorPlugin } from '../../../types/plugins.js'\nimport { HtmlDeserializer } from './HtmlDeserializer.js'\nimport { HtmlDeserializerPlugin } from '../../../types/htmlDeserializer.js'\n\nexport const withPaste = (editor: Editor) => {\n\tconst { insertData } = editor\n\tconst htmlDeserializer = new HtmlDeserializer(editor.createDefaultElement, [])\n\teditor.insertData = data => {\n\t\tif (data.getData('application/x-slate-fragment')) {\n\t\t\treturn insertData(data)\n\t\t}\n\t\tconst html = data.getData('text/html')\n\t\tif (!html) {\n\t\t\treturn insertData(data)\n\t\t}\n\t\tconst document = new DOMParser().parseFromString(html, 'text/html')\n\t\tconst nodes = Array.from(document.body.childNodes)\n\t\tconst result = htmlDeserializer.deserializeBlocks(nodes, {})\n\t\tTransforms.insertFragment(editor, result)\n\t}\n\teditor.htmlDeserializer = htmlDeserializer\n}\n"],"names":[],"mappings":";;AAKO,MAAM,YAAY,CAAC,WAAmB;AAC5C,QAAM,EAAE,eAAe;AACvB,QAAM,mBAAmB,IAAI,iBAAiB,OAAO,sBAAsB,CAAA,CAAE;AAC7E,SAAO,aAAa,CAAA,SAAQ;AAC3B,QAAI,KAAK,QAAQ,8BAA8B,GAAG;AACjD,aAAO,WAAW,IAAI;AAAA,IACvB;AACA,UAAM,OAAO,KAAK,QAAQ,WAAW;AACrC,QAAI,CAAC,MAAM;AACV,aAAO,WAAW,IAAI;AAAA,IACvB;AACA,UAAM,WAAW,IAAI,UAAA,EAAY,gBAAgB,MAAM,WAAW;AAClE,UAAM,QAAQ,MAAM,KAAK,SAAS,KAAK,UAAU;AACjD,UAAM,SAAS,iBAAiB,kBAAkB,OAAO,CAAA,CAAE;AAC3D,eAAW,eAAe,QAAQ,MAAM;AAAA,EACzC;AACA,SAAO,mBAAmB;AAC3B;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AnchorElement.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/anchors/AnchorElement.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Element as SlateElement, Node as SlateNode, Path, Range as SlateRange, Transforms } from 'slate'\nimport { AnchorModifications } from './AnchorModifications'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const anchorElementType = 'anchor' as const\n\nexport interface AnchorElement extends SlateElement {\n\ttype: typeof anchorElementType\n\thref: string\n\tchildren: SlateEditor['children']\n}\n\nexport const isAnchorElement = (element: SlateNode): element is AnchorElement => SlateElement.isElement(element) && element.type === anchorElementType\n\nexport const isAnchorElementActive = (editor: Editor) => {\n\tconst [link] = Editor.nodes(editor, { match: isAnchorElement })\n\treturn !!link\n}\n\nexport const anchorElementPlugin = ({ render }: { render: ElementRenderer<AnchorElement> }): EditorElementPlugin<AnchorElement> => ({\n\ttype: anchorElementType,\n\tisInline: true,\n\trender,\n\tisActive: ({ editor }) => isAnchorElementActive(editor),\n\ttoggleElement: ({ editor, suchThat }) => {\n\t\tif (isAnchorElementActive(editor)) {\n\t\t\tAnchorModifications.unwrapAnchor(editor)\n\t\t} else {\n\t\t\tconst href = suchThat?.href ?? prompt('Insert the URL:')\n\t\t\tif (!href) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tAnchorModifications.wrapAnchor(editor, href)\n\t\t}\n\t},\n\tnormalizeNode: ({ element, path, editor, preventDefault }) => {\n\t\tif (SlateNode.string(element) === '') {\n\t\t\tconst selection = editor.selection\n\t\t\tTransforms.removeNodes(editor, {\n\t\t\t\tat: path,\n\t\t\t})\n\t\t\tif (selection && SlateRange.isCollapsed(selection) && Path.isCommon(path, selection.focus.path)) {\n\t\t\t\tTransforms.select(editor, Path.parent(path))\n\t\t\t}\n\t\t\treturn preventDefault()\n\t\t}\n\t},\n})\n"],"names":["SlateElement","Editor","AnchorModifications","SlateNode","Transforms","SlateRange","Path"],"mappings":";;;;AAIO,MAAM,oBAAoB;AAQ1B,MAAM,kBAAkB,CAAC,YAAiDA,MAAAA,QAAa,UAAU,OAAO,KAAK,QAAQ,SAAS;AAE9H,MAAM,wBAAwB,CAAC,WAAmB;AACxD,QAAM,CAAC,IAAI,IAAIC,aAAO,MAAM,QAAQ,EAAE,OAAO,iBAAiB;AAC9D,SAAO,CAAC,CAAC;AACV;AAEO,MAAM,sBAAsB,CAAC,EAAE,cAA8F;AAAA,EACnI,MAAM;AAAA,EACN,UAAU;AAAA,EACV;AAAA,EACA,UAAU,CAAC,EAAE,aAAa,sBAAsB,MAAM;AAAA,EACtD,eAAe,CAAC,EAAE,QAAQ,eAAe;AACxC,QAAI,sBAAsB,MAAM,GAAG;AAClCC,0BAAAA,oBAAoB,aAAa,MAAM;AAAA,IACxC,OAAO;AACN,YAAM,OAAO,UAAU,QAAQ,OAAO,iBAAiB;AACvD,UAAI,CAAC,MAAM;AACV;AAAA,MACD;AACAA,8CAAoB,WAAW,QAAQ,IAAI;AAAA,IAC5C;AAAA,EACD;AAAA,EACA,eAAe,CAAC,EAAE,SAAS,MAAM,QAAQ,qBAAqB;AAC7D,QAAIC,WAAU,OAAO,OAAO,MAAM,IAAI;AACrC,YAAM,YAAY,OAAO;AACzBC,YAAAA,WAAW,YAAY,QAAQ;AAAA,QAC9B,IAAI;AAAA,MAAA,CACJ;AACD,UAAI,aAAaC,MAAAA,MAAW,YAAY,SAAS,KAAKC,MAAAA,KAAK,SAAS,MAAM,UAAU,MAAM,IAAI,GAAG;AAChGF,cAAAA,WAAW,OAAO,QAAQE,MAAAA,KAAK,OAAO,IAAI,CAAC;AAAA,MAC5C;AACA,aAAO,eAAA;AAAA,IACR;AAAA,EACD;AACD;;;;;"}
1
+ {"version":3,"file":"AnchorElement.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/anchors/AnchorElement.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Element as SlateElement, Node as SlateNode, Path, Range as SlateRange, Transforms } from 'slate'\nimport { AnchorModifications } from './AnchorModifications.js'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types/index.js'\n\nexport const anchorElementType = 'anchor' as const\n\nexport interface AnchorElement extends SlateElement {\n\ttype: typeof anchorElementType\n\thref: string\n\tchildren: SlateEditor['children']\n}\n\nexport const isAnchorElement = (element: SlateNode): element is AnchorElement => SlateElement.isElement(element) && element.type === anchorElementType\n\nexport const isAnchorElementActive = (editor: Editor) => {\n\tconst [link] = Editor.nodes(editor, { match: isAnchorElement })\n\treturn !!link\n}\n\nexport const anchorElementPlugin = ({ render }: { render: ElementRenderer<AnchorElement> }): EditorElementPlugin<AnchorElement> => ({\n\ttype: anchorElementType,\n\tisInline: true,\n\trender,\n\tisActive: ({ editor }) => isAnchorElementActive(editor),\n\ttoggleElement: ({ editor, suchThat }) => {\n\t\tif (isAnchorElementActive(editor)) {\n\t\t\tAnchorModifications.unwrapAnchor(editor)\n\t\t} else {\n\t\t\tconst href = suchThat?.href ?? prompt('Insert the URL:')\n\t\t\tif (!href) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tAnchorModifications.wrapAnchor(editor, href)\n\t\t}\n\t},\n\tnormalizeNode: ({ element, path, editor, preventDefault }) => {\n\t\tif (SlateNode.string(element) === '') {\n\t\t\tconst selection = editor.selection\n\t\t\tTransforms.removeNodes(editor, {\n\t\t\t\tat: path,\n\t\t\t})\n\t\t\tif (selection && SlateRange.isCollapsed(selection) && Path.isCommon(path, selection.focus.path)) {\n\t\t\t\tTransforms.select(editor, Path.parent(path))\n\t\t\t}\n\t\t\treturn preventDefault()\n\t\t}\n\t},\n})\n"],"names":["SlateElement","Editor","AnchorModifications","SlateNode","Transforms","SlateRange","Path"],"mappings":";;;;AAIO,MAAM,oBAAoB;AAQ1B,MAAM,kBAAkB,CAAC,YAAiDA,MAAAA,QAAa,UAAU,OAAO,KAAK,QAAQ,SAAS;AAE9H,MAAM,wBAAwB,CAAC,WAAmB;AACxD,QAAM,CAAC,IAAI,IAAIC,aAAO,MAAM,QAAQ,EAAE,OAAO,iBAAiB;AAC9D,SAAO,CAAC,CAAC;AACV;AAEO,MAAM,sBAAsB,CAAC,EAAE,cAA8F;AAAA,EACnI,MAAM;AAAA,EACN,UAAU;AAAA,EACV;AAAA,EACA,UAAU,CAAC,EAAE,aAAa,sBAAsB,MAAM;AAAA,EACtD,eAAe,CAAC,EAAE,QAAQ,eAAe;AACxC,QAAI,sBAAsB,MAAM,GAAG;AAClCC,0BAAAA,oBAAoB,aAAa,MAAM;AAAA,IACxC,OAAO;AACN,YAAM,OAAO,UAAU,QAAQ,OAAO,iBAAiB;AACvD,UAAI,CAAC,MAAM;AACV;AAAA,MACD;AACAA,8CAAoB,WAAW,QAAQ,IAAI;AAAA,IAC5C;AAAA,EACD;AAAA,EACA,eAAe,CAAC,EAAE,SAAS,MAAM,QAAQ,qBAAqB;AAC7D,QAAIC,WAAU,OAAO,OAAO,MAAM,IAAI;AACrC,YAAM,YAAY,OAAO;AACzBC,YAAAA,WAAW,YAAY,QAAQ;AAAA,QAC9B,IAAI;AAAA,MAAA,CACJ;AACD,UAAI,aAAaC,MAAAA,MAAW,YAAY,SAAS,KAAKC,MAAAA,KAAK,SAAS,MAAM,UAAU,MAAM,IAAI,GAAG;AAChGF,cAAAA,WAAW,OAAO,QAAQE,MAAAA,KAAK,OAAO,IAAI,CAAC;AAAA,MAC5C;AACA,aAAO,eAAA;AAAA,IACR;AAAA,EACD;AACD;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AnchorElement.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/anchors/AnchorElement.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Element as SlateElement, Node as SlateNode, Path, Range as SlateRange, Transforms } from 'slate'\nimport { AnchorModifications } from './AnchorModifications'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const anchorElementType = 'anchor' as const\n\nexport interface AnchorElement extends SlateElement {\n\ttype: typeof anchorElementType\n\thref: string\n\tchildren: SlateEditor['children']\n}\n\nexport const isAnchorElement = (element: SlateNode): element is AnchorElement => SlateElement.isElement(element) && element.type === anchorElementType\n\nexport const isAnchorElementActive = (editor: Editor) => {\n\tconst [link] = Editor.nodes(editor, { match: isAnchorElement })\n\treturn !!link\n}\n\nexport const anchorElementPlugin = ({ render }: { render: ElementRenderer<AnchorElement> }): EditorElementPlugin<AnchorElement> => ({\n\ttype: anchorElementType,\n\tisInline: true,\n\trender,\n\tisActive: ({ editor }) => isAnchorElementActive(editor),\n\ttoggleElement: ({ editor, suchThat }) => {\n\t\tif (isAnchorElementActive(editor)) {\n\t\t\tAnchorModifications.unwrapAnchor(editor)\n\t\t} else {\n\t\t\tconst href = suchThat?.href ?? prompt('Insert the URL:')\n\t\t\tif (!href) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tAnchorModifications.wrapAnchor(editor, href)\n\t\t}\n\t},\n\tnormalizeNode: ({ element, path, editor, preventDefault }) => {\n\t\tif (SlateNode.string(element) === '') {\n\t\t\tconst selection = editor.selection\n\t\t\tTransforms.removeNodes(editor, {\n\t\t\t\tat: path,\n\t\t\t})\n\t\t\tif (selection && SlateRange.isCollapsed(selection) && Path.isCommon(path, selection.focus.path)) {\n\t\t\t\tTransforms.select(editor, Path.parent(path))\n\t\t\t}\n\t\t\treturn preventDefault()\n\t\t}\n\t},\n})\n"],"names":["SlateElement","SlateNode","SlateRange"],"mappings":";;AAIO,MAAM,oBAAoB;AAQ1B,MAAM,kBAAkB,CAAC,YAAiDA,QAAa,UAAU,OAAO,KAAK,QAAQ,SAAS;AAE9H,MAAM,wBAAwB,CAAC,WAAmB;AACxD,QAAM,CAAC,IAAI,IAAI,OAAO,MAAM,QAAQ,EAAE,OAAO,iBAAiB;AAC9D,SAAO,CAAC,CAAC;AACV;AAEO,MAAM,sBAAsB,CAAC,EAAE,cAA8F;AAAA,EACnI,MAAM;AAAA,EACN,UAAU;AAAA,EACV;AAAA,EACA,UAAU,CAAC,EAAE,aAAa,sBAAsB,MAAM;AAAA,EACtD,eAAe,CAAC,EAAE,QAAQ,eAAe;AACxC,QAAI,sBAAsB,MAAM,GAAG;AAClC,0BAAoB,aAAa,MAAM;AAAA,IACxC,OAAO;AACN,YAAM,OAAO,UAAU,QAAQ,OAAO,iBAAiB;AACvD,UAAI,CAAC,MAAM;AACV;AAAA,MACD;AACA,0BAAoB,WAAW,QAAQ,IAAI;AAAA,IAC5C;AAAA,EACD;AAAA,EACA,eAAe,CAAC,EAAE,SAAS,MAAM,QAAQ,qBAAqB;AAC7D,QAAIC,KAAU,OAAO,OAAO,MAAM,IAAI;AACrC,YAAM,YAAY,OAAO;AACzB,iBAAW,YAAY,QAAQ;AAAA,QAC9B,IAAI;AAAA,MAAA,CACJ;AACD,UAAI,aAAaC,MAAW,YAAY,SAAS,KAAK,KAAK,SAAS,MAAM,UAAU,MAAM,IAAI,GAAG;AAChG,mBAAW,OAAO,QAAQ,KAAK,OAAO,IAAI,CAAC;AAAA,MAC5C;AACA,aAAO,eAAA;AAAA,IACR;AAAA,EACD;AACD;"}
1
+ {"version":3,"file":"AnchorElement.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/anchors/AnchorElement.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Element as SlateElement, Node as SlateNode, Path, Range as SlateRange, Transforms } from 'slate'\nimport { AnchorModifications } from './AnchorModifications.js'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types/index.js'\n\nexport const anchorElementType = 'anchor' as const\n\nexport interface AnchorElement extends SlateElement {\n\ttype: typeof anchorElementType\n\thref: string\n\tchildren: SlateEditor['children']\n}\n\nexport const isAnchorElement = (element: SlateNode): element is AnchorElement => SlateElement.isElement(element) && element.type === anchorElementType\n\nexport const isAnchorElementActive = (editor: Editor) => {\n\tconst [link] = Editor.nodes(editor, { match: isAnchorElement })\n\treturn !!link\n}\n\nexport const anchorElementPlugin = ({ render }: { render: ElementRenderer<AnchorElement> }): EditorElementPlugin<AnchorElement> => ({\n\ttype: anchorElementType,\n\tisInline: true,\n\trender,\n\tisActive: ({ editor }) => isAnchorElementActive(editor),\n\ttoggleElement: ({ editor, suchThat }) => {\n\t\tif (isAnchorElementActive(editor)) {\n\t\t\tAnchorModifications.unwrapAnchor(editor)\n\t\t} else {\n\t\t\tconst href = suchThat?.href ?? prompt('Insert the URL:')\n\t\t\tif (!href) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tAnchorModifications.wrapAnchor(editor, href)\n\t\t}\n\t},\n\tnormalizeNode: ({ element, path, editor, preventDefault }) => {\n\t\tif (SlateNode.string(element) === '') {\n\t\t\tconst selection = editor.selection\n\t\t\tTransforms.removeNodes(editor, {\n\t\t\t\tat: path,\n\t\t\t})\n\t\t\tif (selection && SlateRange.isCollapsed(selection) && Path.isCommon(path, selection.focus.path)) {\n\t\t\t\tTransforms.select(editor, Path.parent(path))\n\t\t\t}\n\t\t\treturn preventDefault()\n\t\t}\n\t},\n})\n"],"names":["SlateElement","SlateNode","SlateRange"],"mappings":";;AAIO,MAAM,oBAAoB;AAQ1B,MAAM,kBAAkB,CAAC,YAAiDA,QAAa,UAAU,OAAO,KAAK,QAAQ,SAAS;AAE9H,MAAM,wBAAwB,CAAC,WAAmB;AACxD,QAAM,CAAC,IAAI,IAAI,OAAO,MAAM,QAAQ,EAAE,OAAO,iBAAiB;AAC9D,SAAO,CAAC,CAAC;AACV;AAEO,MAAM,sBAAsB,CAAC,EAAE,cAA8F;AAAA,EACnI,MAAM;AAAA,EACN,UAAU;AAAA,EACV;AAAA,EACA,UAAU,CAAC,EAAE,aAAa,sBAAsB,MAAM;AAAA,EACtD,eAAe,CAAC,EAAE,QAAQ,eAAe;AACxC,QAAI,sBAAsB,MAAM,GAAG;AAClC,0BAAoB,aAAa,MAAM;AAAA,IACxC,OAAO;AACN,YAAM,OAAO,UAAU,QAAQ,OAAO,iBAAiB;AACvD,UAAI,CAAC,MAAM;AACV;AAAA,MACD;AACA,0BAAoB,WAAW,QAAQ,IAAI;AAAA,IAC5C;AAAA,EACD;AAAA,EACA,eAAe,CAAC,EAAE,SAAS,MAAM,QAAQ,qBAAqB;AAC7D,QAAIC,KAAU,OAAO,OAAO,MAAM,IAAI;AACrC,YAAM,YAAY,OAAO;AACzB,iBAAW,YAAY,QAAQ;AAAA,QAC9B,IAAI;AAAA,MAAA,CACJ;AACD,UAAI,aAAaC,MAAW,YAAY,SAAS,KAAK,KAAK,SAAS,MAAM,UAAU,MAAM,IAAI,GAAG;AAChG,mBAAW,OAAO,QAAQ,KAAK,OAAO,IAAI,CAAC;AAAA,MAC5C;AACA,aAAO,eAAA;AAAA,IACR;AAAA,EACD;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AnchorHtmlDeserializer.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/anchors/AnchorHtmlDeserializer.ts"],"sourcesContent":["import { HtmlDeserializerPlugin } from '../../../types'\n\nexport const anchorHtmlDeserializer: HtmlDeserializerPlugin = {\n\tprocessInlinePaste: ({ element, next, cumulativeTextAttrs }) => {\n\t\tif (element.tagName === 'A' && element.getAttribute('href')) {\n\t\t\tconst href = element.getAttribute('href')\n\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: 'anchor',\n\t\t\t\t\thref,\n\t\t\t\t\tchildren: next(element.childNodes, cumulativeTextAttrs),\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\t\treturn null\n\t},\n}\n"],"names":[],"mappings":";;AAEO,MAAM,yBAAiD;AAAA,EAC7D,oBAAoB,CAAC,EAAE,SAAS,MAAM,0BAA0B;AAC/D,QAAI,QAAQ,YAAY,OAAO,QAAQ,aAAa,MAAM,GAAG;AAC5D,YAAM,OAAO,QAAQ,aAAa,MAAM;AAExC,aAAO;AAAA,QACN;AAAA,UACC,MAAM;AAAA,UACN;AAAA,UACA,UAAU,KAAK,QAAQ,YAAY,mBAAmB;AAAA,QAAA;AAAA,MACvD;AAAA,IAEF;AACA,WAAO;AAAA,EACR;AACD;;"}
1
+ {"version":3,"file":"AnchorHtmlDeserializer.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/anchors/AnchorHtmlDeserializer.ts"],"sourcesContent":["import { HtmlDeserializerPlugin } from '../../../types/index.js'\n\nexport const anchorHtmlDeserializer: HtmlDeserializerPlugin = {\n\tprocessInlinePaste: ({ element, next, cumulativeTextAttrs }) => {\n\t\tif (element.tagName === 'A' && element.getAttribute('href')) {\n\t\t\tconst href = element.getAttribute('href')\n\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: 'anchor',\n\t\t\t\t\thref,\n\t\t\t\t\tchildren: next(element.childNodes, cumulativeTextAttrs),\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\t\treturn null\n\t},\n}\n"],"names":[],"mappings":";;AAEO,MAAM,yBAAiD;AAAA,EAC7D,oBAAoB,CAAC,EAAE,SAAS,MAAM,0BAA0B;AAC/D,QAAI,QAAQ,YAAY,OAAO,QAAQ,aAAa,MAAM,GAAG;AAC5D,YAAM,OAAO,QAAQ,aAAa,MAAM;AAExC,aAAO;AAAA,QACN;AAAA,UACC,MAAM;AAAA,UACN;AAAA,UACA,UAAU,KAAK,QAAQ,YAAY,mBAAmB;AAAA,QAAA;AAAA,MACvD;AAAA,IAEF;AACA,WAAO;AAAA,EACR;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AnchorHtmlDeserializer.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/anchors/AnchorHtmlDeserializer.ts"],"sourcesContent":["import { HtmlDeserializerPlugin } from '../../../types'\n\nexport const anchorHtmlDeserializer: HtmlDeserializerPlugin = {\n\tprocessInlinePaste: ({ element, next, cumulativeTextAttrs }) => {\n\t\tif (element.tagName === 'A' && element.getAttribute('href')) {\n\t\t\tconst href = element.getAttribute('href')\n\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: 'anchor',\n\t\t\t\t\thref,\n\t\t\t\t\tchildren: next(element.childNodes, cumulativeTextAttrs),\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\t\treturn null\n\t},\n}\n"],"names":[],"mappings":"AAEO,MAAM,yBAAiD;AAAA,EAC7D,oBAAoB,CAAC,EAAE,SAAS,MAAM,0BAA0B;AAC/D,QAAI,QAAQ,YAAY,OAAO,QAAQ,aAAa,MAAM,GAAG;AAC5D,YAAM,OAAO,QAAQ,aAAa,MAAM;AAExC,aAAO;AAAA,QACN;AAAA,UACC,MAAM;AAAA,UACN;AAAA,UACA,UAAU,KAAK,QAAQ,YAAY,mBAAmB;AAAA,QAAA;AAAA,MACvD;AAAA,IAEF;AACA,WAAO;AAAA,EACR;AACD;"}
1
+ {"version":3,"file":"AnchorHtmlDeserializer.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/anchors/AnchorHtmlDeserializer.ts"],"sourcesContent":["import { HtmlDeserializerPlugin } from '../../../types/index.js'\n\nexport const anchorHtmlDeserializer: HtmlDeserializerPlugin = {\n\tprocessInlinePaste: ({ element, next, cumulativeTextAttrs }) => {\n\t\tif (element.tagName === 'A' && element.getAttribute('href')) {\n\t\t\tconst href = element.getAttribute('href')\n\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: 'anchor',\n\t\t\t\t\thref,\n\t\t\t\t\tchildren: next(element.childNodes, cumulativeTextAttrs),\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\t\treturn null\n\t},\n}\n"],"names":[],"mappings":"AAEO,MAAM,yBAAiD;AAAA,EAC7D,oBAAoB,CAAC,EAAE,SAAS,MAAM,0BAA0B;AAC/D,QAAI,QAAQ,YAAY,OAAO,QAAQ,aAAa,MAAM,GAAG;AAC5D,YAAM,OAAO,QAAQ,aAAa,MAAM;AAExC,aAAO;AAAA,QACN;AAAA,UACC,MAAM;AAAA,UACN;AAAA,UACA,UAAU,KAAK,QAAQ,YAAY,mBAAmB;AAAA,QAAA;AAAA,MACvD;AAAA,IAEF;AACA,WAAO;AAAA,EACR;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AnchorModifications.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/anchors/AnchorModifications.ts"],"sourcesContent":["import { Editor, Range, Transforms } from 'slate'\nimport { AnchorElement, isAnchorElement, isAnchorElementActive } from './AnchorElement'\n\nexport class AnchorModifications {\n\tpublic static unwrapAnchor(editor: Editor) {\n\t\tTransforms.unwrapNodes(editor, { match: isAnchorElement })\n\t}\n\n\tpublic static wrapAnchor(editor: Editor, url: string) {\n\t\tif (isAnchorElementActive(editor)) {\n\t\t\tAnchorModifications.unwrapAnchor(editor)\n\t\t}\n\n\t\tconst selection = editor.selection\n\t\tconst isCollapsed = selection ? Range.isCollapsed(selection!) : false\n\t\tconst anchor: AnchorElement = {\n\t\t\ttype: 'anchor',\n\t\t\thref: url,\n\t\t\tchildren: isCollapsed ? [{ text: url }] : [{ text: '' }],\n\t\t}\n\n\t\tif (isCollapsed) {\n\t\t\tTransforms.insertNodes(editor, anchor)\n\t\t} else {\n\t\t\tTransforms.wrapNodes(editor, anchor, { split: true })\n\t\t\tTransforms.collapse(editor, { edge: 'end' })\n\t\t}\n\t}\n}\n"],"names":["Transforms","isAnchorElement","isAnchorElementActive","Range"],"mappings":";;;;AAGO,MAAM,oBAAoB;AAAA,EAChC,OAAc,aAAa,QAAgB;AAC1CA,UAAAA,WAAW,YAAY,QAAQ,EAAE,OAAOC,cAAAA,iBAAiB;AAAA,EAC1D;AAAA,EAEA,OAAc,WAAW,QAAgB,KAAa;AACrD,QAAIC,cAAAA,sBAAsB,MAAM,GAAG;AAClC,0BAAoB,aAAa,MAAM;AAAA,IACxC;AAEA,UAAM,YAAY,OAAO;AACzB,UAAM,cAAc,YAAYC,MAAAA,MAAM,YAAY,SAAU,IAAI;AAChE,UAAM,SAAwB;AAAA,MAC7B,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU,cAAc,CAAC,EAAE,MAAM,IAAA,CAAK,IAAI,CAAC,EAAE,MAAM,GAAA,CAAI;AAAA,IAAA;AAGxD,QAAI,aAAa;AAChBH,uBAAW,YAAY,QAAQ,MAAM;AAAA,IACtC,OAAO;AACNA,YAAAA,WAAW,UAAU,QAAQ,QAAQ,EAAE,OAAO,MAAM;AACpDA,YAAAA,WAAW,SAAS,QAAQ,EAAE,MAAM,OAAO;AAAA,IAC5C;AAAA,EACD;AACD;;"}
1
+ {"version":3,"file":"AnchorModifications.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/anchors/AnchorModifications.ts"],"sourcesContent":["import { Editor, Range, Transforms } from 'slate'\nimport { AnchorElement, isAnchorElement, isAnchorElementActive } from './AnchorElement.js'\n\nexport class AnchorModifications {\n\tpublic static unwrapAnchor(editor: Editor) {\n\t\tTransforms.unwrapNodes(editor, { match: isAnchorElement })\n\t}\n\n\tpublic static wrapAnchor(editor: Editor, url: string) {\n\t\tif (isAnchorElementActive(editor)) {\n\t\t\tAnchorModifications.unwrapAnchor(editor)\n\t\t}\n\n\t\tconst selection = editor.selection\n\t\tconst isCollapsed = selection ? Range.isCollapsed(selection!) : false\n\t\tconst anchor: AnchorElement = {\n\t\t\ttype: 'anchor',\n\t\t\thref: url,\n\t\t\tchildren: isCollapsed ? [{ text: url }] : [{ text: '' }],\n\t\t}\n\n\t\tif (isCollapsed) {\n\t\t\tTransforms.insertNodes(editor, anchor)\n\t\t} else {\n\t\t\tTransforms.wrapNodes(editor, anchor, { split: true })\n\t\t\tTransforms.collapse(editor, { edge: 'end' })\n\t\t}\n\t}\n}\n"],"names":["Transforms","isAnchorElement","isAnchorElementActive","Range"],"mappings":";;;;AAGO,MAAM,oBAAoB;AAAA,EAChC,OAAc,aAAa,QAAgB;AAC1CA,UAAAA,WAAW,YAAY,QAAQ,EAAE,OAAOC,cAAAA,iBAAiB;AAAA,EAC1D;AAAA,EAEA,OAAc,WAAW,QAAgB,KAAa;AACrD,QAAIC,cAAAA,sBAAsB,MAAM,GAAG;AAClC,0BAAoB,aAAa,MAAM;AAAA,IACxC;AAEA,UAAM,YAAY,OAAO;AACzB,UAAM,cAAc,YAAYC,MAAAA,MAAM,YAAY,SAAU,IAAI;AAChE,UAAM,SAAwB;AAAA,MAC7B,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU,cAAc,CAAC,EAAE,MAAM,IAAA,CAAK,IAAI,CAAC,EAAE,MAAM,GAAA,CAAI;AAAA,IAAA;AAGxD,QAAI,aAAa;AAChBH,uBAAW,YAAY,QAAQ,MAAM;AAAA,IACtC,OAAO;AACNA,YAAAA,WAAW,UAAU,QAAQ,QAAQ,EAAE,OAAO,MAAM;AACpDA,YAAAA,WAAW,SAAS,QAAQ,EAAE,MAAM,OAAO;AAAA,IAC5C;AAAA,EACD;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"AnchorModifications.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/anchors/AnchorModifications.ts"],"sourcesContent":["import { Editor, Range, Transforms } from 'slate'\nimport { AnchorElement, isAnchorElement, isAnchorElementActive } from './AnchorElement'\n\nexport class AnchorModifications {\n\tpublic static unwrapAnchor(editor: Editor) {\n\t\tTransforms.unwrapNodes(editor, { match: isAnchorElement })\n\t}\n\n\tpublic static wrapAnchor(editor: Editor, url: string) {\n\t\tif (isAnchorElementActive(editor)) {\n\t\t\tAnchorModifications.unwrapAnchor(editor)\n\t\t}\n\n\t\tconst selection = editor.selection\n\t\tconst isCollapsed = selection ? Range.isCollapsed(selection!) : false\n\t\tconst anchor: AnchorElement = {\n\t\t\ttype: 'anchor',\n\t\t\thref: url,\n\t\t\tchildren: isCollapsed ? [{ text: url }] : [{ text: '' }],\n\t\t}\n\n\t\tif (isCollapsed) {\n\t\t\tTransforms.insertNodes(editor, anchor)\n\t\t} else {\n\t\t\tTransforms.wrapNodes(editor, anchor, { split: true })\n\t\t\tTransforms.collapse(editor, { edge: 'end' })\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;AAGO,MAAM,oBAAoB;AAAA,EAChC,OAAc,aAAa,QAAgB;AAC1C,eAAW,YAAY,QAAQ,EAAE,OAAO,iBAAiB;AAAA,EAC1D;AAAA,EAEA,OAAc,WAAW,QAAgB,KAAa;AACrD,QAAI,sBAAsB,MAAM,GAAG;AAClC,0BAAoB,aAAa,MAAM;AAAA,IACxC;AAEA,UAAM,YAAY,OAAO;AACzB,UAAM,cAAc,YAAY,MAAM,YAAY,SAAU,IAAI;AAChE,UAAM,SAAwB;AAAA,MAC7B,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU,cAAc,CAAC,EAAE,MAAM,IAAA,CAAK,IAAI,CAAC,EAAE,MAAM,GAAA,CAAI;AAAA,IAAA;AAGxD,QAAI,aAAa;AAChB,iBAAW,YAAY,QAAQ,MAAM;AAAA,IACtC,OAAO;AACN,iBAAW,UAAU,QAAQ,QAAQ,EAAE,OAAO,MAAM;AACpD,iBAAW,SAAS,QAAQ,EAAE,MAAM,OAAO;AAAA,IAC5C;AAAA,EACD;AACD;"}
1
+ {"version":3,"file":"AnchorModifications.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/anchors/AnchorModifications.ts"],"sourcesContent":["import { Editor, Range, Transforms } from 'slate'\nimport { AnchorElement, isAnchorElement, isAnchorElementActive } from './AnchorElement.js'\n\nexport class AnchorModifications {\n\tpublic static unwrapAnchor(editor: Editor) {\n\t\tTransforms.unwrapNodes(editor, { match: isAnchorElement })\n\t}\n\n\tpublic static wrapAnchor(editor: Editor, url: string) {\n\t\tif (isAnchorElementActive(editor)) {\n\t\t\tAnchorModifications.unwrapAnchor(editor)\n\t\t}\n\n\t\tconst selection = editor.selection\n\t\tconst isCollapsed = selection ? Range.isCollapsed(selection!) : false\n\t\tconst anchor: AnchorElement = {\n\t\t\ttype: 'anchor',\n\t\t\thref: url,\n\t\t\tchildren: isCollapsed ? [{ text: url }] : [{ text: '' }],\n\t\t}\n\n\t\tif (isCollapsed) {\n\t\t\tTransforms.insertNodes(editor, anchor)\n\t\t} else {\n\t\t\tTransforms.wrapNodes(editor, anchor, { split: true })\n\t\t\tTransforms.collapse(editor, { edge: 'end' })\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;AAGO,MAAM,oBAAoB;AAAA,EAChC,OAAc,aAAa,QAAgB;AAC1C,eAAW,YAAY,QAAQ,EAAE,OAAO,iBAAiB;AAAA,EAC1D;AAAA,EAEA,OAAc,WAAW,QAAgB,KAAa;AACrD,QAAI,sBAAsB,MAAM,GAAG;AAClC,0BAAoB,aAAa,MAAM;AAAA,IACxC;AAEA,UAAM,YAAY,OAAO;AACzB,UAAM,cAAc,YAAY,MAAM,YAAY,SAAU,IAAI;AAChE,UAAM,SAAwB;AAAA,MAC7B,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU,cAAc,CAAC,EAAE,MAAM,IAAA,CAAK,IAAI,CAAC,EAAE,MAAM,GAAA,CAAI;AAAA,IAAA;AAGxD,QAAI,aAAa;AAChB,iBAAW,YAAY,QAAQ,MAAM;AAAA,IACtC,OAAO;AACN,iBAAW,UAAU,QAAQ,QAAQ,EAAE,OAAO,MAAM;AACpD,iBAAW,SAAS,QAAQ,EAAE,MAAM,OAAO;AAAA,IAC5C;AAAA,EACD;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"withAnchors.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/anchors/withAnchors.ts"],"sourcesContent":["import { Editor } from 'slate'\nimport { AnchorModifications } from './AnchorModifications'\nimport { AnchorElement, anchorElementPlugin } from './AnchorElement'\nimport { anchorHtmlDeserializer } from './AnchorHtmlDeserializer'\nimport { ElementRenderer } from '../../../types'\nimport { parseUrl } from '../../../internal/utils'\n\nexport const withAnchors = ({ render }: { render: ElementRenderer<AnchorElement> }) => <E extends Editor>(editor: E): E => {\n\tconst { insertText } = editor\n\n\teditor.registerElement(anchorElementPlugin({ render }))\n\teditor.htmlDeserializer.registerPlugin(anchorHtmlDeserializer)\n\n\teditor.insertText = text => {\n\t\tif (text && parseUrl(text) !== undefined) {\n\t\t\tAnchorModifications.wrapAnchor(editor, text)\n\t\t} else {\n\t\t\tinsertText(text)\n\t\t}\n\t}\n\n\treturn editor\n}\n"],"names":["anchorElementPlugin","anchorHtmlDeserializer","parseUrl","AnchorModifications"],"mappings":";;;;;;AAOO,MAAM,cAAc,CAAC,EAAE,OAAA,MAAyD,CAAmB,WAAiB;AAC1H,QAAM,EAAE,eAAe;AAEvB,SAAO,gBAAgBA,cAAAA,oBAAoB,EAAE,OAAA,CAAQ,CAAC;AACtD,SAAO,iBAAiB,eAAeC,6CAAsB;AAE7D,SAAO,aAAa,CAAA,SAAQ;AAC3B,QAAI,QAAQC,SAAAA,SAAS,IAAI,MAAM,QAAW;AACzCC,8CAAoB,WAAW,QAAQ,IAAI;AAAA,IAC5C,OAAO;AACN,iBAAW,IAAI;AAAA,IAChB;AAAA,EACD;AAEA,SAAO;AACR;;"}
1
+ {"version":3,"file":"withAnchors.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/anchors/withAnchors.ts"],"sourcesContent":["import { Editor } from 'slate'\nimport { AnchorModifications } from './AnchorModifications.js'\nimport { AnchorElement, anchorElementPlugin } from './AnchorElement.js'\nimport { anchorHtmlDeserializer } from './AnchorHtmlDeserializer.js'\nimport { ElementRenderer } from '../../../types/index.js'\nimport { parseUrl } from '../../../internal/utils/index.js'\n\nexport const withAnchors = ({ render }: { render: ElementRenderer<AnchorElement> }) => <E extends Editor>(editor: E): E => {\n\tconst { insertText } = editor\n\n\teditor.registerElement(anchorElementPlugin({ render }))\n\teditor.htmlDeserializer.registerPlugin(anchorHtmlDeserializer)\n\n\teditor.insertText = text => {\n\t\tif (text && parseUrl(text) !== undefined) {\n\t\t\tAnchorModifications.wrapAnchor(editor, text)\n\t\t} else {\n\t\t\tinsertText(text)\n\t\t}\n\t}\n\n\treturn editor\n}\n"],"names":["anchorElementPlugin","anchorHtmlDeserializer","parseUrl","AnchorModifications"],"mappings":";;;;;;AAOO,MAAM,cAAc,CAAC,EAAE,OAAA,MAAyD,CAAmB,WAAiB;AAC1H,QAAM,EAAE,eAAe;AAEvB,SAAO,gBAAgBA,cAAAA,oBAAoB,EAAE,OAAA,CAAQ,CAAC;AACtD,SAAO,iBAAiB,eAAeC,6CAAsB;AAE7D,SAAO,aAAa,CAAA,SAAQ;AAC3B,QAAI,QAAQC,SAAAA,SAAS,IAAI,MAAM,QAAW;AACzCC,8CAAoB,WAAW,QAAQ,IAAI;AAAA,IAC5C,OAAO;AACN,iBAAW,IAAI;AAAA,IAChB;AAAA,EACD;AAEA,SAAO;AACR;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"withAnchors.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/anchors/withAnchors.ts"],"sourcesContent":["import { Editor } from 'slate'\nimport { AnchorModifications } from './AnchorModifications'\nimport { AnchorElement, anchorElementPlugin } from './AnchorElement'\nimport { anchorHtmlDeserializer } from './AnchorHtmlDeserializer'\nimport { ElementRenderer } from '../../../types'\nimport { parseUrl } from '../../../internal/utils'\n\nexport const withAnchors = ({ render }: { render: ElementRenderer<AnchorElement> }) => <E extends Editor>(editor: E): E => {\n\tconst { insertText } = editor\n\n\teditor.registerElement(anchorElementPlugin({ render }))\n\teditor.htmlDeserializer.registerPlugin(anchorHtmlDeserializer)\n\n\teditor.insertText = text => {\n\t\tif (text && parseUrl(text) !== undefined) {\n\t\t\tAnchorModifications.wrapAnchor(editor, text)\n\t\t} else {\n\t\t\tinsertText(text)\n\t\t}\n\t}\n\n\treturn editor\n}\n"],"names":[],"mappings":";;;;AAOO,MAAM,cAAc,CAAC,EAAE,OAAA,MAAyD,CAAmB,WAAiB;AAC1H,QAAM,EAAE,eAAe;AAEvB,SAAO,gBAAgB,oBAAoB,EAAE,OAAA,CAAQ,CAAC;AACtD,SAAO,iBAAiB,eAAe,sBAAsB;AAE7D,SAAO,aAAa,CAAA,SAAQ;AAC3B,QAAI,QAAQ,SAAS,IAAI,MAAM,QAAW;AACzC,0BAAoB,WAAW,QAAQ,IAAI;AAAA,IAC5C,OAAO;AACN,iBAAW,IAAI;AAAA,IAChB;AAAA,EACD;AAEA,SAAO;AACR;"}
1
+ {"version":3,"file":"withAnchors.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/anchors/withAnchors.ts"],"sourcesContent":["import { Editor } from 'slate'\nimport { AnchorModifications } from './AnchorModifications.js'\nimport { AnchorElement, anchorElementPlugin } from './AnchorElement.js'\nimport { anchorHtmlDeserializer } from './AnchorHtmlDeserializer.js'\nimport { ElementRenderer } from '../../../types/index.js'\nimport { parseUrl } from '../../../internal/utils/index.js'\n\nexport const withAnchors = ({ render }: { render: ElementRenderer<AnchorElement> }) => <E extends Editor>(editor: E): E => {\n\tconst { insertText } = editor\n\n\teditor.registerElement(anchorElementPlugin({ render }))\n\teditor.htmlDeserializer.registerPlugin(anchorHtmlDeserializer)\n\n\teditor.insertText = text => {\n\t\tif (text && parseUrl(text) !== undefined) {\n\t\t\tAnchorModifications.wrapAnchor(editor, text)\n\t\t} else {\n\t\t\tinsertText(text)\n\t\t}\n\t}\n\n\treturn editor\n}\n"],"names":[],"mappings":";;;;AAOO,MAAM,cAAc,CAAC,EAAE,OAAA,MAAyD,CAAmB,WAAiB;AAC1H,QAAM,EAAE,eAAe;AAEvB,SAAO,gBAAgB,oBAAoB,EAAE,OAAA,CAAQ,CAAC;AACtD,SAAO,iBAAiB,eAAe,sBAAsB;AAE7D,SAAO,aAAa,CAAA,SAAQ;AAC3B,QAAI,QAAQ,SAAS,IAAI,MAAM,QAAW;AACzC,0BAAoB,WAAW,QAAQ,IAAI;AAAA,IAC5C,OAAO;AACN,iBAAW,IAAI;AAAA,IAChB;AAAA,EACD;AAEA,SAAO;AACR;"}
@@ -1 +1 @@
1
- {"version":3,"file":"HeadingElement.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/headings/HeadingElement.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Element, Node as SlateNode, Path as SlatePath, Transforms } from 'slate'\nimport { ContemberEditor } from '../../../editor'\nimport { AlignDirection } from '../../attributes'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const headingElementType = 'heading' as const\n\nexport interface HeadingElement extends Element {\n\ttype: typeof headingElementType\n\tlevel: 1 | 2 | 3 | 4 | 5 | 6\n\tisNumbered?: boolean\n\talign?: AlignDirection\n\tchildren: SlateEditor['children']\n}\n\nexport const isHeadingElement = (\n\telement: SlateNode,\n\tsuchThat?: Partial<HeadingElement>,\n): element is HeadingElement => ContemberEditor.isElementType(element, headingElementType, suchThat)\n\nexport const ejectHeadingElement = (editor: Editor, elementPath: SlatePath) => {\n\tContemberEditor.ejectElement(editor, elementPath)\n\tTransforms.setNodes(editor, { type: editor.defaultElementType }, { at: elementPath })\n}\n\nexport const headingElementPlugin = ({ render }: { render: ElementRenderer<HeadingElement> }): EditorElementPlugin<HeadingElement> => ({\n\ttype: headingElementType,\n\trender,\n\tcanContainAnyBlocks: false,\n\tacceptsAttributes: ({ editor, suchThat }) => {\n\t\treturn 'align' in suchThat\n\t},\n\t// TODO in the following function, we need to conditionally trim the selection so that it doesn't potentially\n\t// \tinclude empty strings at the edges of top-level elements.\n\ttoggleElement: ({ editor, suchThat }) => {\n\t\tSlateEditor.withoutNormalizing(editor, () => {\n\t\t\tconst headings = Array.from(Editor.nodes(editor, { match: it => isHeadingElement(it, suchThat) }))\n\t\t\tif (headings.length) {\n\t\t\t\tfor (const heading of headings) {\n\t\t\t\t\tejectHeadingElement(editor, heading[1])\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tTransforms.setNodes(editor, {\n\t\t\t\t\t...suchThat,\n\t\t\t\t\tchildren: [],\n\t\t\t\t\ttype: headingElementType,\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t},\n})\n"],"names":["ContemberEditor","Transforms","SlateEditor","Editor"],"mappings":";;;;AAKO,MAAM,qBAAqB;AAU3B,MAAM,mBAAmB,CAC/B,SACA,aAC+BA,MAAAA,gBAAgB,cAAc,SAAS,oBAAoB,QAAQ;AAE5F,MAAM,sBAAsB,CAAC,QAAgB,gBAA2B;AAC9EA,wBAAgB,aAAa,QAAQ,WAAW;AAChDC,mBAAW,SAAS,QAAQ,EAAE,MAAM,OAAO,sBAAsB,EAAE,IAAI,aAAa;AACrF;AAEO,MAAM,uBAAuB,CAAC,EAAE,cAAgG;AAAA,EACtI,MAAM;AAAA,EACN;AAAA,EACA,qBAAqB;AAAA,EACrB,mBAAmB,CAAC,EAAE,QAAQ,eAAe;AAC5C,WAAO,WAAW;AAAA,EACnB;AAAA;AAAA;AAAA,EAGA,eAAe,CAAC,EAAE,QAAQ,eAAe;AACxCC,iBAAY,mBAAmB,QAAQ,MAAM;AAC5C,YAAM,WAAW,MAAM,KAAKC,MAAAA,OAAO,MAAM,QAAQ,EAAE,OAAO,CAAA,OAAM,iBAAiB,IAAI,QAAQ,EAAA,CAAG,CAAC;AACjG,UAAI,SAAS,QAAQ;AACpB,mBAAW,WAAW,UAAU;AAC/B,8BAAoB,QAAQ,QAAQ,CAAC,CAAC;AAAA,QACvC;AAAA,MACD,OAAO;AACNF,cAAAA,WAAW,SAAS,QAAQ;AAAA,UAC3B,GAAG;AAAA,UACH,UAAU,CAAA;AAAA,UACV,MAAM;AAAA,QAAA,CACN;AAAA,MACF;AAAA,IACD,CAAC;AAAA,EACF;AACD;;;;;"}
1
+ {"version":3,"file":"HeadingElement.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/headings/HeadingElement.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Element, Node as SlateNode, Path as SlatePath, Transforms } from 'slate'\nimport { ContemberEditor } from '../../../editor/index.js'\nimport { AlignDirection } from '../../attributes/index.js'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types/index.js'\n\nexport const headingElementType = 'heading' as const\n\nexport interface HeadingElement extends Element {\n\ttype: typeof headingElementType\n\tlevel: 1 | 2 | 3 | 4 | 5 | 6\n\tisNumbered?: boolean\n\talign?: AlignDirection\n\tchildren: SlateEditor['children']\n}\n\nexport const isHeadingElement = (\n\telement: SlateNode,\n\tsuchThat?: Partial<HeadingElement>,\n): element is HeadingElement => ContemberEditor.isElementType(element, headingElementType, suchThat)\n\nexport const ejectHeadingElement = (editor: Editor, elementPath: SlatePath) => {\n\tContemberEditor.ejectElement(editor, elementPath)\n\tTransforms.setNodes(editor, { type: editor.defaultElementType }, { at: elementPath })\n}\n\nexport const headingElementPlugin = ({ render }: { render: ElementRenderer<HeadingElement> }): EditorElementPlugin<HeadingElement> => ({\n\ttype: headingElementType,\n\trender,\n\tcanContainAnyBlocks: false,\n\tacceptsAttributes: ({ editor, suchThat }) => {\n\t\treturn 'align' in suchThat\n\t},\n\t// TODO in the following function, we need to conditionally trim the selection so that it doesn't potentially\n\t// \tinclude empty strings at the edges of top-level elements.\n\ttoggleElement: ({ editor, suchThat }) => {\n\t\tSlateEditor.withoutNormalizing(editor, () => {\n\t\t\tconst headings = Array.from(Editor.nodes(editor, { match: it => isHeadingElement(it, suchThat) }))\n\t\t\tif (headings.length) {\n\t\t\t\tfor (const heading of headings) {\n\t\t\t\t\tejectHeadingElement(editor, heading[1])\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tTransforms.setNodes(editor, {\n\t\t\t\t\t...suchThat,\n\t\t\t\t\tchildren: [],\n\t\t\t\t\ttype: headingElementType,\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t},\n})\n"],"names":["ContemberEditor","Transforms","SlateEditor","Editor"],"mappings":";;;;AAKO,MAAM,qBAAqB;AAU3B,MAAM,mBAAmB,CAC/B,SACA,aAC+BA,MAAAA,gBAAgB,cAAc,SAAS,oBAAoB,QAAQ;AAE5F,MAAM,sBAAsB,CAAC,QAAgB,gBAA2B;AAC9EA,wBAAgB,aAAa,QAAQ,WAAW;AAChDC,mBAAW,SAAS,QAAQ,EAAE,MAAM,OAAO,sBAAsB,EAAE,IAAI,aAAa;AACrF;AAEO,MAAM,uBAAuB,CAAC,EAAE,cAAgG;AAAA,EACtI,MAAM;AAAA,EACN;AAAA,EACA,qBAAqB;AAAA,EACrB,mBAAmB,CAAC,EAAE,QAAQ,eAAe;AAC5C,WAAO,WAAW;AAAA,EACnB;AAAA;AAAA;AAAA,EAGA,eAAe,CAAC,EAAE,QAAQ,eAAe;AACxCC,iBAAY,mBAAmB,QAAQ,MAAM;AAC5C,YAAM,WAAW,MAAM,KAAKC,MAAAA,OAAO,MAAM,QAAQ,EAAE,OAAO,CAAA,OAAM,iBAAiB,IAAI,QAAQ,EAAA,CAAG,CAAC;AACjG,UAAI,SAAS,QAAQ;AACpB,mBAAW,WAAW,UAAU;AAC/B,8BAAoB,QAAQ,QAAQ,CAAC,CAAC;AAAA,QACvC;AAAA,MACD,OAAO;AACNF,cAAAA,WAAW,SAAS,QAAQ;AAAA,UAC3B,GAAG;AAAA,UACH,UAAU,CAAA;AAAA,UACV,MAAM;AAAA,QAAA,CACN;AAAA,MACF;AAAA,IACD,CAAC;AAAA,EACF;AACD;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"HeadingElement.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/headings/HeadingElement.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Element, Node as SlateNode, Path as SlatePath, Transforms } from 'slate'\nimport { ContemberEditor } from '../../../editor'\nimport { AlignDirection } from '../../attributes'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const headingElementType = 'heading' as const\n\nexport interface HeadingElement extends Element {\n\ttype: typeof headingElementType\n\tlevel: 1 | 2 | 3 | 4 | 5 | 6\n\tisNumbered?: boolean\n\talign?: AlignDirection\n\tchildren: SlateEditor['children']\n}\n\nexport const isHeadingElement = (\n\telement: SlateNode,\n\tsuchThat?: Partial<HeadingElement>,\n): element is HeadingElement => ContemberEditor.isElementType(element, headingElementType, suchThat)\n\nexport const ejectHeadingElement = (editor: Editor, elementPath: SlatePath) => {\n\tContemberEditor.ejectElement(editor, elementPath)\n\tTransforms.setNodes(editor, { type: editor.defaultElementType }, { at: elementPath })\n}\n\nexport const headingElementPlugin = ({ render }: { render: ElementRenderer<HeadingElement> }): EditorElementPlugin<HeadingElement> => ({\n\ttype: headingElementType,\n\trender,\n\tcanContainAnyBlocks: false,\n\tacceptsAttributes: ({ editor, suchThat }) => {\n\t\treturn 'align' in suchThat\n\t},\n\t// TODO in the following function, we need to conditionally trim the selection so that it doesn't potentially\n\t// \tinclude empty strings at the edges of top-level elements.\n\ttoggleElement: ({ editor, suchThat }) => {\n\t\tSlateEditor.withoutNormalizing(editor, () => {\n\t\t\tconst headings = Array.from(Editor.nodes(editor, { match: it => isHeadingElement(it, suchThat) }))\n\t\t\tif (headings.length) {\n\t\t\t\tfor (const heading of headings) {\n\t\t\t\t\tejectHeadingElement(editor, heading[1])\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tTransforms.setNodes(editor, {\n\t\t\t\t\t...suchThat,\n\t\t\t\t\tchildren: [],\n\t\t\t\t\ttype: headingElementType,\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t},\n})\n"],"names":["SlateEditor"],"mappings":";;AAKO,MAAM,qBAAqB;AAU3B,MAAM,mBAAmB,CAC/B,SACA,aAC+B,gBAAgB,cAAc,SAAS,oBAAoB,QAAQ;AAE5F,MAAM,sBAAsB,CAAC,QAAgB,gBAA2B;AAC9E,kBAAgB,aAAa,QAAQ,WAAW;AAChD,aAAW,SAAS,QAAQ,EAAE,MAAM,OAAO,sBAAsB,EAAE,IAAI,aAAa;AACrF;AAEO,MAAM,uBAAuB,CAAC,EAAE,cAAgG;AAAA,EACtI,MAAM;AAAA,EACN;AAAA,EACA,qBAAqB;AAAA,EACrB,mBAAmB,CAAC,EAAE,QAAQ,eAAe;AAC5C,WAAO,WAAW;AAAA,EACnB;AAAA;AAAA;AAAA,EAGA,eAAe,CAAC,EAAE,QAAQ,eAAe;AACxCA,WAAY,mBAAmB,QAAQ,MAAM;AAC5C,YAAM,WAAW,MAAM,KAAK,OAAO,MAAM,QAAQ,EAAE,OAAO,CAAA,OAAM,iBAAiB,IAAI,QAAQ,EAAA,CAAG,CAAC;AACjG,UAAI,SAAS,QAAQ;AACpB,mBAAW,WAAW,UAAU;AAC/B,8BAAoB,QAAQ,QAAQ,CAAC,CAAC;AAAA,QACvC;AAAA,MACD,OAAO;AACN,mBAAW,SAAS,QAAQ;AAAA,UAC3B,GAAG;AAAA,UACH,UAAU,CAAA;AAAA,UACV,MAAM;AAAA,QAAA,CACN;AAAA,MACF;AAAA,IACD,CAAC;AAAA,EACF;AACD;"}
1
+ {"version":3,"file":"HeadingElement.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/headings/HeadingElement.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Element, Node as SlateNode, Path as SlatePath, Transforms } from 'slate'\nimport { ContemberEditor } from '../../../editor/index.js'\nimport { AlignDirection } from '../../attributes/index.js'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types/index.js'\n\nexport const headingElementType = 'heading' as const\n\nexport interface HeadingElement extends Element {\n\ttype: typeof headingElementType\n\tlevel: 1 | 2 | 3 | 4 | 5 | 6\n\tisNumbered?: boolean\n\talign?: AlignDirection\n\tchildren: SlateEditor['children']\n}\n\nexport const isHeadingElement = (\n\telement: SlateNode,\n\tsuchThat?: Partial<HeadingElement>,\n): element is HeadingElement => ContemberEditor.isElementType(element, headingElementType, suchThat)\n\nexport const ejectHeadingElement = (editor: Editor, elementPath: SlatePath) => {\n\tContemberEditor.ejectElement(editor, elementPath)\n\tTransforms.setNodes(editor, { type: editor.defaultElementType }, { at: elementPath })\n}\n\nexport const headingElementPlugin = ({ render }: { render: ElementRenderer<HeadingElement> }): EditorElementPlugin<HeadingElement> => ({\n\ttype: headingElementType,\n\trender,\n\tcanContainAnyBlocks: false,\n\tacceptsAttributes: ({ editor, suchThat }) => {\n\t\treturn 'align' in suchThat\n\t},\n\t// TODO in the following function, we need to conditionally trim the selection so that it doesn't potentially\n\t// \tinclude empty strings at the edges of top-level elements.\n\ttoggleElement: ({ editor, suchThat }) => {\n\t\tSlateEditor.withoutNormalizing(editor, () => {\n\t\t\tconst headings = Array.from(Editor.nodes(editor, { match: it => isHeadingElement(it, suchThat) }))\n\t\t\tif (headings.length) {\n\t\t\t\tfor (const heading of headings) {\n\t\t\t\t\tejectHeadingElement(editor, heading[1])\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tTransforms.setNodes(editor, {\n\t\t\t\t\t...suchThat,\n\t\t\t\t\tchildren: [],\n\t\t\t\t\ttype: headingElementType,\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t},\n})\n"],"names":["SlateEditor"],"mappings":";;AAKO,MAAM,qBAAqB;AAU3B,MAAM,mBAAmB,CAC/B,SACA,aAC+B,gBAAgB,cAAc,SAAS,oBAAoB,QAAQ;AAE5F,MAAM,sBAAsB,CAAC,QAAgB,gBAA2B;AAC9E,kBAAgB,aAAa,QAAQ,WAAW;AAChD,aAAW,SAAS,QAAQ,EAAE,MAAM,OAAO,sBAAsB,EAAE,IAAI,aAAa;AACrF;AAEO,MAAM,uBAAuB,CAAC,EAAE,cAAgG;AAAA,EACtI,MAAM;AAAA,EACN;AAAA,EACA,qBAAqB;AAAA,EACrB,mBAAmB,CAAC,EAAE,QAAQ,eAAe;AAC5C,WAAO,WAAW;AAAA,EACnB;AAAA;AAAA;AAAA,EAGA,eAAe,CAAC,EAAE,QAAQ,eAAe;AACxCA,WAAY,mBAAmB,QAAQ,MAAM;AAC5C,YAAM,WAAW,MAAM,KAAK,OAAO,MAAM,QAAQ,EAAE,OAAO,CAAA,OAAM,iBAAiB,IAAI,QAAQ,EAAA,CAAG,CAAC;AACjG,UAAI,SAAS,QAAQ;AACpB,mBAAW,WAAW,UAAU;AAC/B,8BAAoB,QAAQ,QAAQ,CAAC,CAAC;AAAA,QACvC;AAAA,MACD,OAAO;AACN,mBAAW,SAAS,QAAQ;AAAA,UAC3B,GAAG;AAAA,UACH,UAAU,CAAA;AAAA,UACV,MAAM;AAAA,QAAA,CACN;AAAA,MACF;AAAA,IACD,CAAC;AAAA,EACF;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"HeadingHtmlDeserializer.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/headings/HeadingHtmlDeserializer.ts"],"sourcesContent":["import { headingElementType } from './HeadingElement'\nimport { HtmlDeserializerPlugin } from '../../../types'\nimport { EditorPasteUtils } from '../../../internal/utils/EditorPasteUtils'\n\nexport const headingHtmlDeserializer: HtmlDeserializerPlugin = {\n\tprocessBlockPaste: ({ element, next, cumulativeTextAttrs }) => {\n\t\tconst match = element.nodeName.match(/^H(?<level>[1-6])$/)\n\t\tif (match !== null) {\n\t\t\tconst isNumbered = (element.getAttribute('style')?.match(/mso-list:\\w+ level\\d+ \\w+/) ?? null) !== null\n\t\t\tconst children = isNumbered ? EditorPasteUtils.wordPasteListItemContent(element.childNodes) : element.childNodes\n\t\t\treturn {\n\t\t\t\ttype: headingElementType,\n\t\t\t\tlevel: parseInt(match.groups!.level),\n\t\t\t\tchildren: next(children, cumulativeTextAttrs),\n\t\t\t\tisNumbered,\n\t\t\t}\n\t\t}\n\t\treturn null\n\t},\n}\n"],"names":["EditorPasteUtils","headingElementType"],"mappings":";;;;AAIO,MAAM,0BAAkD;AAAA,EAC9D,mBAAmB,CAAC,EAAE,SAAS,MAAM,0BAA0B;AAC9D,UAAM,QAAQ,QAAQ,SAAS,MAAM,oBAAoB;AACzD,QAAI,UAAU,MAAM;AACnB,YAAM,cAAc,QAAQ,aAAa,OAAO,GAAG,MAAM,2BAA2B,KAAK,UAAU;AACnG,YAAM,WAAW,aAAaA,kCAAiB,yBAAyB,QAAQ,UAAU,IAAI,QAAQ;AACtG,aAAO;AAAA,QACN,MAAMC,eAAAA;AAAAA,QACN,OAAO,SAAS,MAAM,OAAQ,KAAK;AAAA,QACnC,UAAU,KAAK,UAAU,mBAAmB;AAAA,QAC5C;AAAA,MAAA;AAAA,IAEF;AACA,WAAO;AAAA,EACR;AACD;;"}
1
+ {"version":3,"file":"HeadingHtmlDeserializer.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/headings/HeadingHtmlDeserializer.ts"],"sourcesContent":["import { headingElementType } from './HeadingElement.js'\nimport { HtmlDeserializerPlugin } from '../../../types/index.js'\nimport { EditorPasteUtils } from '../../../internal/utils/EditorPasteUtils.js'\n\nexport const headingHtmlDeserializer: HtmlDeserializerPlugin = {\n\tprocessBlockPaste: ({ element, next, cumulativeTextAttrs }) => {\n\t\tconst match = element.nodeName.match(/^H(?<level>[1-6])$/)\n\t\tif (match !== null) {\n\t\t\tconst isNumbered = (element.getAttribute('style')?.match(/mso-list:\\w+ level\\d+ \\w+/) ?? null) !== null\n\t\t\tconst children = isNumbered ? EditorPasteUtils.wordPasteListItemContent(element.childNodes) : element.childNodes\n\t\t\treturn {\n\t\t\t\ttype: headingElementType,\n\t\t\t\tlevel: parseInt(match.groups!.level),\n\t\t\t\tchildren: next(children, cumulativeTextAttrs),\n\t\t\t\tisNumbered,\n\t\t\t}\n\t\t}\n\t\treturn null\n\t},\n}\n"],"names":["EditorPasteUtils","headingElementType"],"mappings":";;;;AAIO,MAAM,0BAAkD;AAAA,EAC9D,mBAAmB,CAAC,EAAE,SAAS,MAAM,0BAA0B;AAC9D,UAAM,QAAQ,QAAQ,SAAS,MAAM,oBAAoB;AACzD,QAAI,UAAU,MAAM;AACnB,YAAM,cAAc,QAAQ,aAAa,OAAO,GAAG,MAAM,2BAA2B,KAAK,UAAU;AACnG,YAAM,WAAW,aAAaA,kCAAiB,yBAAyB,QAAQ,UAAU,IAAI,QAAQ;AACtG,aAAO;AAAA,QACN,MAAMC,eAAAA;AAAAA,QACN,OAAO,SAAS,MAAM,OAAQ,KAAK;AAAA,QACnC,UAAU,KAAK,UAAU,mBAAmB;AAAA,QAC5C;AAAA,MAAA;AAAA,IAEF;AACA,WAAO;AAAA,EACR;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"HeadingHtmlDeserializer.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/headings/HeadingHtmlDeserializer.ts"],"sourcesContent":["import { headingElementType } from './HeadingElement'\nimport { HtmlDeserializerPlugin } from '../../../types'\nimport { EditorPasteUtils } from '../../../internal/utils/EditorPasteUtils'\n\nexport const headingHtmlDeserializer: HtmlDeserializerPlugin = {\n\tprocessBlockPaste: ({ element, next, cumulativeTextAttrs }) => {\n\t\tconst match = element.nodeName.match(/^H(?<level>[1-6])$/)\n\t\tif (match !== null) {\n\t\t\tconst isNumbered = (element.getAttribute('style')?.match(/mso-list:\\w+ level\\d+ \\w+/) ?? null) !== null\n\t\t\tconst children = isNumbered ? EditorPasteUtils.wordPasteListItemContent(element.childNodes) : element.childNodes\n\t\t\treturn {\n\t\t\t\ttype: headingElementType,\n\t\t\t\tlevel: parseInt(match.groups!.level),\n\t\t\t\tchildren: next(children, cumulativeTextAttrs),\n\t\t\t\tisNumbered,\n\t\t\t}\n\t\t}\n\t\treturn null\n\t},\n}\n"],"names":[],"mappings":";;AAIO,MAAM,0BAAkD;AAAA,EAC9D,mBAAmB,CAAC,EAAE,SAAS,MAAM,0BAA0B;AAC9D,UAAM,QAAQ,QAAQ,SAAS,MAAM,oBAAoB;AACzD,QAAI,UAAU,MAAM;AACnB,YAAM,cAAc,QAAQ,aAAa,OAAO,GAAG,MAAM,2BAA2B,KAAK,UAAU;AACnG,YAAM,WAAW,aAAa,iBAAiB,yBAAyB,QAAQ,UAAU,IAAI,QAAQ;AACtG,aAAO;AAAA,QACN,MAAM;AAAA,QACN,OAAO,SAAS,MAAM,OAAQ,KAAK;AAAA,QACnC,UAAU,KAAK,UAAU,mBAAmB;AAAA,QAC5C;AAAA,MAAA;AAAA,IAEF;AACA,WAAO;AAAA,EACR;AACD;"}
1
+ {"version":3,"file":"HeadingHtmlDeserializer.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/headings/HeadingHtmlDeserializer.ts"],"sourcesContent":["import { headingElementType } from './HeadingElement.js'\nimport { HtmlDeserializerPlugin } from '../../../types/index.js'\nimport { EditorPasteUtils } from '../../../internal/utils/EditorPasteUtils.js'\n\nexport const headingHtmlDeserializer: HtmlDeserializerPlugin = {\n\tprocessBlockPaste: ({ element, next, cumulativeTextAttrs }) => {\n\t\tconst match = element.nodeName.match(/^H(?<level>[1-6])$/)\n\t\tif (match !== null) {\n\t\t\tconst isNumbered = (element.getAttribute('style')?.match(/mso-list:\\w+ level\\d+ \\w+/) ?? null) !== null\n\t\t\tconst children = isNumbered ? EditorPasteUtils.wordPasteListItemContent(element.childNodes) : element.childNodes\n\t\t\treturn {\n\t\t\t\ttype: headingElementType,\n\t\t\t\tlevel: parseInt(match.groups!.level),\n\t\t\t\tchildren: next(children, cumulativeTextAttrs),\n\t\t\t\tisNumbered,\n\t\t\t}\n\t\t}\n\t\treturn null\n\t},\n}\n"],"names":[],"mappings":";;AAIO,MAAM,0BAAkD;AAAA,EAC9D,mBAAmB,CAAC,EAAE,SAAS,MAAM,0BAA0B;AAC9D,UAAM,QAAQ,QAAQ,SAAS,MAAM,oBAAoB;AACzD,QAAI,UAAU,MAAM;AACnB,YAAM,cAAc,QAAQ,aAAa,OAAO,GAAG,MAAM,2BAA2B,KAAK,UAAU;AACnG,YAAM,WAAW,aAAa,iBAAiB,yBAAyB,QAAQ,UAAU,IAAI,QAAQ;AACtG,aAAO;AAAA,QACN,MAAM;AAAA,QACN,OAAO,SAAS,MAAM,OAAQ,KAAK;AAAA,QACnC,UAAU,KAAK,UAAU,mBAAmB;AAAA,QAC5C;AAAA,MAAA;AAAA,IAEF;AACA,WAAO;AAAA,EACR;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"withHeadings.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/headings/withHeadings.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Element as SlateElement, Point, Range as SlateRange, Transforms } from 'slate'\nimport { ContemberEditor } from '../../../editor'\nimport { ejectHeadingElement, HeadingElement, headingElementPlugin, headingElementType, isHeadingElement } from './HeadingElement'\nimport { headingHtmlDeserializer } from './HeadingHtmlDeserializer'\nimport { ElementRenderer } from '../../../types'\n\nexport const withHeadings = ({ render }: { render: ElementRenderer<HeadingElement> }) => <E extends Editor>(editor: E): E => {\n\tconst {\n\t\tcanToggleElement,\n\t\tinsertBreak,\n\t\tdeleteBackward,\n\t} = editor\n\n\teditor.registerElement(headingElementPlugin({ render }))\n\teditor.htmlDeserializer.registerPlugin(headingHtmlDeserializer)\n\n\t// T O D O cache this\n\t// e.getNumberedHeadingSection = function recurse(element): number[] {\n\t// \tconst [topLevelIndex] = ReactEditor.findPath(e, element)\n\t// \tlet previousNumberedHeadingIndex: number = topLevelIndex - 1\n\t//\n\t// \tlet previousNumberedHeading: SlateNode\n\t// \tdo {\n\t// \t\tpreviousNumberedHeading = e.children[previousNumberedHeadingIndex--]\n\t// \t} while (\n\t// \t\tpreviousNumberedHeadingIndex >= 0 &&\n\t// \t\t!(isHeading(previousNumberedHeading) && previousNumberedHeading.isNumbered)\n\t// \t)\n\t//\n\t// \tif (previousNumberedHeadingIndex < 0) {\n\t// \t\treturn Array(element.level).fill(1)\n\t// \t}\n\t// \tconst previousHeadingSection = recurse(previousNumberedHeading as HeadingElement)\n\t//\n\t// \t// Ensures the correct length - this is essentially padRight with zeros\n\t// \tconst normalizedPrevious = previousHeadingSection.concat(Array(element.level).fill(0)).slice(0, element.level)\n\t//\n\t// \tnormalizedPrevious[normalizedPrevious.length - 1]++\n\t//\n\t// \t// The map isn't really necessary for now but would be if we introduced deeper levels\n\t// \treturn normalizedPrevious.map(level => Math.max(level, 1))\n\t// }\n\n\teditor.canToggleElement = (elementType, suchThat) => {\n\t\tif (elementType !== headingElementType) {\n\t\t\treturn canToggleElement(elementType, suchThat)\n\t\t}\n\t\tif (!editor.selection) {\n\t\t\treturn false\n\t\t}\n\t\tconst closestBlockEntry = ContemberEditor.closestBlockEntry(editor)\n\t\tif (closestBlockEntry === undefined) {\n\t\t\treturn true\n\t\t}\n\t\tconst [closestBlockElement] = closestBlockEntry\n\n\t\treturn (\n\t\t\tSlateElement.isElement(closestBlockElement) && (\n\t\t\t\teditor.isDefaultElement(closestBlockElement)\n\t\t\t\t|| isHeadingElement(closestBlockElement)\n\t\t\t)\n\t\t)\n\t}\n\n\teditor.insertBreak = () => {\n\t\tSlateEditor.withoutNormalizing(editor, () => {\n\t\t\tinsertBreak()\n\n\t\t\tconst { selection } = editor\n\n\t\t\tif (selection === null || SlateRange.isExpanded(selection)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst [topLevelElement, path] = SlateEditor.node(editor, selection, {\n\t\t\t\tdepth: 1,\n\t\t\t})\n\t\t\tif (isHeadingElement(topLevelElement) && SlateEditor.isEmpty(editor, topLevelElement)) {\n\t\t\t\tejectHeadingElement(editor, path)\n\t\t\t}\n\t\t})\n\t}\n\n\teditor.deleteBackward = unit => {\n\t\tconst selection = editor.selection\n\t\tif (unit !== 'character' || !selection || !SlateRange.isCollapsed(selection) || selection.focus.offset !== 0) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\t// The offset being zero doesn't necessarily imply that selection refers to the start of a heading.\n\t\t// It's just a way to early-exit.\n\n\t\tconst closestNumberedEntry = Editor.above<HeadingElement>(editor, {\n\t\t\tmatch: node => SlateElement.isElement(node) && isHeadingElement(node, { isNumbered: true }),\n\t\t})\n\t\tif (closestNumberedEntry === undefined) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\tconst [, headingPath] = closestNumberedEntry\n\t\tconst headingStartPoint = Editor.start(editor, headingPath)\n\n\t\tif (!Point.equals(headingStartPoint, selection.focus)) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\tTransforms.setNodes(\n\t\t\teditor,\n\t\t\t{ isNumbered: null }, // null removes the key altogether\n\t\t\t{ at: headingPath },\n\t\t)\n\t}\n\n\treturn editor\n}\n"],"names":["headingElementPlugin","headingHtmlDeserializer","headingElementType","ContemberEditor","SlateElement","isHeadingElement","SlateEditor","SlateRange","ejectHeadingElement","Editor","Point","Transforms"],"mappings":";;;;;;AAMO,MAAM,eAAe,CAAC,EAAE,OAAA,MAA0D,CAAmB,WAAiB;AAC5H,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACG;AAEJ,SAAO,gBAAgBA,eAAAA,qBAAqB,EAAE,OAAA,CAAQ,CAAC;AACvD,SAAO,iBAAiB,eAAeC,+CAAuB;AA6B9D,SAAO,mBAAmB,CAAC,aAAa,aAAa;AACpD,QAAI,gBAAgBC,eAAAA,oBAAoB;AACvC,aAAO,iBAAiB,aAAa,QAAQ;AA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AAA,OAAO,MAAM,QAAQ,WAAW;AAE1D,QAAI,CAACC,MAAAA,MAAM,OAAO,mBAAmB,UAAU,KAAK,GAAG;AACtD,aAAO,eAAe,IAAI;AAAA,IAC3B;AACAC,UAAAA,WAAW;AAAA,MACV;AAAA,MACA,EAAE,YAAY,KAAA;AAAA;AAAA,MACd,EAAE,IAAI,YAAA;AAAA,IAAY;AAAA,EAEpB;AAEA,SAAO;AACR;;"}
1
+ {"version":3,"file":"withHeadings.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/headings/withHeadings.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Element as SlateElement, Point, Range as SlateRange, Transforms } from 'slate'\nimport { ContemberEditor } from '../../../editor/index.js'\nimport { ejectHeadingElement, HeadingElement, headingElementPlugin, headingElementType, isHeadingElement } from './HeadingElement.js'\nimport { headingHtmlDeserializer } from './HeadingHtmlDeserializer.js'\nimport { ElementRenderer } from '../../../types/index.js'\n\nexport const withHeadings = ({ render }: { render: ElementRenderer<HeadingElement> }) => <E extends Editor>(editor: E): E => {\n\tconst {\n\t\tcanToggleElement,\n\t\tinsertBreak,\n\t\tdeleteBackward,\n\t} = editor\n\n\teditor.registerElement(headingElementPlugin({ render }))\n\teditor.htmlDeserializer.registerPlugin(headingHtmlDeserializer)\n\n\t// T O D O cache this\n\t// e.getNumberedHeadingSection = function recurse(element): number[] {\n\t// \tconst [topLevelIndex] = ReactEditor.findPath(e, element)\n\t// \tlet previousNumberedHeadingIndex: number = topLevelIndex - 1\n\t//\n\t// \tlet previousNumberedHeading: SlateNode\n\t// \tdo {\n\t// \t\tpreviousNumberedHeading = e.children[previousNumberedHeadingIndex--]\n\t// \t} while (\n\t// \t\tpreviousNumberedHeadingIndex >= 0 &&\n\t// \t\t!(isHeading(previousNumberedHeading) && previousNumberedHeading.isNumbered)\n\t// \t)\n\t//\n\t// \tif (previousNumberedHeadingIndex < 0) {\n\t// \t\treturn Array(element.level).fill(1)\n\t// \t}\n\t// \tconst previousHeadingSection = recurse(previousNumberedHeading as HeadingElement)\n\t//\n\t// \t// Ensures the correct length - this is essentially padRight with zeros\n\t// \tconst normalizedPrevious = previousHeadingSection.concat(Array(element.level).fill(0)).slice(0, element.level)\n\t//\n\t// \tnormalizedPrevious[normalizedPrevious.length - 1]++\n\t//\n\t// \t// The map isn't really necessary for now but would be if we introduced deeper levels\n\t// \treturn normalizedPrevious.map(level => Math.max(level, 1))\n\t// }\n\n\teditor.canToggleElement = (elementType, suchThat) => {\n\t\tif (elementType !== headingElementType) {\n\t\t\treturn canToggleElement(elementType, suchThat)\n\t\t}\n\t\tif (!editor.selection) {\n\t\t\treturn false\n\t\t}\n\t\tconst closestBlockEntry = ContemberEditor.closestBlockEntry(editor)\n\t\tif (closestBlockEntry === undefined) {\n\t\t\treturn true\n\t\t}\n\t\tconst [closestBlockElement] = closestBlockEntry\n\n\t\treturn (\n\t\t\tSlateElement.isElement(closestBlockElement) && (\n\t\t\t\teditor.isDefaultElement(closestBlockElement)\n\t\t\t\t|| isHeadingElement(closestBlockElement)\n\t\t\t)\n\t\t)\n\t}\n\n\teditor.insertBreak = () => {\n\t\tSlateEditor.withoutNormalizing(editor, () => {\n\t\t\tinsertBreak()\n\n\t\t\tconst { selection } = editor\n\n\t\t\tif (selection === null || SlateRange.isExpanded(selection)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst [topLevelElement, path] = SlateEditor.node(editor, selection, {\n\t\t\t\tdepth: 1,\n\t\t\t})\n\t\t\tif (isHeadingElement(topLevelElement) && SlateEditor.isEmpty(editor, topLevelElement)) {\n\t\t\t\tejectHeadingElement(editor, path)\n\t\t\t}\n\t\t})\n\t}\n\n\teditor.deleteBackward = unit => {\n\t\tconst selection = editor.selection\n\t\tif (unit !== 'character' || !selection || !SlateRange.isCollapsed(selection) || selection.focus.offset !== 0) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\t// The offset being zero doesn't necessarily imply that selection refers to the start of a heading.\n\t\t// It's just a way to early-exit.\n\n\t\tconst closestNumberedEntry = Editor.above<HeadingElement>(editor, {\n\t\t\tmatch: node => SlateElement.isElement(node) && isHeadingElement(node, { isNumbered: true }),\n\t\t})\n\t\tif (closestNumberedEntry === undefined) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\tconst [, headingPath] = closestNumberedEntry\n\t\tconst headingStartPoint = Editor.start(editor, headingPath)\n\n\t\tif (!Point.equals(headingStartPoint, selection.focus)) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\tTransforms.setNodes(\n\t\t\teditor,\n\t\t\t{ isNumbered: null }, // null removes the key altogether\n\t\t\t{ at: headingPath },\n\t\t)\n\t}\n\n\treturn editor\n}\n"],"names":["headingElementPlugin","headingHtmlDeserializer","headingElementType","ContemberEditor","SlateElement","isHeadingElement","SlateEditor","SlateRange","ejectHeadingElement","Editor","Point","Transforms"],"mappings":";;;;;;AAMO,MAAM,eAAe,CAAC,EAAE,OAAA,MAA0D,CAAmB,WAAiB;AAC5H,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACG;AAEJ,SAAO,gBAAgBA,eAAAA,qBAAqB,EAAE,OAAA,CAAQ,CAAC;AACvD,SAAO,iBAAiB,eAAeC,+CAAuB;AA6B9D,SAAO,mBAAmB,CAAC,aAAa,aAAa;AACpD,QAAI,gBAAgBC,eAAAA,oBAAoB;AACvC,aAAO,iBAAiB,aAAa,QAAQ;AAAA,IAC9C;AACA,QAAI,CAAC,OAAO,WAAW;AACtB,aAAO;AAAA,IACR;AACA,UAAM,oBAAoBC,MAAAA,gBAAgB,kBAAkB,MAAM;AAClE,QAAI,sBAAsB,QAAW;AACpC,aAAO;AAAA,IACR;AACA,UAAM,CAAC,mBAAmB,IAAI;AAE9B,WACCC,MAAAA,QAAa,UAAU,mBAAmB,MACzC,OAAO,iBAAiB,mBAAmB,KACxCC,gCAAiB,mBAAmB;AAAA,EAG1C;AAEA,SAAO,cAAc,MAAM;AAC1BC,iBAAY,m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src/plugins/element/headings/withHeadings.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Element as SlateElement, Point, Range as SlateRange, Transforms } from 'slate'\nimport { ContemberEditor } from '../../../editor'\nimport { ejectHeadingElement, HeadingElement, headingElementPlugin, headingElementType, isHeadingElement } from './HeadingElement'\nimport { headingHtmlDeserializer } from './HeadingHtmlDeserializer'\nimport { ElementRenderer } from '../../../types'\n\nexport const withHeadings = ({ render }: { render: ElementRenderer<HeadingElement> }) => <E extends Editor>(editor: E): E => {\n\tconst {\n\t\tcanToggleElement,\n\t\tinsertBreak,\n\t\tdeleteBackward,\n\t} = editor\n\n\teditor.registerElement(headingElementPlugin({ render }))\n\teditor.htmlDeserializer.registerPlugin(headingHtmlDeserializer)\n\n\t// T O D O cache this\n\t// e.getNumberedHeadingSection = function recurse(element): number[] {\n\t// \tconst [topLevelIndex] = ReactEditor.findPath(e, element)\n\t// \tlet previousNumberedHeadingIndex: number = topLevelIndex - 1\n\t//\n\t// \tlet previousNumberedHeading: SlateNode\n\t// \tdo {\n\t// \t\tpreviousNumberedHeading = e.children[previousNumberedHeadingIndex--]\n\t// \t} while (\n\t// \t\tpreviousNumberedHeadingIndex >= 0 &&\n\t// \t\t!(isHeading(previousNumberedHeading) && previousNumberedHeading.isNumbered)\n\t// \t)\n\t//\n\t// \tif (previousNumberedHeadingIndex < 0) {\n\t// \t\treturn Array(element.level).fill(1)\n\t// \t}\n\t// \tconst previousHeadingSection = recurse(previousNumberedHeading as HeadingElement)\n\t//\n\t// \t// Ensures the correct length - this is essentially padRight with zeros\n\t// \tconst normalizedPrevious = previousHeadingSection.concat(Array(element.level).fill(0)).slice(0, element.level)\n\t//\n\t// \tnormalizedPrevious[normalizedPrevious.length - 1]++\n\t//\n\t// \t// The map isn't really necessary for now but would be if we introduced deeper levels\n\t// \treturn normalizedPrevious.map(level => Math.max(level, 1))\n\t// }\n\n\teditor.canToggleElement = (elementType, suchThat) => {\n\t\tif (elementType !== headingElementType) {\n\t\t\treturn canToggleElement(elementType, suchThat)\n\t\t}\n\t\tif (!editor.selection) {\n\t\t\treturn false\n\t\t}\n\t\tconst closestBlockEntry = ContemberEditor.closestBlockEntry(editor)\n\t\tif (closestBlockEntry === undefined) {\n\t\t\treturn true\n\t\t}\n\t\tconst [closestBlockElement] = closestBlockEntry\n\n\t\treturn (\n\t\t\tSlateElement.isElement(closestBlockElement) && (\n\t\t\t\teditor.isDefaultElement(closestBlockElement)\n\t\t\t\t|| isHeadingElement(closestBlockElement)\n\t\t\t)\n\t\t)\n\t}\n\n\teditor.insertBreak = () => {\n\t\tSlateEditor.withoutNormalizing(editor, () => {\n\t\t\tinsertBreak()\n\n\t\t\tconst { selection } = editor\n\n\t\t\tif (selection === null || SlateRange.isExpanded(selection)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst [topLevelElement, path] = SlateEditor.node(editor, selection, {\n\t\t\t\tdepth: 1,\n\t\t\t})\n\t\t\tif (isHeadingElement(topLevelElement) && SlateEditor.isEmpty(editor, topLevelElement)) {\n\t\t\t\tejectHeadingElement(editor, path)\n\t\t\t}\n\t\t})\n\t}\n\n\teditor.deleteBackward = unit => {\n\t\tconst selection = editor.selection\n\t\tif (unit !== 'character' || !selection || !SlateRange.isCollapsed(selection) || selection.focus.offset !== 0) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\t// The offset being zero doesn't necessarily imply that selection refers to the start of a heading.\n\t\t// It's just a way to early-exit.\n\n\t\tconst closestNumberedEntry = Editor.above<HeadingElement>(editor, {\n\t\t\tmatch: node => SlateElement.isElement(node) && isHeadingElement(node, { isNumbered: true }),\n\t\t})\n\t\tif (closestNumberedEntry === undefined) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\tconst [, headingPath] = closestNumberedEntry\n\t\tconst headingStartPoint = Editor.start(editor, headingPath)\n\n\t\tif (!Point.equals(headingStartPoint, selection.focus)) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\tTransforms.setNodes(\n\t\t\teditor,\n\t\t\t{ isNumbered: null }, // null removes the key altogether\n\t\t\t{ at: headingPath },\n\t\t)\n\t}\n\n\treturn editor\n}\n"],"names":["SlateElement","SlateEditor","SlateRange"],"mappings":";;;;AAMO,MAAM,eAAe,CAAC,EAAE,OAAA,MAA0D,CAAmB,WAAiB;AAC5H,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACG;AAEJ,SAAO,gBAAgB,qBAAqB,EAAE,OAAA,CAAQ,CAAC;AACvD,SAAO,iBAAiB,eAAe,uBAAuB;AA6B9D,SAAO,mBAAmB,CAAC,aAAa,aAAa;AACpD,QAAI,gBAAgB,oBAAoB;AACvC,aAAO,iBAAiB,aAAa,QAAQ;AAAA,IAC9C;AACA,QAAI,CAAC,OAAO,WAAW;AACtB,aAAO;AAAA,IACR;AACA,UAAM,oBAAoB,gBAAgB,kBAAkB,MAAM;AAClE,QAAI,sBAAsB,QAAW;AACpC,aAAO;AAAA,IACR;AACA,UAAM,CAAC,mBAAmB,IAAI;AAE9B,WACCA,QAAa,UAAU,mBAAmB,MACzC,OAAO,iBAAiB,mBAAmB,KACxC,iBAAiB,mBAAmB;AAAA,EAG1C;AAEA,SAAO,cAAc,MAAM;AAC1BC,WAAY,mBAAmB,QAAQ,MAAM;AAC5C,kBAAA;AAEA,YAAM,EAAE,cAAc;AAEtB,UAAI,cAAc,QAAQC,MAAW,WAAW,SAAS,GAAG;AAC3D;AAAA,MACD;AACA,YAAM,CAAC,iBAAiB,IAAI,IAAID,OAAY,KAAK,QAAQ,WAAW;AAAA,QACnE,OAAO;AAAA,MAAA,CACP;AACD,UAAI,iBAAiB,eAAe,KAAKA,OAAY,QAAQ,QAAQ,eAAe,GAAG;AACtF,4BAAoB,QAAQ,IAAI;AAAA,MACjC;AAAA,IACD,CAAC;AAAA,EACF;AAEA,SAAO,iBAAiB,CAAA,SAAQ;AAC/B,UAAM,YAAY,OAAO;AACzB,QAAI,SAAS,eAAe,CAAC,aAAa,CAACC,MAAW,YAAY,SAAS,KAAK,UAAU,MAAM,WAAW,GAAG;AAC7G,aAAO,eAAe,IAAI;AAAA,IAC3B;AAIA,UAAM,uBAAuB,OAAO,MAAsB,QAAQ;AAAA,MACjE,OAAO,CAAA,SAAQF,QAAa,UAAU,IAAI,KAAK,iBAAiB,MAAM,EAAE,YAAY,KAAA,CAAM;AAAA,IAAA,CAC1F;AACD,QAAI,yBAAyB,QAAW;AACvC,aAAO,eAAe,IAAI;AAAA,IAC3B;AACA,UAAM,CAAA,EAAG,WAAW,IAAI;AACxB,UAAM,oBAAoB,OAAO,MAAM,QAAQ,WAAW;AAE1D,QAAI,CAAC,MAAM,OAAO,mBAAmB,UAAU,KAAK,GAAG;AACtD,aAAO,eAAe,IAAI;AAAA,IAC3B;AACA,eAAW;AAAA,MACV;AAAA,MACA,EAAE,YAAY,KAAA;AAAA;AAAA,MACd,EAAE,IAAI,YAAA;AAAA,IAAY;AAAA,EAEpB;AAEA,SAAO;AACR;"}
1
+ {"version":3,"file":"withHeadings.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/headings/withHeadings.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Element as SlateElement, Point, Range as SlateRange, Transforms } from 'slate'\nimport { ContemberEditor } from '../../../editor/index.js'\nimport { ejectHeadingElement, HeadingElement, headingElementPlugin, headingElementType, isHeadingElement } from './HeadingElement.js'\nimport { headingHtmlDeserializer } from './HeadingHtmlDeserializer.js'\nimport { ElementRenderer } from '../../../types/index.js'\n\nexport const withHeadings = ({ render }: { render: ElementRenderer<HeadingElement> }) => <E extends Editor>(editor: E): E => {\n\tconst {\n\t\tcanToggleElement,\n\t\tinsertBreak,\n\t\tdeleteBackward,\n\t} = editor\n\n\teditor.registerElement(headingElementPlugin({ render }))\n\teditor.htmlDeserializer.registerPlugin(headingHtmlDeserializer)\n\n\t// T O D O cache this\n\t// e.getNumberedHeadingSection = function recurse(element): number[] {\n\t// \tconst [topLevelIndex] = ReactEditor.findPath(e, element)\n\t// \tlet previousNumberedHeadingIndex: number = topLevelIndex - 1\n\t//\n\t// \tlet previousNumberedHeading: SlateNode\n\t// \tdo {\n\t// \t\tpreviousNumberedHeading = e.children[previousNumberedHeadingIndex--]\n\t// \t} while (\n\t// \t\tpreviousNumberedHeadingIndex >= 0 &&\n\t// \t\t!(isHeading(previousNumberedHeading) && previousNumberedHeading.isNumbered)\n\t// \t)\n\t//\n\t// \tif (previousNumberedHeadingIndex < 0) {\n\t// \t\treturn Array(element.level).fill(1)\n\t// \t}\n\t// \tconst previousHeadingSection = recurse(previousNumberedHeading as HeadingElement)\n\t//\n\t// \t// Ensures the correct length - this is essentially padRight with zeros\n\t// \tconst normalizedPrevious = previousHeadingSection.concat(Array(element.level).fill(0)).slice(0, element.level)\n\t//\n\t// \tnormalizedPrevious[normalizedPrevious.length - 1]++\n\t//\n\t// \t// The map isn't really necessary for now but would be if we introduced deeper levels\n\t// \treturn normalizedPrevious.map(level => Math.max(level, 1))\n\t// }\n\n\teditor.canToggleElement = (elementType, suchThat) => {\n\t\tif (elementType !== headingElementType) {\n\t\t\treturn canToggleElement(elementType, suchThat)\n\t\t}\n\t\tif (!editor.selection) {\n\t\t\treturn false\n\t\t}\n\t\tconst closestBlockEntry = ContemberEditor.closestBlockEntry(editor)\n\t\tif (closestBlockEntry === undefined) {\n\t\t\treturn true\n\t\t}\n\t\tconst [closestBlockElement] = closestBlockEntry\n\n\t\treturn (\n\t\t\tSlateElement.isElement(closestBlockElement) && (\n\t\t\t\teditor.isDefaultElement(closestBlockElement)\n\t\t\t\t|| isHeadingElement(closestBlockElement)\n\t\t\t)\n\t\t)\n\t}\n\n\teditor.insertBreak = () => {\n\t\tSlateEditor.withoutNormalizing(editor, () => {\n\t\t\tinsertBreak()\n\n\t\t\tconst { selection } = editor\n\n\t\t\tif (selection === null || SlateRange.isExpanded(selection)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst [topLevelElement, path] = SlateEditor.node(editor, selection, {\n\t\t\t\tdepth: 1,\n\t\t\t})\n\t\t\tif (isHeadingElement(topLevelElement) && SlateEditor.isEmpty(editor, topLevelElement)) {\n\t\t\t\tejectHeadingElement(editor, path)\n\t\t\t}\n\t\t})\n\t}\n\n\teditor.deleteBackward = unit => {\n\t\tconst selection = editor.selection\n\t\tif (unit !== 'character' || !selection || !SlateRange.isCollapsed(selection) || selection.focus.offset !== 0) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\t// The offset being zero doesn't necessarily imply that selection refers to the start of a heading.\n\t\t// It's just a way to early-exit.\n\n\t\tconst closestNumberedEntry = Editor.above<HeadingElement>(editor, {\n\t\t\tmatch: node => SlateElement.isElement(node) && isHeadingElement(node, { isNumbered: true }),\n\t\t})\n\t\tif (closestNumberedEntry === undefined) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\tconst [, headingPath] = closestNumberedEntry\n\t\tconst headingStartPoint = Editor.start(editor, headingPath)\n\n\t\tif (!Point.equals(headingStartPoint, selection.focus)) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\tTransforms.setNodes(\n\t\t\teditor,\n\t\t\t{ isNumbered: null }, // null removes the key altogether\n\t\t\t{ at: headingPath },\n\t\t)\n\t}\n\n\treturn editor\n}\n"],"names":["SlateElement","SlateEditor","SlateRange"],"mappings":";;;;AAMO,MAAM,eAAe,CAAC,EAAE,OAAA,MAA0D,CAAmB,WAAiB;AAC5H,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACG;AAEJ,SAAO,gBAAgB,qBAAqB,EAAE,OAAA,CAAQ,CAAC;AACvD,SAAO,iBAAiB,eAAe,uBAAuB;AA6B9D,SAAO,mBAAmB,CAAC,aAAa,aAAa;AACpD,QAAI,gBAAgB,oBAAoB;AACvC,aAAO,iBAAiB,aAAa,QAAQ;AAAA,IAC9C;AACA,QAAI,CAAC,OAAO,WAAW;AACtB,aAAO;AAAA,IACR;AACA,UAAM,oBAAoB,gBAAgB,kBAAkB,MAAM;AAClE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AAA;AAAA,IAAY;AAAA,EAEpB;AAEA,SAAO;AACR;"}
@@ -1 +1 @@
1
- {"version":3,"file":"HorizontalRuleElement.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/horizonalRules/HorizontalRuleElement.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Element as SlateElement, Node as SlateNode, Range as SlateRange, Transforms } from 'slate'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const horizontalRuleElementType = 'horizontalRule' as const\n\nexport interface HorizontalRuleElement extends SlateElement {\n\ttype: typeof horizontalRuleElementType\n\tchildren: SlateEditor['children']\n}\n\nexport const isHorizontalRuleElement = (element: SlateNode): element is HorizontalRuleElement =>\n\tSlateElement.isElement(element) && element.type === horizontalRuleElementType\n\nexport const isHorizontalRuleElementActive = (editor: Editor) => {\n\tconst [hr] = Editor.nodes(editor, { match: isHorizontalRuleElement })\n\treturn !!hr\n}\n\nexport const horizontalRuleElementPlugin = (\n\t{ render }: { render: ElementRenderer<HorizontalRuleElement> },\n): EditorElementPlugin<HorizontalRuleElement> => ({\n\ttype: horizontalRuleElementType,\n\trender,\n\tisVoid: true,\n\ttoggleElement: ({ editor }) => {\n\t\tif (isHorizontalRuleElementActive(editor)) {\n\t\t\tremoveHorizontalRule(editor)\n\t\t} else {\n\t\t\tinsertHorizontalRule(editor)\n\t\t}\n\t},\n})\n\nconst removeHorizontalRule = (editor: Editor) => {\n\tTransforms.removeNodes(editor, { match: isHorizontalRuleElement })\n}\n\nconst insertHorizontalRule = (editor: Editor) => {\n\tconst selection = editor.selection\n\tconst isCollapsed = selection ? SlateRange.isCollapsed(selection!) : false\n\n\tif (!isCollapsed || isHorizontalRuleElementActive(editor)) {\n\t\treturn\n\t}\n\tconst horizontalRule: HorizontalRuleElement = {\n\t\ttype: horizontalRuleElementType,\n\t\tchildren: [{ text: '' }],\n\t}\n\tTransforms.insertNodes(editor, horizontalRule)\n}\n"],"names":["SlateElement","Editor","Transforms","SlateRange"],"mappings":";;;AAGO,MAAM,4BAA4B;AAOlC,MAAM,0BAA0B,CAAC,YACvCA,MAAAA,QAAa,UAAU,OAAO,KAAK,QAAQ,SAAS;AAE9C,MAAM,gCAAgC,CAAC,WAAmB;AAChE,QAAM,CAAC,EAAE,IAAIC,aAAO,MAAM,QAAQ,EAAE,OAAO,yBAAyB;AACpE,SAAO,CAAC,CAAC;AACV;AAEO,MAAM,8BAA8B,CAC1C,EAAE,cAC+C;AAAA,EACjD,MAAM;AAAA,EACN;AAAA,EACA,QAAQ;AAAA,EACR,eAAe,CAAC,EAAE,aAAa;AAC9B,QAAI,8BAA8B,MAAM,GAAG;AAC1C,2BAAqB,MAAM;AAAA,IAC5B,OAAO;AACN,2BAAqB,MAAM;AAAA,IAC5B;AAAA,EACD;AACD;AAEA,MAAM,uBAAuB,CAAC,WAAmB;AAChDC,QAAAA,WAAW,YAAY,QAAQ,EAAE,OAAO,yBAAyB;AAClE;AAEA,MAAM,uBAAuB,CAAC,WAAmB;AAChD,QAAM,YAAY,OAAO;AACzB,QAAM,cAAc,YAAYC,MAAAA,MAAW,YAAY,SAAU,IAAI;AAErE,MAAI,CAAC,eAAe,8BAA8B,MAAM,GAAG;AAC1D;AAAA,EACD;AACA,QAAM,iBAAwC;AAAA,IAC7C,MAAM;AAAA,IACN,UAAU,CAAC,EAAE,MAAM,IAAI;AAAA,EAAA;AAExBD,mBAAW,YAAY,QAAQ,cAAc;AAC9C;;;;;"}
1
+ {"version":3,"file":"HorizontalRuleElement.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/horizonalRules/HorizontalRuleElement.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Element as SlateElement, Node as SlateNode, Range as SlateRange, Transforms } from 'slate'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types/index.js'\n\nexport const horizontalRuleElementType = 'horizontalRule' as const\n\nexport interface HorizontalRuleElement extends SlateElement {\n\ttype: typeof horizontalRuleElementType\n\tchildren: SlateEditor['children']\n}\n\nexport const isHorizontalRuleElement = (element: SlateNode): element is HorizontalRuleElement =>\n\tSlateElement.isElement(element) && element.type === horizontalRuleElementType\n\nexport const isHorizontalRuleElementActive = (editor: Editor) => {\n\tconst [hr] = Editor.nodes(editor, { match: isHorizontalRuleElement })\n\treturn !!hr\n}\n\nexport const horizontalRuleElementPlugin = (\n\t{ render }: { render: ElementRenderer<HorizontalRuleElement> },\n): EditorElementPlugin<HorizontalRuleElement> => ({\n\ttype: horizontalRuleElementType,\n\trender,\n\tisVoid: true,\n\ttoggleElement: ({ editor }) => {\n\t\tif (isHorizontalRuleElementActive(editor)) {\n\t\t\tremoveHorizontalRule(editor)\n\t\t} else {\n\t\t\tinsertHorizontalRule(editor)\n\t\t}\n\t},\n})\n\nconst removeHorizontalRule = (editor: Editor) => {\n\tTransforms.removeNodes(editor, { match: isHorizontalRuleElement })\n}\n\nconst insertHorizontalRule = (editor: Editor) => {\n\tconst selection = editor.selection\n\tconst isCollapsed = selection ? SlateRange.isCollapsed(selection!) : false\n\n\tif (!isCollapsed || isHorizontalRuleElementActive(editor)) {\n\t\treturn\n\t}\n\tconst horizontalRule: HorizontalRuleElement = {\n\t\ttype: horizontalRuleElementType,\n\t\tchildren: [{ text: '' }],\n\t}\n\tTransforms.insertNodes(editor, horizontalRule)\n}\n"],"names":["SlateElement","Editor","Transforms","SlateRange"],"mappings":";;;AAGO,MAAM,4BAA4B;AAOlC,MAAM,0BAA0B,CAAC,YACvCA,MAAAA,QAAa,UAAU,OAAO,KAAK,QAAQ,SAAS;AAE9C,MAAM,gCAAgC,CAAC,WAAmB;AAChE,QAAM,CAAC,EAAE,IAAIC,aAAO,MAAM,QAAQ,EAAE,OAAO,yBAAyB;AACpE,SAAO,CAAC,CAAC;AACV;AAEO,MAAM,8BAA8B,CAC1C,EAAE,cAC+C;AAAA,EACjD,MAAM;AAAA,EACN;AAAA,EACA,QAAQ;AAAA,EACR,eAAe,CAAC,EAAE,aAAa;AAC9B,QAAI,8BAA8B,MAAM,GAAG;AAC1C,2BAAqB,MAAM;AAAA,IAC5B,OAAO;AACN,2BAAqB,MAAM;AAAA,IAC5B;AAAA,EACD;AACD;AAEA,MAAM,uBAAuB,CAAC,WAAmB;AAChDC,QAAAA,WAAW,YAAY,QAAQ,EAAE,OAAO,yBAAyB;AAClE;AAEA,MAAM,uBAAuB,CAAC,WAAmB;AAChD,QAAM,YAAY,OAAO;AACzB,QAAM,cAAc,YAAYC,MAAAA,MAAW,YAAY,SAAU,IAAI;AAErE,MAAI,CAAC,eAAe,8BAA8B,MAAM,GAAG;AAC1D;AAAA,EACD;AACA,QAAM,iBAAwC;AAAA,IAC7C,MAAM;AAAA,IACN,UAAU,CAAC,EAAE,MAAM,IAAI;AAAA,EAAA;AAExBD,mBAAW,YAAY,QAAQ,cAAc;AAC9C;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"HorizontalRuleElement.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/horizonalRules/HorizontalRuleElement.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Element as SlateElement, Node as SlateNode, Range as SlateRange, Transforms } from 'slate'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const horizontalRuleElementType = 'horizontalRule' as const\n\nexport interface HorizontalRuleElement extends SlateElement {\n\ttype: typeof horizontalRuleElementType\n\tchildren: SlateEditor['children']\n}\n\nexport const isHorizontalRuleElement = (element: SlateNode): element is HorizontalRuleElement =>\n\tSlateElement.isElement(element) && element.type === horizontalRuleElementType\n\nexport const isHorizontalRuleElementActive = (editor: Editor) => {\n\tconst [hr] = Editor.nodes(editor, { match: isHorizontalRuleElement })\n\treturn !!hr\n}\n\nexport const horizontalRuleElementPlugin = (\n\t{ render }: { render: ElementRenderer<HorizontalRuleElement> },\n): EditorElementPlugin<HorizontalRuleElement> => ({\n\ttype: horizontalRuleElementType,\n\trender,\n\tisVoid: true,\n\ttoggleElement: ({ editor }) => {\n\t\tif (isHorizontalRuleElementActive(editor)) {\n\t\t\tremoveHorizontalRule(editor)\n\t\t} else {\n\t\t\tinsertHorizontalRule(editor)\n\t\t}\n\t},\n})\n\nconst removeHorizontalRule = (editor: Editor) => {\n\tTransforms.removeNodes(editor, { match: isHorizontalRuleElement })\n}\n\nconst insertHorizontalRule = (editor: Editor) => {\n\tconst selection = editor.selection\n\tconst isCollapsed = selection ? SlateRange.isCollapsed(selection!) : false\n\n\tif (!isCollapsed || isHorizontalRuleElementActive(editor)) {\n\t\treturn\n\t}\n\tconst horizontalRule: HorizontalRuleElement = {\n\t\ttype: horizontalRuleElementType,\n\t\tchildren: [{ text: '' }],\n\t}\n\tTransforms.insertNodes(editor, horizontalRule)\n}\n"],"names":["SlateElement","SlateRange"],"mappings":";AAGO,MAAM,4BAA4B;AAOlC,MAAM,0BAA0B,CAAC,YACvCA,QAAa,UAAU,OAAO,KAAK,QAAQ,SAAS;AAE9C,MAAM,gCAAgC,CAAC,WAAmB;AAChE,QAAM,CAAC,EAAE,IAAI,OAAO,MAAM,QAAQ,EAAE,OAAO,yBAAyB;AACpE,SAAO,CAAC,CAAC;AACV;AAEO,MAAM,8BAA8B,CAC1C,EAAE,cAC+C;AAAA,EACjD,MAAM;AAAA,EACN;AAAA,EACA,QAAQ;AAAA,EACR,eAAe,CAAC,EAAE,aAAa;AAC9B,QAAI,8BAA8B,MAAM,GAAG;AAC1C,2BAAqB,MAAM;AAAA,IAC5B,OAAO;AACN,2BAAqB,MAAM;AAAA,IAC5B;AAAA,EACD;AACD;AAEA,MAAM,uBAAuB,CAAC,WAAmB;AAChD,aAAW,YAAY,QAAQ,EAAE,OAAO,yBAAyB;AAClE;AAEA,MAAM,uBAAuB,CAAC,WAAmB;AAChD,QAAM,YAAY,OAAO;AACzB,QAAM,cAAc,YAAYC,MAAW,YAAY,SAAU,IAAI;AAErE,MAAI,CAAC,eAAe,8BAA8B,MAAM,GAAG;AAC1D;AAAA,EACD;AACA,QAAM,iBAAwC;AAAA,IAC7C,MAAM;AAAA,IACN,UAAU,CAAC,EAAE,MAAM,IAAI;AAAA,EAAA;AAExB,aAAW,YAAY,QAAQ,cAAc;AAC9C;"}
1
+ {"version":3,"file":"HorizontalRuleElement.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/horizonalRules/HorizontalRuleElement.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Element as SlateElement, Node as SlateNode, Range as SlateRange, Transforms } from 'slate'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types/index.js'\n\nexport const horizontalRuleElementType = 'horizontalRule' as const\n\nexport interface HorizontalRuleElement extends SlateElement {\n\ttype: typeof horizontalRuleElementType\n\tchildren: SlateEditor['children']\n}\n\nexport const isHorizontalRuleElement = (element: SlateNode): element is HorizontalRuleElement =>\n\tSlateElement.isElement(element) && element.type === horizontalRuleElementType\n\nexport const isHorizontalRuleElementActive = (editor: Editor) => {\n\tconst [hr] = Editor.nodes(editor, { match: isHorizontalRuleElement })\n\treturn !!hr\n}\n\nexport const horizontalRuleElementPlugin = (\n\t{ render }: { render: ElementRenderer<HorizontalRuleElement> },\n): EditorElementPlugin<HorizontalRuleElement> => ({\n\ttype: horizontalRuleElementType,\n\trender,\n\tisVoid: true,\n\ttoggleElement: ({ editor }) => {\n\t\tif (isHorizontalRuleElementActive(editor)) {\n\t\t\tremoveHorizontalRule(editor)\n\t\t} else {\n\t\t\tinsertHorizontalRule(editor)\n\t\t}\n\t},\n})\n\nconst removeHorizontalRule = (editor: Editor) => {\n\tTransforms.removeNodes(editor, { match: isHorizontalRuleElement })\n}\n\nconst insertHorizontalRule = (editor: Editor) => {\n\tconst selection = editor.selection\n\tconst isCollapsed = selection ? SlateRange.isCollapsed(selection!) : false\n\n\tif (!isCollapsed || isHorizontalRuleElementActive(editor)) {\n\t\treturn\n\t}\n\tconst horizontalRule: HorizontalRuleElement = {\n\t\ttype: horizontalRuleElementType,\n\t\tchildren: [{ text: '' }],\n\t}\n\tTransforms.insertNodes(editor, horizontalRule)\n}\n"],"names":["SlateElement","SlateRange"],"mappings":";AAGO,MAAM,4BAA4B;AAOlC,MAAM,0BAA0B,CAAC,YACvCA,QAAa,UAAU,OAAO,KAAK,QAAQ,SAAS;AAE9C,MAAM,gCAAgC,CAAC,WAAmB;AAChE,QAAM,CAAC,EAAE,IAAI,OAAO,MAAM,QAAQ,EAAE,OAAO,yBAAyB;AACpE,SAAO,CAAC,CAAC;AACV;AAEO,MAAM,8BAA8B,CAC1C,EAAE,cAC+C;AAAA,EACjD,MAAM;AAAA,EACN;AAAA,EACA,QAAQ;AAAA,EACR,eAAe,CAAC,EAAE,aAAa;AAC9B,QAAI,8BAA8B,MAAM,GAAG;AAC1C,2BAAqB,MAAM;AAAA,IAC5B,OAAO;AACN,2BAAqB,MAAM;AAAA,IAC5B;AAAA,EACD;AACD;AAEA,MAAM,uBAAuB,CAAC,WAAmB;AAChD,aAAW,YAAY,QAAQ,EAAE,OAAO,yBAAyB;AAClE;AAEA,MAAM,uBAAuB,CAAC,WAAmB;AAChD,QAAM,YAAY,OAAO;AACzB,QAAM,cAAc,YAAYC,MAAW,YAAY,SAAU,IAAI;AAErE,MAAI,CAAC,eAAe,8BAA8B,MAAM,GAAG;AAC1D;AAAA,EACD;AACA,QAAM,iBAAwC;AAAA,IAC7C,MAAM;AAAA,IACN,UAAU,CAAC,EAAE,MAAM,IAAI;AAAA,EAAA;AAExB,aAAW,YAAY,QAAQ,cAAc;AAC9C;"}
@@ -1 +1 @@
1
- {"version":3,"file":"withHorizontalRules.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/horizonalRules/withHorizontalRules.ts"],"sourcesContent":["import { Editor, Element as SlateElement, Node as SlateNode, NodeEntry, Range as SlateRange, Text, Transforms } from 'slate'\nimport { HorizontalRuleElement, horizontalRuleElementPlugin, horizontalRuleElementType } from './HorizontalRuleElement'\nimport { ElementRenderer } from '../../../types'\n\nexport const withHorizontalRules = ({ render }: { render: ElementRenderer<HorizontalRuleElement> }) => <E extends Editor>(editor: E): E => {\n\tconst { insertText } = editor\n\n\teditor.registerElement(horizontalRuleElementPlugin({ render }))\n\n\teditor.insertText = text => {\n\t\tinsertText(text)\n\t\tif (text !== '-') {\n\t\t\treturn\n\t\t}\n\t\tconst selection = editor.selection\n\t\tif (!selection || !SlateRange.isCollapsed(selection)) {\n\t\t\treturn\n\t\t}\n\t\tconst focusPoint = selection.focus\n\n\t\tif (focusPoint.offset < 3) {\n\t\t\treturn\n\t\t}\n\t\tconst [targetTextNode, targetPath] = Editor.node(editor, focusPoint)\n\t\tif (!Text.isText(targetTextNode)) {\n\t\t\treturn\n\t\t}\n\t\tconst slice = targetTextNode.text.slice(focusPoint.offset - 3, focusPoint.offset)\n\t\tif (slice !== '---') {\n\t\t\treturn\n\t\t}\n\n\t\tEditor.withoutNormalizing(editor, () => {\n\t\t\tlet closestBlockEntry: NodeEntry | undefined = Editor.above(editor, {\n\t\t\t\tat: focusPoint,\n\t\t\t\tmode: 'lowest',\n\t\t\t\tmatch: matchedNode => SlateElement.isElement(matchedNode) && !editor.isInline(matchedNode) && editor.isDefaultElement(matchedNode),\n\t\t\t})\n\t\t\tif (!closestBlockEntry) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst [closestBlock, closestBlockPath] = closestBlockEntry\n\t\t\tif (closestBlockPath.length !== 1 || SlateNode.string(closestBlock) !== '---') {\n\t\t\t\treturn // We only support horizontal rules at the very top level.\n\t\t\t}\n\n\t\t\t// First insert the rule after the closest block\n\t\t\tconst horizontalRule: HorizontalRuleElement = {\n\t\t\t\ttype: horizontalRuleElementType,\n\t\t\t\tchildren: [{ text: '' }],\n\t\t\t}\n\t\t\tconst newHrPath = [...closestBlockPath.slice(0, -1), closestBlockPath[closestBlockPath.length - 1] + 1]\n\t\t\tTransforms.insertNodes(editor, horizontalRule, {\n\t\t\t\tat: newHrPath,\n\t\t\t})\n\n\t\t\t// Remove the '---'\n\t\t\teditor.deleteBackward('character')\n\t\t\teditor.deleteBackward('character')\n\t\t\teditor.deleteBackward('character')\n\n\t\t\tconst pointAfter = Editor.after(editor, newHrPath)\n\t\t\tif (pointAfter) {\n\t\t\t\tTransforms.select(editor, pointAfter)\n\t\t\t} else {\n\t\t\t\t// There's nothing to select so we're likely at the end. Insert a new default element then.\n\t\t\t\tconst targetPath = [...newHrPath.slice(0, -1), newHrPath[newHrPath.length - 1] + 1]\n\t\t\t\tTransforms.insertNodes(editor, editor.createDefaultElement([{ text: '' }]), {\n\t\t\t\t\tat: targetPath,\n\t\t\t\t\tselect: true,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\t// Lastly, if remove the closest block. Need to update the entry though.\n\t\t\tclosestBlockEntry = Editor.node(editor, closestBlockPath)\n\t\t\tif (!closestBlockEntry) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tTransforms.removeNodes(editor, {\n\t\t\t\tat: closestBlockEntry[1],\n\t\t\t})\n\t\t})\n\t}\n\n\treturn editor\n}\n"],"names":["horizontalRuleElementPlugin","SlateRange","Editor","Text","SlateElement","SlateNode","horizontalRuleElementType","Transforms","targetPath"],"mappings":";;;;AAIO,MAAM,sBAAsB,CAAC,EAAE,OAAA,MAAiE,CAAmB,WAAiB;AAC1I,QAAM,EAAE,eAAe;AAEvB,SAAO,gBAAgBA,sBAAAA,4BAA4B,EAAE,OAAA,CAAQ,CAAC;AAE9D,SAAO,aAAa,CAAA,SAAQ;AAC3B,eAAW,IAAI;AACf,QAAI,SAAS,KAAK;AACjB;AAAA,IACD;AACA,UAAM,YAAY,OAAO;AACzB,QAAI,CAAC,aAAa,CAACC,MAAAA,MAAW,YAAY,SAAS,GAAG;AACrD;AAAA,IACD;AACA,UAAM,aAAa,UAAU;AAE7B,QAAI,WAAW,SAAS,GAAG;AAC1B;AAAA,IACD;AACA,UAAM,CAAC,gBAAgB,UAAU,IAAIC,MAAAA,OAAO,KAAK,QAAQ,UAAU;AACnE,QAAI,CAACC,MAAAA,KAAK,OAAO,cAAc,GAAG;AACjC;AAAA,IACD;AACA,UAAM,QAAQ,eAAe,KAAK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AAAA,OAAO,KAAK,QAAQ,gBAAgB;AACxD,UAAI,CAAC,mBAAmB;AACvB;AAAA,MACD;AACAK,YAAAA,WAAW,YAAY,QAAQ;AAAA,QAC9B,IAAI,kBAAkB,CAAC;AAAA,MAAA,CACvB;AAAA,IACF,CAAC;AAAA,EACF;AAEA,SAAO;AACR;;"}
1
+ {"version":3,"file":"withHorizontalRules.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/horizonalRules/withHorizontalRules.ts"],"sourcesContent":["import { Editor, Element as SlateElement, Node as SlateNode, NodeEntry, Range as SlateRange, Text, Transforms } from 'slate'\nimport { HorizontalRuleElement, horizontalRuleElementPlugin, horizontalRuleElementType } from './HorizontalRuleElement.js'\nimport { ElementRenderer } from '../../../types/index.js'\n\nexport const withHorizontalRules = ({ render }: { render: ElementRenderer<HorizontalRuleElement> }) => <E extends Editor>(editor: E): E => {\n\tconst { insertText } = editor\n\n\teditor.registerElement(horizontalRuleElementPlugin({ render }))\n\n\teditor.insertText = text => {\n\t\tinsertText(text)\n\t\tif (text !== '-') {\n\t\t\treturn\n\t\t}\n\t\tconst selection = editor.selection\n\t\tif (!selection || !SlateRange.isCollapsed(selection)) {\n\t\t\treturn\n\t\t}\n\t\tconst focusPoint = selection.focus\n\n\t\tif (focusPoint.offset < 3) {\n\t\t\treturn\n\t\t}\n\t\tconst [targetTextNode, targetPath] = Editor.node(editor, focusPoint)\n\t\tif (!Text.isText(targetTextNode)) {\n\t\t\treturn\n\t\t}\n\t\tconst slice = targetTextNode.text.slice(focusPoint.offset - 3, focusPoint.offset)\n\t\tif (slice !== '---') {\n\t\t\treturn\n\t\t}\n\n\t\tEditor.withoutNormalizing(editor, () => {\n\t\t\tlet closestBlockEntry: NodeEntry | undefined = Editor.above(editor, {\n\t\t\t\tat: focusPoint,\n\t\t\t\tmode: 'lowest',\n\t\t\t\tmatch: matchedNode => SlateElement.isElement(matchedNode) && !editor.isInline(matchedNode) && editor.isDefaultElement(matchedNode),\n\t\t\t})\n\t\t\tif (!closestBlockEntry) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst [closestBlock, closestBlockPath] = closestBlockEntry\n\t\t\tif (closestBlockPath.length !== 1 || SlateNode.string(closestBlock) !== '---') {\n\t\t\t\treturn // We only support horizontal rules at the very top level.\n\t\t\t}\n\n\t\t\t// First insert the rule after the closest block\n\t\t\tconst horizontalRule: HorizontalRuleElement = {\n\t\t\t\ttype: horizontalRuleElementType,\n\t\t\t\tchildren: [{ text: '' }],\n\t\t\t}\n\t\t\tconst newHrPath = [...closestBlockPath.slice(0, -1), closestBlockPath[closestBlockPath.length - 1] + 1]\n\t\t\tTransforms.insertNodes(editor, horizontalRule, {\n\t\t\t\tat: newHrPath,\n\t\t\t})\n\n\t\t\t// Remove the '---'\n\t\t\teditor.deleteBackward('character')\n\t\t\teditor.deleteBackward('character')\n\t\t\teditor.deleteBackward('character')\n\n\t\t\tconst pointAfter = Editor.after(editor, newHrPath)\n\t\t\tif (pointAfter) {\n\t\t\t\tTransforms.select(editor, pointAfter)\n\t\t\t} else {\n\t\t\t\t// There's nothing to select so we're likely at the end. Insert a new default element then.\n\t\t\t\tconst targetPath = [...newHrPath.slice(0, -1), newHrPath[newHrPath.length - 1] + 1]\n\t\t\t\tTransforms.insertNodes(editor, editor.createDefaultElement([{ text: '' }]), {\n\t\t\t\t\tat: targetPath,\n\t\t\t\t\tselect: true,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\t// Lastly, if remove the closest block. Need to update the entry though.\n\t\t\tclosestBlockEntry = Editor.node(editor, closestBlockPath)\n\t\t\tif (!closestBlockEntry) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tTransforms.removeNodes(editor, {\n\t\t\t\tat: closestBlockEntry[1],\n\t\t\t})\n\t\t})\n\t}\n\n\treturn editor\n}\n"],"names":["horizontalRuleElementPlugin","SlateRange","Editor","Text","SlateElement","SlateNode","horizontalRuleElementType","Transforms","targetPath"],"mappings":";;;;AAIO,MAAM,sBAAs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AiB,SAAS,CAAC,IAAI,CAAC;AACtGC,uBAAW,YAAY,QAAQ,gBAAgB;AAAA,QAC9C,IAAI;AAAA,MAAA,CACJ;AAGD,aAAO,eAAe,WAAW;AACjC,aAAO,eAAe,WAAW;AACjC,aAAO,eAAe,WAAW;AAEjC,YAAM,aAAaL,MAAAA,OAAO,MAAM,QAAQ,SAAS;AACjD,UAAI,YAAY;AACfK,yBAAW,OAAO,QAAQ,UAAU;AAAA,MACrC,OAAO;AAEN,cAAMC,cAAa,CAAC,GAAG,UAAU,MAAM,GAAG,EAAE,GAAG,UAAU,UAAU,SAAS,CAAC,IAAI,CAAC;AAClFD,yBAAW,YAAY,QAAQ,OAAO,qBAAqB,CAAC,EAAE,MAAM,GAAA,CAAI,CAAC,GAAG;AAAA,UAC3E,IAAIC;AAAAA,UACJ,QAAQ;AAAA,QAAA,CACR;AAAA,MACF;AAGA,0BAAoBN,MAAAA,OAAO,KAAK,QAAQ,gBAAgB;AACxD,UAAI,CAAC,mBAAmB;AACvB;AAAA,MACD;AACAK,YAAAA,WAAW,YAAY,QAAQ;AAAA,QAC9B,IAAI,kBAAkB,CAAC;AAAA,MAAA,CACvB;AAAA,IACF,CAAC;AAAA,EACF;AAEA,SAAO;AACR;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"withHorizontalRules.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/horizonalRules/withHorizontalRules.ts"],"sourcesContent":["import { Editor, Element as SlateElement, Node as SlateNode, NodeEntry, Range as SlateRange, Text, Transforms } from 'slate'\nimport { HorizontalRuleElement, horizontalRuleElementPlugin, horizontalRuleElementType } from './HorizontalRuleElement'\nimport { ElementRenderer } from '../../../types'\n\nexport const withHorizontalRules = ({ render }: { render: ElementRenderer<HorizontalRuleElement> }) => <E extends Editor>(editor: E): E => {\n\tconst { insertText } = editor\n\n\teditor.registerElement(horizontalRuleElementPlugin({ render }))\n\n\teditor.insertText = text => {\n\t\tinsertText(text)\n\t\tif (text !== '-') {\n\t\t\treturn\n\t\t}\n\t\tconst selection = editor.selection\n\t\tif (!selection || !SlateRange.isCollapsed(selection)) {\n\t\t\treturn\n\t\t}\n\t\tconst focusPoint = selection.focus\n\n\t\tif (focusPoint.offset < 3) {\n\t\t\treturn\n\t\t}\n\t\tconst [targetTextNode, targetPath] = Editor.node(editor, focusPoint)\n\t\tif (!Text.isText(targetTextNode)) {\n\t\t\treturn\n\t\t}\n\t\tconst slice = targetTextNode.text.slice(focusPoint.offset - 3, focusPoint.offset)\n\t\tif (slice !== '---') {\n\t\t\treturn\n\t\t}\n\n\t\tEditor.withoutNormalizing(editor, () => {\n\t\t\tlet closestBlockEntry: NodeEntry | undefined = Editor.above(editor, {\n\t\t\t\tat: focusPoint,\n\t\t\t\tmode: 'lowest',\n\t\t\t\tmatch: matchedNode => SlateElement.isElement(matchedNode) && !editor.isInline(matchedNode) && editor.isDefaultElement(matchedNode),\n\t\t\t})\n\t\t\tif (!closestBlockEntry) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst [closestBlock, closestBlockPath] = closestBlockEntry\n\t\t\tif (closestBlockPath.length !== 1 || SlateNode.string(closestBlock) !== '---') {\n\t\t\t\treturn // We only support horizontal rules at the very top level.\n\t\t\t}\n\n\t\t\t// First insert the rule after the closest block\n\t\t\tconst horizontalRule: HorizontalRuleElement = {\n\t\t\t\ttype: horizontalRuleElementType,\n\t\t\t\tchildren: [{ text: '' }],\n\t\t\t}\n\t\t\tconst newHrPath = [...closestBlockPath.slice(0, -1), closestBlockPath[closestBlockPath.length - 1] + 1]\n\t\t\tTransforms.insertNodes(editor, horizontalRule, {\n\t\t\t\tat: newHrPath,\n\t\t\t})\n\n\t\t\t// Remove the '---'\n\t\t\teditor.deleteBackward('character')\n\t\t\teditor.deleteBackward('character')\n\t\t\teditor.deleteBackward('character')\n\n\t\t\tconst pointAfter = Editor.after(editor, newHrPath)\n\t\t\tif (pointAfter) {\n\t\t\t\tTransforms.select(editor, pointAfter)\n\t\t\t} else {\n\t\t\t\t// There's nothing to select so we're likely at the end. Insert a new default element then.\n\t\t\t\tconst targetPath = [...newHrPath.slice(0, -1), newHrPath[newHrPath.length - 1] + 1]\n\t\t\t\tTransforms.insertNodes(editor, editor.createDefaultElement([{ text: '' }]), {\n\t\t\t\t\tat: targetPath,\n\t\t\t\t\tselect: true,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\t// Lastly, if remove the closest block. Need to update the entry though.\n\t\t\tclosestBlockEntry = Editor.node(editor, closestBlockPath)\n\t\t\tif (!closestBlockEntry) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tTransforms.removeNodes(editor, {\n\t\t\t\tat: closestBlockEntry[1],\n\t\t\t})\n\t\t})\n\t}\n\n\treturn editor\n}\n"],"names":["SlateRange","SlateElement","SlateNode","targetPath"],"mappings":";;AAIO,MAAM,sBAAsB,CAAC,EAAE,OAAA,MAAiE,CAAmB,WAAiB;AAC1I,QAAM,EAAE,eAAe;AAEvB,SAAO,gBAAgB,4BAA4B,EAAE,OAAA,CAAQ,CAAC;AAE9D,SAAO,aAAa,CAAA,SAAQ;AAC3B,eAAW,IAAI;AACf,QAAI,SAAS,KAAK;AACjB;AAAA,IACD;AACA,UAAM,YAAY,OAAO;AACzB,QAAI,CAAC,aAAa,CAACA,MAAW,YAAY,SAAS,GAAG;AACrD;AAAA,IACD;AACA,UAAM,aAAa,UAAU;AAE7B,QAAI,WAAW,SAAS,GAAG;AAC1B;AAAA,IACD;AACA,UAAM,CAAC,gBAAgB,UAAU,IAAI,OAAO,KAAK,QAAQ,UAAU;AACnE,QAAI,CAAC,KAAK,OAAO,cAAc,GAAG;AACjC;AAAA,IACD;AACA,UAAM,QAAQ,eAAe,KAAK,MAAM,WAAW,SAAS,GAAG,WAAW,MAAM;AAChF,QAAI,UAAU,OAAO;AACpB;AAAA,IACD;AAEA,WAAO,mBAAmB,QAAQ,MAAM;AACvC,UAAI,oBAA2C,OAAO,MAAM,QAAQ;AAAA,QACnE,IAAI;AAAA,QACJ,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","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/horizonalRules/withHorizontalRules.ts"],"sourcesContent":["import { Editor, Element as SlateElement, Node as SlateNode, NodeEntry, Range as SlateRange, Text, Transforms } from 'slate'\nimport { HorizontalRuleElement, horizontalRuleElementPlugin, horizontalRuleElementType } from './HorizontalRuleElement.js'\nimport { ElementRenderer } from '../../../types/index.js'\n\nexport const withHorizontalRules = ({ render }: { render: ElementRenderer<HorizontalRuleElement> }) => <E extends Editor>(editor: E): E => {\n\tconst { insertText } = editor\n\n\teditor.registerElement(horizontalRuleElementPlugin({ render }))\n\n\teditor.insertText = text => {\n\t\tinsertText(text)\n\t\tif (text !== '-') {\n\t\t\treturn\n\t\t}\n\t\tconst selection = editor.selection\n\t\tif (!selection || !SlateRange.isCollapsed(selection)) {\n\t\t\treturn\n\t\t}\n\t\tconst focusPoint = selection.focus\n\n\t\tif (focusPoint.offset < 3) {\n\t\t\treturn\n\t\t}\n\t\tconst [targetTextNode, targetPath] = Editor.node(editor, focusPoint)\n\t\tif (!Text.isText(targetTextNode)) {\n\t\t\treturn\n\t\t}\n\t\tconst slice = targetTextNode.text.slice(focusPoint.offset - 3, focusPoint.offset)\n\t\tif (slice !== '---') {\n\t\t\treturn\n\t\t}\n\n\t\tEditor.withoutNormalizing(editor, () => {\n\t\t\tlet closestBlockEntry: NodeEntry | undefined = Editor.above(editor, {\n\t\t\t\tat: focusPoint,\n\t\t\t\tmode: 'lowest',\n\t\t\t\tmatch: matchedNode => SlateElement.isElement(matchedNode) && !editor.isInline(matchedNode) && editor.isDefaultElement(matchedNode),\n\t\t\t})\n\t\t\tif (!closestBlockEntry) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst [closestBlock, closestBlockPath] = closestBlockEntry\n\t\t\tif (closestBlockPath.length !== 1 || SlateNode.string(closestBlock) !== '---') {\n\t\t\t\treturn // We only support horizontal rules at the very top level.\n\t\t\t}\n\n\t\t\t// First insert the rule after the closest block\n\t\t\tconst horizontalRule: HorizontalRuleElement = {\n\t\t\t\ttype: horizontalRuleElementType,\n\t\t\t\tchildren: [{ text: '' }],\n\t\t\t}\n\t\t\tconst newHrPath = [...closestBlockPath.slice(0, -1), closestBlockPath[closestBlockPath.length - 1] + 1]\n\t\t\tTransforms.insertNodes(editor, horizontalRule, {\n\t\t\t\tat: newHrPath,\n\t\t\t})\n\n\t\t\t// Remove the '---'\n\t\t\teditor.deleteBackward('character')\n\t\t\teditor.deleteBackward('character')\n\t\t\teditor.deleteBackward('character')\n\n\t\t\tconst pointAfter = Editor.after(editor, newHrPath)\n\t\t\tif (pointAfter) {\n\t\t\t\tTransforms.select(editor, pointAfter)\n\t\t\t} else {\n\t\t\t\t// There's nothing to select so we're likely at the end. Insert a new default element then.\n\t\t\t\tconst targetPath = [...newHrPath.slice(0, -1), newHrPath[newHrPath.length - 1] + 1]\n\t\t\t\tTransforms.insertNodes(editor, editor.createDefaultElement([{ text: '' }]), {\n\t\t\t\t\tat: targetPath,\n\t\t\t\t\tselect: true,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\t// Lastly, if remove the closest block. Need to update the entry though.\n\t\t\tclosestBlockEntry = Editor.node(editor, closestBlockPath)\n\t\t\tif (!closestBlockEntry) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tTransforms.removeNodes(editor, {\n\t\t\t\tat: closestBlockEntry[1],\n\t\t\t})\n\t\t})\n\t}\n\n\treturn editor\n}\n"],"names":["SlateRange","SlateElement","SlateNode","targetPath"],"mappings":";;AAIO,MAAM,sBAAsB,CAAC,EAAE,OAAA,MAAiE,CAAmB,WAAiB;AAC1I,QAAM,EAAE,eAAe;AAEvB,SAAO,gBAAgB,4BAA4B,EAAE,OAAA,CAAQ,CAAC;AAE9D,SAAO,aAAa,CAAA,SAAQ;AAC3B,eAAW,IAAI;AACf,QAAI,SAAS,KAAK;AACjB;AAAA,IACD;AACA,UAAM,YAAY,OAAO;AACzB,QAAI,CAAC,aAAa,CAACA,MAAW,YAAY,SAAS,GAA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U,UAAU,SAAS,CAAC,IAAI,CAAC;AAClF,mBAAW,YAAY,QAAQ,OAAO,qBAAqB,CAAC,EAAE,MAAM,GAAA,CAAI,CAAC,GAAG;AAAA,UAC3E,IAAIA;AAAAA,UACJ,QAAQ;AAAA,QAAA,CACR;AAAA,MACF;AAGA,0BAAoB,OAAO,KAAK,QAAQ,gBAAgB;AACxD,UAAI,CAAC,mBAAmB;AACvB;AAAA,MACD;AACA,iBAAW,YAAY,QAAQ;AAAA,QAC9B,IAAI,kBAAkB,CAAC;AAAA,MAAA,CACvB;AAAA,IACF,CAAC;AAAA,EACF;AAEA,SAAO;AACR;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ListElement.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/lists/ListElement.ts"],"sourcesContent":["import { Editor, Element, Element as SlateElement, Node, Path as SlatePath } from 'slate'\nimport { isUnorderedListElement, UnorderedListElement } from './UnorderedListElement'\nimport { isOrderedListElement, OrderedListElement } from './OrderedListElement'\nimport { ContemberEditor } from '../../../editor'\nimport { isListItemElement } from './ListItemElement'\n\nexport const isListElement = <T extends UnorderedListElement | OrderedListElement>(\n\telement: Node,\n\tsuchThat?: Partial<T>,\n): element is T =>\n\tisOrderedListElement(element, suchThat as Partial<OrderedListElement>) || isUnorderedListElement(element, suchThat as Partial<UnorderedListElement>)\n\nexport const getParentListElement = (editor: Editor): Element | undefined => {\n\tconst closestNonDefaultEntry = ContemberEditor.closest(editor, {\n\t\tmatch: node => SlateElement.isElement(node) && Editor.isBlock(editor, node) && !editor.isDefaultElement(node),\n\t})\n\tif (!closestNonDefaultEntry) {\n\t\treturn undefined\n\t}\n\tconst [closestNonDefaultElement, closestNonDefaultPath] = closestNonDefaultEntry\n\tif (isListItemElement(closestNonDefaultElement)) {\n\t\treturn Editor.node(editor, SlatePath.parent(closestNonDefaultPath))[0] as SlateElement\n\t} else if (isListElement(closestNonDefaultElement)) {\n\t\treturn closestNonDefaultElement\n\t}\n\treturn undefined\n}\n"],"names":["isOrderedListElement","isUnorderedListElement","ContemberEditor","SlateElement","Editor","isListItemElement","SlatePath"],"mappings":";;;;;;;AAMO,MAAM,gBAAgB,CAC5B,SACA,aAEAA,mBAAAA,qBAAqB,SAAS,QAAuC,KAAKC,4CAAuB,SAAS,QAAyC;AAE7I,MAAM,uBAAuB,CAAC,WAAwC;AAC5E,QAAM,yBAAyBC,MAAAA,gBAAgB,QAAQ,QAAQ;AAAA,IAC9D,OAAO,CAAA,SAAQC,MAAAA,QAAa,UAAU,IAAI,KAAKC,MAAAA,OAAO,QAAQ,QAAQ,IAAI,KAAK,CAAC,OAAO,iBAAiB,IAAI;AAAA,EAAA,CAC5G;AACD,MAAI,CAAC,wBAAwB;AAC5B,WAAO;AAAA,EACR;AACA,QAAM,CAAC,0BAA0B,qBAAqB,IAAI;AAC1D,MAAIC,gBAAAA,kBAAkB,wBAAwB,GAAG;AAChD,WAAOD,MAAAA,OAAO,KAAK,QAAQE,MAAAA,KAAU,OAAO,qBAAqB,CAAC,EAAE,CAAC;AAAA,EACtE,WAAW,cAAc,wBAAwB,GAAG;AACnD,WAAO;AAAA,EACR;AACA,SAAO;AACR;;;"}
1
+ {"version":3,"file":"ListElement.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/lists/ListElement.ts"],"sourcesContent":["import { Editor, Element, Element as SlateElement, Node, Path as SlatePath } from 'slate'\nimport { isUnorderedListElement, UnorderedListElement } from './UnorderedListElement.js'\nimport { isOrderedListElement, OrderedListElement } from './OrderedListElement.js'\nimport { ContemberEditor } from '../../../editor/index.js'\nimport { isListItemElement } from './ListItemElement.js'\n\nexport const isListElement = <T extends UnorderedListElement | OrderedListElement>(\n\telement: Node,\n\tsuchThat?: Partial<T>,\n): element is T =>\n\tisOrderedListElement(element, suchThat as Partial<OrderedListElement>) || isUnorderedListElement(element, suchThat as Partial<UnorderedListElement>)\n\nexport const getParentListElement = (editor: Editor): Element | undefined => {\n\tconst closestNonDefaultEntry = ContemberEditor.closest(editor, {\n\t\tmatch: node => SlateElement.isElement(node) && Editor.isBlock(editor, node) && !editor.isDefaultElement(node),\n\t})\n\tif (!closestNonDefaultEntry) {\n\t\treturn undefined\n\t}\n\tconst [closestNonDefaultElement, closestNonDefaultPath] = closestNonDefaultEntry\n\tif (isListItemElement(closestNonDefaultElement)) {\n\t\treturn Editor.node(editor, SlatePath.parent(closestNonDefaultPath))[0] as SlateElement\n\t} else if (isListElement(closestNonDefaultElement)) {\n\t\treturn closestNonDefaultElement\n\t}\n\treturn undefined\n}\n"],"names":["isOrderedListElement","isUnorderedListElement","ContemberEditor","SlateElement","Editor","isListItemElement","SlatePath"],"mappings":";;;;;;;AAMO,MAAM,gBAAgB,CAC5B,SACA,aAEAA,mBAAAA,qBAAqB,SAAS,QAAuC,KAAKC,4CAAuB,SAAS,QAAyC;AAE7I,MAAM,uBAAuB,CAAC,WAAwC;AAC5E,QAAM,yBAAyBC,MAAAA,gBAAgB,QAAQ,QAAQ;AAAA,IAC9D,OAAO,CAAA,SAAQC,MAAAA,QAAa,UAAU,IAAI,KAAKC,MAAAA,OAAO,QAAQ,QAAQ,IAAI,KAAK,CAAC,OAAO,iBAAiB,IAAI;AAAA,EAAA,CAC5G;AACD,MAAI,CAAC,wBAAwB;AAC5B,WAAO;AAAA,EACR;AACA,QAAM,CAAC,0BAA0B,qBAAqB,IAAI;AAC1D,MAAIC,gBAAAA,kBAAkB,wBAAwB,GAAG;AAChD,WAAOD,MAAAA,OAAO,KAAK,QAAQE,MAAAA,KAAU,OAAO,qBAAqB,CAAC,EAAE,CAAC;AAAA,EACtE,WAAW,cAAc,wBAAwB,GAAG;AACnD,WAAO;AAAA,EACR;AACA,SAAO;AACR;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ListElement.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/lists/ListElement.ts"],"sourcesContent":["import { Editor, Element, Element as SlateElement, Node, Path as SlatePath } from 'slate'\nimport { isUnorderedListElement, UnorderedListElement } from './UnorderedListElement'\nimport { isOrderedListElement, OrderedListElement } from './OrderedListElement'\nimport { ContemberEditor } from '../../../editor'\nimport { isListItemElement } from './ListItemElement'\n\nexport const isListElement = <T extends UnorderedListElement | OrderedListElement>(\n\telement: Node,\n\tsuchThat?: Partial<T>,\n): element is T =>\n\tisOrderedListElement(element, suchThat as Partial<OrderedListElement>) || isUnorderedListElement(element, suchThat as Partial<UnorderedListElement>)\n\nexport const getParentListElement = (editor: Editor): Element | undefined => {\n\tconst closestNonDefaultEntry = ContemberEditor.closest(editor, {\n\t\tmatch: node => SlateElement.isElement(node) && Editor.isBlock(editor, node) && !editor.isDefaultElement(node),\n\t})\n\tif (!closestNonDefaultEntry) {\n\t\treturn undefined\n\t}\n\tconst [closestNonDefaultElement, closestNonDefaultPath] = closestNonDefaultEntry\n\tif (isListItemElement(closestNonDefaultElement)) {\n\t\treturn Editor.node(editor, SlatePath.parent(closestNonDefaultPath))[0] as SlateElement\n\t} else if (isListElement(closestNonDefaultElement)) {\n\t\treturn closestNonDefaultElement\n\t}\n\treturn undefined\n}\n"],"names":["SlateElement","SlatePath"],"mappings":";;;;;AAMO,MAAM,gBAAgB,CAC5B,SACA,aAEA,qBAAqB,SAAS,QAAuC,KAAK,uBAAuB,SAAS,QAAyC;AAE7I,MAAM,uBAAuB,CAAC,WAAwC;AAC5E,QAAM,yBAAyB,gBAAgB,QAAQ,QAAQ;AAAA,IAC9D,OAAO,CAAA,SAAQA,QAAa,UAAU,IAAI,KAAK,OAAO,QAAQ,QAAQ,IAAI,KAAK,CAAC,OAAO,iBAAiB,IAAI;AAAA,EAAA,CAC5G;AACD,MAAI,CAAC,wBAAwB;AAC5B,WAAO;AAAA,EACR;AACA,QAAM,CAAC,0BAA0B,qBAAqB,IAAI;AAC1D,MAAI,kBAAkB,wBAAwB,GAAG;AAChD,WAAO,OAAO,KAAK,QAAQC,KAAU,OAAO,qBAAqB,CAAC,EAAE,CAAC;AAAA,EACtE,WAAW,cAAc,wBAAwB,GAAG;AACnD,WAAO;AAAA,EACR;AACA,SAAO;AACR;"}
1
+ {"version":3,"file":"ListElement.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/lists/ListElement.ts"],"sourcesContent":["import { Editor, Element, Element as SlateElement, Node, Path as SlatePath } from 'slate'\nimport { isUnorderedListElement, UnorderedListElement } from './UnorderedListElement.js'\nimport { isOrderedListElement, OrderedListElement } from './OrderedListElement.js'\nimport { ContemberEditor } from '../../../editor/index.js'\nimport { isListItemElement } from './ListItemElement.js'\n\nexport const isListElement = <T extends UnorderedListElement | OrderedListElement>(\n\telement: Node,\n\tsuchThat?: Partial<T>,\n): element is T =>\n\tisOrderedListElement(element, suchThat as Partial<OrderedListElement>) || isUnorderedListElement(element, suchThat as Partial<UnorderedListElement>)\n\nexport const getParentListElement = (editor: Editor): Element | undefined => {\n\tconst closestNonDefaultEntry = ContemberEditor.closest(editor, {\n\t\tmatch: node => SlateElement.isElement(node) && Editor.isBlock(editor, node) && !editor.isDefaultElement(node),\n\t})\n\tif (!closestNonDefaultEntry) {\n\t\treturn undefined\n\t}\n\tconst [closestNonDefaultElement, closestNonDefaultPath] = closestNonDefaultEntry\n\tif (isListItemElement(closestNonDefaultElement)) {\n\t\treturn Editor.node(editor, SlatePath.parent(closestNonDefaultPath))[0] as SlateElement\n\t} else if (isListElement(closestNonDefaultElement)) {\n\t\treturn closestNonDefaultElement\n\t}\n\treturn undefined\n}\n"],"names":["SlateElement","SlatePath"],"mappings":";;;;;AAMO,MAAM,gBAAgB,CAC5B,SACA,aAEA,qBAAqB,SAAS,QAAuC,KAAK,uBAAuB,SAAS,QAAyC;AAE7I,MAAM,uBAAuB,CAAC,WAAwC;AAC5E,QAAM,yBAAyB,gBAAgB,QAAQ,QAAQ;AAAA,IAC9D,OAAO,CAAA,SAAQA,QAAa,UAAU,IAAI,KAAK,OAAO,QAAQ,QAAQ,IAAI,KAAK,CAAC,OAAO,iBAAiB,IAAI;AAAA,EAAA,CAC5G;AACD,MAAI,CAAC,wBAAwB;AAC5B,WAAO;AAAA,EACR;AACA,QAAM,CAAC,0BAA0B,qBAAqB,IAAI;AAC1D,MAAI,kBAAkB,wBAAwB,GAAG;AAChD,WAAO,OAAO,KAAK,QAAQC,KAAU,OAAO,qBAAqB,CAAC,EAAE,CAAC;AAAA,EACtE,WAAW,cAAc,wBAAwB,GAAG;AACnD,WAAO;AAAA,EACR;AACA,SAAO;AACR;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ListHtmlDeserializer.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/lists/ListHtmlDeserializer.ts"],"sourcesContent":["import { unorderedListElementType } from './UnorderedListElement'\nimport { orderedListElementType } from './OrderedListElement'\nimport { listItemElementType } from './ListItemElement'\nimport { Element as SlateElement } from 'slate'\nimport { HtmlDeserializerPlugin } from '../../../types'\nimport { NodesWithType } from '../../behaviour/paste/HtmlDeserializer'\nimport { EditorPasteUtils } from '../../../internal/utils/EditorPasteUtils'\n\nexport interface ListElementProperties {\n\tordered: boolean\n\tproperties: Record<string, unknown>\n}\n\nexport interface ListHtmlDeserializerOptions {\n\tgetListElementProperties?: (text: string) => ListElementProperties\n}\n\nconst defaultGetListElementProperties = (text: string): ListElementProperties => {\n\tconst firstChar = text[0]\n\treturn {\n\t\tordered: firstChar === 'o' ? false : firstChar.match(/^\\w$/) !== null,\n\t\tproperties: {},\n\t}\n}\n\nexport const listHtmlDeserializerFactory = (\n\t{ getListElementProperties = defaultGetListElementProperties }: ListHtmlDeserializerOptions = {},\n): HtmlDeserializerPlugin => ({\n\tprocessBlockPaste: ({ element, next, cumulativeTextAttrs }) => {\n\t\tif (element.tagName === 'UL') {\n\t\t\treturn [{ type: unorderedListElementType, children: next(element.childNodes, cumulativeTextAttrs) }]\n\t\t}\n\t\tif (element.tagName === 'OL') {\n\t\t\treturn [{ type: orderedListElementType, children: next(element.childNodes, cumulativeTextAttrs) }]\n\t\t}\n\t\tif (element.tagName === 'LI') {\n\t\t\treturn [{ type: listItemElementType, children: next(element.childNodes, cumulativeTextAttrs) }]\n\t\t}\n\t\treturn null\n\t},\n\tprocessNodeListPaste: ({ nodeList, cumulativeTextAttrs, deserializer }) => {\n\t\tconst result: NodesWithType[] = []\n\t\tlet group: Node[] = []\n\t\tlet groupWasList = false\n\t\tlet isOrdered: boolean = false\n\t\tlet currentListProperties: Record<string, unknown> = {}\n\t\tlet includesList = false\n\t\tlet lastListId: string | null = null\n\n\t\tconst processGroup = (): NodesWithType => {\n\t\t\tif (groupWasList) {\n\t\t\t\treturn {\n\t\t\t\t\telements: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: isOrdered ? orderedListElementType : unorderedListElementType,\n\t\t\t\t\t\t\t...currentListProperties,\n\t\t\t\t\t\t\tchildren: group.map(item => {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\ttype: listItemElementType,\n\t\t\t\t\t\t\t\t\tchildren: deserializer.deserializeBlocks(\n\t\t\t\t\t\t\t\t\t\tEditorPasteUtils.wordPasteListItemContent(item.childNodes),\n\t\t\t\t\t\t\t\t\t\tcumulativeTextAttrs,\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t} as SlateElement,\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn deserializer.processNodeListPaste(group, cumulativeTextAttrs)\n\t\t\t}\n\t\t}\n\n\t\tfor (let i = 0; i < nodeList.length; i++) {\n\t\t\tconst curr = nodeList[i]\n\t\t\tconst isWhiteSpace = curr.nodeType === Node.TEXT_NODE && curr.textContent?.match(/^\\s*$/) !== null\n\t\t\tif (groupWasList && isWhiteSpace) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlet isList = false\n\t\t\tlet listId: string | null = null\n\t\t\tif (curr instanceof HTMLElement && curr.nodeName === 'P') {\n\t\t\t\tconst match = curr.getAttribute('style')?.match(/mso-list:(\\w+ level\\d+ \\w+)/) ?? null\n\t\t\t\tif (match !== null) {\n\t\t\t\t\tisList = true\n\t\t\t\t\tlistId = match[1]\n\n\t\t\t\t\tif (!groupWasList || lastListId === listId) {\n\t\t\t\t\t\tconst textContent = (curr as HTMLElement).textContent!\n\t\t\t\t\t\tconst specifics: ListElementProperties = getListElementProperties(textContent)\n\t\t\t\t\t\tisOrdered = specifics.ordered\n\t\t\t\t\t\tcurrentListProperties = specifics.properties\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (isList !== groupWasList || listId !== lastListId) {\n\t\t\t\tincludesList = true\n\t\t\t\tif (group.length > 0) {\n\t\t\t\t\tresult.push(processGroup())\n\t\t\t\t\tgroup = []\n\t\t\t\t}\n\t\t\t}\n\t\t\tgroupWasList = isList\n\t\t\tlastListId = listId\n\t\t\tgroup.push(curr)\n\t\t}\n\n\t\tif (includesList) {\n\t\t\tresult.push(processGroup())\n\t\t\treturn EditorPasteUtils.flattenNodesWithType(result, deserializer.createDefaultElement)\n\t\t}\n\t\treturn null\n\t},\n})\n"],"names":["unorderedListElementType","orderedListElementType","listItemElementType","EditorPasteUtils"],"mappings":";;;;;;AAiBA,MAAM,kCAAkC,CAAC,SAAwC;AAChF,QAAM,YAAY,KAAK,CAAC;AACxB,SAAO;AAAA,IACN,SAAS,cAAc,MAAM,QAAQ,UAAU,MAAM,MAAM,MAAM;AAAA,IACjE,YAAY,CAAA;AAAA,EAAC;AAEf;AAEO,MAAM,8BAA8B,CAC1C,EAAE,2BAA2B,gCAAA,IAAiE,CAAA,OACjE;AAAA,EAC7B,mBAAmB,CAAC,EAAE,SAAS,MAAM,0BAA0B;AAC9D,QAAI,QAAQ,YAAY,MAAM;AAC7B,aAAO,CAAC,EAAE,MAAMA,qBAAAA,0BAA0B,UAAU,KAAK,QAAQ,YAAY,mBAAmB,GAAG;AAAA,IACpG;AACA,QAAI,QAAQ,YAAY,MAAM;AAC7B,aAAO,CAAC,EAAE,MAAMC,mBAAAA,wBA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AK;AAClF,YAAI,UAAU,MAAM;AACnB,mBAAS;AACT,mBAAS,MAAM,CAAC;AAEhB,cAAI,CAAC,gBAAgB,eAAe,QAAQ;AAC3C,kBAAM,cAAe,KAAqB;AAC1C,kBAAM,YAAmC,yBAAyB,WAAW;AAC7E,wBAAY,UAAU;AACtB,oCAAwB,UAAU;AAAA,UACnC;AAAA,QACD;AAAA,MACD;AAEA,UAAI,WAAW,gBAAgB,WAAW,YAAY;AACrD,uBAAe;AACf,YAAI,MAAM,SAAS,GAAG;AACrB,iBAAO,KAAK,cAAc;AAC1B,kBAAQ,CAAA;AAAA,QACT;AAAA,MACD;AACA,qBAAe;AACf,mBAAa;AACb,YAAM,KAAK,IAAI;AAAA,IAChB;AAEA,QAAI,cAAc;AACjB,aAAO,KAAK,cAAc;AAC1B,aAAOA,iBAAAA,iBAAiB,qBAAqB,QAAQ,aAAa,oBAAoB;AAAA,IACvF;AACA,WAAO;AAAA,EACR;AACD;;"}
1
+ {"version":3,"file":"ListHtmlDeserializer.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/lists/ListHtmlDeserializer.ts"],"sourcesContent":["import { unorderedListElementType } from './UnorderedListElement.js'\nimport { orderedListElementType } from './OrderedListElement.js'\nimport { listItemElementType } from './ListItemElement.js'\nimport { Element as SlateElement } from 'slate'\nimport { HtmlDeserializerPlugin } from '../../../types/index.js'\nimport { NodesWithType } from '../../behaviour/paste/HtmlDeserializer.js'\nimport { EditorPasteUtils } from '../../../internal/utils/EditorPasteUtils.js'\n\nexport interface ListElementProperties {\n\tordered: boolean\n\tproperties: Record<string, unknown>\n}\n\nexport interface ListHtmlDeserializerOptions {\n\tgetListElementProperties?: (text: string) => ListElementProperties\n}\n\nconst defaultGetListElementProperties = (text: string): ListElementProperties => {\n\tconst firstChar = text[0]\n\treturn {\n\t\tordered: firstChar === 'o' ? false : firstChar.match(/^\\w$/) !== null,\n\t\tproperties: {},\n\t}\n}\n\nexport const listHtmlDeserializerFactory = (\n\t{ getListElementProperties = defaultGetListElementProperties }: ListHtmlDeserializerOptions = {},\n): HtmlDeserializerPlugin => ({\n\tprocessBlockPaste: ({ element, next, cumulativeTextAttrs }) => {\n\t\tif (element.tagName === 'UL') {\n\t\t\treturn [{ type: unorderedListElementType, children: next(element.childNodes, cumulativeTextAttrs) }]\n\t\t}\n\t\tif (element.tagName === 'OL') {\n\t\t\treturn [{ type: orderedListElementType, children: next(element.childNodes, cumulativeTextAttrs) }]\n\t\t}\n\t\tif (element.tagName === 'LI') {\n\t\t\treturn [{ type: listItemElementType, children: next(element.childNodes, cumulativeTextAttrs) }]\n\t\t}\n\t\treturn null\n\t},\n\tprocessNodeListPaste: ({ nodeList, cumulativeTextAttrs, deserializer }) => {\n\t\tconst result: NodesWithType[] = []\n\t\tlet group: Node[] = []\n\t\tlet groupWasList = false\n\t\tlet isOrdered: boolean = false\n\t\tlet currentListProperties: Record<string, unknown> = {}\n\t\tlet includesList = false\n\t\tlet lastListId: string | null = null\n\n\t\tconst processGroup = (): NodesWithType => {\n\t\t\tif (groupWasList) {\n\t\t\t\treturn {\n\t\t\t\t\telements: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: isOrdered ? orderedListElementType : unorderedListElementType,\n\t\t\t\t\t\t\t...currentListProperties,\n\t\t\t\t\t\t\tchildren: group.map(item => {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\ttype: listItemElementType,\n\t\t\t\t\t\t\t\t\tchildren: deserializer.deserializeBlocks(\n\t\t\t\t\t\t\t\t\t\tEditorPasteUtils.wordPasteListItemContent(item.childNodes),\n\t\t\t\t\t\t\t\t\t\tcumulativeTextAttrs,\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t} as SlateElement,\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn deserializer.processNodeListPaste(group, cumulativeTextAttrs)\n\t\t\t}\n\t\t}\n\n\t\tfor (let i = 0; i < nodeList.length; i++) {\n\t\t\tconst curr = nodeList[i]\n\t\t\tconst isWhiteSpace = curr.nodeType === Node.TEXT_NODE && curr.textContent?.match(/^\\s*$/) !== null\n\t\t\tif (groupWasList && isWhiteSpace) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlet isList = false\n\t\t\tlet listId: string | null = null\n\t\t\tif (curr instanceof HTMLElement && curr.nodeName === 'P') {\n\t\t\t\tconst match = curr.getAttribute('style')?.match(/mso-list:(\\w+ level\\d+ \\w+)/) ?? null\n\t\t\t\tif (match !== null) {\n\t\t\t\t\tisList = true\n\t\t\t\t\tlistId = match[1]\n\n\t\t\t\t\tif (!groupWasList || lastListId === listId) {\n\t\t\t\t\t\tconst textContent = (curr as HTMLElement).textContent!\n\t\t\t\t\t\tconst specifics: ListElementProperties = getListElementProperties(textContent)\n\t\t\t\t\t\tisOrdered = specifics.ordered\n\t\t\t\t\t\tcurrentListProperties = specifics.properties\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (isList !== groupWasList || listId !== lastListId) {\n\t\t\t\tincludesList = true\n\t\t\t\tif (group.length > 0) {\n\t\t\t\t\tresult.push(processGroup())\n\t\t\t\t\tgroup = []\n\t\t\t\t}\n\t\t\t}\n\t\t\tgroupWasList = isList\n\t\t\tlastListId = listId\n\t\t\tgroup.push(curr)\n\t\t}\n\n\t\tif (includesList) {\n\t\t\tresult.push(processGroup())\n\t\t\treturn EditorPasteUtils.flattenNodesWithType(result, deserializer.createDefaultElement)\n\t\t}\n\t\treturn null\n\t},\n})\n"],"names":["unorderedListElementType","orderedListElementType","listItemElementType","EditorPasteUtils"],"mappings":";;;;;;AAiBA,MAAM,kCAAkC,CAAC,SAAwC;AAChF,QAAM,YAAY,KAAK,CAAC;AACxB,SAAO;AAAA,IACN,SAAS,cAAc,MAAM,QAAQ,UAAU,MAAM,MAAM,MAAM;AAAA,IACjE,YAAY,CAAA;AAAA,EAAC;A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AEA,aAAS,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;AACzC,YAAM,OAAO,SAAS,CAAC;AACvB,YAAM,eAAe,KAAK,aAAa,KAAK,aAAa,KAAK,aAAa,MAAM,OAAO,MAAM;AAC9F,UAAI,gBAAgB,cAAc;AACjC;AAAA,MACD;AACA,UAAI,SAAS;AACb,UAAI,SAAwB;AAC5B,UAAI,gBAAgB,eAAe,KAAK,aAAa,KAAK;AACzD,cAAM,QAAQ,KAAK,aAAa,OAAO,GAAG,MAAM,6BAA6B,KAAK;AAClF,YAAI,UAAU,MAAM;AACnB,mBAAS;AACT,mBAAS,MAAM,CAAC;AAEhB,cAAI,CAAC,gBAAgB,eAAe,QAAQ;AAC3C,kBAAM,cAAe,KAAqB;AAC1C,kBAAM,YAAmC,yBAAyB,WAAW;AAC7E,wBAAY,UAAU;AACtB,oCAAwB,UAAU;AAAA,UACnC;AAAA,QACD;AAAA,MACD;AAEA,UAAI,WAAW,gBAAgB,WAAW,YAAY;AACrD,uBAAe;AACf,YAAI,MAAM,SAAS,GAAG;AACrB,iBAAO,KAAK,cAAc;AAC1B,kBAAQ,CAAA;AAAA,QACT;AAAA,MACD;AACA,qBAAe;AACf,mBAAa;AACb,YAAM,KAAK,IAAI;AAAA,IAChB;AAEA,QAAI,cAAc;AACjB,aAAO,KAAK,cAAc;AAC1B,aAAOA,iBAAAA,iBAAiB,qBAAqB,QAAQ,aAAa,oBAAoB;AAAA,IACvF;AACA,WAAO;AAAA,EACR;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ListHtmlDeserializer.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/lists/ListHtmlDeserializer.ts"],"sourcesContent":["import { unorderedListElementType } from './UnorderedListElement'\nimport { orderedListElementType } from './OrderedListElement'\nimport { listItemElementType } from './ListItemElement'\nimport { Element as SlateElement } from 'slate'\nimport { HtmlDeserializerPlugin } from '../../../types'\nimport { NodesWithType } from '../../behaviour/paste/HtmlDeserializer'\nimport { EditorPasteUtils } from '../../../internal/utils/EditorPasteUtils'\n\nexport interface ListElementProperties {\n\tordered: boolean\n\tproperties: Record<string, unknown>\n}\n\nexport interface ListHtmlDeserializerOptions {\n\tgetListElementProperties?: (text: string) => ListElementProperties\n}\n\nconst defaultGetListElementProperties = (text: string): ListElementProperties => {\n\tconst firstChar = text[0]\n\treturn {\n\t\tordered: firstChar === 'o' ? false : firstChar.match(/^\\w$/) !== null,\n\t\tproperties: {},\n\t}\n}\n\nexport const listHtmlDeserializerFactory = (\n\t{ getListElementProperties = defaultGetListElementProperties }: ListHtmlDeserializerOptions = {},\n): HtmlDeserializerPlugin => ({\n\tprocessBlockPaste: ({ element, next, cumulativeTextAttrs }) => {\n\t\tif (element.tagName === 'UL') {\n\t\t\treturn [{ type: unorderedListElementType, children: next(element.childNodes, cumulativeTextAttrs) }]\n\t\t}\n\t\tif (element.tagName === 'OL') {\n\t\t\treturn [{ type: orderedListElementType, children: next(element.childNodes, cumulativeTextAttrs) }]\n\t\t}\n\t\tif (element.tagName === 'LI') {\n\t\t\treturn [{ type: listItemElementType, children: next(element.childNodes, cumulativeTextAttrs) }]\n\t\t}\n\t\treturn null\n\t},\n\tprocessNodeListPaste: ({ nodeList, cumulativeTextAttrs, deserializer }) => {\n\t\tconst result: NodesWithType[] = []\n\t\tlet group: Node[] = []\n\t\tlet groupWasList = false\n\t\tlet isOrdered: boolean = false\n\t\tlet currentListProperties: Record<string, unknown> = {}\n\t\tlet includesList = false\n\t\tlet lastListId: string | null = null\n\n\t\tconst processGroup = (): NodesWithType => {\n\t\t\tif (groupWasList) {\n\t\t\t\treturn {\n\t\t\t\t\telements: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: isOrdered ? orderedListElementType : unorderedListElementType,\n\t\t\t\t\t\t\t...currentListProperties,\n\t\t\t\t\t\t\tchildren: group.map(item => {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\ttype: listItemElementType,\n\t\t\t\t\t\t\t\t\tchildren: deserializer.deserializeBlocks(\n\t\t\t\t\t\t\t\t\t\tEditorPasteUtils.wordPasteListItemContent(item.childNodes),\n\t\t\t\t\t\t\t\t\t\tcumulativeTextAttrs,\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t} as SlateElement,\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn deserializer.processNodeListPaste(group, cumulativeTextAttrs)\n\t\t\t}\n\t\t}\n\n\t\tfor (let i = 0; i < nodeList.length; i++) {\n\t\t\tconst curr = nodeList[i]\n\t\t\tconst isWhiteSpace = curr.nodeType === Node.TEXT_NODE && curr.textContent?.match(/^\\s*$/) !== null\n\t\t\tif (groupWasList && isWhiteSpace) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlet isList = false\n\t\t\tlet listId: string | null = null\n\t\t\tif (curr instanceof HTMLElement && curr.nodeName === 'P') {\n\t\t\t\tconst match = curr.getAttribute('style')?.match(/mso-list:(\\w+ level\\d+ \\w+)/) ?? null\n\t\t\t\tif (match !== null) {\n\t\t\t\t\tisList = true\n\t\t\t\t\tlistId = match[1]\n\n\t\t\t\t\tif (!groupWasList || lastListId === listId) {\n\t\t\t\t\t\tconst textContent = (curr as HTMLElement).textContent!\n\t\t\t\t\t\tconst specifics: ListElementProperties = getListElementProperties(textContent)\n\t\t\t\t\t\tisOrdered = specifics.ordered\n\t\t\t\t\t\tcurrentListProperties = specifics.properties\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (isList !== groupWasList || listId !== lastListId) {\n\t\t\t\tincludesList = true\n\t\t\t\tif (group.length > 0) {\n\t\t\t\t\tresult.push(processGroup())\n\t\t\t\t\tgroup = []\n\t\t\t\t}\n\t\t\t}\n\t\t\tgroupWasList = isList\n\t\t\tlastListId = listId\n\t\t\tgroup.push(curr)\n\t\t}\n\n\t\tif (includesList) {\n\t\t\tresult.push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UAAU,aAAa;AAAA,oBACtB,iBAAiB,yBAAyB,KAAK,UAAU;AAAA,oBACzD;AAAA,kBAAA;AAAA,gBACD;AAAA,cAEF,CAAC;AAAA,YAAA;AAAA,UACF;AAAA,QACD;AAAA,MAEF,OAAO;AACN,eAAO,aAAa,qBAAqB,OAAO,mBAAmB;AAAA,MACpE;AAAA,IACD;AAEA,aAAS,IAAI,GAAG,IAAI,SAAS,QAAQ,KAAK;AACzC,YAAM,OAAO,SAAS,CAAC;AACvB,YAAM,eAAe,KAAK,aAAa,KAAK,aAAa,KAAK,aAAa,MAAM,OAAO,MAAM;AAC9F,UAAI,gBAAgB,cAAc;AACjC;AAAA,MACD;AACA,UAAI,SAAS;AACb,UAAI,SAAwB;AAC5B,UAAI,gBAAgB,eAAe,KAAK,aAAa,KAAK;AACzD,cAAM,QAAQ,KAAK,aAAa,OAAO,GAAG,MAAM,6BAA6B,KAAK;AAClF,YAAI,UAAU,MAAM;AACnB,mBAAS;AACT,mBAAS,MAAM,CAAC;AAEhB,cAAI,CAAC,gBAAgB,eAAe,QAAQ;AAC3C,kBAAM,cAAe,KAAqB;AAC1C,kBAAM,YAAmC,yBAAyB,WAAW;AAC7E,wBAAY,UAAU;AACtB,oCAAwB,UAAU;AAAA,UACnC;AAAA,QACD;AAAA,MACD;AAEA,UAAI,WAAW,gBAAgB,WAAW,YAAY;AACrD,uBAAe;AACf,YAAI,MAAM,SAAS,GAAG;AACrB,iBAAO,KAAK,cAAc;AAC1B,kBAAQ,CAAA;AAAA,QACT;AAAA,MACD;AACA,qBAAe;AACf,mBAAa;AACb,YAAM,KAAK,IAAI;AAAA,IAChB;AAEA,QAAI,cAAc;AACjB,aAAO,KAAK,cAAc;AAC1B,aAAO,iBAAiB,qBAAqB,QAAQ,aAAa,oBAAoB;AAAA,IACvF;AACA,WAAO;AAAA,EACR;AACD;"}
1
+ {"version":3,"file":"ListHtmlDeserializer.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/lists/ListHtmlDeserializer.ts"],"sourcesContent":["import { unorderedListElementType } from './UnorderedListElement.js'\nimport { orderedListElementType } from './OrderedListElement.js'\nimport { listItemElementType } from './ListItemElement.js'\nimport { Element as SlateElement } from 'slate'\nimport { HtmlDeserializerPlugin } from '../../../types/index.js'\nimport { NodesWithType } from '../../behaviour/paste/HtmlDeserializer.js'\nimport { EditorPasteUtils } from '../../../internal/utils/EditorPasteUtils.js'\n\nexport interface ListElementProperties {\n\tordered: boolean\n\tproperties: Record<string, unknown>\n}\n\nexport interface ListHtmlDeserializerOptions {\n\tgetListElementProperties?: (text: string) => ListElementProperties\n}\n\nconst defaultGetListElementProperties = (text: string): ListElementProperties => {\n\tconst firstChar = text[0]\n\treturn {\n\t\tordered: firstChar === 'o' ? false : firstChar.match(/^\\w$/) !== null,\n\t\tproperties: {},\n\t}\n}\n\nexport const listHtmlDeserializerFactory = (\n\t{ getListElementProperties = defaultGetListElementProperties }: ListHtmlDeserializerOptions = {},\n): HtmlDeserializerPlugin => ({\n\tprocessBlockPaste: ({ element, next, cumulativeTextAttrs }) => {\n\t\tif (element.tagName === 'UL') {\n\t\t\treturn [{ type: unorderedListElementType, children: next(element.childNodes, cumulativeTextAttrs) }]\n\t\t}\n\t\tif (element.tagName === 'OL') {\n\t\t\treturn [{ type: orderedListElementType, children: next(element.childNodes, cumulativeTextAttrs) }]\n\t\t}\n\t\tif (element.tagName === 'LI') {\n\t\t\treturn [{ type: listItemElementType, children: next(element.childNodes, cumulativeTextAttrs) }]\n\t\t}\n\t\treturn null\n\t},\n\tprocessNodeListPaste: ({ nodeList, cumulativeTextAttrs, deserializer }) => {\n\t\tconst result: NodesWithType[] = []\n\t\tlet group: Node[] = []\n\t\tlet groupWasList = false\n\t\tlet isOrdered: boolean = false\n\t\tlet currentListProperties: Record<string, unknown> = {}\n\t\tlet includesList = false\n\t\tlet lastListId: string | null = null\n\n\t\tconst processGroup = (): NodesWithType => {\n\t\t\tif (groupWasList) {\n\t\t\t\treturn {\n\t\t\t\t\telements: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: isOrdered ? orderedListElementType : unorderedListElementType,\n\t\t\t\t\t\t\t...currentListProperties,\n\t\t\t\t\t\t\tchildren: group.map(item => {\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\ttype: listItemElementType,\n\t\t\t\t\t\t\t\t\tchildren: deserializer.deserializeBlocks(\n\t\t\t\t\t\t\t\t\t\tEditorPasteUtils.wordPasteListItemContent(item.childNodes),\n\t\t\t\t\t\t\t\t\t\tcumulativeTextAttrs,\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t} as SlateElement,\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn deserializer.processNodeListPaste(group, cumulativeTextAttrs)\n\t\t\t}\n\t\t}\n\n\t\tfor (let i = 0; i < nodeList.length; i++) {\n\t\t\tconst curr = nodeList[i]\n\t\t\tconst isWhiteSpace = curr.nodeType === Node.TEXT_NODE && curr.textContent?.match(/^\\s*$/) !== null\n\t\t\tif (groupWasList && isWhiteSpace) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlet isList = false\n\t\t\tlet listId: string | null = null\n\t\t\tif (curr instanceof HTMLElement && curr.nodeName === 'P') {\n\t\t\t\tconst match = curr.getAttribute('style')?.match(/mso-list:(\\w+ level\\d+ \\w+)/) ?? null\n\t\t\t\tif (match !== null) {\n\t\t\t\t\tisList = true\n\t\t\t\t\tlistId = match[1]\n\n\t\t\t\t\tif (!groupWasList || lastListId === listId) {\n\t\t\t\t\t\tconst textContent = (curr as HTMLElement).textContent!\n\t\t\t\t\t\tconst specifics: ListElementProperties = getListElementProperties(textContent)\n\t\t\t\t\t\tisOrdered = specifics.ordered\n\t\t\t\t\t\tcurrentListProperties = specifics.properties\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (isList !== groupWasList || listId !== lastListId) {\n\t\t\t\tincludesList = true\n\t\t\t\tif (group.length > 0) {\n\t\t\t\t\tresult.push(processGroup())\n\t\t\t\t\tgroup = []\n\t\t\t\t}\n\t\t\t}\n\t\t\tgroupWasList = isList\n\t\t\tlastListId = listId\n\t\t\tgroup.push(curr)\n\t\t}\n\n\t\tif (includesList) {\n\t\t\tresult.push(processGroup())\n\t\t\treturn EditorPasteUtils.flattenNodesWithType(result, deserializer.createDefaultElement)\n\t\t}\n\t\treturn null\n\t},\n})\n"],"names":[],"mappings":";;;;AAiBA,MAAM,kCAAkC,CAAC,SAAwC;AAChF,QAAM,YAAY,KAAK,CAAC;AACxB,SAAO;AAAA,IACN,SAAS,cAAc,MAAM,QAAQ,UAAU,MAAM,MAAM,MAAM;AAAA,IACjE,YAAY,CAAA;AAAA,EAAC;AAEf;AAEO,MAAM,8BAA8B,CAC1C,EAAE,2BAA2B,gCAAA,IAAiE,CAAA,OACjE;AAAA,EAC7B,mBAAmB,CAAC,EAAE,SAAS,MAAM,0BAA0B;AAC9D,QAAI,QAAQ,YAAY,MAAM;AAC7B,aAAO,CAAC,EAAE,MAAM,0BAA0B,UAAU,KAAK,QAAQ,YAAY,mBAAmB,GAAG;AAAA,IACpG;AACA,QAAI,QAAQ,YAAY,MAAM;AAC7B,aAAO,CAAC,EAAE,MAAM,wBAAwB,UAAU,KAAK,QAAQ,YAAY,mBAAmB,GAAG;AAAA,IAClG;AACA,QAAI,QAAQ,YAAY,MAAM;AAC7B,aAAO,CAAC,EAAE,MAAM,qBAAqB,UAAU,KAAK,QAAQ,YAAY,mBAAmB,GAAG;AAAA,IAC/F;AACA,WAAO;AAAA,EACR;AAAA,EACA,sBAAsB,CAAC,EAAE,UAAU,qBAAqB,mBAAmB;AAC1E,UAAM,SAA0B,CAAA;AAChC,QAAI,QAAgB,CAAA;AACpB,QAAI,eAAe;AACnB,QAAI,YAAqB;AACzB,QAAI,wBAAiD,CAAA;AACrD,QAAI,eAAe;AACnB,QAAI,aAA4B;AA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