@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":"RichTextEditor.cjs","sources":["../../../../../packages/react-slate-editor-base/src/components/RichTextEditor.tsx"],"sourcesContent":["import { Component, Field, FieldAccessor, FieldBasicProps, QueryLanguage, useEntity } from '@contember/react-binding'\nimport { FunctionComponent, useCallback, useMemo, useState } from 'react'\nimport { Descendant, Editor, Element as SlateElement, Node as SlateNode, NodeEntry, Transforms } from 'slate'\nimport { Slate } from 'slate-react'\nimport { createEditor, CreateEditorPublicOptions } from '../editor'\nimport { paragraphElementType } from '../plugins'\nimport { useRichTextFieldNodes } from '../internal/hooks/useRichTextFieldNodes'\n\nexport type RichTextEditorProps =\n\t& FieldBasicProps\n\t& CreateEditorPublicOptions\n\t& {\n\t\tchildren: React.ReactNode\n\t}\n\n/**\n * Rich text field supports more advanced formatting capabilities. Output of this field is a JSON.\n *\n * @group Form Fields\n */\nexport const RichTextEditor: FunctionComponent<RichTextEditorProps> = Component(\n\tprops => {\n\t\tconst entity = useEntity()\n\t\tconst environment = entity.environment\n\t\tconst getParent = entity.getAccessor\n\n\t\tconst desugaredField = useMemo(\n\t\t\t() => QueryLanguage.desugarRelativeSingleField(props, environment),\n\t\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: props is stable via Component HOC\n\t\t\t[environment, props],\n\t\t)\n\t\tconst fieldAccessor = useMemo(() => entity.getField<string>(desugaredField), [entity, desugaredField])\n\n\t\t// The cache is questionable, really.\n\t\tconst [contemberFieldElementCache] = useState(() => new WeakMap<FieldAccessor<string>, SlateElement[]>())\n\n\t\tconst [editor] = useState(() => {\n\t\t\tconst { editor } = createEditor({\n\t\t\t\tplugins: props.plugins,\n\t\t\t\tdefaultElementType: paragraphElementType,\n\t\t\t\tentity,\n\t\t\t\tenvironment,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\n\t\t\tconst { normalizeNode } = editor\n\t\t\tObject.assign(editor, {\n\t\t\t\tinsertBreak: () => {\n\t\t\t\t\tTransforms.insertText(editor, '\\n')\n\t\t\t\t},\n\t\t\t\tnormalizeNode: (nodeEntry: NodeEntry) => {\n\t\t\t\t\tconst [node, path] = nodeEntry\n\t\t\t\t\tif (path.length === 0 && SlateElement.isAncestor(node)) {\n\t\t\t\t\t\t// Enforce that there's exactly one child and that it's\n\t\t\t\t\t\tif (node.children.length > 1) {\n\t\t\t\t\t\t\treturn Editor.withoutNormalizing(editor, () => {\n\t\t\t\t\t\t\t\tconst targetPath = [0, (editor.children[0] as SlateElement).children.length]\n\t\t\t\t\t\t\t\tTransforms.moveNodes(editor, {\n\t\t\t\t\t\t\t\t\tat: [1],\n\t\t\t\t\t\t\t\t\tto: targetPath,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\tTransforms.unwrapNodes(editor, { at: targetPath })\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (SlateElement.isElement(node.children[0]) && !editor.isDefaultElement(node.children[0])) {\n\t\t\t\t\t\t\treturn Editor.withoutNormalizing(editor, () => {\n\t\t\t\t\t\t\t\tTransforms.wrapNodes(editor, editor.createDefaultElement([{ text: '' }]), {\n\t\t\t\t\t\t\t\t\tat: path,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\tTransforms.unwrapNodes(editor, { at: [0, 0] })\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (SlateElement.isElement(node) && Editor.isBlock(editor, node) && path.length > 1) {\n\t\t\t\t\t\treturn Transforms.unwrapNodes(editor, { at: path })\n\t\t\t\t\t}\n\t\t\t\t\tnormalizeNode(nodeEntry)\n\t\t\t\t},\n\t\t\t})\n\n\t\t\treturn editor\n\t\t})\n\n\t\tconst valueNodes = useRichTextFieldNodes({\n\t\t\teditor,\n\t\t\tfieldAccessor,\n\t\t\tcontemberFieldElementCache,\n\t\t})\n\n\t\tconst serialize = editor.serializeNodes\n\t\tconst onChange = useCallback(\n\t\t\t(value: Descendant[]) => {\n\t\t\t\tgetParent().batchUpdates(getAccessor => {\n\t\t\t\t\tconst fieldAccessor = getAccessor().getField(desugaredField)\n\n\t\t\t\t\tif (SlateNode.string({ type: 'dummy', children: value }) === '' && fieldAccessor.valueOnServer === null) {\n\t\t\t\t\t\tfieldAccessor.updateValue(null)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tif (SlateElement.isElement(value[0])) {\n\t\t\t\t\t\tfieldAccessor.updateValue(serialize(value[0].children))\n\t\t\t\t\t\tcontemberFieldElementCache.set(getAccessor().getField(desugaredField), value as SlateElement[])\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t},\n\t\t\t[getParent, contemberFieldElementCache, desugaredField, serialize],\n\t\t)\n\n\t\treturn (\n\t\t\t<Slate editor={editor} initialValue={valueNodes} onChange={onChange}>\n\t\t\t\t{props.children}\n\t\t\t</Slate>\n\t\t)\n\t},\n\tprops => (\n\t\t<>\n\t\t\t<Field defaultValue={props.defaultValue} field={props.field} isNonbearing={props.isNonbearing} />\n\t\t</>\n\t),\n\t'RichTextEditor',\n)\n"],"names":["Component","useEntity","useMemo","QueryLanguage","useState","editor","createEditor","paragraphElementType","Transforms","SlateElement","Editor","useRichTextFieldNodes","useCallback","fieldAccessor","SlateNode","Slate","this","jsxDEV","Fragment","Field"],"mappings":";;;;;;;;;;AAoBO,MAAM,iBAAyDA,aAAAA;AAAAA,EACrE,CAAA,UAAS;AACR,UAAM,SAASC,aAAAA,UAAA;AACf,UAAM,cAAc,OAAO;AAC3B,UAAM,YAAY,OAAO;AAEzB,UAAM,iBAAiBC,MAAAA;AAAAA,MACtB,MAAMC,2BAAc,2BAA2B,OAAO,WAAW;AAAA;AAAA,MAEjE,CAAC,aAAa,KAAK;AAAA,IAAA;AAEpB,UAAM,gBAAgBD,cAAQ,MAAM,OAAO,SAAiB,cAAc,GAAG,CAAC,QAAQ,cAAc,CAAC;AAGrG,UAAM,CAAC,0BAA0B,IAAIE,MAAAA,SAAS,MAAM,oBAAI,SAAgD;AAExG,UAAM,CAAC,MAAM,IAAIA,MAAAA,SAAS,MAAM;AAC/B,YAAM,EAAE,QAAAC,QAAAA,IAAWC,0BAAa;AAAA,QAC/B,SAAS,MAAM;AAAA,QACf,oBAAoBC,iBAAAA;AAAAA,QACpB;AAAA,QACA;AAAA,QACA,UAAU,MAAM;AAAA,MAAA,CAChB;AAED,YAAM,EAAE,kBAAkBF;AAC1B,aAAO,OAAOA,SAAQ;AAAA,QACrB,aAAa,MAA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AAAA,MACA;AAAA,IAAA,CACA;AAED,UAAM,YAAY,OAAO;AACzB,UAAM,WAAWC,MAAAA;AAAAA,MAChB,CAAC,UAAwB;AACxB,kBAAA,EAAY,aAAa,CAAA,gBAAe;AACvC,gBAAMC,iBAAgB,cAAc,SAAS,cAAc;AAE3D,cAAIC,WAAU,OAAO,EAAE,MAAM,SAAS,UAAU,MAAA,CAAO,MAAM,MAAMD,eAAc,kBAAkB,MAAM;AACxGA,2BAAc,YAAY,IAAI;AAC9B;AAAA,UACD;AAEA,cAAIJ,MAAAA,QAAa,UAAU,MAAM,CAAC,CAAC,GAAG;AACrCI,2BAAc,YAAY,UAAU,MAAM,CAAC,EAAE,QAAQ,CAAC;AACtD,uCAA2B,IAAI,YAAA,EAAc,SAAS,cAAc,GAAG,KAAuB;AAAA,UAC/F;AAAA,QACD,CAAC;AAAA,MACF;AAAA,MACA,CAAC,WAAW,4BAA4B,gBAAgB,SAAS;AAAA,IAAA;AAGlE,gDACEE,WAAAA,OAAA,EAAM,QAAgB,cAAc,YAAY,UAC/C,gBAAM,YADR,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAC,MAEA;AAAA,EAEF;AAAA,EACA,CAAA,UACCC,8BAAAA,OAAAC,wBAAA,EACC,UAAAD,qCAACE,aAAAA,OAAA,EAAM,cAAc,MAAM,cAAc,OAAO,MAAM,OAAO,cAAc,MAAM,aAAA,GAAjF,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAH,MAA+F,EAAA,GADhG,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAEA;AAAA,EAED;AACD;;"}
1
+ {"version":3,"file":"RichTextEditor.cjs","sources":["../../../../../packages/react-slate-editor-base/src/components/RichTextEditor.tsx"],"sourcesContent":["import { Component, Field, FieldAccessor, FieldBasicProps, QueryLanguage, useEntity } from '@contember/react-binding'\nimport { FunctionComponent, useCallback, useMemo, useState } from 'react'\nimport { Descendant, Editor, Element as SlateElement, Node as SlateNode, NodeEntry, Transforms } from 'slate'\nimport { Slate } from 'slate-react'\nimport { createEditor, CreateEditorPublicOptions } from '../editor/index.js'\nimport { paragraphElementType } from '../plugins/index.js'\nimport { useRichTextFieldNodes } from '../internal/hooks/useRichTextFieldNodes.js'\n\nexport type RichTextEditorProps =\n\t& FieldBasicProps\n\t& CreateEditorPublicOptions\n\t& {\n\t\tchildren: React.ReactNode\n\t}\n\n/**\n * Rich text field supports more advanced formatting capabilities. Output of this field is a JSON.\n *\n * @group Form Fields\n */\nexport const RichTextEditor: FunctionComponent<RichTextEditorProps> = Component(\n\tprops => {\n\t\tconst entity = useEntity()\n\t\tconst environment = entity.environment\n\t\tconst getParent = entity.getAccessor\n\n\t\tconst desugaredField = useMemo(\n\t\t\t() => QueryLanguage.desugarRelativeSingleField(props, environment),\n\t\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: props is stable via Component HOC\n\t\t\t[environment, props],\n\t\t)\n\t\tconst fieldAccessor = useMemo(() => entity.getField<string>(desugaredField), [entity, desugaredField])\n\n\t\t// The cache is questionable, really.\n\t\tconst [contemberFieldElementCache] = useState(() => new WeakMap<FieldAccessor<string>, SlateElement[]>())\n\n\t\tconst [editor] = useState(() => {\n\t\t\tconst { editor } = createEditor({\n\t\t\t\tplugins: props.plugins,\n\t\t\t\tdefaultElementType: paragraphElementType,\n\t\t\t\tentity,\n\t\t\t\tenvironment,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\n\t\t\tconst { normalizeNode } = editor\n\t\t\tObject.assign(editor, {\n\t\t\t\tinsertBreak: () => {\n\t\t\t\t\tTransforms.insertText(editor, '\\n')\n\t\t\t\t},\n\t\t\t\tnormalizeNode: (nodeEntry: NodeEntry) => {\n\t\t\t\t\tconst [node, path] = nodeEntry\n\t\t\t\t\tif (path.length === 0 && SlateElement.isAncestor(node)) {\n\t\t\t\t\t\t// Enforce that there's exactly one child and that it's\n\t\t\t\t\t\tif (node.children.length > 1) {\n\t\t\t\t\t\t\treturn Editor.withoutNormalizing(editor, () => {\n\t\t\t\t\t\t\t\tconst targetPath = [0, (editor.children[0] as SlateElement).children.length]\n\t\t\t\t\t\t\t\tTransforms.moveNodes(editor, {\n\t\t\t\t\t\t\t\t\tat: [1],\n\t\t\t\t\t\t\t\t\tto: targetPath,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\tTransforms.unwrapNodes(editor, { at: targetPath })\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (SlateElement.isElement(node.children[0]) && !editor.isDefaultElement(node.children[0])) {\n\t\t\t\t\t\t\treturn Editor.withoutNormalizing(editor, () => {\n\t\t\t\t\t\t\t\tTransforms.wrapNodes(editor, editor.createDefaultElement([{ text: '' }]), {\n\t\t\t\t\t\t\t\t\tat: path,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\tTransforms.unwrapNodes(editor, { at: [0, 0] })\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (SlateElement.isElement(node) && Editor.isBlock(editor, node) && path.length > 1) {\n\t\t\t\t\t\treturn Transforms.unwrapNodes(editor, { at: path })\n\t\t\t\t\t}\n\t\t\t\t\tnormalizeNode(nodeEntry)\n\t\t\t\t},\n\t\t\t})\n\n\t\t\treturn editor\n\t\t})\n\n\t\tconst valueNodes = useRichTextFieldNodes({\n\t\t\teditor,\n\t\t\tfieldAccessor,\n\t\t\tcontemberFieldElementCache,\n\t\t})\n\n\t\tconst serialize = editor.serializeNodes\n\t\tconst onChange = useCallback(\n\t\t\t(value: Descendant[]) => {\n\t\t\t\tgetParent().batchUpdates(getAccessor => {\n\t\t\t\t\tconst fieldAccessor = getAccessor().getField(desugaredField)\n\n\t\t\t\t\tif (SlateNode.string({ type: 'dummy', children: value }) === '' && fieldAccessor.valueOnServer === null) {\n\t\t\t\t\t\tfieldAccessor.updateValue(null)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tif (SlateElement.isElement(value[0])) {\n\t\t\t\t\t\tfieldAccessor.updateValue(serialize(value[0].children))\n\t\t\t\t\t\tcontemberFieldElementCache.set(getAccessor().getField(desugaredField), value as SlateElement[])\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t},\n\t\t\t[getParent, contemberFieldElementCache, desugaredField, serialize],\n\t\t)\n\n\t\treturn (\n\t\t\t<Slate editor={editor} initialValue={valueNodes} onChange={onChange}>\n\t\t\t\t{props.children}\n\t\t\t</Slate>\n\t\t)\n\t},\n\tprops => (\n\t\t<>\n\t\t\t<Field defaultValue={props.defaultValue} field={props.field} isNonbearing={props.isNonbearing} />\n\t\t</>\n\t),\n\t'RichTextEditor',\n)\n"],"names":["Component","useEntity","useMemo","QueryLanguage","useState","editor","createEditor","paragraphElementType","Transforms","SlateElement","Editor","useRichTextFieldNodes","useCallback","fieldAccessor","SlateNode","Slate","this","jsxDEV","Fragment","Field"],"mappings":";;;;;;;;;;AAoBO,MAAM,iBAAyDA,aAAAA;AAAAA,EACrE,CAAA,UAAS;AACR,UAAM,SAASC,aAAAA,UAAA;AACf,UAAM,cAAc,OAAO;AAC3B,UAAM,YAAY,OAAO;AAEzB,UAAM,iBAAiBC,MAAAA;AAAAA,MACtB,MAAMC,2BAAc,2BAA2B,OAAO,WAAW;AAAA;AAAA,MAEjE,CAAC,aAAa,KAAK;AAAA,IAAA;AAEpB,UAAM,gBAAgBD,cAAQ,MAAM,OAAO,SAAiB,cAAc,GAAG,CAAC,QAAQ,cAAc,CAAC;AAGrG,UAAM,CAAC,0BAA0B,IAAIE,MAAAA,SAAS,MAAM,oBAAI,SAAgD;AAExG,UAAM,CAAC,MAAM,IAAIA,MAAAA,SAAS,MAAM;AAC/B,YAAM,EAAE,QAAAC,QAAAA,IAAWC,0BAAa;A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,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAEA;AAAA,EAED;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"RichTextEditor.js","sources":["../../../../../packages/react-slate-editor-base/src/components/RichTextEditor.tsx"],"sourcesContent":["import { Component, Field, FieldAccessor, FieldBasicProps, QueryLanguage, useEntity } from '@contember/react-binding'\nimport { FunctionComponent, useCallback, useMemo, useState } from 'react'\nimport { Descendant, Editor, Element as SlateElement, Node as SlateNode, NodeEntry, Transforms } from 'slate'\nimport { Slate } from 'slate-react'\nimport { createEditor, CreateEditorPublicOptions } from '../editor'\nimport { paragraphElementType } from '../plugins'\nimport { useRichTextFieldNodes } from '../internal/hooks/useRichTextFieldNodes'\n\nexport type RichTextEditorProps =\n\t& FieldBasicProps\n\t& CreateEditorPublicOptions\n\t& {\n\t\tchildren: React.ReactNode\n\t}\n\n/**\n * Rich text field supports more advanced formatting capabilities. Output of this field is a JSON.\n *\n * @group Form Fields\n */\nexport const RichTextEditor: FunctionComponent<RichTextEditorProps> = Component(\n\tprops => {\n\t\tconst entity = useEntity()\n\t\tconst environment = entity.environment\n\t\tconst getParent = entity.getAccessor\n\n\t\tconst desugaredField = useMemo(\n\t\t\t() => QueryLanguage.desugarRelativeSingleField(props, environment),\n\t\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: props is stable via Component HOC\n\t\t\t[environment, props],\n\t\t)\n\t\tconst fieldAccessor = useMemo(() => entity.getField<string>(desugaredField), [entity, desugaredField])\n\n\t\t// The cache is questionable, really.\n\t\tconst [contemberFieldElementCache] = useState(() => new WeakMap<FieldAccessor<string>, SlateElement[]>())\n\n\t\tconst [editor] = useState(() => {\n\t\t\tconst { editor } = createEditor({\n\t\t\t\tplugins: props.plugins,\n\t\t\t\tdefaultElementType: paragraphElementType,\n\t\t\t\tentity,\n\t\t\t\tenvironment,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\n\t\t\tconst { normalizeNode } = editor\n\t\t\tObject.assign(editor, {\n\t\t\t\tinsertBreak: () => {\n\t\t\t\t\tTransforms.insertText(editor, '\\n')\n\t\t\t\t},\n\t\t\t\tnormalizeNode: (nodeEntry: NodeEntry) => {\n\t\t\t\t\tconst [node, path] = nodeEntry\n\t\t\t\t\tif (path.length === 0 && SlateElement.isAncestor(node)) {\n\t\t\t\t\t\t// Enforce that there's exactly one child and that it's\n\t\t\t\t\t\tif (node.children.length > 1) {\n\t\t\t\t\t\t\treturn Editor.withoutNormalizing(editor, () => {\n\t\t\t\t\t\t\t\tconst targetPath = [0, (editor.children[0] as SlateElement).children.length]\n\t\t\t\t\t\t\t\tTransforms.moveNodes(editor, {\n\t\t\t\t\t\t\t\t\tat: [1],\n\t\t\t\t\t\t\t\t\tto: targetPath,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\tTransforms.unwrapNodes(editor, { at: targetPath })\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (SlateElement.isElement(node.children[0]) && !editor.isDefaultElement(node.children[0])) {\n\t\t\t\t\t\t\treturn Editor.withoutNormalizing(editor, () => {\n\t\t\t\t\t\t\t\tTransforms.wrapNodes(editor, editor.createDefaultElement([{ text: '' }]), {\n\t\t\t\t\t\t\t\t\tat: path,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\tTransforms.unwrapNodes(editor, { at: [0, 0] })\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (SlateElement.isElement(node) && Editor.isBlock(editor, node) && path.length > 1) {\n\t\t\t\t\t\treturn Transforms.unwrapNodes(editor, { at: path })\n\t\t\t\t\t}\n\t\t\t\t\tnormalizeNode(nodeEntry)\n\t\t\t\t},\n\t\t\t})\n\n\t\t\treturn editor\n\t\t})\n\n\t\tconst valueNodes = useRichTextFieldNodes({\n\t\t\teditor,\n\t\t\tfieldAccessor,\n\t\t\tcontemberFieldElementCache,\n\t\t})\n\n\t\tconst serialize = editor.serializeNodes\n\t\tconst onChange = useCallback(\n\t\t\t(value: Descendant[]) => {\n\t\t\t\tgetParent().batchUpdates(getAccessor => {\n\t\t\t\t\tconst fieldAccessor = getAccessor().getField(desugaredField)\n\n\t\t\t\t\tif (SlateNode.string({ type: 'dummy', children: value }) === '' && fieldAccessor.valueOnServer === null) {\n\t\t\t\t\t\tfieldAccessor.updateValue(null)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tif (SlateElement.isElement(value[0])) {\n\t\t\t\t\t\tfieldAccessor.updateValue(serialize(value[0].children))\n\t\t\t\t\t\tcontemberFieldElementCache.set(getAccessor().getField(desugaredField), value as SlateElement[])\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t},\n\t\t\t[getParent, contemberFieldElementCache, desugaredField, serialize],\n\t\t)\n\n\t\treturn (\n\t\t\t<Slate editor={editor} initialValue={valueNodes} onChange={onChange}>\n\t\t\t\t{props.children}\n\t\t\t</Slate>\n\t\t)\n\t},\n\tprops => (\n\t\t<>\n\t\t\t<Field defaultValue={props.defaultValue} field={props.field} isNonbearing={props.isNonbearing} />\n\t\t</>\n\t),\n\t'RichTextEditor',\n)\n"],"names":["editor","SlateElement","fieldAccessor","SlateNode","this"],"mappings":";;;;;;;;AAoBO,MAAM,iBAAyD;AAAA,EACrE,CAAA,UAAS;AACR,UAAM,SAAS,UAAA;AACf,UAAM,cAAc,OAAO;AAC3B,UAAM,YAAY,OAAO;AAEzB,UAAM,iBAAiB;AAAA,MACtB,MAAM,cAAc,2BAA2B,OAAO,WAAW;AAAA;AAAA,MAEjE,CAAC,aAAa,KAAK;AAAA,IAAA;AAEpB,UAAM,gBAAgB,QAAQ,MAAM,OAAO,SAAiB,cAAc,GAAG,CAAC,QAAQ,cAAc,CAAC;AAGrG,UAAM,CAAC,0BAA0B,IAAI,SAAS,MAAM,oBAAI,SAAgD;AAExG,UAAM,CAAC,MAAM,IAAI,SAAS,MAAM;AAC/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version":3,"file":"RichTextEditor.js","sources":["../../../../../packages/react-slate-editor-base/src/components/RichTextEditor.tsx"],"sourcesContent":["import { Component, Field, FieldAccessor, FieldBasicProps, QueryLanguage, useEntity } from '@contember/react-binding'\nimport { FunctionComponent, useCallback, useMemo, useState } from 'react'\nimport { Descendant, Editor, Element as SlateElement, Node as SlateNode, NodeEntry, Transforms } from 'slate'\nimport { Slate } from 'slate-react'\nimport { createEditor, CreateEditorPublicOptions } from '../editor/index.js'\nimport { paragraphElementType } from '../plugins/index.js'\nimport { useRichTextFieldNodes } from '../internal/hooks/useRichTextFieldNodes.js'\n\nexport type RichTextEditorProps =\n\t& FieldBasicProps\n\t& CreateEditorPublicOptions\n\t& {\n\t\tchildren: React.ReactNode\n\t}\n\n/**\n * Rich text field supports more advanced formatting capabilities. Output of this field is a JSON.\n *\n * @group Form Fields\n */\nexport const RichTextEditor: FunctionComponent<RichTextEditorProps> = Component(\n\tprops => {\n\t\tconst entity = useEntity()\n\t\tconst environment = entity.environment\n\t\tconst getParent = entity.getAccessor\n\n\t\tconst desugaredField = useMemo(\n\t\t\t() => QueryLanguage.desugarRelativeSingleField(props, environment),\n\t\t\t// biome-ignore lint/correctness/useExhaustiveDependencies: props is stable via Component HOC\n\t\t\t[environment, props],\n\t\t)\n\t\tconst fieldAccessor = useMemo(() => entity.getField<string>(desugaredField), [entity, desugaredField])\n\n\t\t// The cache is questionable, really.\n\t\tconst [contemberFieldElementCache] = useState(() => new WeakMap<FieldAccessor<string>, SlateElement[]>())\n\n\t\tconst [editor] = useState(() => {\n\t\t\tconst { editor } = createEditor({\n\t\t\t\tplugins: props.plugins,\n\t\t\t\tdefaultElementType: paragraphElementType,\n\t\t\t\tentity,\n\t\t\t\tenvironment,\n\t\t\t\tchildren: props.children,\n\t\t\t})\n\n\t\t\tconst { normalizeNode } = editor\n\t\t\tObject.assign(editor, {\n\t\t\t\tinsertBreak: () => {\n\t\t\t\t\tTransforms.insertText(editor, '\\n')\n\t\t\t\t},\n\t\t\t\tnormalizeNode: (nodeEntry: NodeEntry) => {\n\t\t\t\t\tconst [node, path] = nodeEntry\n\t\t\t\t\tif (path.length === 0 && SlateElement.isAncestor(node)) {\n\t\t\t\t\t\t// Enforce that there's exactly one child and that it's\n\t\t\t\t\t\tif (node.children.length > 1) {\n\t\t\t\t\t\t\treturn Editor.withoutNormalizing(editor, () => {\n\t\t\t\t\t\t\t\tconst targetPath = [0, (editor.children[0] as SlateElement).children.length]\n\t\t\t\t\t\t\t\tTransforms.moveNodes(editor, {\n\t\t\t\t\t\t\t\t\tat: [1],\n\t\t\t\t\t\t\t\t\tto: targetPath,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\tTransforms.unwrapNodes(editor, { at: targetPath })\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (SlateElement.isElement(node.children[0]) && !editor.isDefaultElement(node.children[0])) {\n\t\t\t\t\t\t\treturn Editor.withoutNormalizing(editor, () => {\n\t\t\t\t\t\t\t\tTransforms.wrapNodes(editor, editor.createDefaultElement([{ text: '' }]), {\n\t\t\t\t\t\t\t\t\tat: path,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\tTransforms.unwrapNodes(editor, { at: [0, 0] })\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (SlateElement.isElement(node) && Editor.isBlock(editor, node) && path.length > 1) {\n\t\t\t\t\t\treturn Transforms.unwrapNodes(editor, { at: path })\n\t\t\t\t\t}\n\t\t\t\t\tnormalizeNode(nodeEntry)\n\t\t\t\t},\n\t\t\t})\n\n\t\t\treturn editor\n\t\t})\n\n\t\tconst valueNodes = useRichTextFieldNodes({\n\t\t\teditor,\n\t\t\tfieldAccessor,\n\t\t\tcontemberFieldElementCache,\n\t\t})\n\n\t\tconst serialize = editor.serializeNodes\n\t\tconst onChange = useCallback(\n\t\t\t(value: Descendant[]) => {\n\t\t\t\tgetParent().batchUpdates(getAccessor => {\n\t\t\t\t\tconst fieldAccessor = getAccessor().getField(desugaredField)\n\n\t\t\t\t\tif (SlateNode.string({ type: 'dummy', children: value }) === '' && fieldAccessor.valueOnServer === null) {\n\t\t\t\t\t\tfieldAccessor.updateValue(null)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tif (SlateElement.isElement(value[0])) {\n\t\t\t\t\t\tfieldAccessor.updateValue(serialize(value[0].children))\n\t\t\t\t\t\tcontemberFieldElementCache.set(getAccessor().getField(desugaredField), value as SlateElement[])\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t},\n\t\t\t[getParent, contemberFieldElementCache, desugaredField, serialize],\n\t\t)\n\n\t\treturn (\n\t\t\t<Slate editor={editor} initialValue={valueNodes} onChange={onChange}>\n\t\t\t\t{props.children}\n\t\t\t</Slate>\n\t\t)\n\t},\n\tprops => (\n\t\t<>\n\t\t\t<Field defaultValue={props.defaultValue} field={props.field} isNonbearing={props.isNonbearing} />\n\t\t</>\n\t),\n\t'RichTextEditor',\n)\n"],"names":["editor","SlateElement","fieldAccessor","SlateNode","this"],"mappings":";;;;;;;;AAoBO,MAAM,iBAAyD;AAAA,EACrE,CAAA,UAAS;AACR,UAAM,SAAS,UAAA;AACf,UAAM,cAAc,OAAO;AAC3B,UAAM,YAAY,OAAO;AAEzB,UAAM,iBAAiB;AAAA,MACtB,MAAM,cAAc,2BAA2B,OAAO,WAAW;AAAA;AAAA,MAEjE,CAAC,aAAa,KAAK;AAAA,IAAA;AAEpB,UAAM,gBAAgB,QAAQ,MAAM,OAAO,SAAiB,cAAc,GAAG,CAAC,QAAQ,cAAc,CAAC;AAGrG,UAAM,CAAC,0BAA0B,IAAI,SAAS,MAAM,oBAAI,SAAgD;AAExG,UAAM,CAAC,MAAM,IAAI,SAAS,MAAM;AAC/B,YAAM,EAAE,QAAAA,QAAAA,IAAW,aAAa;AAAA,QAC/B,SAAS,MAAM;AAAA,QACf,oBAAoB;AAAA,QACpB;AAAA,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aAAa,sBAAsB;AAAA,MACxC;AAAA,MACA;AAAA,MACA;AAAA,IAAA,CACA;AAED,UAAM,YAAY,OAAO;AACzB,UAAM,WAAW;AAAA,MAChB,CAAC,UAAwB;AACxB,kBAAA,EAAY,aAAa,CAAA,gBAAe;AACvC,gBAAME,iBAAgB,cAAc,SAAS,cAAc;AAE3D,cAAIC,KAAU,OAAO,EAAE,MAAM,SAAS,UAAU,MAAA,CAAO,MAAM,MAAMD,eAAc,kBAAkB,MAAM;AACxGA,2BAAc,YAAY,IAAI;AAC9B;AAAA,UACD;AAEA,cAAID,QAAa,UAAU,MAAM,CAAC,CAAC,GAAG;AACrCC,2BAAc,YAAY,UAAU,MAAM,CAAC,EAAE,QAAQ,CAAC;AACtD,uCAA2B,IAAI,YAAA,EAAc,SAAS,cAAc,GAAG,KAAuB;AAAA,UAC/F;AAAA,QACD,CAAC;AAAA,MACF;AAAA,MACA,CAAC,WAAW,4BAA4B,gBAAgB,SAAS;AAAA,IAAA;AAGlE,kCACE,OAAA,EAAM,QAAgB,cAAc,YAAY,UAC/C,gBAAM,YADR,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAAE,MAEA;AAAA,EAEF;AAAA,EACA,CAAA,UACC,uBAAA,UAAA,EACC,UAAA,uBAAC,OAAA,EAAM,cAAc,MAAM,cAAc,OAAO,MAAM,OAAO,cAAc,MAAM,aAAA,GAAjF,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAA+F,EAAA,GADhG,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAEA;AAAA,EAED;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EditorWrapNodeTrigger.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/components/triggers/EditorWrapNodeTrigger.tsx"],"sourcesContent":["import { Selection } from 'slate'\nimport { MouseEventHandler, ReactElement } from 'react'\nimport { useSlate } from 'slate-react'\nimport { Slot } from '@radix-ui/react-slot'\nimport * as React from 'react'\nimport { composeEventHandlers } from '@radix-ui/primitive'\nimport { EditorTransforms } from '../../slate-reexport'\n\nexport interface EditorWrapNodeTriggerProps {\n\telementType: string\n\tselection?: Selection\n\tsuchThat?: Record<string, unknown>\n\tchildren: ReactElement\n\tonClick?: MouseEventHandler<HTMLElement>\n}\n\nexport const EditorWrapNodeTrigger = ({ elementType, suchThat, selection, ...props }: EditorWrapNodeTriggerProps) => {\n\tconst editor = useSlate()\n\tconst onClick = () => {\n\t\tif (selection) {\n\t\t\tEditorTransforms.select(editor, selection)\n\t\t}\n\t\tEditorTransforms.wrapNodes(\n\t\t\teditor,\n\t\t\t{\n\t\t\t\ttype: elementType,\n\t\t\t\tchildren: [{ text: '' }],\n\t\t\t\t...suchThat,\n\t\t\t},\n\t\t\t{ split: true },\n\t\t)\n\t\tEditorTransforms.collapse(editor, { edge: 'end' })\n\t}\n\n\treturn <Slot {...props} onClick={composeEventHandlers(props.onClick, onClick)} />\n}\n"],"names":["useSlate","EditorTransforms","jsxDEV","Slot","composeEventHandlers","this"],"mappings":";;;;;;;AAgBO,MAAM,wBAAwB,CAAC,EAAE,aAAa,UAAU,WAAW,GAAG,YAAwC;AACpH,QAAM,SAASA,WAAAA,SAAA;AACf,QAAM,UAAU,MAAM;AACrB,QAAI,WAAW;AACdC,uBAAiB,OAAO,QAAQ,SAAS;AAAA,IAC1C;AACAA,UAAAA,WAAiB;AAAA,MAChB;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,UAAU,CAAC,EAAE,MAAM,IAAI;AAAA,QACvB,GAAG;AAAA,MAAA;AAAA,MAEJ,EAAE,OAAO,KAAA;AAAA,IAAK;AAEfA,UAAAA,WAAiB,SAAS,QAAQ,EAAE,MAAM,OAAO;AAAA,EAClD;AAEA,SAAOC,8BAAAA,OAACC,UAAAA,QAAM,GAAG,OAAO,SAASC,UAAAA,qBAAqB,MAAM,SAAS,OAAO,KAArE,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAAwE;AAChF;;"}
1
+ {"version":3,"file":"EditorWrapNodeTrigger.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/components/triggers/EditorWrapNodeTrigger.tsx"],"sourcesContent":["import { Selection } from 'slate'\nimport { MouseEventHandler, ReactElement } from 'react'\nimport { useSlate } from 'slate-react'\nimport { Slot } from '@radix-ui/react-slot'\nimport * as React from 'react'\nimport { composeEventHandlers } from '@radix-ui/primitive'\nimport { EditorTransforms } from '../../slate-reexport.js'\n\nexport interface EditorWrapNodeTriggerProps {\n\telementType: string\n\tselection?: Selection\n\tsuchThat?: Record<string, unknown>\n\tchildren: ReactElement\n\tonClick?: MouseEventHandler<HTMLElement>\n}\n\nexport const EditorWrapNodeTrigger = ({ elementType, suchThat, selection, ...props }: EditorWrapNodeTriggerProps) => {\n\tconst editor = useSlate()\n\tconst onClick = () => {\n\t\tif (selection) {\n\t\t\tEditorTransforms.select(editor, selection)\n\t\t}\n\t\tEditorTransforms.wrapNodes(\n\t\t\teditor,\n\t\t\t{\n\t\t\t\ttype: elementType,\n\t\t\t\tchildren: [{ text: '' }],\n\t\t\t\t...suchThat,\n\t\t\t},\n\t\t\t{ split: true },\n\t\t)\n\t\tEditorTransforms.collapse(editor, { edge: 'end' })\n\t}\n\n\treturn <Slot {...props} onClick={composeEventHandlers(props.onClick, onClick)} />\n}\n"],"names":["useSlate","EditorTransforms","jsxDEV","Slot","composeEventHandlers","this"],"mappings":";;;;;;;AAgBO,MAAM,wBAAwB,CAAC,EAAE,aAAa,UAAU,WAAW,GAAG,YAAwC;AACpH,QAAM,SAASA,WAAAA,SAAA;AACf,QAAM,UAAU,MAAM;AACrB,QAAI,WAAW;AACdC,uBAAiB,OAAO,QAAQ,SAAS;AAAA,IAC1C;AACAA,UAAAA,WAAiB;AAAA,MAChB;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,UAAU,CAAC,EAAE,MAAM,IAAI;AAAA,QACvB,GAAG;AAAA,MAAA;AAAA,MAEJ,EAAE,OAAO,KAAA;AAAA,IAAK;AAEfA,UAAAA,WAAiB,SAAS,QAAQ,EAAE,MAAM,OAAO;AAAA,EAClD;AAEA,SAAOC,8BAAAA,OAACC,UAAAA,QAAM,GAAG,OAAO,SAASC,UAAAA,qBAAqB,MAAM,SAAS,OAAO,KAArE,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAAwE;AAChF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EditorWrapNodeTrigger.js","sources":["../../../../../../packages/react-slate-editor-base/src/components/triggers/EditorWrapNodeTrigger.tsx"],"sourcesContent":["import { Selection } from 'slate'\nimport { MouseEventHandler, ReactElement } from 'react'\nimport { useSlate } from 'slate-react'\nimport { Slot } from '@radix-ui/react-slot'\nimport * as React from 'react'\nimport { composeEventHandlers } from '@radix-ui/primitive'\nimport { EditorTransforms } from '../../slate-reexport'\n\nexport interface EditorWrapNodeTriggerProps {\n\telementType: string\n\tselection?: Selection\n\tsuchThat?: Record<string, unknown>\n\tchildren: ReactElement\n\tonClick?: MouseEventHandler<HTMLElement>\n}\n\nexport const EditorWrapNodeTrigger = ({ elementType, suchThat, selection, ...props }: EditorWrapNodeTriggerProps) => {\n\tconst editor = useSlate()\n\tconst onClick = () => {\n\t\tif (selection) {\n\t\t\tEditorTransforms.select(editor, selection)\n\t\t}\n\t\tEditorTransforms.wrapNodes(\n\t\t\teditor,\n\t\t\t{\n\t\t\t\ttype: elementType,\n\t\t\t\tchildren: [{ text: '' }],\n\t\t\t\t...suchThat,\n\t\t\t},\n\t\t\t{ split: true },\n\t\t)\n\t\tEditorTransforms.collapse(editor, { edge: 'end' })\n\t}\n\n\treturn <Slot {...props} onClick={composeEventHandlers(props.onClick, onClick)} />\n}\n"],"names":["EditorTransforms","this"],"mappings":";;;;;AAgBO,MAAM,wBAAwB,CAAC,EAAE,aAAa,UAAU,WAAW,GAAG,YAAwC;AACpH,QAAM,SAAS,SAAA;AACf,QAAM,UAAU,MAAM;AACrB,QAAI,WAAW;AACdA,iBAAiB,OAAO,QAAQ,SAAS;AAAA,IAC1C;AACAA,eAAiB;AAAA,MAChB;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,UAAU,CAAC,EAAE,MAAM,IAAI;AAAA,QACvB,GAAG;AAAA,MAAA;AAAA,MAEJ,EAAE,OAAO,KAAA;AAAA,IAAK;AAEfA,eAAiB,SAAS,QAAQ,EAAE,MAAM,OAAO;AAAA,EAClD;AAEA,SAAO,uBAAC,QAAM,GAAG,OAAO,SAAS,qBAAqB,MAAM,SAAS,OAAO,KAArE,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAAwE;AAChF;"}
1
+ {"version":3,"file":"EditorWrapNodeTrigger.js","sources":["../../../../../../packages/react-slate-editor-base/src/components/triggers/EditorWrapNodeTrigger.tsx"],"sourcesContent":["import { Selection } from 'slate'\nimport { MouseEventHandler, ReactElement } from 'react'\nimport { useSlate } from 'slate-react'\nimport { Slot } from '@radix-ui/react-slot'\nimport * as React from 'react'\nimport { composeEventHandlers } from '@radix-ui/primitive'\nimport { EditorTransforms } from '../../slate-reexport.js'\n\nexport interface EditorWrapNodeTriggerProps {\n\telementType: string\n\tselection?: Selection\n\tsuchThat?: Record<string, unknown>\n\tchildren: ReactElement\n\tonClick?: MouseEventHandler<HTMLElement>\n}\n\nexport const EditorWrapNodeTrigger = ({ elementType, suchThat, selection, ...props }: EditorWrapNodeTriggerProps) => {\n\tconst editor = useSlate()\n\tconst onClick = () => {\n\t\tif (selection) {\n\t\t\tEditorTransforms.select(editor, selection)\n\t\t}\n\t\tEditorTransforms.wrapNodes(\n\t\t\teditor,\n\t\t\t{\n\t\t\t\ttype: elementType,\n\t\t\t\tchildren: [{ text: '' }],\n\t\t\t\t...suchThat,\n\t\t\t},\n\t\t\t{ split: true },\n\t\t)\n\t\tEditorTransforms.collapse(editor, { edge: 'end' })\n\t}\n\n\treturn <Slot {...props} onClick={composeEventHandlers(props.onClick, onClick)} />\n}\n"],"names":["EditorTransforms","this"],"mappings":";;;;;AAgBO,MAAM,wBAAwB,CAAC,EAAE,aAAa,UAAU,WAAW,GAAG,YAAwC;AACpH,QAAM,SAAS,SAAA;AACf,QAAM,UAAU,MAAM;AACrB,QAAI,WAAW;AACdA,iBAAiB,OAAO,QAAQ,SAAS;AAAA,IAC1C;AACAA,eAAiB;AAAA,MAChB;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,UAAU,CAAC,EAAE,MAAM,IAAI;AAAA,QACvB,GAAG;AAAA,MAAA;AAAA,MAEJ,EAAE,OAAO,KAAA;AAAA,IAAK;AAEfA,eAAiB,SAAS,QAAQ,EAAE,MAAM,OAAO;AAAA,EAClD;AAEA,SAAO,uBAAC,QAAM,GAAG,OAAO,SAAS,qBAAqB,MAAM,SAAS,OAAO,KAArE,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAC,MAAwE;AAChF;"}
@@ -1 +1 @@
1
- {"version":3,"file":"createEditor.cjs","sources":["../../../../../packages/react-slate-editor-base/src/editor/createEditor.ts"],"sourcesContent":["import { createEditorWithEssentials } from './createEditorWithEssentials'\nimport { Editor } from 'slate'\nimport { EditorPlugin, EditorPluginWrapperProps } from '../types'\nimport { createElement, FunctionComponent, ReactNode } from 'react'\nimport { EntityAccessor } from '@contember/react-binding'\nimport { Environment } from '@contember/react-binding'\n\nexport interface CreateEditorPublicOptions {\n\tplugins?: EditorPlugin[]\n}\n\nexport interface CreateEditorOptions extends CreateEditorPublicOptions {\n\tdefaultElementType: string\n\tentity: EntityAccessor\n\tenvironment: Environment\n\tchildren: ReactNode\n}\n\nexport const createEditor = ({\n\tplugins = [],\n\tdefaultElementType,\n\tentity,\n\tenvironment,\n\tchildren,\n}: CreateEditorOptions): {\n\teditor: Editor\n\tOuterWrapper: FunctionComponent<{ children: ReactNode }>\n\tInnerWrapper: FunctionComponent<{ children: ReactNode }>\n} => {\n\tconst editor = createEditorWithEssentials({ defaultElementType })\n\tconst outerWrappers: FunctionComponent<EditorPluginWrapperProps>[] = []\n\tconst innerWrappers: FunctionComponent<EditorPluginWrapperProps>[] = []\n\tplugins?.forEach(plugin => {\n\t\tif (typeof plugin === 'function') {\n\t\t\tplugin(editor)\n\t\t\treturn\n\t\t}\n\t\tplugin.extendEditor?.({ editor, children, environment, entity })\n\t\tif (plugin?.OuterWrapper) {\n\t\t\touterWrappers.push(plugin.OuterWrapper)\n\t\t}\n\t\tif (plugin?.InnerWrapper) {\n\t\t\tinnerWrappers.push(plugin.InnerWrapper)\n\t\t}\n\t})\n\treturn {\n\t\teditor,\n\t\tOuterWrapper: ({ children }) => outerWrappers.reduceRight((acc, Wrapper) => createElement(Wrapper, { editor }, acc), children),\n\t\tInnerWrapper: ({ children }) => innerWrappers.reduceRight((acc, Wrapper) => createElement(Wrapper, { editor }, acc), children),\n\t}\n}\n"],"names":["createEditorWithEssentials","children","createElement"],"mappings":";;;;AAkBO,MAAM,eAAe,CAAC;AAAA,EAC5B,UAAU,CAAA;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,MAIK;AACJ,QAAM,SAASA,2BAAAA,2BAA2B,EAAE,oBAAoB;AAChE,QAAM,gBAA+D,CAAA;AACrE,QAAM,gBAA+D,CAAA;AACrE,WAAS,QAAQ,CAAA,WAAU;AAC1B,QAAI,OAAO,WAAW,YAAY;AACjC,aAAO,MAAM;AACb;AAAA,IACD;AACA,WAAO,eAAe,EAAE,QAAQ,UAAU,aAAa,QAAQ;AAC/D,QAAI,QAAQ,cAAc;AACzB,oBAAc,KAAK,OAAO,YAAY;AAAA,IACvC;AACA,QAAI,QAAQ,cAAc;AACzB,oBAAc,KAAK,OAAO,YAAY;AAAA,IACvC;AAAA,EACD,CAAC;AACD,SAAO;AAAA,IACN;AAAA,IACA,cAAc,CAAC,EAAE,UAAAC,UAAAA,MAAe,cAAc,YAAY,CAAC,KAAK,YAAYC,MAAAA,cAAc,SAAS,EAAE,UAAU,GAAG,GAAGD,SAAQ;AAAA,IAC7H,cAAc,CAAC,EAAE,UAAAA,UAAAA,MAAe,cAAc,YAAY,CAAC,KAAK,YAAYC,MAAAA,cAAc,SAAS,EAAE,UAAU,GAAG,GAAGD,SAAQ;AAAA,EAAA;AAE/H;;"}
1
+ {"version":3,"file":"createEditor.cjs","sources":["../../../../../packages/react-slate-editor-base/src/editor/createEditor.ts"],"sourcesContent":["import { createEditorWithEssentials } from './createEditorWithEssentials.js'\nimport { Editor } from 'slate'\nimport { EditorPlugin, EditorPluginWrapperProps } from '../types/index.js'\nimport { createElement, FunctionComponent, ReactNode } from 'react'\nimport { EntityAccessor } from '@contember/react-binding'\nimport { Environment } from '@contember/react-binding'\n\nexport interface CreateEditorPublicOptions {\n\tplugins?: EditorPlugin[]\n}\n\nexport interface CreateEditorOptions extends CreateEditorPublicOptions {\n\tdefaultElementType: string\n\tentity: EntityAccessor\n\tenvironment: Environment\n\tchildren: ReactNode\n}\n\nexport const createEditor = ({\n\tplugins = [],\n\tdefaultElementType,\n\tentity,\n\tenvironment,\n\tchildren,\n}: CreateEditorOptions): {\n\teditor: Editor\n\tOuterWrapper: FunctionComponent<{ children: ReactNode }>\n\tInnerWrapper: FunctionComponent<{ children: ReactNode }>\n} => {\n\tconst editor = createEditorWithEssentials({ defaultElementType })\n\tconst outerWrappers: FunctionComponent<EditorPluginWrapperProps>[] = []\n\tconst innerWrappers: FunctionComponent<EditorPluginWrapperProps>[] = []\n\tplugins?.forEach(plugin => {\n\t\tif (typeof plugin === 'function') {\n\t\t\tplugin(editor)\n\t\t\treturn\n\t\t}\n\t\tplugin.extendEditor?.({ editor, children, environment, entity })\n\t\tif (plugin?.OuterWrapper) {\n\t\t\touterWrappers.push(plugin.OuterWrapper)\n\t\t}\n\t\tif (plugin?.InnerWrapper) {\n\t\t\tinnerWrappers.push(plugin.InnerWrapper)\n\t\t}\n\t})\n\treturn {\n\t\teditor,\n\t\tOuterWrapper: ({ children }) => outerWrappers.reduceRight((acc, Wrapper) => createElement(Wrapper, { editor }, acc), children),\n\t\tInnerWrapper: ({ children }) => innerWrappers.reduceRight((acc, Wrapper) => createElement(Wrapper, { editor }, acc), children),\n\t}\n}\n"],"names":["createEditorWithEssentials","children","createElement"],"mappings":";;;;AAkBO,MAAM,eAAe,CAAC;AAAA,EAC5B,UAAU,CAAA;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,MAIK;AACJ,QAAM,SAASA,2BAAAA,2BAA2B,EAAE,oBAAoB;AAChE,QAAM,gBAA+D,CAAA;AACrE,QAAM,gBAA+D,CAAA;AACrE,WAAS,QAAQ,CAAA,WAAU;AAC1B,QAAI,OAAO,WAAW,YAAY;AACjC,aAAO,MAAM;AACb;AAAA,IACD;AACA,WAAO,eAAe,EAAE,QAAQ,UAAU,aAAa,QAAQ;AAC/D,QAAI,QAAQ,cAAc;AACzB,oBAAc,KAAK,OAAO,YAAY;AAAA,IACvC;AACA,QAAI,QAAQ,cAAc;AACzB,oBAAc,KAAK,OAAO,YAAY;AAAA,IACvC;AAAA,EACD,CAAC;AACD,SAAO;AAAA,IACN;AAAA,IACA,cAAc,CAAC,EAAE,UAAAC,UAAAA,MAAe,cAAc,YAAY,CAAC,KAAK,YAAYC,MAAAA,cAAc,SAAS,EAAE,UAAU,GAAG,GAAGD,SAAQ;AAAA,IAC7H,cAAc,CAAC,EAAE,UAAAA,UAAAA,MAAe,cAAc,YAAY,CAAC,KAAK,YAAYC,MAAAA,cAAc,SAAS,EAAE,UAAU,GAAG,GAAGD,SAAQ;AAAA,EAAA;AAE/H;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"createEditor.js","sources":["../../../../../packages/react-slate-editor-base/src/editor/createEditor.ts"],"sourcesContent":["import { createEditorWithEssentials } from './createEditorWithEssentials'\nimport { Editor } from 'slate'\nimport { EditorPlugin, EditorPluginWrapperProps } from '../types'\nimport { createElement, FunctionComponent, ReactNode } from 'react'\nimport { EntityAccessor } from '@contember/react-binding'\nimport { Environment } from '@contember/react-binding'\n\nexport interface CreateEditorPublicOptions {\n\tplugins?: EditorPlugin[]\n}\n\nexport interface CreateEditorOptions extends CreateEditorPublicOptions {\n\tdefaultElementType: string\n\tentity: EntityAccessor\n\tenvironment: Environment\n\tchildren: ReactNode\n}\n\nexport const createEditor = ({\n\tplugins = [],\n\tdefaultElementType,\n\tentity,\n\tenvironment,\n\tchildren,\n}: CreateEditorOptions): {\n\teditor: Editor\n\tOuterWrapper: FunctionComponent<{ children: ReactNode }>\n\tInnerWrapper: FunctionComponent<{ children: ReactNode }>\n} => {\n\tconst editor = createEditorWithEssentials({ defaultElementType })\n\tconst outerWrappers: FunctionComponent<EditorPluginWrapperProps>[] = []\n\tconst innerWrappers: FunctionComponent<EditorPluginWrapperProps>[] = []\n\tplugins?.forEach(plugin => {\n\t\tif (typeof plugin === 'function') {\n\t\t\tplugin(editor)\n\t\t\treturn\n\t\t}\n\t\tplugin.extendEditor?.({ editor, children, environment, entity })\n\t\tif (plugin?.OuterWrapper) {\n\t\t\touterWrappers.push(plugin.OuterWrapper)\n\t\t}\n\t\tif (plugin?.InnerWrapper) {\n\t\t\tinnerWrappers.push(plugin.InnerWrapper)\n\t\t}\n\t})\n\treturn {\n\t\teditor,\n\t\tOuterWrapper: ({ children }) => outerWrappers.reduceRight((acc, Wrapper) => createElement(Wrapper, { editor }, acc), children),\n\t\tInnerWrapper: ({ children }) => innerWrappers.reduceRight((acc, Wrapper) => createElement(Wrapper, { editor }, acc), children),\n\t}\n}\n"],"names":["children"],"mappings":";;AAkBO,MAAM,eAAe,CAAC;AAAA,EAC5B,UAAU,CAAA;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,MAIK;AACJ,QAAM,SAAS,2BAA2B,EAAE,oBAAoB;AAChE,QAAM,gBAA+D,CAAA;AACrE,QAAM,gBAA+D,CAAA;AACrE,WAAS,QAAQ,CAAA,WAAU;AAC1B,QAAI,OAAO,WAAW,YAAY;AACjC,aAAO,MAAM;AACb;AAAA,IACD;AACA,WAAO,eAAe,EAAE,QAAQ,UAAU,aAAa,QAAQ;AAC/D,QAAI,QAAQ,cAAc;AACzB,oBAAc,KAAK,OAAO,YAAY;AAAA,IACvC;AACA,QAAI,QAAQ,cAAc;AACzB,oBAAc,KAAK,OAAO,YAAY;AAAA,IACvC;AAAA,EACD,CAAC;AACD,SAAO;AAAA,IACN;AAAA,IACA,cAAc,CAAC,EAAE,UAAAA,UAAAA,MAAe,cAAc,YAAY,CAAC,KAAK,YAAY,cAAc,SAAS,EAAE,UAAU,GAAG,GAAGA,SAAQ;AAAA,IAC7H,cAAc,CAAC,EAAE,UAAAA,UAAAA,MAAe,cAAc,YAAY,CAAC,KAAK,YAAY,cAAc,SAAS,EAAE,UAAU,GAAG,GAAGA,SAAQ;AAAA,EAAA;AAE/H;"}
1
+ {"version":3,"file":"createEditor.js","sources":["../../../../../packages/react-slate-editor-base/src/editor/createEditor.ts"],"sourcesContent":["import { createEditorWithEssentials } from './createEditorWithEssentials.js'\nimport { Editor } from 'slate'\nimport { EditorPlugin, EditorPluginWrapperProps } from '../types/index.js'\nimport { createElement, FunctionComponent, ReactNode } from 'react'\nimport { EntityAccessor } from '@contember/react-binding'\nimport { Environment } from '@contember/react-binding'\n\nexport interface CreateEditorPublicOptions {\n\tplugins?: EditorPlugin[]\n}\n\nexport interface CreateEditorOptions extends CreateEditorPublicOptions {\n\tdefaultElementType: string\n\tentity: EntityAccessor\n\tenvironment: Environment\n\tchildren: ReactNode\n}\n\nexport const createEditor = ({\n\tplugins = [],\n\tdefaultElementType,\n\tentity,\n\tenvironment,\n\tchildren,\n}: CreateEditorOptions): {\n\teditor: Editor\n\tOuterWrapper: FunctionComponent<{ children: ReactNode }>\n\tInnerWrapper: FunctionComponent<{ children: ReactNode }>\n} => {\n\tconst editor = createEditorWithEssentials({ defaultElementType })\n\tconst outerWrappers: FunctionComponent<EditorPluginWrapperProps>[] = []\n\tconst innerWrappers: FunctionComponent<EditorPluginWrapperProps>[] = []\n\tplugins?.forEach(plugin => {\n\t\tif (typeof plugin === 'function') {\n\t\t\tplugin(editor)\n\t\t\treturn\n\t\t}\n\t\tplugin.extendEditor?.({ editor, children, environment, entity })\n\t\tif (plugin?.OuterWrapper) {\n\t\t\touterWrappers.push(plugin.OuterWrapper)\n\t\t}\n\t\tif (plugin?.InnerWrapper) {\n\t\t\tinnerWrappers.push(plugin.InnerWrapper)\n\t\t}\n\t})\n\treturn {\n\t\teditor,\n\t\tOuterWrapper: ({ children }) => outerWrappers.reduceRight((acc, Wrapper) => createElement(Wrapper, { editor }, acc), children),\n\t\tInnerWrapper: ({ children }) => innerWrappers.reduceRight((acc, Wrapper) => createElement(Wrapper, { editor }, acc), children),\n\t}\n}\n"],"names":["children"],"mappings":";;AAkBO,MAAM,eAAe,CAAC;AAAA,EAC5B,UAAU,CAAA;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,MAIK;AACJ,QAAM,SAAS,2BAA2B,EAAE,oBAAoB;AAChE,QAAM,gBAA+D,CAAA;AACrE,QAAM,gBAA+D,CAAA;AACrE,WAAS,QAAQ,CAAA,WAAU;AAC1B,QAAI,OAAO,WAAW,YAAY;AACjC,aAAO,MAAM;AACb;AAAA,IACD;AACA,WAAO,eAAe,EAAE,QAAQ,UAAU,aAAa,QAAQ;AAC/D,QAAI,QAAQ,cAAc;AACzB,oBAAc,KAAK,OAAO,YAAY;AAAA,IACvC;AACA,QAAI,QAAQ,cAAc;AACzB,oBAAc,KAAK,OAAO,YAAY;AAAA,IACvC;AAAA,EACD,CAAC;AACD,SAAO;AAAA,IACN;AAAA,IACA,cAAc,CAAC,EAAE,UAAAA,UAAAA,MAAe,cAAc,YAAY,CAAC,KAAK,YAAY,cAAc,SAAS,EAAE,UAAU,GAAG,GAAGA,SAAQ;AAAA,IAC7H,cAAc,CAAC,EAAE,UAAAA,UAAAA,MAAe,cAAc,YAAY,CAAC,KAAK,YAAY,cAAc,SAAS,EAAE,UAAU,GAAG,GAAGA,SAAQ;AAAA,EAAA;AAE/H;"}
@@ -1 +1 @@
1
- {"version":3,"file":"createEditorWithEssentials.cjs","sources":["../../../../../packages/react-slate-editor-base/src/editor/createEditorWithEssentials.tsx"],"sourcesContent":["import { createElement, isValidElement, ReactElement } from 'react'\nimport {\n\tcreateEditor,\n\tDescendant,\n\tEditor,\n\tElement as SlateElement,\n\tNode as SlateNode,\n\tPath,\n\tRange as SlateRange,\n\tText as SlateText,\n\tTransforms,\n} from 'slate'\nimport * as Slate from 'slate'\nimport { withHistory } from 'slate-history'\nimport { ReactEditor, withReact } from 'slate-react'\nimport { EditorElementPlugin, EditorMarkPlugin } from '../types/plugins'\nimport { TextSpecifics } from '../types/editor'\nimport { DefaultElement } from '../internal/components/DefaultElement'\nimport { withPaste } from '../plugins/behaviour'\nimport { ContemberEditor } from './index'\n\nexport const createEditorWithEssentials = ({ defaultElementType }: { defaultElementType: string }): Editor => {\n\tconst underlyingEditor = withHistory(withReact(createEditor() as ReactEditor))\n\n\tconst editor = underlyingEditor as unknown as Editor\n\tconst { normalizeNode, isInline, isVoid, deleteBackward } = editor\n\n\tconst elements = new Map<string, EditorElementPlugin<any>>()\n\tconst marks = new Map<string, EditorMarkPlugin>()\n\n\tObject.assign<Editor, Partial<Editor>>(editor, {\n\t\tslate: Slate,\n\t\tformatVersion: 1,\n\t\tdefaultElementType,\n\t\tisDefaultElement: element => 'type' in element && (element as any).type === defaultElementType,\n\t\tcreateDefaultElement: children => ({\n\t\t\ttype: defaultElementType,\n\t\t\tchildren,\n\t\t}),\n\t\tinsertBetweenBlocks: ([element, path], edge) => {\n\t\t\tconst edgeOffset = edge === 'before' ? 0 : 1\n\t\t\tconst targetPath = path.slice(0, -1).concat(path[path.length - 1] + edgeOffset)\n\t\t\tTransforms.insertNodes(editor, editor.createDefaultElement([{ text: '' }]), {\n\t\t\t\tat: targetPath,\n\t\t\t\tselect: true,\n\t\t\t})\n\t\t},\n\n\t\tcanToggleMarks: () => true,\n\t\tcanToggleElement: <E extends SlateElement>() => true,\n\n\t\thasMarks: <T extends SlateText>(marks: TextSpecifics<T>) => ContemberEditor.hasMarks(editor, marks),\n\n\t\t// TODO in the following function, we need to conditionally trim the selection so that it doesn't potentially\n\t\t// \tinclude empty strings at the edges of top-level elements.\n\t\tisElementActive: <E extends SlateElement>(elementType: E['type'], suchThat?: Partial<E>) => {\n\t\t\treturn (\n\t\t\t\telements.get(elementType)?.isActive?.({ editor, suchThat })\n\t\t\t\t\t?? Array.from(Editor.nodes(editor, {\n\t\t\t\t\t\t\tmatch: node => SlateElement.isElement(node) && ContemberEditor.isElementType(node, elementType, suchThat),\n\t\t\t\t\t\t\tvoids: false,\n\t\t\t\t\t\t})).length > 0\n\t\t\t)\n\t\t},\n\n\t\tacceptsAttributes: <E extends SlateElement>(elementType: E['type'], suchThat: Partial<E>) => {\n\t\t\treturn elements.get(elementType)?.acceptsAttributes?.({ editor, suchThat }) ?? false\n\t\t},\n\n\t\ttoggleMarks: <T extends SlateText>(marks: TextSpecifics<T>) => {\n\t\t\tif (!editor.canToggleMarks(marks)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst isActive = editor.hasMarks(marks)\n\t\t\tif (isActive) {\n\t\t\t\tContemberEditor.removeMarks(editor, marks)\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tContemberEditor.addMarks(editor, marks)\n\t\t\treturn true\n\t\t},\n\t\ttoggleElement: <E extends SlateElement>(elementType: E['type'], suchThat?: Partial<E>) => {\n\t\t\telements.get(elementType)?.toggleElement?.({\n\t\t\t\teditor,\n\t\t\t\tsuchThat,\n\t\t\t})\n\t\t},\n\n\t\tisInline: element => {\n\t\t\treturn elements.get(element.type)?.isInline ?? isInline(element)\n\t\t},\n\n\t\tisVoid: element => {\n\t\t\tconst elIsVoid = elements.get(element.type)?.isVoid\n\t\t\tif (elIsVoid === undefined) {\n\t\t\t\treturn isVoid(element)\n\t\t\t}\n\t\t\tif (typeof elIsVoid === 'boolean') {\n\t\t\t\treturn elIsVoid\n\t\t\t}\n\t\t\treturn elIsVoid({ editor, element })\n\t\t},\n\n\t\tcanContainAnyBlocks: element => {\n\t\t\tif (Editor.isEditor(element)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn !editor.isInline(element)\n\t\t\t\t&& !editor.isVoid(element)\n\t\t\t\t&& (elements.has(element.type) ? elements.get(element.type)!.canContainAnyBlocks ?? false : true)\n\t\t},\n\n\t\tserializeNodes: (nodes, errorMessage) => ContemberEditor.serializeNodes(editor, nodes, errorMessage),\n\t\tdeserializeNodes: (serializedNodes, errorMessage) => ContemberEditor.permissivelyDeserializeNodes(editor, serializedNodes, errorMessage),\n\n\t\tupgradeFormatBySingleVersion: (node, oldVersion) => {\n\t\t\tif (SlateElement.isElement(node)) {\n\t\t\t\treturn {\n\t\t\t\t\t...node,\n\t\t\t\t\tchildren: node.children.map(child => editor.upgradeFormatBySingleVersion(child, oldVersion) as Descendant),\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn node\n\t\t},\n\n\t\trenderElement: props => {\n\t\t\tconst component = elements.get(props.element.type)?.render ?? DefaultElement\n\t\t\treturn createElement(component, props)\n\t\t},\n\n\t\trenderLeafChildren: props => props.children,\n\n\t\trenderLeaf: props => {\n\t\t\tlet el: ReactElement = createElement('span', props.attributes, editor.renderLeafChildren(props))\n\t\t\tfor (const [, mark] of marks) {\n\t\t\t\tif (props.leaf[mark.type] === true) {\n\t\t\t\t\tconst markerEl = mark.render({ ...props, children: el })\n\t\t\t\t\tif (markerEl !== null) {\n\t\t\t\t\t\tif (!isValidElement(markerEl)) {\n\t\t\t\t\t\t\tthrow new Error(`Mark plugin ${mark.type} returned a non-React element`)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tel = markerEl\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn el\n\t\t},\n\n\t\t// Just noop functions so that other plugins can safely bubble-call\n\t\tonDOMBeforeInput: () => {},\n\t\tonKeyDown: e => {\n\t\t\tfor (const [, mark] of marks) {\n\t\t\t\tif (mark.isHotKey(e.nativeEvent)) {\n\t\t\t\t\teditor.toggleMarks({ [mark.type]: true })\n\t\t\t\t\te.preventDefault()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Inline void nodes cannot be deleted by default: https://github.com/ianstormtaylor/slate/issues/3456\n\t\t\t// This is a hack to get around this issue. The problem is that when an inline void node is selected, Slate's\n\t\t\t// beforeInput handler doesn't get triggered. However, when we put the caret right after the inline void\n\t\t\t// and press Backspace (or the other way around with Delete), it works just fine. Furthermore, if we deleted the\n\t\t\t// node directly, either we'd lose the selection state or Slate, not knowing about us deleting, would still\n\t\t\t// try to delete things on its own so as to respond to the user interaction. So we take advantage of this and\n\t\t\t// instead of deleting the void node, we just carefully move the selection and have Slate do the deleting.\n\t\t\tif (e.key !== 'Delete' && e.key !== 'Backspace') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst selection = editor.selection\n\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst voidEntry = Editor.void(editor, {\n\t\t\t\t\tat: selection,\n\t\t\t\t\tmode: 'lowest',\n\t\t\t\t\tvoids: true,\n\t\t\t\t})\n\t\t\t\tif (!voidEntry) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst [node, nodePath] = voidEntry\n\t\t\t\tif (editor.isInline(node)) {\n\t\t\t\t\tconst adjacentPoint = e.key === 'Backspace'\n\t\t\t\t\t\t? Editor.point(editor, Path.next(nodePath), {\n\t\t\t\t\t\t\tedge: 'start',\n\t\t\t\t\t\t})\n\t\t\t\t\t\t: Editor.point(editor, Path.previous(nodePath), {\n\t\t\t\t\t\t\tedge: 'end',\n\t\t\t\t\t\t})\n\t\t\t\t\tTransforms.select(editor, adjacentPoint)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tonFocus: () => {},\n\t\tonBlur: () => {},\n\t\tnormalizeNode: ([node, path]) => {\n\t\t\tif (Editor.isEditor(node) && node.children.length === 0) {\n\t\t\t\tTransforms.insertNodes(editor, editor.createDefaultElement([{ text: '' }]))\n\t\t\t}\n\t\t\tif (!SlateElement.isElement(node)) {\n\t\t\t\tnormalizeNode([node, path])\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlet defaultPrevented = false\n\t\t\telements.get(node.type)?.normalizeNode?.({\n\t\t\t\telement: node,\n\t\t\t\tpath,\n\t\t\t\teditor,\n\t\t\t\tpreventDefault: () => {\n\t\t\t\t\tdefaultPrevented = true\n\t\t\t\t},\n\t\t\t})\n\t\t\tif (!defaultPrevented) {\n\t\t\t\tnormalizeNode([node, path])\n\t\t\t}\n\t\t},\n\t\tregisterElement: plugin => {\n\t\t\telements.set(plugin.type, plugin)\n\t\t},\n\t\tregisterMark: plugin => {\n\t\t\tmarks.set(plugin.type, plugin)\n\t\t},\n\n\t\tdeleteBackward: unit => {\n\t\t\tconst selection = editor.selection\n\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst [node, nodePath] = Editor.node(editor, [selection.focus.path[0]])\n\t\t\t\tif (SlateElement.isElement(node) && SlateNode.string(node) === '') {\n\t\t\t\t\tconst previous = Editor.previous(editor, {\n\t\t\t\t\t\tat: nodePath,\n\t\t\t\t\t\tvoids: true,\n\t\t\t\t\t})\n\n\t\t\t\t\tif (previous) {\n\t\t\t\t\t\tconst [previousNode] = previous\n\t\t\t\t\t\tif (SlateElement.isElement(previousNode) && editor.isVoid(previousNode)) {\n\t\t\t\t\t\t\teditor.apply({\n\t\t\t\t\t\t\t\ttype: 'remove_node',\n\t\t\t\t\t\t\t\tpath: nodePath,\n\t\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tdeleteBackward(unit)\n\t\t},\n\t})\n\n\twithPaste(editor)\n\n\treturn editor\n}\n"],"names":["withHistory","withReact","createEditor","Slate","Transforms","marks","ContemberEditor","Editor","SlateElement","DefaultElement","createElement","isValidElement","SlateRange","Path","SlateNode","withPaste"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAqBO,MAAM,6BAA6B,CAAC,EAAE,yBAAiE;AAC7G,QAAM,mBAAmBA,aAAAA,YAAYC,qBAAUC,MAAAA,aAAA,CAA6B,CAAC;AAE7E,QAAM,SAAS;AACf,QAAM,EAAE,eAAe,UAAU,QAAQ,mBAAmB;AAE5D,QAAM,+BAAe,IAAA;AACrB,QAAM,4BAAY,IAAA;AAElB,SAAO,OAAgC,QAAQ;AAAA,IAC9C,OAAOC;AAAAA,IACP,eAAe;AAAA,IACf;AAAA,IACA,kBAAkB,CAAA,YAAW,UAAU,WAAY,QAAgB,SAAS;AAAA,IAC5E,sBAAsB,CAAA,cAAa;AAAA,MAClC,MAAM;AAAA,MACN;AAAA,IAAA;AAAA,IAED,qBAAqB,CAAC,CAAC,SAAS,IAAI,GAAG,SAAS;AAC/C,YAAM,aAAa,SAAS,WAAW,IAAI;AAC3C,YAAM,aAAa,KAAK,MAAM,GAAG,EAAE,EAAE,OAAO,KAAK,KAAK,SAAS,CAAC,IAAI,UAAU;AAC9EC,uBAAW,YAAY,QAAQ,OAAO,qBAAqB,CAAC,EAAE,MAAM,GAAA,CAAI,CAAC,GAAG;AAAA,QAC3E,IAAI;AAAA,QACJ,QAAQ;AAAA,MAAA,CACR;AAAA,IACF;AAAA,IAEA,gBAAgB,MAAM;AAAA,IACtB,kBAAkB,MAA8B;AAAA,IAEhD,UAAU,CAAsBC,WAA4BC,MAAAA,gBAAgB,SAAS,QAAQ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AACA,qBAAe,IAAI;AAAA,IACpB;AAAA,EAAA,CACA;AAEDO,YAAAA,UAAU,MAAM;AAEhB,SAAO;AACR;;"}
1
+ {"version":3,"file":"createEditorWithEssentials.cjs","sources":["../../../../../packages/react-slate-editor-base/src/editor/createEditorWithEssentials.tsx"],"sourcesContent":["import { createElement, isValidElement, ReactElement } from 'react'\nimport {\n\tcreateEditor,\n\tDescendant,\n\tEditor,\n\tElement as SlateElement,\n\tNode as SlateNode,\n\tPath,\n\tRange as SlateRange,\n\tText as SlateText,\n\tTransforms,\n} from 'slate'\nimport * as Slate from 'slate'\nimport { withHistory } from 'slate-history'\nimport { ReactEditor, withReact } from 'slate-react'\nimport { EditorElementPlugin, EditorMarkPlugin } from '../types/plugins.js'\nimport { TextSpecifics } from '../types/editor.js'\nimport { DefaultElement } from '../internal/components/DefaultElement.js'\nimport { withPaste } from '../plugins/behaviour/index.js'\nimport { ContemberEditor } from './index.js'\n\nexport const createEditorWithEssentials = ({ defaultElementType }: { defaultElementType: string }): Editor => {\n\tconst underlyingEditor = withHistory(withReact(createEditor() as ReactEditor))\n\n\tconst editor = underlyingEditor as unknown as Editor\n\tconst { normalizeNode, isInline, isVoid, deleteBackward } = editor\n\n\tconst elements = new Map<string, EditorElementPlugin<any>>()\n\tconst marks = new Map<string, EditorMarkPlugin>()\n\n\tObject.assign<Editor, Partial<Editor>>(editor, {\n\t\tslate: Slate,\n\t\tformatVersion: 1,\n\t\tdefaultElementType,\n\t\tisDefaultElement: element => 'type' in element && (element as any).type === defaultElementType,\n\t\tcreateDefaultElement: children => ({\n\t\t\ttype: defaultElementType,\n\t\t\tchildren,\n\t\t}),\n\t\tinsertBetweenBlocks: ([element, path], edge) => {\n\t\t\tconst edgeOffset = edge === 'before' ? 0 : 1\n\t\t\tconst targetPath = path.slice(0, -1).concat(path[path.length - 1] + edgeOffset)\n\t\t\tTransforms.insertNodes(editor, editor.createDefaultElement([{ text: '' }]), {\n\t\t\t\tat: targetPath,\n\t\t\t\tselect: true,\n\t\t\t})\n\t\t},\n\n\t\tcanToggleMarks: () => true,\n\t\tcanToggleElement: <E extends SlateElement>() => true,\n\n\t\thasMarks: <T extends SlateText>(marks: TextSpecifics<T>) => ContemberEditor.hasMarks(editor, marks),\n\n\t\t// TODO in the following function, we need to conditionally trim the selection so that it doesn't potentially\n\t\t// \tinclude empty strings at the edges of top-level elements.\n\t\tisElementActive: <E extends SlateElement>(elementType: E['type'], suchThat?: Partial<E>) => {\n\t\t\treturn (\n\t\t\t\telements.get(elementType)?.isActive?.({ editor, suchThat })\n\t\t\t\t\t?? Array.from(Editor.nodes(editor, {\n\t\t\t\t\t\t\tmatch: node => SlateElement.isElement(node) && ContemberEditor.isElementType(node, elementType, suchThat),\n\t\t\t\t\t\t\tvoids: false,\n\t\t\t\t\t\t})).length > 0\n\t\t\t)\n\t\t},\n\n\t\tacceptsAttributes: <E extends SlateElement>(elementType: E['type'], suchThat: Partial<E>) => {\n\t\t\treturn elements.get(elementType)?.acceptsAttributes?.({ editor, suchThat }) ?? false\n\t\t},\n\n\t\ttoggleMarks: <T extends SlateText>(marks: TextSpecifics<T>) => {\n\t\t\tif (!editor.canToggleMarks(marks)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst isActive = editor.hasMarks(marks)\n\t\t\tif (isActive) {\n\t\t\t\tContemberEditor.removeMarks(editor, marks)\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tContemberEditor.addMarks(editor, marks)\n\t\t\treturn true\n\t\t},\n\t\ttoggleElement: <E extends SlateElement>(elementType: E['type'], suchThat?: Partial<E>) => {\n\t\t\telements.get(elementType)?.toggleElement?.({\n\t\t\t\teditor,\n\t\t\t\tsuchThat,\n\t\t\t})\n\t\t},\n\n\t\tisInline: element => {\n\t\t\treturn elements.get(element.type)?.isInline ?? isInline(element)\n\t\t},\n\n\t\tisVoid: element => {\n\t\t\tconst elIsVoid = elements.get(element.type)?.isVoid\n\t\t\tif (elIsVoid === undefined) {\n\t\t\t\treturn isVoid(element)\n\t\t\t}\n\t\t\tif (typeof elIsVoid === 'boolean') {\n\t\t\t\treturn elIsVoid\n\t\t\t}\n\t\t\treturn elIsVoid({ editor, element })\n\t\t},\n\n\t\tcanContainAnyBlocks: element => {\n\t\t\tif (Editor.isEditor(element)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn !editor.isInline(element)\n\t\t\t\t&& !editor.isVoid(element)\n\t\t\t\t&& (elements.has(element.type) ? elements.get(element.type)!.canContainAnyBlocks ?? false : true)\n\t\t},\n\n\t\tserializeNodes: (nodes, errorMessage) => ContemberEditor.serializeNodes(editor, nodes, errorMessage),\n\t\tdeserializeNodes: (serializedNodes, errorMessage) => ContemberEditor.permissivelyDeserializeNodes(editor, serializedNodes, errorMessage),\n\n\t\tupgradeFormatBySingleVersion: (node, oldVersion) => {\n\t\t\tif (SlateElement.isElement(node)) {\n\t\t\t\treturn {\n\t\t\t\t\t...node,\n\t\t\t\t\tchildren: node.children.map(child => editor.upgradeFormatBySingleVersion(child, oldVersion) as Descendant),\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn node\n\t\t},\n\n\t\trenderElement: props => {\n\t\t\tconst component = elements.get(props.element.type)?.render ?? DefaultElement\n\t\t\treturn createElement(component, props)\n\t\t},\n\n\t\trenderLeafChildren: props => props.children,\n\n\t\trenderLeaf: props => {\n\t\t\tlet el: ReactElement = createElement('span', props.attributes, editor.renderLeafChildren(props))\n\t\t\tfor (const [, mark] of marks) {\n\t\t\t\tif (props.leaf[mark.type] === true) {\n\t\t\t\t\tconst markerEl = mark.render({ ...props, children: el })\n\t\t\t\t\tif (markerEl !== null) {\n\t\t\t\t\t\tif (!isValidElement(markerEl)) {\n\t\t\t\t\t\t\tthrow new Error(`Mark plugin ${mark.type} returned a non-React element`)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tel = markerEl\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn el\n\t\t},\n\n\t\t// Just noop functions so that other plugins can safely bubble-call\n\t\tonDOMBeforeInput: () => {},\n\t\tonKeyDown: e => {\n\t\t\tfor (const [, mark] of marks) {\n\t\t\t\tif (mark.isHotKey(e.nativeEvent)) {\n\t\t\t\t\teditor.toggleMarks({ [mark.type]: true })\n\t\t\t\t\te.preventDefault()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Inline void nodes cannot be deleted by default: https://github.com/ianstormtaylor/slate/issues/3456\n\t\t\t// This is a hack to get around this issue. The problem is that when an inline void node is selected, Slate's\n\t\t\t// beforeInput handler doesn't get triggered. However, when we put the caret right after the inline void\n\t\t\t// and press Backspace (or the other way around with Delete), it works just fine. Furthermore, if we deleted the\n\t\t\t// node directly, either we'd lose the selection state or Slate, not knowing about us deleting, would still\n\t\t\t// try to delete things on its own so as to respond to the user interaction. So we take advantage of this and\n\t\t\t// instead of deleting the void node, we just carefully move the selection and have Slate do the deleting.\n\t\t\tif (e.key !== 'Delete' && e.key !== 'Backspace') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst selection = editor.selection\n\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst voidEntry = Editor.void(editor, {\n\t\t\t\t\tat: selection,\n\t\t\t\t\tmode: 'lowest',\n\t\t\t\t\tvoids: true,\n\t\t\t\t})\n\t\t\t\tif (!voidEntry) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst [node, nodePath] = voidEntry\n\t\t\t\tif (editor.isInline(node)) {\n\t\t\t\t\tconst adjacentPoint = e.key === 'Backspace'\n\t\t\t\t\t\t? Editor.point(editor, Path.next(nodePath), {\n\t\t\t\t\t\t\tedge: 'start',\n\t\t\t\t\t\t})\n\t\t\t\t\t\t: Editor.point(editor, Path.previous(nodePath), {\n\t\t\t\t\t\t\tedge: 'end',\n\t\t\t\t\t\t})\n\t\t\t\t\tTransforms.select(editor, adjacentPoint)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tonFocus: () => {},\n\t\tonBlur: () => {},\n\t\tnormalizeNode: ([node, path]) => {\n\t\t\tif (Editor.isEditor(node) && node.children.length === 0) {\n\t\t\t\tTransforms.insertNodes(editor, editor.createDefaultElement([{ text: '' }]))\n\t\t\t}\n\t\t\tif (!SlateElement.isElement(node)) {\n\t\t\t\tnormalizeNode([node, path])\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlet defaultPrevented = false\n\t\t\telements.get(node.type)?.normalizeNode?.({\n\t\t\t\telement: node,\n\t\t\t\tpath,\n\t\t\t\teditor,\n\t\t\t\tpreventDefault: () => {\n\t\t\t\t\tdefaultPrevented = true\n\t\t\t\t},\n\t\t\t})\n\t\t\tif (!defaultPrevented) {\n\t\t\t\tnormalizeNode([node, path])\n\t\t\t}\n\t\t},\n\t\tregisterElement: plugin => {\n\t\t\telements.set(plugin.type, plugin)\n\t\t},\n\t\tregisterMark: plugin => {\n\t\t\tmarks.set(plugin.type, plugin)\n\t\t},\n\n\t\tdeleteBackward: unit => {\n\t\t\tconst selection = editor.selection\n\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst [node, nodePath] = Editor.node(editor, [selection.focus.path[0]])\n\t\t\t\tif (SlateElement.isElement(node) && SlateNode.string(node) === '') {\n\t\t\t\t\tconst previous = Editor.previous(editor, {\n\t\t\t\t\t\tat: nodePath,\n\t\t\t\t\t\tvoids: true,\n\t\t\t\t\t})\n\n\t\t\t\t\tif (previous) {\n\t\t\t\t\t\tconst [previousNode] = previous\n\t\t\t\t\t\tif (SlateElement.isElement(previousNode) && editor.isVoid(previousNode)) {\n\t\t\t\t\t\t\teditor.apply({\n\t\t\t\t\t\t\t\ttype: 'remove_node',\n\t\t\t\t\t\t\t\tpath: nodePath,\n\t\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tdeleteBackward(unit)\n\t\t},\n\t})\n\n\twithPaste(editor)\n\n\treturn editor\n}\n"],"names":["withHistory","withReact","createEditor","Slate","Transforms","marks","ContemberEditor","Editor","SlateElement","DefaultElement","createElement","isValidElement","SlateRange","Path","SlateNode","withPaste"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAqBO,MAAM,6BAA6B,CAAC,EAAE,yBAAiE;AAC7G,QAAM,mBAAmBA,aAAAA,YAAYC,qBAAUC,MAAAA,aAAA,CAA6B,CAAC;AAE7E,QAAM,SAAS;AACf,QAAM,EAAE,eAAe,UAAU,QAAQ,mBAAmB;AAE5D,QAAM,+BAAe,IAAA;AACrB,QAAM,4BAAY,IAAA;AAElB,SAAO,OAAgC,QAAQ;AAAA,IAC9C,OAAOC;AAAAA,IACP,eAAe;AAAA,IACf;AAAA,IACA,kBAAkB,CAAA,YAAW,UAAU,WAAY,QAAgB,SAAS;AAAA,IAC5E,sBAAsB,CAAA,cAAa;AAAA,MAClC,MAAM;AAAA,MACN;AAAA,IAAA;AAAA,IAED,qBAAqB,CAAC,CAAC,SAAS,IAAI,GAAG,SAAS;AAC/C,YAAM,aAAa,SAAS,WAAW,IAAI;AAC3C,YAAM,aAAa,KAAK,MAAM,GAAG,EAAE,EAAE,OAAO,KAAK,KAAK,SAAS,CAAC,IAAI,UAAU;AAC9EC,uBAAW,YAAY,QAAQ,OAAO,qBAAqB,CAAC,EAAE,MAAM,GAAA,CAAI,CAAC,GAAG;AAAA,QAC3E,IAAI;AAAA,QACJ,QAAQ;AAAA,MAAA,CACR;AAAA,IACF;AAAA,IAEA,gBAAgB,MAAM;AAAA,IACtB,kBAAkB,MAA8B;AAAA,IAEhD,UAAU,CAAsBC,WAA4BC,MAAAA,gBAAgB,SAAS,QAAQD,MAAK;AAAA;AAAA;AAAA,IAIlG,iBAAiB,CAAyB,aAAwB,aAA0B;AAC3F,aACC,SAAS,IAAI,WAAW,GAAG,WAAW,EAAE,QAAQ,SAAA,CAAU,KACtD,MAAM,KAAKE,MAAAA,OAAO,MAA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/src/editor/createEditorWithEssentials.tsx"],"sourcesContent":["import { createElement, isValidElement, ReactElement } from 'react'\nimport {\n\tcreateEditor,\n\tDescendant,\n\tEditor,\n\tElement as SlateElement,\n\tNode as SlateNode,\n\tPath,\n\tRange as SlateRange,\n\tText as SlateText,\n\tTransforms,\n} from 'slate'\nimport * as Slate from 'slate'\nimport { withHistory } from 'slate-history'\nimport { ReactEditor, withReact } from 'slate-react'\nimport { EditorElementPlugin, EditorMarkPlugin } from '../types/plugins'\nimport { TextSpecifics } from '../types/editor'\nimport { DefaultElement } from '../internal/components/DefaultElement'\nimport { withPaste } from '../plugins/behaviour'\nimport { ContemberEditor } from './index'\n\nexport const createEditorWithEssentials = ({ defaultElementType }: { defaultElementType: string }): Editor => {\n\tconst underlyingEditor = withHistory(withReact(createEditor() as ReactEditor))\n\n\tconst editor = underlyingEditor as unknown as Editor\n\tconst { normalizeNode, isInline, isVoid, deleteBackward } = editor\n\n\tconst elements = new Map<string, EditorElementPlugin<any>>()\n\tconst marks = new Map<string, EditorMarkPlugin>()\n\n\tObject.assign<Editor, Partial<Editor>>(editor, {\n\t\tslate: Slate,\n\t\tformatVersion: 1,\n\t\tdefaultElementType,\n\t\tisDefaultElement: element => 'type' in element && (element as any).type === defaultElementType,\n\t\tcreateDefaultElement: children => ({\n\t\t\ttype: defaultElementType,\n\t\t\tchildren,\n\t\t}),\n\t\tinsertBetweenBlocks: ([element, path], edge) => {\n\t\t\tconst edgeOffset = edge === 'before' ? 0 : 1\n\t\t\tconst targetPath = path.slice(0, -1).concat(path[path.length - 1] + edgeOffset)\n\t\t\tTransforms.insertNodes(editor, editor.createDefaultElement([{ text: '' }]), {\n\t\t\t\tat: targetPath,\n\t\t\t\tselect: true,\n\t\t\t})\n\t\t},\n\n\t\tcanToggleMarks: () => true,\n\t\tcanToggleElement: <E extends SlateElement>() => true,\n\n\t\thasMarks: <T extends SlateText>(marks: TextSpecifics<T>) => ContemberEditor.hasMarks(editor, marks),\n\n\t\t// TODO in the following function, we need to conditionally trim the selection so that it doesn't potentially\n\t\t// \tinclude empty strings at the edges of top-level elements.\n\t\tisElementActive: <E extends SlateElement>(elementType: E['type'], suchThat?: Partial<E>) => {\n\t\t\treturn (\n\t\t\t\telements.get(elementType)?.isActive?.({ editor, suchThat })\n\t\t\t\t\t?? Array.from(Editor.nodes(editor, {\n\t\t\t\t\t\t\tmatch: node => SlateElement.isElement(node) && ContemberEditor.isElementType(node, elementType, suchThat),\n\t\t\t\t\t\t\tvoids: false,\n\t\t\t\t\t\t})).length > 0\n\t\t\t)\n\t\t},\n\n\t\tacceptsAttributes: <E extends SlateElement>(elementType: E['type'], suchThat: Partial<E>) => {\n\t\t\treturn elements.get(elementType)?.acceptsAttributes?.({ editor, suchThat }) ?? false\n\t\t},\n\n\t\ttoggleMarks: <T extends SlateText>(marks: TextSpecifics<T>) => {\n\t\t\tif (!editor.canToggleMarks(marks)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst isActive = editor.hasMarks(marks)\n\t\t\tif (isActive) {\n\t\t\t\tContemberEditor.removeMarks(editor, marks)\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tContemberEditor.addMarks(editor, marks)\n\t\t\treturn true\n\t\t},\n\t\ttoggleElement: <E extends SlateElement>(elementType: E['type'], suchThat?: Partial<E>) => {\n\t\t\telements.get(elementType)?.toggleElement?.({\n\t\t\t\teditor,\n\t\t\t\tsuchThat,\n\t\t\t})\n\t\t},\n\n\t\tisInline: element => {\n\t\t\treturn elements.get(element.type)?.isInline ?? isInline(element)\n\t\t},\n\n\t\tisVoid: element => {\n\t\t\tconst elIsVoid = elements.get(element.type)?.isVoid\n\t\t\tif (elIsVoid === undefined) {\n\t\t\t\treturn isVoid(element)\n\t\t\t}\n\t\t\tif (typeof elIsVoid === 'boolean') {\n\t\t\t\treturn elIsVoid\n\t\t\t}\n\t\t\treturn elIsVoid({ editor, element })\n\t\t},\n\n\t\tcanContainAnyBlocks: element => {\n\t\t\tif (Editor.isEditor(element)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn !editor.isInline(element)\n\t\t\t\t&& !editor.isVoid(element)\n\t\t\t\t&& (elements.has(element.type) ? elements.get(element.type)!.canContainAnyBlocks ?? false : true)\n\t\t},\n\n\t\tserializeNodes: (nodes, errorMessage) => ContemberEditor.serializeNodes(editor, nodes, errorMessage),\n\t\tdeserializeNodes: (serializedNodes, errorMessage) => ContemberEditor.permissivelyDeserializeNodes(editor, serializedNodes, errorMessage),\n\n\t\tupgradeFormatBySingleVersion: (node, oldVersion) => {\n\t\t\tif (SlateElement.isElement(node)) {\n\t\t\t\treturn {\n\t\t\t\t\t...node,\n\t\t\t\t\tchildren: node.children.map(child => editor.upgradeFormatBySingleVersion(child, oldVersion) as Descendant),\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn node\n\t\t},\n\n\t\trenderElement: props => {\n\t\t\tconst component = elements.get(props.element.type)?.render ?? DefaultElement\n\t\t\treturn createElement(component, props)\n\t\t},\n\n\t\trenderLeafChildren: props => props.children,\n\n\t\trenderLeaf: props => {\n\t\t\tlet el: ReactElement = createElement('span', props.attributes, editor.renderLeafChildren(props))\n\t\t\tfor (const [, mark] of marks) {\n\t\t\t\tif (props.leaf[mark.type] === true) {\n\t\t\t\t\tconst markerEl = mark.render({ ...props, children: el })\n\t\t\t\t\tif (markerEl !== null) {\n\t\t\t\t\t\tif (!isValidElement(markerEl)) {\n\t\t\t\t\t\t\tthrow new Error(`Mark plugin ${mark.type} returned a non-React element`)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tel = markerEl\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn el\n\t\t},\n\n\t\t// Just noop functions so that other plugins can safely bubble-call\n\t\tonDOMBeforeInput: () => {},\n\t\tonKeyDown: e => {\n\t\t\tfor (const [, mark] of marks) {\n\t\t\t\tif (mark.isHotKey(e.nativeEvent)) {\n\t\t\t\t\teditor.toggleMarks({ [mark.type]: true })\n\t\t\t\t\te.preventDefault()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Inline void nodes cannot be deleted by default: https://github.com/ianstormtaylor/slate/issues/3456\n\t\t\t// This is a hack to get around this issue. The problem is that when an inline void node is selected, Slate's\n\t\t\t// beforeInput handler doesn't get triggered. However, when we put the caret right after the inline void\n\t\t\t// and press Backspace (or the other way around with Delete), it works just fine. Furthermore, if we deleted the\n\t\t\t// node directly, either we'd lose the selection state or Slate, not knowing about us deleting, would still\n\t\t\t// try to delete things on its own so as to respond to the user interaction. So we take advantage of this and\n\t\t\t// instead of deleting the void node, we just carefully move the selection and have Slate do the deleting.\n\t\t\tif (e.key !== 'Delete' && e.key !== 'Backspace') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst selection = editor.selection\n\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst voidEntry = Editor.void(editor, {\n\t\t\t\t\tat: selection,\n\t\t\t\t\tmode: 'lowest',\n\t\t\t\t\tvoids: true,\n\t\t\t\t})\n\t\t\t\tif (!voidEntry) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst [node, nodePath] = voidEntry\n\t\t\t\tif (editor.isInline(node)) {\n\t\t\t\t\tconst adjacentPoint = e.key === 'Backspace'\n\t\t\t\t\t\t? Editor.point(editor, Path.next(nodePath), {\n\t\t\t\t\t\t\tedge: 'start',\n\t\t\t\t\t\t})\n\t\t\t\t\t\t: Editor.point(editor, Path.previous(nodePath), {\n\t\t\t\t\t\t\tedge: 'end',\n\t\t\t\t\t\t})\n\t\t\t\t\tTransforms.select(editor, adjacentPoint)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tonFocus: () => {},\n\t\tonBlur: () => {},\n\t\tnormalizeNode: ([node, path]) => {\n\t\t\tif (Editor.isEditor(node) && node.children.length === 0) {\n\t\t\t\tTransforms.insertNodes(editor, editor.createDefaultElement([{ text: '' }]))\n\t\t\t}\n\t\t\tif (!SlateElement.isElement(node)) {\n\t\t\t\tnormalizeNode([node, path])\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlet defaultPrevented = false\n\t\t\telements.get(node.type)?.normalizeNode?.({\n\t\t\t\telement: node,\n\t\t\t\tpath,\n\t\t\t\teditor,\n\t\t\t\tpreventDefault: () => {\n\t\t\t\t\tdefaultPrevented = true\n\t\t\t\t},\n\t\t\t})\n\t\t\tif (!defaultPrevented) {\n\t\t\t\tnormalizeNode([node, path])\n\t\t\t}\n\t\t},\n\t\tregisterElement: plugin => {\n\t\t\telements.set(plugin.type, plugin)\n\t\t},\n\t\tregisterMark: plugin => {\n\t\t\tmarks.set(plugin.type, plugin)\n\t\t},\n\n\t\tdeleteBackward: unit => {\n\t\t\tconst selection = editor.selection\n\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst [node, nodePath] = Editor.node(editor, [selection.focus.path[0]])\n\t\t\t\tif (SlateElement.isElement(node) && SlateNode.string(node) === '') {\n\t\t\t\t\tconst previous = Editor.previous(editor, {\n\t\t\t\t\t\tat: nodePath,\n\t\t\t\t\t\tvoids: true,\n\t\t\t\t\t})\n\n\t\t\t\t\tif (previous) {\n\t\t\t\t\t\tconst [previousNode] = previous\n\t\t\t\t\t\tif (SlateElement.isElement(previousNode) && editor.isVoid(previousNode)) {\n\t\t\t\t\t\t\teditor.apply({\n\t\t\t\t\t\t\t\ttype: 'remove_node',\n\t\t\t\t\t\t\t\tpath: nodePath,\n\t\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tdeleteBackward(unit)\n\t\t},\n\t})\n\n\twithPaste(editor)\n\n\treturn editor\n}\n"],"names":["marks","SlateElement","SlateRange","SlateNode"],"mappings":";;;;;;;;AAqBO,MAAM,6BAA6B,CAAC,EAAE,yBAAiE;AAC7G,QAAM,mBAAmB,YAAY,UAAU,aAAA,CAA6B,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B,YAAM,YAAY,OAAO;AAEzB,UAAI,aAAaC,MAAW,YAAY,SAAS,GAAG;AACnD,cAAM,CAAC,MAAM,QAAQ,IAAI,OAAO,KAAK,QAAQ,CAAC,UAAU,MAAM,KAAK,CAAC,CAAC,CAAC;AACtE,YAAID,QAAa,UAAU,IAAI,KAAKE,KAAU,OAAO,IAAI,MAAM,IAAI;AAClE,gBAAM,WAAW,OAAO,SAAS,QAAQ;AAAA,YACxC,IAAI;AAAA,YACJ,OAAO;AAAA,UAAA,CACP;AAED,cAAI,UAAU;AACb,kBAAM,CAAC,YAAY,IAAI;AACvB,gBAAIF,QAAa,UAAU,YAAY,KAAK,OAAO,OAAO,YAAY,GAAG;AACxE,qBAAO,MAAM;AAAA,gBACZ,MAAM;AAAA,gBACN,MAAM;AAAA,gBACN;AAAA,cAAA,CACA;AACD;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,MACD;AACA,qBAAe,IAAI;AAAA,IACpB;AAAA,EAAA,CACA;AAED,YAAU,MAAM;AAEhB,SAAO;AACR;"}
1
+ {"version":3,"file":"createEditorWithEssentials.js","sources":["../../../../../packages/react-slate-editor-base/src/editor/createEditorWithEssentials.tsx"],"sourcesContent":["import { createElement, isValidElement, ReactElement } from 'react'\nimport {\n\tcreateEditor,\n\tDescendant,\n\tEditor,\n\tElement as SlateElement,\n\tNode as SlateNode,\n\tPath,\n\tRange as SlateRange,\n\tText as SlateText,\n\tTransforms,\n} from 'slate'\nimport * as Slate from 'slate'\nimport { withHistory } from 'slate-history'\nimport { ReactEditor, withReact } from 'slate-react'\nimport { EditorElementPlugin, EditorMarkPlugin } from '../types/plugins.js'\nimport { TextSpecifics } from '../types/editor.js'\nimport { DefaultElement } from '../internal/components/DefaultElement.js'\nimport { withPaste } from '../plugins/behaviour/index.js'\nimport { ContemberEditor } from './index.js'\n\nexport const createEditorWithEssentials = ({ defaultElementType }: { defaultElementType: string }): Editor => {\n\tconst underlyingEditor = withHistory(withReact(createEditor() as ReactEditor))\n\n\tconst editor = underlyingEditor as unknown as Editor\n\tconst { normalizeNode, isInline, isVoid, deleteBackward } = editor\n\n\tconst elements = new Map<string, EditorElementPlugin<any>>()\n\tconst marks = new Map<string, EditorMarkPlugin>()\n\n\tObject.assign<Editor, Partial<Editor>>(editor, {\n\t\tslate: Slate,\n\t\tformatVersion: 1,\n\t\tdefaultElementType,\n\t\tisDefaultElement: element => 'type' in element && (element as any).type === defaultElementType,\n\t\tcreateDefaultElement: children => ({\n\t\t\ttype: defaultElementType,\n\t\t\tchildren,\n\t\t}),\n\t\tinsertBetweenBlocks: ([element, path], edge) => {\n\t\t\tconst edgeOffset = edge === 'before' ? 0 : 1\n\t\t\tconst targetPath = path.slice(0, -1).concat(path[path.length - 1] + edgeOffset)\n\t\t\tTransforms.insertNodes(editor, editor.createDefaultElement([{ text: '' }]), {\n\t\t\t\tat: targetPath,\n\t\t\t\tselect: true,\n\t\t\t})\n\t\t},\n\n\t\tcanToggleMarks: () => true,\n\t\tcanToggleElement: <E extends SlateElement>() => true,\n\n\t\thasMarks: <T extends SlateText>(marks: TextSpecifics<T>) => ContemberEditor.hasMarks(editor, marks),\n\n\t\t// TODO in the following function, we need to conditionally trim the selection so that it doesn't potentially\n\t\t// \tinclude empty strings at the edges of top-level elements.\n\t\tisElementActive: <E extends SlateElement>(elementType: E['type'], suchThat?: Partial<E>) => {\n\t\t\treturn (\n\t\t\t\telements.get(elementType)?.isActive?.({ editor, suchThat })\n\t\t\t\t\t?? Array.from(Editor.nodes(editor, {\n\t\t\t\t\t\t\tmatch: node => SlateElement.isElement(node) && ContemberEditor.isElementType(node, elementType, suchThat),\n\t\t\t\t\t\t\tvoids: false,\n\t\t\t\t\t\t})).length > 0\n\t\t\t)\n\t\t},\n\n\t\tacceptsAttributes: <E extends SlateElement>(elementType: E['type'], suchThat: Partial<E>) => {\n\t\t\treturn elements.get(elementType)?.acceptsAttributes?.({ editor, suchThat }) ?? false\n\t\t},\n\n\t\ttoggleMarks: <T extends SlateText>(marks: TextSpecifics<T>) => {\n\t\t\tif (!editor.canToggleMarks(marks)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst isActive = editor.hasMarks(marks)\n\t\t\tif (isActive) {\n\t\t\t\tContemberEditor.removeMarks(editor, marks)\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tContemberEditor.addMarks(editor, marks)\n\t\t\treturn true\n\t\t},\n\t\ttoggleElement: <E extends SlateElement>(elementType: E['type'], suchThat?: Partial<E>) => {\n\t\t\telements.get(elementType)?.toggleElement?.({\n\t\t\t\teditor,\n\t\t\t\tsuchThat,\n\t\t\t})\n\t\t},\n\n\t\tisInline: element => {\n\t\t\treturn elements.get(element.type)?.isInline ?? isInline(element)\n\t\t},\n\n\t\tisVoid: element => {\n\t\t\tconst elIsVoid = elements.get(element.type)?.isVoid\n\t\t\tif (elIsVoid === undefined) {\n\t\t\t\treturn isVoid(element)\n\t\t\t}\n\t\t\tif (typeof elIsVoid === 'boolean') {\n\t\t\t\treturn elIsVoid\n\t\t\t}\n\t\t\treturn elIsVoid({ editor, element })\n\t\t},\n\n\t\tcanContainAnyBlocks: element => {\n\t\t\tif (Editor.isEditor(element)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn !editor.isInline(element)\n\t\t\t\t&& !editor.isVoid(element)\n\t\t\t\t&& (elements.has(element.type) ? elements.get(element.type)!.canContainAnyBlocks ?? false : true)\n\t\t},\n\n\t\tserializeNodes: (nodes, errorMessage) => ContemberEditor.serializeNodes(editor, nodes, errorMessage),\n\t\tdeserializeNodes: (serializedNodes, errorMessage) => ContemberEditor.permissivelyDeserializeNodes(editor, serializedNodes, errorMessage),\n\n\t\tupgradeFormatBySingleVersion: (node, oldVersion) => {\n\t\t\tif (SlateElement.isElement(node)) {\n\t\t\t\treturn {\n\t\t\t\t\t...node,\n\t\t\t\t\tchildren: node.children.map(child => editor.upgradeFormatBySingleVersion(child, oldVersion) as Descendant),\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn node\n\t\t},\n\n\t\trenderElement: props => {\n\t\t\tconst component = elements.get(props.element.type)?.render ?? DefaultElement\n\t\t\treturn createElement(component, props)\n\t\t},\n\n\t\trenderLeafChildren: props => props.children,\n\n\t\trenderLeaf: props => {\n\t\t\tlet el: ReactElement = createElement('span', props.attributes, editor.renderLeafChildren(props))\n\t\t\tfor (const [, mark] of marks) {\n\t\t\t\tif (props.leaf[mark.type] === true) {\n\t\t\t\t\tconst markerEl = mark.render({ ...props, children: el })\n\t\t\t\t\tif (markerEl !== null) {\n\t\t\t\t\t\tif (!isValidElement(markerEl)) {\n\t\t\t\t\t\t\tthrow new Error(`Mark plugin ${mark.type} returned a non-React element`)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tel = markerEl\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn el\n\t\t},\n\n\t\t// Just noop functions so that other plugins can safely bubble-call\n\t\tonDOMBeforeInput: () => {},\n\t\tonKeyDown: e => {\n\t\t\tfor (const [, mark] of marks) {\n\t\t\t\tif (mark.isHotKey(e.nativeEvent)) {\n\t\t\t\t\teditor.toggleMarks({ [mark.type]: true })\n\t\t\t\t\te.preventDefault()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Inline void nodes cannot be deleted by default: https://github.com/ianstormtaylor/slate/issues/3456\n\t\t\t// This is a hack to get around this issue. The problem is that when an inline void node is selected, Slate's\n\t\t\t// beforeInput handler doesn't get triggered. However, when we put the caret right after the inline void\n\t\t\t// and press Backspace (or the other way around with Delete), it works just fine. Furthermore, if we deleted the\n\t\t\t// node directly, either we'd lose the selection state or Slate, not knowing about us deleting, would still\n\t\t\t// try to delete things on its own so as to respond to the user interaction. So we take advantage of this and\n\t\t\t// instead of deleting the void node, we just carefully move the selection and have Slate do the deleting.\n\t\t\tif (e.key !== 'Delete' && e.key !== 'Backspace') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst selection = editor.selection\n\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst voidEntry = Editor.void(editor, {\n\t\t\t\t\tat: selection,\n\t\t\t\t\tmode: 'lowest',\n\t\t\t\t\tvoids: true,\n\t\t\t\t})\n\t\t\t\tif (!voidEntry) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst [node, nodePath] = voidEntry\n\t\t\t\tif (editor.isInline(node)) {\n\t\t\t\t\tconst adjacentPoint = e.key === 'Backspace'\n\t\t\t\t\t\t? Editor.point(editor, Path.next(nodePath), {\n\t\t\t\t\t\t\tedge: 'start',\n\t\t\t\t\t\t})\n\t\t\t\t\t\t: Editor.point(editor, Path.previous(nodePath), {\n\t\t\t\t\t\t\tedge: 'end',\n\t\t\t\t\t\t})\n\t\t\t\t\tTransforms.select(editor, adjacentPoint)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tonFocus: () => {},\n\t\tonBlur: () => {},\n\t\tnormalizeNode: ([node, path]) => {\n\t\t\tif (Editor.isEditor(node) && node.children.length === 0) {\n\t\t\t\tTransforms.insertNodes(editor, editor.createDefaultElement([{ text: '' }]))\n\t\t\t}\n\t\t\tif (!SlateElement.isElement(node)) {\n\t\t\t\tnormalizeNode([node, path])\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlet defaultPrevented = false\n\t\t\telements.get(node.type)?.normalizeNode?.({\n\t\t\t\telement: node,\n\t\t\t\tpath,\n\t\t\t\teditor,\n\t\t\t\tpreventDefault: () => {\n\t\t\t\t\tdefaultPrevented = true\n\t\t\t\t},\n\t\t\t})\n\t\t\tif (!defaultPrevented) {\n\t\t\t\tnormalizeNode([node, path])\n\t\t\t}\n\t\t},\n\t\tregisterElement: plugin => {\n\t\t\telements.set(plugin.type, plugin)\n\t\t},\n\t\tregisterMark: plugin => {\n\t\t\tmarks.set(plugin.type, plugin)\n\t\t},\n\n\t\tdeleteBackward: unit => {\n\t\t\tconst selection = editor.selection\n\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst [node, nodePath] = Editor.node(editor, [selection.focus.path[0]])\n\t\t\t\tif (SlateElement.isElement(node) && SlateNode.string(node) === '') {\n\t\t\t\t\tconst previous = Editor.previous(editor, {\n\t\t\t\t\t\tat: nodePath,\n\t\t\t\t\t\tvoids: true,\n\t\t\t\t\t})\n\n\t\t\t\t\tif (previous) {\n\t\t\t\t\t\tconst [previousNode] = previous\n\t\t\t\t\t\tif (SlateElement.isElement(previousNode) && editor.isVoid(previousNode)) {\n\t\t\t\t\t\t\teditor.apply({\n\t\t\t\t\t\t\t\ttype: 'remove_node',\n\t\t\t\t\t\t\t\tpath: nodePath,\n\t\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tdeleteBackward(unit)\n\t\t},\n\t})\n\n\twithPaste(editor)\n\n\treturn editor\n}\n"],"names":["marks","SlateElement","SlateRange","SlateNode"],"mappings":";;;;;;;;AAqBO,MAAM,6BAA6B,CAAC,EAAE,yBAAiE;AAC7G,QAAM,mBAAmB,YAAY,UAAU,aAAA,CAA6B,CAAC;AAE7E,QAAM,SAAS;AACf,QAAM,EAAE,eAAe,UAAU,QAAQ,mBAAmB;AAE5D,QAAM,+BAAe,IAAA;AACrB,QAAM,4BAAY,IAAA;AAElB,SAAO,OAAgC,QAAQ;AAAA,IAC9C,OAAO;AAAA,IACP,eAAe;AAAA,IACf;AAAA,IACA,kBAAkB,CAAA,YAAW,UAAU,WAAY,QAAgB,SAAS;AAAA,IAC5E,sBAAsB,CAAA,cAAa;AAAA,MAClC,MAAM;AAAA,MACN;AAAA,IAAA;AAAA,IAED,qBAAqB,CAAC,CAAC,SAAS,IAAI,GAAG,SAAS;AAC/C,YAAM,aAAa,SAAS,WAAW,IAAI;AAC3C,YAAM,aAAa,KAAK,MAAM,GAAG,EAAE,EAAE,OAAO,KAAK,KAAK,SAAS,CAAC,IAAI,UAAU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AA,CACA;AACD;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,MACD;AACA,qBAAe,IAAI;AAAA,IACpB;AAAA,EAAA,CACA;AAED,YAAU,MAAM;AAEhB,SAAO;AACR;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../../../packages/react-slate-editor-base/src/editor/index.ts"],"sourcesContent":["import {\n\taddMarks,\n\tcanToggleMark,\n\tclosest,\n\tclosestBlockEntry,\n\tclosestViableBlockContainerEntry,\n\tejectElement,\n\telementToSpecifics,\n\tgetElementDataAttributes,\n\tgetPreviousSibling,\n\thasMarks,\n\thasParentOfType,\n\tisElementType,\n\tpermissivelyDeserializeNodes,\n\tremoveMarks,\n\tserializeNodes,\n\tstrictlyDeserializeNodes,\n\ttextToSpecifics,\n\ttoLatestFormat,\n\ttopLevelNodes,\n} from './methods'\n\nexport type { ElementDataAttributes } from './methods'\n\n// TODO use export * as ContemberEditor from './methods' once the tooling is ready.\nexport const ContemberEditor = {\n\taddMarks,\n\tcanToggleMark,\n\tclosest,\n\tclosestBlockEntry,\n\tclosestViableBlockContainerEntry,\n\tejectElement,\n\telementToSpecifics,\n\tgetElementDataAttributes,\n\tgetPreviousSibling,\n\thasMarks,\n\thasParentOfType,\n\tisElementType,\n\tpermissivelyDeserializeNodes,\n\tremoveMarks,\n\tserializeNodes,\n\tstrictlyDeserializeNodes,\n\ttextToSpecifics,\n\ttoLatestFormat,\n\ttopLevelNodes,\n}\n\nexport * from './createEditor'\n"],"names":["addMarks","canToggleMark","closest","closestBlockEntry","closestViableBlockContainerEntry","ejectElement","elementToSpecifics","getElementDataAttributes","getPreviousSibling","hasMarks","hasParentOfType","isElementType","permissivelyDeserializeNodes","removeMarks","serializeNodes","strictlyDeserializeNodes","textToSpecifics","toLatestFormat","topLevelNodes"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAyBO,MAAM,kBAAkB;AAAA,EAAA,UAC9BA,SAAAA;AAAAA,EAAA,eACAC,cAAAA;AAAAA,EAAA,SACAC,QAAAA;AAAAA,EAAA,mBACAC,kBAAAA;AAAAA,EAAA,kCACAC,iCAAAA;AAAAA,EAAA,cACAC,aAAAA;AAAAA,EAAA,oBACAC,mBAAAA;AAAAA,EAAA,0BACAC,yBAAAA;AAAAA,EAAA,oBACAC,mBAAAA;AAAAA,EAAA,UACAC,SAAAA;AAAAA,EAAA,iBACAC,gBAAAA;AAAAA,EAAA,eACAC,cAAAA;AAAAA,EAAA,8BACAC,6BAAAA;AAAAA,EAAA,aACAC,YAAAA;AAAAA,EAAA,gBACAC,eAAAA;AAAAA,EAAA,0BACAC,yBAAAA;AAAAA,EAAA,iBACAC,gBAAAA;AAAAA,EAAA,gBACAC,eAAAA;AAAAA,EAAA,eACAC,cAAAA;AACD;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../../../packages/react-slate-editor-base/src/editor/index.ts"],"sourcesContent":["import {\n\taddMarks,\n\tcanToggleMark,\n\tclosest,\n\tclosestBlockEntry,\n\tclosestViableBlockContainerEntry,\n\tejectElement,\n\telementToSpecifics,\n\tgetElementDataAttributes,\n\tgetPreviousSibling,\n\thasMarks,\n\thasParentOfType,\n\tisElementType,\n\tpermissivelyDeserializeNodes,\n\tremoveMarks,\n\tserializeNodes,\n\tstrictlyDeserializeNodes,\n\ttextToSpecifics,\n\ttoLatestFormat,\n\ttopLevelNodes,\n} from './methods/index.js'\n\nexport type { ElementDataAttributes } from './methods/index.js'\n\n// TODO use export * as ContemberEditor from './methods/index.js' once the tooling is ready.\nexport const ContemberEditor = {\n\taddMarks,\n\tcanToggleMark,\n\tclosest,\n\tclosestBlockEntry,\n\tclosestViableBlockContainerEntry,\n\tejectElement,\n\telementToSpecifics,\n\tgetElementDataAttributes,\n\tgetPreviousSibling,\n\thasMarks,\n\thasParentOfType,\n\tisElementType,\n\tpermissivelyDeserializeNodes,\n\tremoveMarks,\n\tserializeNodes,\n\tstrictlyDeserializeNodes,\n\ttextToSpecifics,\n\ttoLatestFormat,\n\ttopLevelNodes,\n}\n\nexport * from './createEditor.js'\n"],"names":["addMarks","canToggleMark","closest","closestBlockEntry","closestViableBlockContainerEntry","ejectElement","elementToSpecifics","getElementDataAttributes","getPreviousSibling","hasMarks","hasParentOfType","isElementType","permissivelyDeserializeNodes","removeMarks","serializeNodes","strictlyDeserializeNodes","textToSpecifics","toLatestFormat","topLevelNodes"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAyBO,MAAM,kBAAkB;AAAA,EAAA,UAC9BA,SAAAA;AAAAA,EAAA,eACAC,cAAAA;AAAAA,EAAA,SACAC,QAAAA;AAAAA,EAAA,mBACAC,kBAAAA;AAAAA,EAAA,kCACAC,iCAAAA;AAAAA,EAAA,cACAC,aAAAA;AAAAA,EAAA,oBACAC,mBAAAA;AAAAA,EAAA,0BACAC,yBAAAA;AAAAA,EAAA,oBACAC,mBAAAA;AAAAA,EAAA,UACAC,SAAAA;AAAAA,EAAA,iBACAC,gBAAAA;AAAAA,EAAA,eACAC,cAAAA;AAAAA,EAAA,8BACAC,6BAAAA;AAAAA,EAAA,aACAC,YAAAA;AAAAA,EAAA,gBACAC,eAAAA;AAAAA,EAAA,0BACAC,yBAAAA;AAAAA,EAAA,iBACAC,gBAAAA;AAAAA,EAAA,gBACAC,eAAAA;AAAAA,EAAA,eACAC,cAAAA;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../packages/react-slate-editor-base/src/editor/index.ts"],"sourcesContent":["import {\n\taddMarks,\n\tcanToggleMark,\n\tclosest,\n\tclosestBlockEntry,\n\tclosestViableBlockContainerEntry,\n\tejectElement,\n\telementToSpecifics,\n\tgetElementDataAttributes,\n\tgetPreviousSibling,\n\thasMarks,\n\thasParentOfType,\n\tisElementType,\n\tpermissivelyDeserializeNodes,\n\tremoveMarks,\n\tserializeNodes,\n\tstrictlyDeserializeNodes,\n\ttextToSpecifics,\n\ttoLatestFormat,\n\ttopLevelNodes,\n} from './methods'\n\nexport type { ElementDataAttributes } from './methods'\n\n// TODO use export * as ContemberEditor from './methods' once the tooling is ready.\nexport const ContemberEditor = {\n\taddMarks,\n\tcanToggleMark,\n\tclosest,\n\tclosestBlockEntry,\n\tclosestViableBlockContainerEntry,\n\tejectElement,\n\telementToSpecifics,\n\tgetElementDataAttributes,\n\tgetPreviousSibling,\n\thasMarks,\n\thasParentOfType,\n\tisElementType,\n\tpermissivelyDeserializeNodes,\n\tremoveMarks,\n\tserializeNodes,\n\tstrictlyDeserializeNodes,\n\ttextToSpecifics,\n\ttoLatestFormat,\n\ttopLevelNodes,\n}\n\nexport * from './createEditor'\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAyBO,MAAM,kBAAkB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../packages/react-slate-editor-base/src/editor/index.ts"],"sourcesContent":["import {\n\taddMarks,\n\tcanToggleMark,\n\tclosest,\n\tclosestBlockEntry,\n\tclosestViableBlockContainerEntry,\n\tejectElement,\n\telementToSpecifics,\n\tgetElementDataAttributes,\n\tgetPreviousSibling,\n\thasMarks,\n\thasParentOfType,\n\tisElementType,\n\tpermissivelyDeserializeNodes,\n\tremoveMarks,\n\tserializeNodes,\n\tstrictlyDeserializeNodes,\n\ttextToSpecifics,\n\ttoLatestFormat,\n\ttopLevelNodes,\n} from './methods/index.js'\n\nexport type { ElementDataAttributes } from './methods/index.js'\n\n// TODO use export * as ContemberEditor from './methods/index.js' once the tooling is ready.\nexport const ContemberEditor = {\n\taddMarks,\n\tcanToggleMark,\n\tclosest,\n\tclosestBlockEntry,\n\tclosestViableBlockContainerEntry,\n\tejectElement,\n\telementToSpecifics,\n\tgetElementDataAttributes,\n\tgetPreviousSibling,\n\thasMarks,\n\thasParentOfType,\n\tisElementType,\n\tpermissivelyDeserializeNodes,\n\tremoveMarks,\n\tserializeNodes,\n\tstrictlyDeserializeNodes,\n\ttextToSpecifics,\n\ttoLatestFormat,\n\ttopLevelNodes,\n}\n\nexport * from './createEditor.js'\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAyBO,MAAM,kBAAkB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"addMarks.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/addMarks.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Text as SlateText } from 'slate'\nimport { TextSpecifics } from '../../types/editor'\n\nexport const addMarks = <T extends SlateText, E extends SlateEditor>(editor: E, marks: TextSpecifics<T>) => {\n\tEditor.withoutNormalizing(editor, () => {\n\t\tfor (const mark in marks) {\n\t\t\tEditor.addMark(editor, mark, (marks as any)[mark])\n\t\t}\n\t})\n}\n"],"names":["Editor"],"mappings":";;;AAGO,MAAM,WAAW,CAA6C,QAAW,UAA4B;AAC3GA,eAAO,mBAAmB,QAAQ,MAAM;AACvC,eAAW,QAAQ,OAAO;AACzBA,YAAAA,OAAO,QAAQ,QAAQ,MAAO,MAAc,IAAI,CAAC;AAAA,IAClD;AAAA,EACD,CAAC;AACF;;"}
1
+ {"version":3,"file":"addMarks.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/addMarks.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Text as SlateText } from 'slate'\nimport { TextSpecifics } from '../../types/editor.js'\n\nexport const addMarks = <T extends SlateText, E extends SlateEditor>(editor: E, marks: TextSpecifics<T>) => {\n\tEditor.withoutNormalizing(editor, () => {\n\t\tfor (const mark in marks) {\n\t\t\tEditor.addMark(editor, mark, (marks as any)[mark])\n\t\t}\n\t})\n}\n"],"names":["Editor"],"mappings":";;;AAGO,MAAM,WAAW,CAA6C,QAAW,UAA4B;AAC3GA,eAAO,mBAAmB,QAAQ,MAAM;AACvC,eAAW,QAAQ,OAAO;AACzBA,YAAAA,OAAO,QAAQ,QAAQ,MAAO,MAAc,IAAI,CAAC;AAAA,IAClD;AAAA,EACD,CAAC;AACF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"addMarks.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/addMarks.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Text as SlateText } from 'slate'\nimport { TextSpecifics } from '../../types/editor'\n\nexport const addMarks = <T extends SlateText, E extends SlateEditor>(editor: E, marks: TextSpecifics<T>) => {\n\tEditor.withoutNormalizing(editor, () => {\n\t\tfor (const mark in marks) {\n\t\t\tEditor.addMark(editor, mark, (marks as any)[mark])\n\t\t}\n\t})\n}\n"],"names":[],"mappings":";AAGO,MAAM,WAAW,CAA6C,QAAW,UAA4B;AAC3G,SAAO,mBAAmB,QAAQ,MAAM;AACvC,eAAW,QAAQ,OAAO;AACzB,aAAO,QAAQ,QAAQ,MAAO,MAAc,IAAI,CAAC;AAAA,IAClD;AAAA,EACD,CAAC;AACF;"}
1
+ {"version":3,"file":"addMarks.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/addMarks.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Text as SlateText } from 'slate'\nimport { TextSpecifics } from '../../types/editor.js'\n\nexport const addMarks = <T extends SlateText, E extends SlateEditor>(editor: E, marks: TextSpecifics<T>) => {\n\tEditor.withoutNormalizing(editor, () => {\n\t\tfor (const mark in marks) {\n\t\t\tEditor.addMark(editor, mark, (marks as any)[mark])\n\t\t}\n\t})\n}\n"],"names":[],"mappings":";AAGO,MAAM,WAAW,CAA6C,QAAW,UAA4B;AAC3G,SAAO,mBAAmB,QAAQ,MAAM;AACvC,eAAW,QAAQ,OAAO;AACzB,aAAO,QAAQ,QAAQ,MAAO,MAAc,IAAI,CAAC;AAAA,IAClD;AAAA,EACD,CAAC;AACF;"}
@@ -1 +1 @@
1
- {"version":3,"file":"closestBlockEntry.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/closestBlockEntry.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Element, Location } from 'slate'\nimport { closest } from './closest'\n\nexport const closestBlockEntry = <E extends SlateEditor>(\n\teditor: E,\n\toptions?: {\n\t\tat?: Location\n\t\tmatch?: (node: Element) => boolean\n\t},\n) =>\n\tclosest(editor, {\n\t\tat: options?.at,\n\t\tmatch: node => !Editor.isEditor(node) && Editor.isBlock(editor, node) && (options?.match ? options.match(node) : true),\n\t})\n"],"names":["closest","Editor"],"mappings":";;;;AAGO,MAAM,oBAAoB,CAChC,QACA,YAKAA,QAAAA,QAAQ,QAAQ;AAAA,EACf,IAAI,SAAS;AAAA,EACb,OAAO,CAAA,SAAQ,CAACC,MAAAA,OAAO,SAAS,IAAI,KAAKA,aAAO,QAAQ,QAAQ,IAAI,MAAM,SAAS,QAAQ,QAAQ,MAAM,IAAI,IAAI;AAClH,CAAC;;"}
1
+ {"version":3,"file":"closestBlockEntry.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/closestBlockEntry.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Element, Location } from 'slate'\nimport { closest } from './closest.js'\n\nexport const closestBlockEntry = <E extends SlateEditor>(\n\teditor: E,\n\toptions?: {\n\t\tat?: Location\n\t\tmatch?: (node: Element) => boolean\n\t},\n) =>\n\tclosest(editor, {\n\t\tat: options?.at,\n\t\tmatch: node => !Editor.isEditor(node) && Editor.isBlock(editor, node) && (options?.match ? options.match(node) : true),\n\t})\n"],"names":["closest","Editor"],"mappings":";;;;AAGO,MAAM,oBAAoB,CAChC,QACA,YAKAA,QAAAA,QAAQ,QAAQ;AAAA,EACf,IAAI,SAAS;AAAA,EACb,OAAO,CAAA,SAAQ,CAACC,MAAAA,OAAO,SAAS,IAAI,KAAKA,aAAO,QAAQ,QAAQ,IAAI,MAAM,SAAS,QAAQ,QAAQ,MAAM,IAAI,IAAI;AAClH,CAAC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"closestBlockEntry.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/closestBlockEntry.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Element, Location } from 'slate'\nimport { closest } from './closest'\n\nexport const closestBlockEntry = <E extends SlateEditor>(\n\teditor: E,\n\toptions?: {\n\t\tat?: Location\n\t\tmatch?: (node: Element) => boolean\n\t},\n) =>\n\tclosest(editor, {\n\t\tat: options?.at,\n\t\tmatch: node => !Editor.isEditor(node) && Editor.isBlock(editor, node) && (options?.match ? options.match(node) : true),\n\t})\n"],"names":[],"mappings":";;AAGO,MAAM,oBAAoB,CAChC,QACA,YAKA,QAAQ,QAAQ;AAAA,EACf,IAAI,SAAS;AAAA,EACb,OAAO,CAAA,SAAQ,CAAC,OAAO,SAAS,IAAI,KAAK,OAAO,QAAQ,QAAQ,IAAI,MAAM,SAAS,QAAQ,QAAQ,MAAM,IAAI,IAAI;AAClH,CAAC;"}
1
+ {"version":3,"file":"closestBlockEntry.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/closestBlockEntry.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Element, Location } from 'slate'\nimport { closest } from './closest.js'\n\nexport const closestBlockEntry = <E extends SlateEditor>(\n\teditor: E,\n\toptions?: {\n\t\tat?: Location\n\t\tmatch?: (node: Element) => boolean\n\t},\n) =>\n\tclosest(editor, {\n\t\tat: options?.at,\n\t\tmatch: node => !Editor.isEditor(node) && Editor.isBlock(editor, node) && (options?.match ? options.match(node) : true),\n\t})\n"],"names":[],"mappings":";;AAGO,MAAM,oBAAoB,CAChC,QACA,YAKA,QAAQ,QAAQ;AAAA,EACf,IAAI,SAAS;AAAA,EACb,OAAO,CAAA,SAAQ,CAAC,OAAO,SAAS,IAAI,KAAK,OAAO,QAAQ,QAAQ,IAAI,MAAM,SAAS,QAAQ,QAAQ,MAAM,IAAI,IAAI;AAClH,CAAC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"closestViableBlockContainerEntry.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/closestViableBlockContainerEntry.ts"],"sourcesContent":["import type { Location as SlateLocation, NodeEntry } from 'slate'\nimport { Editor as SlateEditor, Element as SlateElement } from 'slate'\nimport { closest } from './closest'\n\nexport const closestViableBlockContainerEntry = <E extends SlateEditor>(\n\teditor: E,\n\toptions?: {\n\t\tat?: SlateLocation\n\t},\n): NodeEntry<SlateElement | SlateEditor> | undefined =>\n\tclosest(editor, {\n\t\tat: options?.at,\n\t\tmatch: node => editor.canContainAnyBlocks(node),\n\t})\n"],"names":["closest"],"mappings":";;;AAIO,MAAM,mCAAmC,CAC/C,QACA,YAIAA,QAAAA,QAAQ,QAAQ;AAAA,EACf,IAAI,SAAS;AAAA,EACb,OAAO,CAAA,SAAQ,OAAO,oBAAoB,IAAI;AAC/C,CAAC;;"}
1
+ {"version":3,"file":"closestViableBlockContainerEntry.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/closestViableBlockContainerEntry.ts"],"sourcesContent":["import type { Location as SlateLocation, NodeEntry } from 'slate'\nimport { Editor as SlateEditor, Element as SlateElement } from 'slate'\nimport { closest } from './closest.js'\n\nexport const closestViableBlockContainerEntry = <E extends SlateEditor>(\n\teditor: E,\n\toptions?: {\n\t\tat?: SlateLocation\n\t},\n): NodeEntry<SlateElement | SlateEditor> | undefined =>\n\tclosest(editor, {\n\t\tat: options?.at,\n\t\tmatch: node => editor.canContainAnyBlocks(node),\n\t})\n"],"names":["closest"],"mappings":";;;AAIO,MAAM,mCAAmC,CAC/C,QACA,YAIAA,QAAAA,QAAQ,QAAQ;AAAA,EACf,IAAI,SAAS;AAAA,EACb,OAAO,CAAA,SAAQ,OAAO,oBAAoB,IAAI;AAC/C,CAAC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"closestViableBlockContainerEntry.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/closestViableBlockContainerEntry.ts"],"sourcesContent":["import type { Location as SlateLocation, NodeEntry } from 'slate'\nimport { Editor as SlateEditor, Element as SlateElement } from 'slate'\nimport { closest } from './closest'\n\nexport const closestViableBlockContainerEntry = <E extends SlateEditor>(\n\teditor: E,\n\toptions?: {\n\t\tat?: SlateLocation\n\t},\n): NodeEntry<SlateElement | SlateEditor> | undefined =>\n\tclosest(editor, {\n\t\tat: options?.at,\n\t\tmatch: node => editor.canContainAnyBlocks(node),\n\t})\n"],"names":[],"mappings":";AAIO,MAAM,mCAAmC,CAC/C,QACA,YAIA,QAAQ,QAAQ;AAAA,EACf,IAAI,SAAS;AAAA,EACb,OAAO,CAAA,SAAQ,OAAO,oBAAoB,IAAI;AAC/C,CAAC;"}
1
+ {"version":3,"file":"closestViableBlockContainerEntry.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/closestViableBlockContainerEntry.ts"],"sourcesContent":["import type { Location as SlateLocation, NodeEntry } from 'slate'\nimport { Editor as SlateEditor, Element as SlateElement } from 'slate'\nimport { closest } from './closest.js'\n\nexport const closestViableBlockContainerEntry = <E extends SlateEditor>(\n\teditor: E,\n\toptions?: {\n\t\tat?: SlateLocation\n\t},\n): NodeEntry<SlateElement | SlateEditor> | undefined =>\n\tclosest(editor, {\n\t\tat: options?.at,\n\t\tmatch: node => editor.canContainAnyBlocks(node),\n\t})\n"],"names":[],"mappings":";AAIO,MAAM,mCAAmC,CAC/C,QACA,YAIA,QAAQ,QAAQ;AAAA,EACf,IAAI,SAAS;AAAA,EACb,OAAO,CAAA,SAAQ,OAAO,oBAAoB,IAAI;AAC/C,CAAC;"}
@@ -1 +1 @@
1
- {"version":3,"file":"hasMarks.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/hasMarks.ts"],"sourcesContent":["import { Editor as SlateEditor, Node as SlateNode, Path, Text as SlateText } from 'slate'\nimport { TextSpecifics } from '../../types/editor'\n\nexport const hasMarks = <T extends SlateText, E extends SlateEditor>(\n\teditor: E,\n\tmarks: TextSpecifics<T>,\n\toptions: {\n\t\tfrom?: Path\n\t\tto?: Path\n\t} = {},\n) => {\n\tconst from = options.from ?? editor.selection?.anchor.path\n\tconst to = options.to ?? editor.selection?.focus.path\n\n\tif (!from && !to) {\n\t\treturn false\n\t}\n\n\tfor (\n\t\tconst [text] of SlateNode.texts(editor, {\n\t\t\tfrom,\n\t\t\tto,\n\t\t})\n\t) {\n\t\tfor (const markName in marks) {\n\t\t\tif (!(markName in text) || text[markName] !== (marks as any)[markName]) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn true\n}\n"],"names":["SlateNode"],"mappings":";;;AAGO,MAAM,WAAW,CACvB,QACA,OACA,UAGI,CAAA,MACA;AACJ,QAAM,OAAO,QAAQ,QAAQ,OAAO,WAAW,OAAO;AACtD,QAAM,KAAK,QAAQ,MAAM,OAAO,WAAW,MAAM;AAEjD,MAAI,CAAC,QAAQ,CAAC,IAAI;AACjB,WAAO;AAAA,EACR;AAEA,aACO,CAAC,IAAI,KAAKA,MAAAA,KAAU,MAAM,QAAQ;AAAA,IACvC;AAAA,IACA;AAAA,EAAA,CACA,GACA;AACD,eAAW,YAAY,OAAO;AAC7B,UAAI,EAAE,YAAY,SAAS,KAAK,QAAQ,MAAO,MAAc,QAAQ,GAAG;AACvE,eAAO;AAAA,MACR;AAAA,IACD;AAAA,EACD;AACA,SAAO;AACR;;"}
1
+ {"version":3,"file":"hasMarks.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/hasMarks.ts"],"sourcesContent":["import { Editor as SlateEditor, Node as SlateNode, Path, Text as SlateText } from 'slate'\nimport { TextSpecifics } from '../../types/editor.js'\n\nexport const hasMarks = <T extends SlateText, E extends SlateEditor>(\n\teditor: E,\n\tmarks: TextSpecifics<T>,\n\toptions: {\n\t\tfrom?: Path\n\t\tto?: Path\n\t} = {},\n) => {\n\tconst from = options.from ?? editor.selection?.anchor.path\n\tconst to = options.to ?? editor.selection?.focus.path\n\n\tif (!from && !to) {\n\t\treturn false\n\t}\n\n\tfor (\n\t\tconst [text] of SlateNode.texts(editor, {\n\t\t\tfrom,\n\t\t\tto,\n\t\t})\n\t) {\n\t\tfor (const markName in marks) {\n\t\t\tif (!(markName in text) || text[markName] !== (marks as any)[markName]) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn true\n}\n"],"names":["SlateNode"],"mappings":";;;AAGO,MAAM,WAAW,CACvB,QACA,OACA,UAGI,CAAA,MACA;AACJ,QAAM,OAAO,QAAQ,QAAQ,OAAO,WAAW,OAAO;AACtD,QAAM,KAAK,QAAQ,MAAM,OAAO,WAAW,MAAM;AAEjD,MAAI,CAAC,QAAQ,CAAC,IAAI;AACjB,WAAO;AAAA,EACR;AAEA,aACO,CAAC,IAAI,KAAKA,MAAAA,KAAU,MAAM,QAAQ;AAAA,IACvC;AAAA,IACA;AAAA,EAAA,CACA,GACA;AACD,eAAW,YAAY,OAAO;AAC7B,UAAI,EAAE,YAAY,SAAS,KAAK,QAAQ,MAAO,MAAc,QAAQ,GAAG;AACvE,eAAO;AAAA,MACR;AAAA,IACD;AAAA,EACD;AACA,SAAO;AACR;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"hasMarks.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/hasMarks.ts"],"sourcesContent":["import { Editor as SlateEditor, Node as SlateNode, Path, Text as SlateText } from 'slate'\nimport { TextSpecifics } from '../../types/editor'\n\nexport const hasMarks = <T extends SlateText, E extends SlateEditor>(\n\teditor: E,\n\tmarks: TextSpecifics<T>,\n\toptions: {\n\t\tfrom?: Path\n\t\tto?: Path\n\t} = {},\n) => {\n\tconst from = options.from ?? editor.selection?.anchor.path\n\tconst to = options.to ?? editor.selection?.focus.path\n\n\tif (!from && !to) {\n\t\treturn false\n\t}\n\n\tfor (\n\t\tconst [text] of SlateNode.texts(editor, {\n\t\t\tfrom,\n\t\t\tto,\n\t\t})\n\t) {\n\t\tfor (const markName in marks) {\n\t\t\tif (!(markName in text) || text[markName] !== (marks as any)[markName]) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn true\n}\n"],"names":["SlateNode"],"mappings":";AAGO,MAAM,WAAW,CACvB,QACA,OACA,UAGI,CAAA,MACA;AACJ,QAAM,OAAO,QAAQ,QAAQ,OAAO,WAAW,OAAO;AACtD,QAAM,KAAK,QAAQ,MAAM,OAAO,WAAW,MAAM;AAEjD,MAAI,CAAC,QAAQ,CAAC,IAAI;AACjB,WAAO;AAAA,EACR;AAEA,aACO,CAAC,IAAI,KAAKA,KAAU,MAAM,QAAQ;AAAA,IACvC;AAAA,IACA;AAAA,EAAA,CACA,GACA;AACD,eAAW,YAAY,OAAO;AAC7B,UAAI,EAAE,YAAY,SAAS,KAAK,QAAQ,MAAO,MAAc,QAAQ,GAAG;AACvE,eAAO;AAAA,MACR;AAAA,IACD;AAAA,EACD;AACA,SAAO;AACR;"}
1
+ {"version":3,"file":"hasMarks.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/hasMarks.ts"],"sourcesContent":["import { Editor as SlateEditor, Node as SlateNode, Path, Text as SlateText } from 'slate'\nimport { TextSpecifics } from '../../types/editor.js'\n\nexport const hasMarks = <T extends SlateText, E extends SlateEditor>(\n\teditor: E,\n\tmarks: TextSpecifics<T>,\n\toptions: {\n\t\tfrom?: Path\n\t\tto?: Path\n\t} = {},\n) => {\n\tconst from = options.from ?? editor.selection?.anchor.path\n\tconst to = options.to ?? editor.selection?.focus.path\n\n\tif (!from && !to) {\n\t\treturn false\n\t}\n\n\tfor (\n\t\tconst [text] of SlateNode.texts(editor, {\n\t\t\tfrom,\n\t\t\tto,\n\t\t})\n\t) {\n\t\tfor (const markName in marks) {\n\t\t\tif (!(markName in text) || text[markName] !== (marks as any)[markName]) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn true\n}\n"],"names":["SlateNode"],"mappings":";AAGO,MAAM,WAAW,CACvB,QACA,OACA,UAGI,CAAA,MACA;AACJ,QAAM,OAAO,QAAQ,QAAQ,OAAO,WAAW,OAAO;AACtD,QAAM,KAAK,QAAQ,MAAM,OAAO,WAAW,MAAM;AAEjD,MAAI,CAAC,QAAQ,CAAC,IAAI;AACjB,WAAO;AAAA,EACR;AAEA,aACO,CAAC,IAAI,KAAKA,KAAU,MAAM,QAAQ;AAAA,IACvC;AAAA,IACA;AAAA,EAAA,CACA,GACA;AACD,eAAW,YAAY,OAAO;AAC7B,UAAI,EAAE,YAAY,SAAS,KAAK,QAAQ,MAAO,MAAc,QAAQ,GAAG;AACvE,eAAO;AAAA,MACR;AAAA,IACD;AAAA,EACD;AACA,SAAO;AACR;"}
@@ -1 +1 @@
1
- {"version":3,"file":"hasParentOfType.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/hasParentOfType.ts"],"sourcesContent":["import { Editor as SlateEditor, Element as SlateElement, Node as SlateNode, NodeEntry, Path as SlatePath } from 'slate'\nimport { ContemberEditor } from '../index'\n\nexport const hasParentOfType = <Editor extends SlateEditor, Element extends SlateElement>(\n\teditor: Editor,\n\tnodeEntry: NodeEntry<SlateNode | SlateElement>,\n\ttype: Element['type'],\n\tsuchThat?: Partial<Element>,\n): boolean => {\n\tconst [, path] = nodeEntry\n\tif (path.length === 1) {\n\t\treturn false // Doesn't have a parent\n\t}\n\tconst parentPath = SlatePath.parent(path)\n\tconst parent = SlateNode.get(editor, parentPath)\n\n\treturn ContemberEditor.isElementType(parent, type, suchThat)\n}\n"],"names":["SlatePath","SlateNode","ContemberEditor"],"mappings":";;;;AAGO,MAAM,kBAAkB,CAC9B,QACA,WACA,MACA,aACa;AACb,QAAM,CAAA,EAAG,IAAI,IAAI;AACjB,MAAI,KAAK,WAAW,GAAG;AACtB,WAAO;AAAA,EACR;AACA,QAAM,aAAaA,MAAAA,KAAU,OAAO,IAAI;AACxC,QAAM,SAASC,MAAAA,KAAU,IAAI,QAAQ,UAAU;AAE/C,SAAOC,MAAAA,gBAAgB,cAAc,QAAQ,MAAM,QAAQ;AAC5D;;"}
1
+ {"version":3,"file":"hasParentOfType.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/hasParentOfType.ts"],"sourcesContent":["import { Editor as SlateEditor, Element as SlateElement, Node as SlateNode, NodeEntry, Path as SlatePath } from 'slate'\nimport { ContemberEditor } from '../index.js'\n\nexport const hasParentOfType = <Editor extends SlateEditor, Element extends SlateElement>(\n\teditor: Editor,\n\tnodeEntry: NodeEntry<SlateNode | SlateElement>,\n\ttype: Element['type'],\n\tsuchThat?: Partial<Element>,\n): boolean => {\n\tconst [, path] = nodeEntry\n\tif (path.length === 1) {\n\t\treturn false // Doesn't have a parent\n\t}\n\tconst parentPath = SlatePath.parent(path)\n\tconst parent = SlateNode.get(editor, parentPath)\n\n\treturn ContemberEditor.isElementType(parent, type, suchThat)\n}\n"],"names":["SlatePath","SlateNode","ContemberEditor"],"mappings":";;;;AAGO,MAAM,kBAAkB,CAC9B,QACA,WACA,MACA,aACa;AACb,QAAM,CAAA,EAAG,IAAI,IAAI;AACjB,MAAI,KAAK,WAAW,GAAG;AACtB,WAAO;AAAA,EACR;AACA,QAAM,aAAaA,MAAAA,KAAU,OAAO,IAAI;AACxC,QAAM,SAASC,MAAAA,KAAU,IAAI,QAAQ,UAAU;AAE/C,SAAOC,MAAAA,gBAAgB,cAAc,QAAQ,MAAM,QAAQ;AAC5D;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"hasParentOfType.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/hasParentOfType.ts"],"sourcesContent":["import { Editor as SlateEditor, Element as SlateElement, Node as SlateNode, NodeEntry, Path as SlatePath } from 'slate'\nimport { ContemberEditor } from '../index'\n\nexport const hasParentOfType = <Editor extends SlateEditor, Element extends SlateElement>(\n\teditor: Editor,\n\tnodeEntry: NodeEntry<SlateNode | SlateElement>,\n\ttype: Element['type'],\n\tsuchThat?: Partial<Element>,\n): boolean => {\n\tconst [, path] = nodeEntry\n\tif (path.length === 1) {\n\t\treturn false // Doesn't have a parent\n\t}\n\tconst parentPath = SlatePath.parent(path)\n\tconst parent = SlateNode.get(editor, parentPath)\n\n\treturn ContemberEditor.isElementType(parent, type, suchThat)\n}\n"],"names":["SlatePath","SlateNode"],"mappings":";;AAGO,MAAM,kBAAkB,CAC9B,QACA,WACA,MACA,aACa;AACb,QAAM,CAAA,EAAG,IAAI,IAAI;AACjB,MAAI,KAAK,WAAW,GAAG;AACtB,WAAO;AAAA,EACR;AACA,QAAM,aAAaA,KAAU,OAAO,IAAI;AACxC,QAAM,SAASC,KAAU,IAAI,QAAQ,UAAU;AAE/C,SAAO,gBAAgB,cAAc,QAAQ,MAAM,QAAQ;AAC5D;"}
1
+ {"version":3,"file":"hasParentOfType.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/hasParentOfType.ts"],"sourcesContent":["import { Editor as SlateEditor, Element as SlateElement, Node as SlateNode, NodeEntry, Path as SlatePath } from 'slate'\nimport { ContemberEditor } from '../index.js'\n\nexport const hasParentOfType = <Editor extends SlateEditor, Element extends SlateElement>(\n\teditor: Editor,\n\tnodeEntry: NodeEntry<SlateNode | SlateElement>,\n\ttype: Element['type'],\n\tsuchThat?: Partial<Element>,\n): boolean => {\n\tconst [, path] = nodeEntry\n\tif (path.length === 1) {\n\t\treturn false // Doesn't have a parent\n\t}\n\tconst parentPath = SlatePath.parent(path)\n\tconst parent = SlateNode.get(editor, parentPath)\n\n\treturn ContemberEditor.isElementType(parent, type, suchThat)\n}\n"],"names":["SlatePath","SlateNode"],"mappings":";;AAGO,MAAM,kBAAkB,CAC9B,QACA,WACA,MACA,aACa;AACb,QAAM,CAAA,EAAG,IAAI,IAAI;AACjB,MAAI,KAAK,WAAW,GAAG;AACtB,WAAO;AAAA,EACR;AACA,QAAM,aAAaA,KAAU,OAAO,IAAI;AACxC,QAAM,SAASC,KAAU,IAAI,QAAQ,UAAU;AAE/C,SAAO,gBAAgB,cAAc,QAAQ,MAAM,QAAQ;AAC5D;"}
@@ -1 +1 @@
1
- {"version":3,"file":"permissivelyDeserializeNodes.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/permissivelyDeserializeNodes.ts"],"sourcesContent":["import { toLatestFormat } from './toLatestFormat'\nimport { Editor as SlateEditor, Element as SlateElement, Text as SlateText } from 'slate'\nimport { SerializableEditorNode } from '../../types/editor'\n\nexport const permissivelyDeserializeNodes = <E extends SlateEditor>(\n\teditor: E,\n\tserializedElement: string,\n\terrorMessage?: string,\n): Array<SlateElement | SlateText> => {\n\tlet deserialized: SerializableEditorNode | SlateElement | null = null\n\ttry {\n\t\t// It is important that only the JSON.parse call is inside the try block.\n\t\t// We don't want to catch other exceptions from here.\n\t\tdeserialized = JSON.parse(serializedElement)\n\t} catch (e) {}\n\n\tif (typeof deserialized !== 'object' || deserialized === null) {\n\t\treturn [editor.createDefaultElement([{ text: serializedElement }])]\n\t}\n\n\tif ('formatVersion' in deserialized) {\n\t\treturn toLatestFormat(editor, deserialized as SerializableEditorNode).children\n\t}\n\n\t// If no format version is specified, assume zero.\n\treturn toLatestFormat(editor, {\n\t\tformatVersion: 0,\n\t\tchildren: [deserialized],\n\t}).children\n}\n"],"names":["toLatestFormat"],"mappings":";;;AAIO,MAAM,+BAA+B,CAC3C,QACA,mBACA,iBACqC;AACrC,MAAI,eAA6D;AACjE,MAAI;AAGH,mBAAe,KAAK,MAAM,iBAAiB;AAAA,EAC5C,SAAS,GAAG;AAAA,EAAC;AAEb,MAAI,OAAO,iBAAiB,YAAY,iBAAiB,MAAM;AAC9D,WAAO,CAAC,OAAO,qBAAqB,CAAC,EAAE,MAAM,kBAAA,CAAmB,CAAC,CAAC;AAAA,EACnE;AAEA,MAAI,mBAAmB,cAAc;AACpC,WAAOA,8BAAe,QAAQ,YAAsC,EAAE;AAAA,EACvE;AAGA,SAAOA,eAAAA,eAAe,QAAQ;AAAA,IAC7B,eAAe;AAAA,IACf,UAAU,CAAC,YAAY;AAAA,EAAA,CACvB,EAAE;AACJ;;"}
1
+ {"version":3,"file":"permissivelyDeserializeNodes.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/permissivelyDeserializeNodes.ts"],"sourcesContent":["import { toLatestFormat } from './toLatestFormat.js'\nimport { Editor as SlateEditor, Element as SlateElement, Text as SlateText } from 'slate'\nimport { SerializableEditorNode } from '../../types/editor.js'\n\nexport const permissivelyDeserializeNodes = <E extends SlateEditor>(\n\teditor: E,\n\tserializedElement: string,\n\terrorMessage?: string,\n): Array<SlateElement | SlateText> => {\n\tlet deserialized: SerializableEditorNode | SlateElement | null = null\n\ttry {\n\t\t// It is important that only the JSON.parse call is inside the try block.\n\t\t// We don't want to catch other exceptions from here.\n\t\tdeserialized = JSON.parse(serializedElement)\n\t} catch (e) {}\n\n\tif (typeof deserialized !== 'object' || deserialized === null) {\n\t\treturn [editor.createDefaultElement([{ text: serializedElement }])]\n\t}\n\n\tif ('formatVersion' in deserialized) {\n\t\treturn toLatestFormat(editor, deserialized as SerializableEditorNode).children\n\t}\n\n\t// If no format version is specified, assume zero.\n\treturn toLatestFormat(editor, {\n\t\tformatVersion: 0,\n\t\tchildren: [deserialized],\n\t}).children\n}\n"],"names":["toLatestFormat"],"mappings":";;;AAIO,MAAM,+BAA+B,CAC3C,QACA,mBACA,iBACqC;AACrC,MAAI,eAA6D;AACjE,MAAI;AAGH,mBAAe,KAAK,MAAM,iBAAiB;AAAA,EAC5C,SAAS,GAAG;AAAA,EAAC;AAEb,MAAI,OAAO,iBAAiB,YAAY,iBAAiB,MAAM;AAC9D,WAAO,CAAC,OAAO,qBAAqB,CAAC,EAAE,MAAM,kBAAA,CAAmB,CAAC,CAAC;AAAA,EACnE;AAEA,MAAI,mBAAmB,cAAc;AACpC,WAAOA,8BAAe,QAAQ,YAAsC,EAAE;AAAA,EACvE;AAGA,SAAOA,eAAAA,eAAe,QAAQ;AAAA,IAC7B,eAAe;AAAA,IACf,UAAU,CAAC,YAAY;AAAA,EAAA,CACvB,EAAE;AACJ;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"permissivelyDeserializeNodes.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/permissivelyDeserializeNodes.ts"],"sourcesContent":["import { toLatestFormat } from './toLatestFormat'\nimport { Editor as SlateEditor, Element as SlateElement, Text as SlateText } from 'slate'\nimport { SerializableEditorNode } from '../../types/editor'\n\nexport const permissivelyDeserializeNodes = <E extends SlateEditor>(\n\teditor: E,\n\tserializedElement: string,\n\terrorMessage?: string,\n): Array<SlateElement | SlateText> => {\n\tlet deserialized: SerializableEditorNode | SlateElement | null = null\n\ttry {\n\t\t// It is important that only the JSON.parse call is inside the try block.\n\t\t// We don't want to catch other exceptions from here.\n\t\tdeserialized = JSON.parse(serializedElement)\n\t} catch (e) {}\n\n\tif (typeof deserialized !== 'object' || deserialized === null) {\n\t\treturn [editor.createDefaultElement([{ text: serializedElement }])]\n\t}\n\n\tif ('formatVersion' in deserialized) {\n\t\treturn toLatestFormat(editor, deserialized as SerializableEditorNode).children\n\t}\n\n\t// If no format version is specified, assume zero.\n\treturn toLatestFormat(editor, {\n\t\tformatVersion: 0,\n\t\tchildren: [deserialized],\n\t}).children\n}\n"],"names":[],"mappings":";AAIO,MAAM,+BAA+B,CAC3C,QACA,mBACA,iBACqC;AACrC,MAAI,eAA6D;AACjE,MAAI;AAGH,mBAAe,KAAK,MAAM,iBAAiB;AAAA,EAC5C,SAAS,GAAG;AAAA,EAAC;AAEb,MAAI,OAAO,iBAAiB,YAAY,iBAAiB,MAAM;AAC9D,WAAO,CAAC,OAAO,qBAAqB,CAAC,EAAE,MAAM,kBAAA,CAAmB,CAAC,CAAC;AAAA,EACnE;AAEA,MAAI,mBAAmB,cAAc;AACpC,WAAO,eAAe,QAAQ,YAAsC,EAAE;AAAA,EACvE;AAGA,SAAO,eAAe,QAAQ;AAAA,IAC7B,eAAe;AAAA,IACf,UAAU,CAAC,YAAY;AAAA,EAAA,CACvB,EAAE;AACJ;"}
1
+ {"version":3,"file":"permissivelyDeserializeNodes.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/permissivelyDeserializeNodes.ts"],"sourcesContent":["import { toLatestFormat } from './toLatestFormat.js'\nimport { Editor as SlateEditor, Element as SlateElement, Text as SlateText } from 'slate'\nimport { SerializableEditorNode } from '../../types/editor.js'\n\nexport const permissivelyDeserializeNodes = <E extends SlateEditor>(\n\teditor: E,\n\tserializedElement: string,\n\terrorMessage?: string,\n): Array<SlateElement | SlateText> => {\n\tlet deserialized: SerializableEditorNode | SlateElement | null = null\n\ttry {\n\t\t// It is important that only the JSON.parse call is inside the try block.\n\t\t// We don't want to catch other exceptions from here.\n\t\tdeserialized = JSON.parse(serializedElement)\n\t} catch (e) {}\n\n\tif (typeof deserialized !== 'object' || deserialized === null) {\n\t\treturn [editor.createDefaultElement([{ text: serializedElement }])]\n\t}\n\n\tif ('formatVersion' in deserialized) {\n\t\treturn toLatestFormat(editor, deserialized as SerializableEditorNode).children\n\t}\n\n\t// If no format version is specified, assume zero.\n\treturn toLatestFormat(editor, {\n\t\tformatVersion: 0,\n\t\tchildren: [deserialized],\n\t}).children\n}\n"],"names":[],"mappings":";AAIO,MAAM,+BAA+B,CAC3C,QACA,mBACA,iBACqC;AACrC,MAAI,eAA6D;AACjE,MAAI;AAGH,mBAAe,KAAK,MAAM,iBAAiB;AAAA,EAC5C,SAAS,GAAG;AAAA,EAAC;AAEb,MAAI,OAAO,iBAAiB,YAAY,iBAAiB,MAAM;AAC9D,WAAO,CAAC,OAAO,qBAAqB,CAAC,EAAE,MAAM,kBAAA,CAAmB,CAAC,CAAC;AAAA,EACnE;AAEA,MAAI,mBAAmB,cAAc;AACpC,WAAO,eAAe,QAAQ,YAAsC,EAAE;AAAA,EACvE;AAGA,SAAO,eAAe,QAAQ;AAAA,IAC7B,eAAe;AAAA,IACf,UAAU,CAAC,YAAY;AAAA,EAAA,CACvB,EAAE;AACJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"removeMarks.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/removeMarks.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Text as SlateText } from 'slate'\nimport { TextSpecifics } from '../../types/editor'\n\nexport const removeMarks = <T extends SlateText, E extends SlateEditor>(editor: E, marks: TextSpecifics<T>) => {\n\tEditor.withoutNormalizing(editor, () => {\n\t\tfor (const mark in marks) {\n\t\t\tEditor.removeMark(editor, mark)\n\t\t}\n\t})\n}\n"],"names":["Editor"],"mappings":";;;AAGO,MAAM,cAAc,CAA6C,QAAW,UAA4B;AAC9GA,eAAO,mBAAmB,QAAQ,MAAM;AACvC,eAAW,QAAQ,OAAO;AACzBA,mBAAO,WAAW,QAAQ,IAAI;AAAA,IAC/B;AAAA,EACD,CAAC;AACF;;"}
1
+ {"version":3,"file":"removeMarks.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/removeMarks.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Text as SlateText } from 'slate'\nimport { TextSpecifics } from '../../types/editor.js'\n\nexport const removeMarks = <T extends SlateText, E extends SlateEditor>(editor: E, marks: TextSpecifics<T>) => {\n\tEditor.withoutNormalizing(editor, () => {\n\t\tfor (const mark in marks) {\n\t\t\tEditor.removeMark(editor, mark)\n\t\t}\n\t})\n}\n"],"names":["Editor"],"mappings":";;;AAGO,MAAM,cAAc,CAA6C,QAAW,UAA4B;AAC9GA,eAAO,mBAAmB,QAAQ,MAAM;AACvC,eAAW,QAAQ,OAAO;AACzBA,mBAAO,WAAW,QAAQ,IAAI;AAAA,IAC/B;AAAA,EACD,CAAC;AACF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"removeMarks.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/removeMarks.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Text as SlateText } from 'slate'\nimport { TextSpecifics } from '../../types/editor'\n\nexport const removeMarks = <T extends SlateText, E extends SlateEditor>(editor: E, marks: TextSpecifics<T>) => {\n\tEditor.withoutNormalizing(editor, () => {\n\t\tfor (const mark in marks) {\n\t\t\tEditor.removeMark(editor, mark)\n\t\t}\n\t})\n}\n"],"names":[],"mappings":";AAGO,MAAM,cAAc,CAA6C,QAAW,UAA4B;AAC9G,SAAO,mBAAmB,QAAQ,MAAM;AACvC,eAAW,QAAQ,OAAO;AACzB,aAAO,WAAW,QAAQ,IAAI;AAAA,IAC/B;AAAA,EACD,CAAC;AACF;"}
1
+ {"version":3,"file":"removeMarks.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/removeMarks.ts"],"sourcesContent":["import { Editor, Editor as SlateEditor, Text as SlateText } from 'slate'\nimport { TextSpecifics } from '../../types/editor.js'\n\nexport const removeMarks = <T extends SlateText, E extends SlateEditor>(editor: E, marks: TextSpecifics<T>) => {\n\tEditor.withoutNormalizing(editor, () => {\n\t\tfor (const mark in marks) {\n\t\t\tEditor.removeMark(editor, mark)\n\t\t}\n\t})\n}\n"],"names":[],"mappings":";AAGO,MAAM,cAAc,CAA6C,QAAW,UAA4B;AAC9G,SAAO,mBAAmB,QAAQ,MAAM;AACvC,eAAW,QAAQ,OAAO;AACzB,aAAO,WAAW,QAAQ,IAAI;AAAA,IAC/B;AAAA,EACD,CAAC;AACF;"}
@@ -1 +1 @@
1
- {"version":3,"file":"serializeNodes.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/serializeNodes.ts"],"sourcesContent":["import { Editor as SlateEditor, Element as SlateElement, Text as SlateText } from 'slate'\nimport { SerializableEditorNode } from '../../types/editor'\n\nexport const serializeNodes = <E extends SlateEditor>(\n\teditor: E,\n\telements: Array<SlateElement | SlateText>,\n\terrorMessage?: string,\n) => {\n\ttry {\n\t\tconst serialized: SerializableEditorNode = {\n\t\t\tformatVersion: editor.formatVersion,\n\t\t\tchildren: elements,\n\t\t}\n\t\treturn JSON.stringify(serialized)\n\t} catch (e) {\n\t\tthrow new Error(errorMessage || `Editor: serialization error`)\n\t}\n}\n"],"names":[],"mappings":";;AAGO,MAAM,iBAAiB,CAC7B,QACA,UACA,iBACI;AACJ,MAAI;AACH,UAAM,aAAqC;AAAA,MAC1C,eAAe,OAAO;AAAA,MACtB,UAAU;AAAA,IAAA;AAEX,WAAO,KAAK,UAAU,UAAU;AAAA,EACjC,SAAS,GAAG;AACX,UAAM,IAAI,MAAM,gBAAgB,6BAA6B;AAAA,EAC9D;AACD;;"}
1
+ {"version":3,"file":"serializeNodes.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/serializeNodes.ts"],"sourcesContent":["import { Editor as SlateEditor, Element as SlateElement, Text as SlateText } from 'slate'\nimport { SerializableEditorNode } from '../../types/editor.js'\n\nexport const serializeNodes = <E extends SlateEditor>(\n\teditor: E,\n\telements: Array<SlateElement | SlateText>,\n\terrorMessage?: string,\n) => {\n\ttry {\n\t\tconst serialized: SerializableEditorNode = {\n\t\t\tformatVersion: editor.formatVersion,\n\t\t\tchildren: elements,\n\t\t}\n\t\treturn JSON.stringify(serialized)\n\t} catch (e) {\n\t\tthrow new Error(errorMessage || `Editor: serialization error`)\n\t}\n}\n"],"names":[],"mappings":";;AAGO,MAAM,iBAAiB,CAC7B,QACA,UACA,iBACI;AACJ,MAAI;AACH,UAAM,aAAqC;AAAA,MAC1C,eAAe,OAAO;AAAA,MACtB,UAAU;AAAA,IAAA;AAEX,WAAO,KAAK,UAAU,UAAU;AAAA,EACjC,SAAS,GAAG;AACX,UAAM,IAAI,MAAM,gBAAgB,6BAA6B;AAAA,EAC9D;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"serializeNodes.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/serializeNodes.ts"],"sourcesContent":["import { Editor as SlateEditor, Element as SlateElement, Text as SlateText } from 'slate'\nimport { SerializableEditorNode } from '../../types/editor'\n\nexport const serializeNodes = <E extends SlateEditor>(\n\teditor: E,\n\telements: Array<SlateElement | SlateText>,\n\terrorMessage?: string,\n) => {\n\ttry {\n\t\tconst serialized: SerializableEditorNode = {\n\t\t\tformatVersion: editor.formatVersion,\n\t\t\tchildren: elements,\n\t\t}\n\t\treturn JSON.stringify(serialized)\n\t} catch (e) {\n\t\tthrow new Error(errorMessage || `Editor: serialization error`)\n\t}\n}\n"],"names":[],"mappings":"AAGO,MAAM,iBAAiB,CAC7B,QACA,UACA,iBACI;AACJ,MAAI;AACH,UAAM,aAAqC;AAAA,MAC1C,eAAe,OAAO;AAAA,MACtB,UAAU;AAAA,IAAA;AAEX,WAAO,KAAK,UAAU,UAAU;AAAA,EACjC,SAAS,GAAG;AACX,UAAM,IAAI,MAAM,gBAAgB,6BAA6B;AAAA,EAC9D;AACD;"}
1
+ {"version":3,"file":"serializeNodes.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/serializeNodes.ts"],"sourcesContent":["import { Editor as SlateEditor, Element as SlateElement, Text as SlateText } from 'slate'\nimport { SerializableEditorNode } from '../../types/editor.js'\n\nexport const serializeNodes = <E extends SlateEditor>(\n\teditor: E,\n\telements: Array<SlateElement | SlateText>,\n\terrorMessage?: string,\n) => {\n\ttry {\n\t\tconst serialized: SerializableEditorNode = {\n\t\t\tformatVersion: editor.formatVersion,\n\t\t\tchildren: elements,\n\t\t}\n\t\treturn JSON.stringify(serialized)\n\t} catch (e) {\n\t\tthrow new Error(errorMessage || `Editor: serialization error`)\n\t}\n}\n"],"names":[],"mappings":"AAGO,MAAM,iBAAiB,CAC7B,QACA,UACA,iBACI;AACJ,MAAI;AACH,UAAM,aAAqC;AAAA,MAC1C,eAAe,OAAO;AAAA,MACtB,UAAU;AAAA,IAAA;AAEX,WAAO,KAAK,UAAU,UAAU;AAAA,EACjC,SAAS,GAAG;AACX,UAAM,IAAI,MAAM,gBAAgB,6BAA6B;AAAA,EAC9D;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"strictlyDeserializeNodes.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/strictlyDeserializeNodes.ts"],"sourcesContent":["import { toLatestFormat } from './toLatestFormat'\nimport { Editor as SlateEditor, Element as SlateElement, Text as SlateText } from 'slate'\nimport { SerializableEditorNode } from '../../types/editor'\n\nexport const strictlyDeserializeNodes = <E extends SlateEditor>(\n\teditor: E,\n\tserializedElement: string,\n\terrorMessage?: string,\n): Array<SlateElement | SlateText> => {\n\tlet deserialized: SerializableEditorNode\n\ttry {\n\t\t// It is important that only the JSON.parse call is inside the try block.\n\t\t// We don't want to catch other exceptions from here.\n\t\tdeserialized = JSON.parse(serializedElement)\n\t} catch (e) {\n\t\tthrow new Error(errorMessage || `Editor: deserialization error`)\n\t}\n\treturn toLatestFormat(editor, deserialized).children\n}\n"],"names":["toLatestFormat"],"mappings":";;;AAIO,MAAM,2BAA2B,CACvC,QACA,mBACA,iBACqC;AACrC,MAAI;AACJ,MAAI;AAGH,mBAAe,KAAK,MAAM,iBAAiB;AAAA,EAC5C,SAAS,GAAG;AACX,UAAM,IAAI,MAAM,gBAAgB,+BAA+B;AAAA,EAChE;AACA,SAAOA,8BAAe,QAAQ,YAAY,EAAE;AAC7C;;"}
1
+ {"version":3,"file":"strictlyDeserializeNodes.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/strictlyDeserializeNodes.ts"],"sourcesContent":["import { toLatestFormat } from './toLatestFormat.js'\nimport { Editor as SlateEditor, Element as SlateElement, Text as SlateText } from 'slate'\nimport { SerializableEditorNode } from '../../types/editor.js'\n\nexport const strictlyDeserializeNodes = <E extends SlateEditor>(\n\teditor: E,\n\tserializedElement: string,\n\terrorMessage?: string,\n): Array<SlateElement | SlateText> => {\n\tlet deserialized: SerializableEditorNode\n\ttry {\n\t\t// It is important that only the JSON.parse call is inside the try block.\n\t\t// We don't want to catch other exceptions from here.\n\t\tdeserialized = JSON.parse(serializedElement)\n\t} catch (e) {\n\t\tthrow new Error(errorMessage || `Editor: deserialization error`)\n\t}\n\treturn toLatestFormat(editor, deserialized).children\n}\n"],"names":["toLatestFormat"],"mappings":";;;AAIO,MAAM,2BAA2B,CACvC,QACA,mBACA,iBACqC;AACrC,MAAI;AACJ,MAAI;AAGH,mBAAe,KAAK,MAAM,iBAAiB;AAAA,EAC5C,SAAS,GAAG;AACX,UAAM,IAAI,MAAM,gBAAgB,+BAA+B;AAAA,EAChE;AACA,SAAOA,8BAAe,QAAQ,YAAY,EAAE;AAC7C;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"strictlyDeserializeNodes.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/strictlyDeserializeNodes.ts"],"sourcesContent":["import { toLatestFormat } from './toLatestFormat'\nimport { Editor as SlateEditor, Element as SlateElement, Text as SlateText } from 'slate'\nimport { SerializableEditorNode } from '../../types/editor'\n\nexport const strictlyDeserializeNodes = <E extends SlateEditor>(\n\teditor: E,\n\tserializedElement: string,\n\terrorMessage?: string,\n): Array<SlateElement | SlateText> => {\n\tlet deserialized: SerializableEditorNode\n\ttry {\n\t\t// It is important that only the JSON.parse call is inside the try block.\n\t\t// We don't want to catch other exceptions from here.\n\t\tdeserialized = JSON.parse(serializedElement)\n\t} catch (e) {\n\t\tthrow new Error(errorMessage || `Editor: deserialization error`)\n\t}\n\treturn toLatestFormat(editor, deserialized).children\n}\n"],"names":[],"mappings":";AAIO,MAAM,2BAA2B,CACvC,QACA,mBACA,iBACqC;AACrC,MAAI;AACJ,MAAI;AAGH,mBAAe,KAAK,MAAM,iBAAiB;AAAA,EAC5C,SAAS,GAAG;AACX,UAAM,IAAI,MAAM,gBAAgB,+BAA+B;AAAA,EAChE;AACA,SAAO,eAAe,QAAQ,YAAY,EAAE;AAC7C;"}
1
+ {"version":3,"file":"strictlyDeserializeNodes.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/strictlyDeserializeNodes.ts"],"sourcesContent":["import { toLatestFormat } from './toLatestFormat.js'\nimport { Editor as SlateEditor, Element as SlateElement, Text as SlateText } from 'slate'\nimport { SerializableEditorNode } from '../../types/editor.js'\n\nexport const strictlyDeserializeNodes = <E extends SlateEditor>(\n\teditor: E,\n\tserializedElement: string,\n\terrorMessage?: string,\n): Array<SlateElement | SlateText> => {\n\tlet deserialized: SerializableEditorNode\n\ttry {\n\t\t// It is important that only the JSON.parse call is inside the try block.\n\t\t// We don't want to catch other exceptions from here.\n\t\tdeserialized = JSON.parse(serializedElement)\n\t} catch (e) {\n\t\tthrow new Error(errorMessage || `Editor: deserialization error`)\n\t}\n\treturn toLatestFormat(editor, deserialized).children\n}\n"],"names":[],"mappings":";AAIO,MAAM,2BAA2B,CACvC,QACA,mBACA,iBACqC;AACrC,MAAI;AACJ,MAAI;AAGH,mBAAe,KAAK,MAAM,iBAAiB;AAAA,EAC5C,SAAS,GAAG;AACX,UAAM,IAAI,MAAM,gBAAgB,+BAA+B;AAAA,EAChE;AACA,SAAO,eAAe,QAAQ,YAAY,EAAE;AAC7C;"}
@@ -1 +1 @@
1
- {"version":3,"file":"textToSpecifics.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/textToSpecifics.ts"],"sourcesContent":["import { Text as SlateText } from 'slate'\nimport { TextSpecifics } from '../../types/editor'\n\nexport const textToSpecifics = <Text extends SlateText = SlateText>(textNode: Text): TextSpecifics<Text> => {\n\tconst { text, ...specifics } = textNode\n\treturn specifics\n}\n"],"names":[],"mappings":";;AAGO,MAAM,kBAAkB,CAAqC,aAAwC;AAC3G,QAAM,EAAE,MAAM,GAAG,UAAA,IAAc;AAC/B,SAAO;AACR;;"}
1
+ {"version":3,"file":"textToSpecifics.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/textToSpecifics.ts"],"sourcesContent":["import { Text as SlateText } from 'slate'\nimport { TextSpecifics } from '../../types/editor.js'\n\nexport const textToSpecifics = <Text extends SlateText = SlateText>(textNode: Text): TextSpecifics<Text> => {\n\tconst { text, ...specifics } = textNode\n\treturn specifics\n}\n"],"names":[],"mappings":";;AAGO,MAAM,kBAAkB,CAAqC,aAAwC;AAC3G,QAAM,EAAE,MAAM,GAAG,UAAA,IAAc;AAC/B,SAAO;AACR;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"textToSpecifics.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/textToSpecifics.ts"],"sourcesContent":["import { Text as SlateText } from 'slate'\nimport { TextSpecifics } from '../../types/editor'\n\nexport const textToSpecifics = <Text extends SlateText = SlateText>(textNode: Text): TextSpecifics<Text> => {\n\tconst { text, ...specifics } = textNode\n\treturn specifics\n}\n"],"names":[],"mappings":"AAGO,MAAM,kBAAkB,CAAqC,aAAwC;AAC3G,QAAM,EAAE,MAAM,GAAG,UAAA,IAAc;AAC/B,SAAO;AACR;"}
1
+ {"version":3,"file":"textToSpecifics.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/textToSpecifics.ts"],"sourcesContent":["import { Text as SlateText } from 'slate'\nimport { TextSpecifics } from '../../types/editor.js'\n\nexport const textToSpecifics = <Text extends SlateText = SlateText>(textNode: Text): TextSpecifics<Text> => {\n\tconst { text, ...specifics } = textNode\n\treturn specifics\n}\n"],"names":[],"mappings":"AAGO,MAAM,kBAAkB,CAAqC,aAAwC;AAC3G,QAAM,EAAE,MAAM,GAAG,UAAA,IAAc;AAC/B,SAAO;AACR;"}
@@ -1 +1 @@
1
- {"version":3,"file":"toLatestFormat.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/toLatestFormat.ts"],"sourcesContent":["import { BindingError } from '@contember/react-binding'\nimport { Editor as SlateEditor, Element as SlateElement } from 'slate'\nimport { SerializableEditorNode } from '../../types/editor'\n\nexport const toLatestFormat = <E extends SlateEditor>(\n\teditor: E,\n\tpotentiallyOldNode: SerializableEditorNode,\n): SerializableEditorNode => {\n\tif (potentiallyOldNode.formatVersion === editor.formatVersion) {\n\t\treturn potentiallyOldNode\n\t}\n\tif (potentiallyOldNode.formatVersion > editor.formatVersion) {\n\t\t// Boy oh boy, do we have a situation…\n\t\treturn potentiallyOldNode // Just hope it's at least somewhat backwards compatible.\n\t}\n\tlet formatNumber = potentiallyOldNode.formatVersion\n\ttry {\n\t\tfor (; formatNumber < editor.formatVersion; formatNumber++) {\n\t\t\tpotentiallyOldNode = {\n\t\t\t\tformatVersion: formatNumber + 1,\n\t\t\t\tchildren: potentiallyOldNode.children.map(oldChild => editor.upgradeFormatBySingleVersion(oldChild, formatNumber)) as SlateElement[],\n\t\t\t}\n\t\t}\n\t\treturn potentiallyOldNode\n\t} catch (e) {\n\t\tconst genericMessage = `Failed to upgrade editor format from version ${formatNumber}.`\n\t\tif (e instanceof RangeError) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`${genericMessage}\\nDetected a stack overflow. `\n\t\t\t\t\t+ `Perhaps you incorrectly implemented 'upgradeFormatBySingleVersion'?`,\n\t\t\t)\n\t\t}\n\t\tthrow new BindingError(genericMessage)\n\t}\n}\n"],"names":["BindingError"],"mappings":";;;AAIO,MAAM,iBAAiB,CAC7B,QACA,uBAC4B;AAC5B,MAAI,mBAAmB,kBAAkB,OAAO,eAAe;AAC9D,WAAO;AAAA,EACR;AACA,MAAI,mBAAmB,gBAAgB,OAAO,eAAe;AAE5D,WAAO;AAAA,EACR;AACA,MAAI,eAAe,mBAAmB;AACtC,MAAI;AACH,WAAO,eAAe,OAAO,eAAe,gBAAgB;AAC3D,2BAAqB;AAAA,QACpB,eAAe,eAAe;AAAA,QAC9B,UAAU,mBAAmB,SAAS,IAAI,cAAY,OAAO,6BAA6B,UAAU,YAAY,CAAC;AAAA,MAAA;AAAA,IAEnH;AACA,WAAO;AAAA,EACR,SAAS,GAAG;AACX,UAAM,iBAAiB,gDAAgD,YAAY;AACnF,QAAI,aAAa,YAAY;AAC5B,YAAM,IAAIA,aAAAA;AAAAA,QACT,GAAG,cAAc;AAAA;AAAA,MAAA;AAAA,IAGnB;AACA,UAAM,IAAIA,aAAAA,aAAa,cAAc;AAAA,EACtC;AACD;;"}
1
+ {"version":3,"file":"toLatestFormat.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/toLatestFormat.ts"],"sourcesContent":["import { BindingError } from '@contember/react-binding'\nimport { Editor as SlateEditor, Element as SlateElement } from 'slate'\nimport { SerializableEditorNode } from '../../types/editor.js'\n\nexport const toLatestFormat = <E extends SlateEditor>(\n\teditor: E,\n\tpotentiallyOldNode: SerializableEditorNode,\n): SerializableEditorNode => {\n\tif (potentiallyOldNode.formatVersion === editor.formatVersion) {\n\t\treturn potentiallyOldNode\n\t}\n\tif (potentiallyOldNode.formatVersion > editor.formatVersion) {\n\t\t// Boy oh boy, do we have a situation…\n\t\treturn potentiallyOldNode // Just hope it's at least somewhat backwards compatible.\n\t}\n\tlet formatNumber = potentiallyOldNode.formatVersion\n\ttry {\n\t\tfor (; formatNumber < editor.formatVersion; formatNumber++) {\n\t\t\tpotentiallyOldNode = {\n\t\t\t\tformatVersion: formatNumber + 1,\n\t\t\t\tchildren: potentiallyOldNode.children.map(oldChild => editor.upgradeFormatBySingleVersion(oldChild, formatNumber)) as SlateElement[],\n\t\t\t}\n\t\t}\n\t\treturn potentiallyOldNode\n\t} catch (e) {\n\t\tconst genericMessage = `Failed to upgrade editor format from version ${formatNumber}.`\n\t\tif (e instanceof RangeError) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`${genericMessage}\\nDetected a stack overflow. `\n\t\t\t\t\t+ `Perhaps you incorrectly implemented 'upgradeFormatBySingleVersion'?`,\n\t\t\t)\n\t\t}\n\t\tthrow new BindingError(genericMessage)\n\t}\n}\n"],"names":["BindingError"],"mappings":";;;AAIO,MAAM,iBAAiB,CAC7B,QACA,uBAC4B;AAC5B,MAAI,mBAAmB,kBAAkB,OAAO,eAAe;AAC9D,WAAO;AAAA,EACR;AACA,MAAI,mBAAmB,gBAAgB,OAAO,eAAe;AAE5D,WAAO;AAAA,EACR;AACA,MAAI,eAAe,mBAAmB;AACtC,MAAI;AACH,WAAO,eAAe,OAAO,eAAe,gBAAgB;AAC3D,2BAAqB;AAAA,QACpB,eAAe,eAAe;AAAA,QAC9B,UAAU,mBAAmB,SAAS,IAAI,cAAY,OAAO,6BAA6B,UAAU,YAAY,CAAC;AAAA,MAAA;AAAA,IAEnH;AACA,WAAO;AAAA,EACR,SAAS,GAAG;AACX,UAAM,iBAAiB,gDAAgD,YAAY;AACnF,QAAI,aAAa,YAAY;AAC5B,YAAM,IAAIA,aAAAA;AAAAA,QACT,GAAG,cAAc;AAAA;AAAA,MAAA;AAAA,IAGnB;AACA,UAAM,IAAIA,aAAAA,aAAa,cAAc;AAAA,EACtC;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"toLatestFormat.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/toLatestFormat.ts"],"sourcesContent":["import { BindingError } from '@contember/react-binding'\nimport { Editor as SlateEditor, Element as SlateElement } from 'slate'\nimport { SerializableEditorNode } from '../../types/editor'\n\nexport const toLatestFormat = <E extends SlateEditor>(\n\teditor: E,\n\tpotentiallyOldNode: SerializableEditorNode,\n): SerializableEditorNode => {\n\tif (potentiallyOldNode.formatVersion === editor.formatVersion) {\n\t\treturn potentiallyOldNode\n\t}\n\tif (potentiallyOldNode.formatVersion > editor.formatVersion) {\n\t\t// Boy oh boy, do we have a situation…\n\t\treturn potentiallyOldNode // Just hope it's at least somewhat backwards compatible.\n\t}\n\tlet formatNumber = potentiallyOldNode.formatVersion\n\ttry {\n\t\tfor (; formatNumber < editor.formatVersion; formatNumber++) {\n\t\t\tpotentiallyOldNode = {\n\t\t\t\tformatVersion: formatNumber + 1,\n\t\t\t\tchildren: potentiallyOldNode.children.map(oldChild => editor.upgradeFormatBySingleVersion(oldChild, formatNumber)) as SlateElement[],\n\t\t\t}\n\t\t}\n\t\treturn potentiallyOldNode\n\t} catch (e) {\n\t\tconst genericMessage = `Failed to upgrade editor format from version ${formatNumber}.`\n\t\tif (e instanceof RangeError) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`${genericMessage}\\nDetected a stack overflow. `\n\t\t\t\t\t+ `Perhaps you incorrectly implemented 'upgradeFormatBySingleVersion'?`,\n\t\t\t)\n\t\t}\n\t\tthrow new BindingError(genericMessage)\n\t}\n}\n"],"names":[],"mappings":";AAIO,MAAM,iBAAiB,CAC7B,QACA,uBAC4B;AAC5B,MAAI,mBAAmB,kBAAkB,OAAO,eAAe;AAC9D,WAAO;AAAA,EACR;AACA,MAAI,mBAAmB,gBAAgB,OAAO,eAAe;AAE5D,WAAO;AAAA,EACR;AACA,MAAI,eAAe,mBAAmB;AACtC,MAAI;AACH,WAAO,eAAe,OAAO,eAAe,gBAAgB;AAC3D,2BAAqB;AAAA,QACpB,eAAe,eAAe;AAAA,QAC9B,UAAU,mBAAmB,SAAS,IAAI,cAAY,OAAO,6BAA6B,UAAU,YAAY,CAAC;AAAA,MAAA;AAAA,IAEnH;AACA,WAAO;AAAA,EACR,SAAS,GAAG;AACX,UAAM,iBAAiB,gDAAgD,YAAY;AACnF,QAAI,aAAa,YAAY;AAC5B,YAAM,IAAI;AAAA,QACT,GAAG,cAAc;AAAA;AAAA,MAAA;AAAA,IAGnB;AACA,UAAM,IAAI,aAAa,cAAc;AAAA,EACtC;AACD;"}
1
+ {"version":3,"file":"toLatestFormat.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/toLatestFormat.ts"],"sourcesContent":["import { BindingError } from '@contember/react-binding'\nimport { Editor as SlateEditor, Element as SlateElement } from 'slate'\nimport { SerializableEditorNode } from '../../types/editor.js'\n\nexport const toLatestFormat = <E extends SlateEditor>(\n\teditor: E,\n\tpotentiallyOldNode: SerializableEditorNode,\n): SerializableEditorNode => {\n\tif (potentiallyOldNode.formatVersion === editor.formatVersion) {\n\t\treturn potentiallyOldNode\n\t}\n\tif (potentiallyOldNode.formatVersion > editor.formatVersion) {\n\t\t// Boy oh boy, do we have a situation…\n\t\treturn potentiallyOldNode // Just hope it's at least somewhat backwards compatible.\n\t}\n\tlet formatNumber = potentiallyOldNode.formatVersion\n\ttry {\n\t\tfor (; formatNumber < editor.formatVersion; formatNumber++) {\n\t\t\tpotentiallyOldNode = {\n\t\t\t\tformatVersion: formatNumber + 1,\n\t\t\t\tchildren: potentiallyOldNode.children.map(oldChild => editor.upgradeFormatBySingleVersion(oldChild, formatNumber)) as SlateElement[],\n\t\t\t}\n\t\t}\n\t\treturn potentiallyOldNode\n\t} catch (e) {\n\t\tconst genericMessage = `Failed to upgrade editor format from version ${formatNumber}.`\n\t\tif (e instanceof RangeError) {\n\t\t\tthrow new BindingError(\n\t\t\t\t`${genericMessage}\\nDetected a stack overflow. `\n\t\t\t\t\t+ `Perhaps you incorrectly implemented 'upgradeFormatBySingleVersion'?`,\n\t\t\t)\n\t\t}\n\t\tthrow new BindingError(genericMessage)\n\t}\n}\n"],"names":[],"mappings":";AAIO,MAAM,iBAAiB,CAC7B,QACA,uBAC4B;AAC5B,MAAI,mBAAmB,kBAAkB,OAAO,eAAe;AAC9D,WAAO;AAAA,EACR;AACA,MAAI,mBAAmB,gBAAgB,OAAO,eAAe;AAE5D,WAAO;AAAA,EACR;AACA,MAAI,eAAe,mBAAmB;AACtC,MAAI;AACH,WAAO,eAAe,OAAO,eAAe,gBAAgB;AAC3D,2BAAqB;AAAA,QACpB,eAAe,eAAe;AAAA,QAC9B,UAAU,mBAAmB,SAAS,IAAI,cAAY,OAAO,6BAA6B,UAAU,YAAY,CAAC;AAAA,MAAA;AAAA,IAEnH;AACA,WAAO;AAAA,EACR,SAAS,GAAG;AACX,UAAM,iBAAiB,gDAAgD,YAAY;AACnF,QAAI,aAAa,YAAY;AAC5B,YAAM,IAAI;AAAA,QACT,GAAG,cAAc;AAAA;AAAA,MAAA;AAAA,IAGnB;AACA,UAAM,IAAI,aAAa,cAAc;AAAA,EACtC;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EditorPasteUtils.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/internal/utils/EditorPasteUtils.ts"],"sourcesContent":["import { Element } from 'slate'\nimport { NodesWithType } from '../../plugins/behaviour/paste/HtmlDeserializer'\nimport { EditorDefaultElementFactory } from '../../types/editor'\n\nexport class EditorPasteUtils {\n\tpublic static wordPasteListItemContent(allNodes: Iterable<Node> | ArrayLike<Node>): Node[] {\n\t\tconst nodes: Node[] = []\n\t\tlet ignoring = false\n\t\tlet forProcessing = Array.from(allNodes)\n\t\tif (\n\t\t\t(forProcessing.length === 1 && forProcessing[0].nodeName === 'SPAN')\n\t\t\t|| (forProcessing.length === 2 && forProcessing[0].nodeName === 'SPAN' && forProcessing[1].nodeName === 'O:P')\n\t\t) {\n\t\t\tforProcessing = Array.from(forProcessing[0].childNodes)\n\t\t}\n\n\t\tfor (const node of forProcessing) {\n\t\t\tconst isStartIgnore = node.nodeType === Node.COMMENT_NODE && node.nodeValue === '[if !supportLists]'\n\t\t\tif (isStartIgnore) {\n\t\t\t\tignoring = true\n\t\t\t} else {\n\t\t\t\tconst isEndIgnore = node.nodeType === Node.COMMENT_NODE && node.nodeValue === '[endif]'\n\t\t\t\tif (isEndIgnore) {\n\t\t\t\t\tignoring = false\n\t\t\t\t} else {\n\t\t\t\t\tif (!ignoring) {\n\t\t\t\t\t\tnodes.push(node)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nodes\n\t}\n\n\tpublic static flattenNodesWithType(withType: NodesWithType[], defaultElementFactory: EditorDefaultElementFactory): NodesWithType {\n\t\tconst withTypeFiltered = withType.filter((item): item is Exclude<NodesWithType, null> => item !== null)\n\t\tconst containsBlock = withTypeFiltered.find(({ elements }) => elements !== undefined) !== undefined\n\n\t\tif (containsBlock) {\n\t\t\treturn {\n\t\t\t\telements: withTypeFiltered.flatMap<Element>(item => {\n\t\t\t\t\tif (item.elements === undefined) {\n\t\t\t\t\t\treturn [defaultElementFactory(item.texts)]\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn item.elements\n\t\t\t\t\t}\n\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,EAAE,OAAO,iBAAiB,QAAQ,CAAA,SAAQ,KAAK,KAAM,EAAA;AAAA,IAC7D;AAAA,EACD;AACD;;"}
1
+ {"version":3,"file":"EditorPasteUtils.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/internal/utils/EditorPasteUtils.ts"],"sourcesContent":["import { Element } from 'slate'\nimport { NodesWithType } from '../../plugins/behaviour/paste/HtmlDeserializer.js'\nimport { EditorDefaultElementFactory } from '../../types/editor.js'\n\nexport class EditorPasteUtils {\n\tpublic static wordPasteListItemContent(allNodes: Iterable<Node> | ArrayLike<Node>): Node[] {\n\t\tconst nodes: Node[] = []\n\t\tlet ignoring = false\n\t\tlet forProcessing = Array.from(allNodes)\n\t\tif (\n\t\t\t(forProcessing.length === 1 && forProcessing[0].nodeName === 'SPAN')\n\t\t\t|| (forProcessing.length === 2 && forProcessing[0].nodeName === 'SPAN' && forProcessing[1].nodeName === 'O:P')\n\t\t) {\n\t\t\tforProcessing = Array.from(forProcessing[0].childNodes)\n\t\t}\n\n\t\tfor (const node of forProcessing) {\n\t\t\tconst isStartIgnore = node.nodeType === Node.COMMENT_NODE && node.nodeValue === '[if !supportLists]'\n\t\t\tif (isStartIgnore) {\n\t\t\t\tignoring = true\n\t\t\t} else {\n\t\t\t\tconst isEndIgnore = node.nodeType === Node.COMMENT_NODE && node.nodeValue === '[endif]'\n\t\t\t\tif (isEndIgnore) {\n\t\t\t\t\tignoring = false\n\t\t\t\t} else {\n\t\t\t\t\tif (!ignoring) {\n\t\t\t\t\t\tnodes.push(node)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nodes\n\t}\n\n\tpublic static flattenNodesWithType(withType: NodesWithType[], defaultElementFactory: EditorDefaultElementFactory): NodesWithType {\n\t\tconst withTypeFiltered = withType.filter((item): item is Exclude<NodesWithType, null> => item !== null)\n\t\tconst containsBlock = withTypeFiltered.find(({ elements }) => elements !== undefined) !== undefined\n\n\t\tif (containsBlock) {\n\t\t\treturn {\n\t\t\t\telements: withTypeFiltered.flatMap<Element>(item => {\n\t\t\t\t\tif (item.elements === undefined) {\n\t\t\t\t\t\treturn [defaultElementFactory(item.texts)]\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn item.elements\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t}\n\t\t} else {\n\t\t\treturn { texts: withTypeFiltered.flatMap(item => item.texts!) }\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;AAIO,MAAM,iBAAiB;AAAA,EAC7B,OAAc,yBAAyB,UAAoD;AAC1F,UAAM,QAAgB,CAAA;AACtB,QAAI,WAAW;AACf,QAAI,gBAAgB,MAAM,KAAK,QAAQ;AACvC,QACE,cAAc,WAAW,KAAK,cAAc,CAAC,EAAE,aAAa,UACzD,cAAc,WAAW,KAAK,cAAc,CAAC,EAAE,aAAa,UAAU,cAAc,CAAC,EAAE,aAAa,OACvG;AACD,sBAAgB,MAAM,KAAK,cAAc,CAAC,EAAE,UAAU;AAAA,IACvD;AAEA,eAAW,QAAQ,eAAe;AACjC,YAAM,gBAAgB,KAAK,aAAa,KAAK,gBAAgB,KAAK,cAAc;AAChF,UAAI,eAAe;AAClB,mBAAW;AAAA,MACZ,OAAO;AACN,cAAM,cAAc,KAAK,aAAa,KAAK,gBAAgB,KAAK,cAAc;AAC9E,YAAI,aAAa;AAChB,qBAAW;AAAA,QACZ,OAAO;AACN,cAAI,CAAC,UAAU;AACd,kBAAM,KAAK,IAAI;AAAA,UAChB;AAAA,QACD;AAAA,MACD;AAAA,IACD;AACA,WAAO;AAAA,EACR;AAAA,EAEA,OAAc,qBAAqB,UAA2B,uBAAmE;AAChI,UAAM,mBAAmB,SAAS,OAAO,CAAC,SAA+C,SAAS,IAAI;AACtG,UAAM,gBAAgB,iBAAiB,KAAK,CAAC,EAAE,eAAe,aAAa,MAAS,MAAM;AAE1F,QAAI,eAAe;AAClB,aAAO;AAAA,QACN,UAAU,iBAAiB,QAAiB,CAAA,SAAQ;AACnD,cAAI,KAAK,aAAa,QAAW;AAChC,mBAAO,CAAC,sBAAsB,KAAK,KAAK,CAAC;AAAA,UAC1C,OAAO;AACN,mBAAO,KAAK;AAAA,UACb;AAAA,QACD,CAAC;AAAA,MAAA;AAAA,IAEH,OAAO;AACN,aAAO,EAAE,OAAO,iBAAiB,QAAQ,CAAA,SAAQ,KAAK,KAAM,EAAA;AAAA,IAC7D;AAAA,EACD;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EditorPasteUtils.js","sources":["../../../../../../packages/react-slate-editor-base/src/internal/utils/EditorPasteUtils.ts"],"sourcesContent":["import { Element } from 'slate'\nimport { NodesWithType } from '../../plugins/behaviour/paste/HtmlDeserializer'\nimport { EditorDefaultElementFactory } from '../../types/editor'\n\nexport class EditorPasteUtils {\n\tpublic static wordPasteListItemContent(allNodes: Iterable<Node> | ArrayLike<Node>): Node[] {\n\t\tconst nodes: Node[] = []\n\t\tlet ignoring = false\n\t\tlet forProcessing = Array.from(allNodes)\n\t\tif (\n\t\t\t(forProcessing.length === 1 && forProcessing[0].nodeName === 'SPAN')\n\t\t\t|| (forProcessing.length === 2 && forProcessing[0].nodeName === 'SPAN' && forProcessing[1].nodeName === 'O:P')\n\t\t) {\n\t\t\tforProcessing = Array.from(forProcessing[0].childNodes)\n\t\t}\n\n\t\tfor (const node of forProcessing) {\n\t\t\tconst isStartIgnore = node.nodeType === Node.COMMENT_NODE && node.nodeValue === '[if !supportLists]'\n\t\t\tif (isStartIgnore) {\n\t\t\t\tignoring = true\n\t\t\t} else {\n\t\t\t\tconst isEndIgnore = node.nodeType === Node.COMMENT_NODE && node.nodeValue === '[endif]'\n\t\t\t\tif (isEndIgnore) {\n\t\t\t\t\tignoring = false\n\t\t\t\t} else {\n\t\t\t\t\tif (!ignoring) {\n\t\t\t\t\t\tnodes.push(node)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nodes\n\t}\n\n\tpublic static flattenNodesWithType(withType: NodesWithType[], defaultElementFactory: EditorDefaultElementFactory): NodesWithType {\n\t\tconst withTypeFiltered = withType.filter((item): item is Exclude<NodesWithType, null> => item !== null)\n\t\tconst containsBlock = withTypeFiltered.find(({ elements }) => elements !== undefined) !== undefined\n\n\t\tif (containsBlock) {\n\t\t\treturn {\n\t\t\t\telements: withTypeFiltered.flatMap<Element>(item => {\n\t\t\t\t\tif (item.elements === undefined) {\n\t\t\t\t\t\treturn [defaultElementFactory(item.texts)]\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn item.elements\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t}\n\t\t} else {\n\t\t\treturn { texts: withTypeFiltered.flatMap(item => item.texts!) }\n\t\t}\n\t}\n}\n"],"names":[],"mappings":"AAIO,MAAM,iBAAiB;AAAA,EAC7B,OAAc,yBAAyB,UAAoD;AAC1F,UAAM,QAAgB,CAAA;AACtB,QAAI,WAAW;AACf,QAAI,gBAAgB,MAAM,KAAK,QAAQ;AACvC,QACE,cAAc,WAAW,KAAK,cAAc,CAAC,EAAE,aAAa,UACzD,cAAc,WAAW,KAAK,cAAc,CAAC,EAAE,aAAa,UAAU,cAAc,CAAC,EAAE,aAAa,OACvG;AACD,sBAAgB,MAAM,KAAK,cAAc,CAAC,EAAE,UAAU;AAAA,IACvD;AAEA,eAAW,QAAQ,eAAe;AACjC,YAAM,gBAAgB,KAAK,aAAa,KAAK,gBAAgB,KAAK,cAAc;AAChF,UAAI,eAAe;AAClB,mBAAW;AAAA,MACZ,OAAO;AACN,cAAM,cAAc,KAAK,aAAa,KAAK,gBAAgB,KAAK,cAAc;AAC9E,YAAI,aAAa;AAChB,qBAAW;AAAA,QACZ,OAAO;AACN,cAAI,CAAC,UAAU;AACd,kBAAM,KAAK,IAAI;AAAA,UAChB;AAAA,QACD;AAAA,MACD;AAAA,IACD;AACA,WAAO;AAAA,EACR;AAAA,EAEA,OAAc,qBAAqB,UAA2B,uBAAmE;AAChI,UAAM,mBAAmB,SAAS,OAAO,CAAC,SAA+C,SAAS,IAAI;AACtG,UAAM,gBAAgB,iBAAiB,KAAK,CAAC,EAAE,eAAe,aAAa,MAAS,MAAM;AAE1F,QAAI,eAAe;AAClB,aAAO;AAAA,QACN,UAAU,iBAAiB,QAAiB,CAAA,SAAQ;AACnD,cAAI,KAAK,aAAa,QAAW;AAChC,mBAAO,CAAC,sBAAsB,KAAK,KAAK,CAAC;AAAA,UAC1C,OAAO;AACN,mBAAO,KAAK;AAAA,UACb;AAAA,QACD,CAAC;AAAA,MAAA;AAAA,IAEH,OAAO;AACN,aAAO,EAAE,OAAO,iBAAiB,QAAQ,CAAA,SAAQ,KAAK,KAAM,EAAA;AAAA,IAC7D;AAAA,EACD;AACD;"}
1
+ {"version":3,"file":"EditorPasteUtils.js","sources":["../../../../../../packages/react-slate-editor-base/src/internal/utils/EditorPasteUtils.ts"],"sourcesContent":["import { Element } from 'slate'\nimport { NodesWithType } from '../../plugins/behaviour/paste/HtmlDeserializer.js'\nimport { EditorDefaultElementFactory } from '../../types/editor.js'\n\nexport class EditorPasteUtils {\n\tpublic static wordPasteListItemContent(allNodes: Iterable<Node> | ArrayLike<Node>): Node[] {\n\t\tconst nodes: Node[] = []\n\t\tlet ignoring = false\n\t\tlet forProcessing = Array.from(allNodes)\n\t\tif (\n\t\t\t(forProcessing.length === 1 && forProcessing[0].nodeName === 'SPAN')\n\t\t\t|| (forProcessing.length === 2 && forProcessing[0].nodeName === 'SPAN' && forProcessing[1].nodeName === 'O:P')\n\t\t) {\n\t\t\tforProcessing = Array.from(forProcessing[0].childNodes)\n\t\t}\n\n\t\tfor (const node of forProcessing) {\n\t\t\tconst isStartIgnore = node.nodeType === Node.COMMENT_NODE && node.nodeValue === '[if !supportLists]'\n\t\t\tif (isStartIgnore) {\n\t\t\t\tignoring = true\n\t\t\t} else {\n\t\t\t\tconst isEndIgnore = node.nodeType === Node.COMMENT_NODE && node.nodeValue === '[endif]'\n\t\t\t\tif (isEndIgnore) {\n\t\t\t\t\tignoring = false\n\t\t\t\t} else {\n\t\t\t\t\tif (!ignoring) {\n\t\t\t\t\t\tnodes.push(node)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nodes\n\t}\n\n\tpublic static flattenNodesWithType(withType: NodesWithType[], defaultElementFactory: EditorDefaultElementFactory): NodesWithType {\n\t\tconst withTypeFiltered = withType.filter((item): item is Exclude<NodesWithType, null> => item !== null)\n\t\tconst containsBlock = withTypeFiltered.find(({ elements }) => elements !== undefined) !== undefined\n\n\t\tif (containsBlock) {\n\t\t\treturn {\n\t\t\t\telements: withTypeFiltered.flatMap<Element>(item => {\n\t\t\t\t\tif (item.elements === undefined) {\n\t\t\t\t\t\treturn [defaultElementFactory(item.texts)]\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn item.elements\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t}\n\t\t} else {\n\t\t\treturn { texts: withTypeFiltered.flatMap(item => item.texts!) }\n\t\t}\n\t}\n}\n"],"names":[],"mappings":"AAIO,MAAM,iBAAiB;AAAA,EAC7B,OAAc,yBAAyB,UAAoD;AAC1F,UAAM,QAAgB,CAAA;AACtB,QAAI,WAAW;AACf,QAAI,gBAAgB,MAAM,KAAK,QAAQ;AACvC,QACE,cAAc,WAAW,KAAK,cAAc,CAAC,EAAE,aAAa,UACzD,cAAc,WAAW,KAAK,cAAc,CAAC,EAAE,aAAa,UAAU,cAAc,CAAC,EAAE,aAAa,OACvG;AACD,sBAAgB,MAAM,KAAK,cAAc,CAAC,EAAE,UAAU;AAAA,IACvD;AAEA,eAAW,QAAQ,eAAe;AACjC,YAAM,gBAAgB,KAAK,aAAa,KAAK,gBAAgB,KAAK,cAAc;AAChF,UAAI,eAAe;AAClB,mBAAW;AAAA,MACZ,OAAO;AACN,cAAM,cAAc,KAAK,aAAa,KAAK,gBAAgB,KAAK,cAAc;AAC9E,YAAI,aAAa;AAChB,qBAAW;AAAA,QACZ,OAAO;AACN,cAAI,CAAC,UAAU;AAC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