@contember/react-slate-editor-base 2.0.0-alpha.31 → 2.0.0-alpha.35

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 (268) 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/EditorElementTrigger.cjs.map +1 -1
  4. package/dist/development/src/components/triggers/EditorElementTrigger.js.map +1 -1
  5. package/dist/development/src/components/triggers/EditorGenericTrigger.cjs.map +1 -1
  6. package/dist/development/src/components/triggers/EditorGenericTrigger.js.map +1 -1
  7. package/dist/development/src/components/triggers/EditorMarkTrigger.cjs.map +1 -1
  8. package/dist/development/src/components/triggers/EditorMarkTrigger.js.map +1 -1
  9. package/dist/development/src/components/triggers/EditorWrapNodeTrigger.cjs.map +1 -1
  10. package/dist/development/src/components/triggers/EditorWrapNodeTrigger.js.map +1 -1
  11. package/dist/development/src/editor/createEditor.cjs.map +1 -1
  12. package/dist/development/src/editor/createEditor.js.map +1 -1
  13. package/dist/development/src/editor/createEditorWithEssentials.cjs.map +1 -1
  14. package/dist/development/src/editor/createEditorWithEssentials.js.map +1 -1
  15. package/dist/development/src/editor/index.cjs.map +1 -1
  16. package/dist/development/src/editor/methods/addMarks.cjs.map +1 -1
  17. package/dist/development/src/editor/methods/addMarks.js.map +1 -1
  18. package/dist/development/src/editor/methods/canToggleMark.cjs.map +1 -1
  19. package/dist/development/src/editor/methods/canToggleMark.js.map +1 -1
  20. package/dist/development/src/editor/methods/closest.cjs.map +1 -1
  21. package/dist/development/src/editor/methods/closest.js.map +1 -1
  22. package/dist/development/src/editor/methods/closestBlockEntry.cjs.map +1 -1
  23. package/dist/development/src/editor/methods/ejectElement.cjs.map +1 -1
  24. package/dist/development/src/editor/methods/ejectElement.js.map +1 -1
  25. package/dist/development/src/editor/methods/getElementDataAttributes.cjs.map +1 -1
  26. package/dist/development/src/editor/methods/getElementDataAttributes.js.map +1 -1
  27. package/dist/development/src/editor/methods/getPreviousSibling.cjs.map +1 -1
  28. package/dist/development/src/editor/methods/getPreviousSibling.js.map +1 -1
  29. package/dist/development/src/editor/methods/hasMarks.cjs.map +1 -1
  30. package/dist/development/src/editor/methods/hasMarks.js.map +1 -1
  31. package/dist/development/src/editor/methods/hasParentOfType.cjs.map +1 -1
  32. package/dist/development/src/editor/methods/hasParentOfType.js.map +1 -1
  33. package/dist/development/src/editor/methods/isElementType.cjs.map +1 -1
  34. package/dist/development/src/editor/methods/isElementType.js.map +1 -1
  35. package/dist/development/src/editor/methods/permissivelyDeserializeNodes.cjs.map +1 -1
  36. package/dist/development/src/editor/methods/permissivelyDeserializeNodes.js.map +1 -1
  37. package/dist/development/src/editor/methods/removeMarks.cjs.map +1 -1
  38. package/dist/development/src/editor/methods/removeMarks.js.map +1 -1
  39. package/dist/development/src/editor/methods/serializeNodes.cjs.map +1 -1
  40. package/dist/development/src/editor/methods/serializeNodes.js.map +1 -1
  41. package/dist/development/src/editor/methods/strictlyDeserializeNodes.cjs.map +1 -1
  42. package/dist/development/src/editor/methods/strictlyDeserializeNodes.js.map +1 -1
  43. package/dist/development/src/editor/methods/toLatestFormat.cjs.map +1 -1
  44. package/dist/development/src/editor/methods/toLatestFormat.js.map +1 -1
  45. package/dist/development/src/internal/components/DefaultElement.cjs.map +1 -1
  46. package/dist/development/src/internal/components/DefaultElement.js.map +1 -1
  47. package/dist/development/src/internal/hooks/useRichTextFieldNodes.cjs.map +1 -1
  48. package/dist/development/src/internal/hooks/useRichTextFieldNodes.js.map +1 -1
  49. package/dist/development/src/internal/utils/EditorPasteUtils.cjs.map +1 -1
  50. package/dist/development/src/internal/utils/EditorPasteUtils.js.map +1 -1
  51. package/dist/development/src/internal/utils/parseUrl.cjs.map +1 -1
  52. package/dist/development/src/internal/utils/parseUrl.js.map +1 -1
  53. package/dist/development/src/plugins/attributes/alignment/alignButton.cjs.map +1 -1
  54. package/dist/development/src/plugins/attributes/alignment/alignButton.js.map +1 -1
  55. package/dist/development/src/plugins/behaviour/paste/HtmlDeserializer.cjs.map +1 -1
  56. package/dist/development/src/plugins/behaviour/paste/HtmlDeserializer.js.map +1 -1
  57. package/dist/development/src/plugins/behaviour/paste/createMarkHtmlDeserializer.cjs.map +1 -1
  58. package/dist/development/src/plugins/behaviour/paste/createMarkHtmlDeserializer.js.map +1 -1
  59. package/dist/development/src/plugins/behaviour/paste/withPaste.cjs.map +1 -1
  60. package/dist/development/src/plugins/behaviour/paste/withPaste.js.map +1 -1
  61. package/dist/development/src/plugins/element/anchors/AnchorElement.cjs.map +1 -1
  62. package/dist/development/src/plugins/element/anchors/AnchorElement.js.map +1 -1
  63. package/dist/development/src/plugins/element/anchors/AnchorHtmlDeserializer.cjs.map +1 -1
  64. package/dist/development/src/plugins/element/anchors/AnchorHtmlDeserializer.js.map +1 -1
  65. package/dist/development/src/plugins/element/anchors/AnchorModifications.cjs.map +1 -1
  66. package/dist/development/src/plugins/element/anchors/AnchorModifications.js.map +1 -1
  67. package/dist/development/src/plugins/element/anchors/withAnchors.cjs.map +1 -1
  68. package/dist/development/src/plugins/element/anchors/withAnchors.js.map +1 -1
  69. package/dist/development/src/plugins/element/headings/HeadingElement.cjs.map +1 -1
  70. package/dist/development/src/plugins/element/headings/HeadingElement.js.map +1 -1
  71. package/dist/development/src/plugins/element/headings/HeadingHtmlDeserializer.cjs.map +1 -1
  72. package/dist/development/src/plugins/element/headings/HeadingHtmlDeserializer.js.map +1 -1
  73. package/dist/development/src/plugins/element/headings/withHeadings.cjs.map +1 -1
  74. package/dist/development/src/plugins/element/headings/withHeadings.js.map +1 -1
  75. package/dist/development/src/plugins/element/horizonalRules/HorizontalRuleElement.cjs.map +1 -1
  76. package/dist/development/src/plugins/element/horizonalRules/HorizontalRuleElement.js.map +1 -1
  77. package/dist/development/src/plugins/element/horizonalRules/withHorizontalRules.cjs.map +1 -1
  78. package/dist/development/src/plugins/element/horizonalRules/withHorizontalRules.js.map +1 -1
  79. package/dist/development/src/plugins/element/lists/ListElement.cjs.map +1 -1
  80. package/dist/development/src/plugins/element/lists/ListElement.js.map +1 -1
  81. package/dist/development/src/plugins/element/lists/ListHtmlDeserializer.cjs.map +1 -1
  82. package/dist/development/src/plugins/element/lists/ListHtmlDeserializer.js.map +1 -1
  83. package/dist/development/src/plugins/element/lists/ListItemElement.cjs.map +1 -1
  84. package/dist/development/src/plugins/element/lists/ListItemElement.js.map +1 -1
  85. package/dist/development/src/plugins/element/lists/OrderedListElement.cjs.map +1 -1
  86. package/dist/development/src/plugins/element/lists/UnorderedListElement.cjs.map +1 -1
  87. package/dist/development/src/plugins/element/lists/transforms/dedentListItem.cjs.map +1 -1
  88. package/dist/development/src/plugins/element/lists/transforms/dedentListItem.js.map +1 -1
  89. package/dist/development/src/plugins/element/lists/transforms/indentListItem.cjs.map +1 -1
  90. package/dist/development/src/plugins/element/lists/transforms/indentListItem.js.map +1 -1
  91. package/dist/development/src/plugins/element/lists/transforms/normalizeListElement.cjs.map +1 -1
  92. package/dist/development/src/plugins/element/lists/transforms/normalizeListElement.js.map +1 -1
  93. package/dist/development/src/plugins/element/lists/transforms/toggleListElement.cjs.map +1 -1
  94. package/dist/development/src/plugins/element/lists/transforms/toggleListElement.js.map +1 -1
  95. package/dist/development/src/plugins/element/lists/withLists.cjs.map +1 -1
  96. package/dist/development/src/plugins/element/lists/withLists.js.map +1 -1
  97. package/dist/development/src/plugins/element/paragraphs/ParagraphElement.cjs.map +1 -1
  98. package/dist/development/src/plugins/element/paragraphs/ParagraphElement.js.map +1 -1
  99. package/dist/development/src/plugins/element/paragraphs/withParagraphs.cjs.map +1 -1
  100. package/dist/development/src/plugins/element/paragraphs/withParagraphs.js.map +1 -1
  101. package/dist/development/src/plugins/element/scrollTargets/ScrollTargetElement.cjs.map +1 -1
  102. package/dist/development/src/plugins/element/scrollTargets/ScrollTargetElement.js.map +1 -1
  103. package/dist/development/src/plugins/element/scrollTargets/withScrollTargets.cjs.map +1 -1
  104. package/dist/development/src/plugins/element/scrollTargets/withScrollTargets.js.map +1 -1
  105. package/dist/development/src/plugins/element/tables/TableCellElement.cjs.map +1 -1
  106. package/dist/development/src/plugins/element/tables/TableCellElement.js.map +1 -1
  107. package/dist/development/src/plugins/element/tables/TableElement.cjs.map +1 -1
  108. package/dist/development/src/plugins/element/tables/TableElement.js.map +1 -1
  109. package/dist/development/src/plugins/element/tables/TableElementSelection.cjs.map +1 -1
  110. package/dist/development/src/plugins/element/tables/TableElementSelection.js.map +1 -1
  111. package/dist/development/src/plugins/element/tables/TableHtmlDeserializer.cjs.map +1 -1
  112. package/dist/development/src/plugins/element/tables/TableHtmlDeserializer.js.map +1 -1
  113. package/dist/development/src/plugins/element/tables/TableModifications.cjs.map +1 -1
  114. package/dist/development/src/plugins/element/tables/TableModifications.js +1 -1
  115. package/dist/development/src/plugins/element/tables/TableModifications.js.map +1 -1
  116. package/dist/development/src/plugins/element/tables/TableRowElement.cjs.map +1 -1
  117. package/dist/development/src/plugins/element/tables/TableRowElement.js.map +1 -1
  118. package/dist/development/src/plugins/element/tables/gaugeTableColumnCount.cjs.map +1 -1
  119. package/dist/development/src/plugins/element/tables/gaugeTableColumnCount.js.map +1 -1
  120. package/dist/development/src/plugins/element/tables/withTables.cjs.map +1 -1
  121. package/dist/development/src/plugins/element/tables/withTables.js.map +1 -1
  122. package/dist/development/src/plugins/text/bold/withBold.cjs.map +1 -1
  123. package/dist/development/src/plugins/text/bold/withBold.js.map +1 -1
  124. package/dist/development/src/plugins/text/code/withCode.cjs.map +1 -1
  125. package/dist/development/src/plugins/text/highlight/withHighlight.cjs.map +1 -1
  126. package/dist/development/src/plugins/text/italic/withItalic.cjs.map +1 -1
  127. package/dist/development/src/plugins/text/italic/withItalic.js.map +1 -1
  128. package/dist/development/src/plugins/text/newline/withNewline.cjs.map +1 -1
  129. package/dist/development/src/plugins/text/newline/withNewline.js.map +1 -1
  130. package/dist/development/src/plugins/text/strikeThrough/withStrikeThrough.cjs.map +1 -1
  131. package/dist/development/src/plugins/text/strikeThrough/withStrikeThrough.js.map +1 -1
  132. package/dist/development/src/plugins/text/underline/withUnderline.cjs.map +1 -1
  133. package/dist/development/src/plugins/text/underline/withUnderline.js.map +1 -1
  134. package/dist/production/src/components/RichTextEditor.cjs.map +1 -1
  135. package/dist/production/src/components/RichTextEditor.js.map +1 -1
  136. package/dist/production/src/components/triggers/EditorElementTrigger.cjs.map +1 -1
  137. package/dist/production/src/components/triggers/EditorElementTrigger.js.map +1 -1
  138. package/dist/production/src/components/triggers/EditorGenericTrigger.cjs.map +1 -1
  139. package/dist/production/src/components/triggers/EditorGenericTrigger.js.map +1 -1
  140. package/dist/production/src/components/triggers/EditorMarkTrigger.cjs.map +1 -1
  141. package/dist/production/src/components/triggers/EditorMarkTrigger.js.map +1 -1
  142. package/dist/production/src/components/triggers/EditorWrapNodeTrigger.cjs.map +1 -1
  143. package/dist/production/src/components/triggers/EditorWrapNodeTrigger.js.map +1 -1
  144. package/dist/production/src/editor/createEditor.cjs.map +1 -1
  145. package/dist/production/src/editor/createEditor.js.map +1 -1
  146. package/dist/production/src/editor/createEditorWithEssentials.cjs.map +1 -1
  147. package/dist/production/src/editor/createEditorWithEssentials.js.map +1 -1
  148. package/dist/production/src/editor/index.cjs.map +1 -1
  149. package/dist/production/src/editor/methods/addMarks.cjs.map +1 -1
  150. package/dist/production/src/editor/methods/addMarks.js.map +1 -1
  151. package/dist/production/src/editor/methods/canToggleMark.cjs.map +1 -1
  152. package/dist/production/src/editor/methods/canToggleMark.js.map +1 -1
  153. package/dist/production/src/editor/methods/closest.cjs.map +1 -1
  154. package/dist/production/src/editor/methods/closest.js.map +1 -1
  155. package/dist/production/src/editor/methods/closestBlockEntry.cjs.map +1 -1
  156. package/dist/production/src/editor/methods/ejectElement.cjs.map +1 -1
  157. package/dist/production/src/editor/methods/ejectElement.js.map +1 -1
  158. package/dist/production/src/editor/methods/getElementDataAttributes.cjs.map +1 -1
  159. package/dist/production/src/editor/methods/getElementDataAttributes.js.map +1 -1
  160. package/dist/production/src/editor/methods/getPreviousSibling.cjs.map +1 -1
  161. package/dist/production/src/editor/methods/getPreviousSibling.js.map +1 -1
  162. package/dist/production/src/editor/methods/hasMarks.cjs.map +1 -1
  163. package/dist/production/src/editor/methods/hasMarks.js.map +1 -1
  164. package/dist/production/src/editor/methods/hasParentOfType.cjs.map +1 -1
  165. package/dist/production/src/editor/methods/hasParentOfType.js.map +1 -1
  166. package/dist/production/src/editor/methods/isElementType.cjs.map +1 -1
  167. package/dist/production/src/editor/methods/isElementType.js.map +1 -1
  168. package/dist/production/src/editor/methods/permissivelyDeserializeNodes.cjs.map +1 -1
  169. package/dist/production/src/editor/methods/permissivelyDeserializeNodes.js.map +1 -1
  170. package/dist/production/src/editor/methods/removeMarks.cjs.map +1 -1
  171. package/dist/production/src/editor/methods/removeMarks.js.map +1 -1
  172. package/dist/production/src/editor/methods/serializeNodes.cjs.map +1 -1
  173. package/dist/production/src/editor/methods/serializeNodes.js.map +1 -1
  174. package/dist/production/src/editor/methods/strictlyDeserializeNodes.cjs.map +1 -1
  175. package/dist/production/src/editor/methods/strictlyDeserializeNodes.js.map +1 -1
  176. package/dist/production/src/editor/methods/toLatestFormat.cjs.map +1 -1
  177. package/dist/production/src/editor/methods/toLatestFormat.js.map +1 -1
  178. package/dist/production/src/internal/components/DefaultElement.cjs.map +1 -1
  179. package/dist/production/src/internal/components/DefaultElement.js.map +1 -1
  180. package/dist/production/src/internal/hooks/useRichTextFieldNodes.cjs.map +1 -1
  181. package/dist/production/src/internal/hooks/useRichTextFieldNodes.js.map +1 -1
  182. package/dist/production/src/internal/utils/EditorPasteUtils.cjs.map +1 -1
  183. package/dist/production/src/internal/utils/EditorPasteUtils.js.map +1 -1
  184. package/dist/production/src/internal/utils/parseUrl.cjs.map +1 -1
  185. package/dist/production/src/internal/utils/parseUrl.js.map +1 -1
  186. package/dist/production/src/plugins/attributes/alignment/alignButton.cjs.map +1 -1
  187. package/dist/production/src/plugins/attributes/alignment/alignButton.js.map +1 -1
  188. package/dist/production/src/plugins/behaviour/paste/HtmlDeserializer.cjs.map +1 -1
  189. package/dist/production/src/plugins/behaviour/paste/HtmlDeserializer.js.map +1 -1
  190. package/dist/production/src/plugins/behaviour/paste/createMarkHtmlDeserializer.cjs.map +1 -1
  191. package/dist/production/src/plugins/behaviour/paste/createMarkHtmlDeserializer.js.map +1 -1
  192. package/dist/production/src/plugins/behaviour/paste/withPaste.cjs.map +1 -1
  193. package/dist/production/src/plugins/behaviour/paste/withPaste.js.map +1 -1
  194. package/dist/production/src/plugins/element/anchors/AnchorElement.cjs.map +1 -1
  195. package/dist/production/src/plugins/element/anchors/AnchorElement.js.map +1 -1
  196. package/dist/production/src/plugins/element/anchors/AnchorHtmlDeserializer.cjs.map +1 -1
  197. package/dist/production/src/plugins/element/anchors/AnchorHtmlDeserializer.js.map +1 -1
  198. package/dist/production/src/plugins/element/anchors/AnchorModifications.cjs.map +1 -1
  199. package/dist/production/src/plugins/element/anchors/AnchorModifications.js.map +1 -1
  200. package/dist/production/src/plugins/element/anchors/withAnchors.cjs.map +1 -1
  201. package/dist/production/src/plugins/element/anchors/withAnchors.js.map +1 -1
  202. package/dist/production/src/plugins/element/headings/HeadingElement.cjs.map +1 -1
  203. package/dist/production/src/plugins/element/headings/HeadingElement.js.map +1 -1
  204. package/dist/production/src/plugins/element/headings/HeadingHtmlDeserializer.cjs.map +1 -1
  205. package/dist/production/src/plugins/element/headings/HeadingHtmlDeserializer.js.map +1 -1
  206. package/dist/production/src/plugins/element/headings/withHeadings.cjs.map +1 -1
  207. package/dist/production/src/plugins/element/headings/withHeadings.js.map +1 -1
  208. package/dist/production/src/plugins/element/horizonalRules/HorizontalRuleElement.cjs.map +1 -1
  209. package/dist/production/src/plugins/element/horizonalRules/HorizontalRuleElement.js.map +1 -1
  210. package/dist/production/src/plugins/element/horizonalRules/withHorizontalRules.cjs.map +1 -1
  211. package/dist/production/src/plugins/element/horizonalRules/withHorizontalRules.js.map +1 -1
  212. package/dist/production/src/plugins/element/lists/ListElement.cjs.map +1 -1
  213. package/dist/production/src/plugins/element/lists/ListElement.js.map +1 -1
  214. package/dist/production/src/plugins/element/lists/ListHtmlDeserializer.cjs.map +1 -1
  215. package/dist/production/src/plugins/element/lists/ListHtmlDeserializer.js.map +1 -1
  216. package/dist/production/src/plugins/element/lists/ListItemElement.cjs.map +1 -1
  217. package/dist/production/src/plugins/element/lists/ListItemElement.js.map +1 -1
  218. package/dist/production/src/plugins/element/lists/OrderedListElement.cjs.map +1 -1
  219. package/dist/production/src/plugins/element/lists/UnorderedListElement.cjs.map +1 -1
  220. package/dist/production/src/plugins/element/lists/transforms/dedentListItem.cjs.map +1 -1
  221. package/dist/production/src/plugins/element/lists/transforms/dedentListItem.js.map +1 -1
  222. package/dist/production/src/plugins/element/lists/transforms/indentListItem.cjs.map +1 -1
  223. package/dist/production/src/plugins/element/lists/transforms/indentListItem.js.map +1 -1
  224. package/dist/production/src/plugins/element/lists/transforms/normalizeListElement.cjs.map +1 -1
  225. package/dist/production/src/plugins/element/lists/transforms/normalizeListElement.js.map +1 -1
  226. package/dist/production/src/plugins/element/lists/transforms/toggleListElement.cjs.map +1 -1
  227. package/dist/production/src/plugins/element/lists/transforms/toggleListElement.js.map +1 -1
  228. package/dist/production/src/plugins/element/lists/withLists.cjs.map +1 -1
  229. package/dist/production/src/plugins/element/lists/withLists.js.map +1 -1
  230. package/dist/production/src/plugins/element/paragraphs/ParagraphElement.cjs.map +1 -1
  231. package/dist/production/src/plugins/element/paragraphs/ParagraphElement.js.map +1 -1
  232. package/dist/production/src/plugins/element/paragraphs/withParagraphs.cjs.map +1 -1
  233. package/dist/production/src/plugins/element/paragraphs/withParagraphs.js.map +1 -1
  234. package/dist/production/src/plugins/element/scrollTargets/ScrollTargetElement.cjs.map +1 -1
  235. package/dist/production/src/plugins/element/scrollTargets/ScrollTargetElement.js.map +1 -1
  236. package/dist/production/src/plugins/element/scrollTargets/withScrollTargets.cjs.map +1 -1
  237. package/dist/production/src/plugins/element/scrollTargets/withScrollTargets.js.map +1 -1
  238. package/dist/production/src/plugins/element/tables/TableCellElement.cjs.map +1 -1
  239. package/dist/production/src/plugins/element/tables/TableCellElement.js.map +1 -1
  240. package/dist/production/src/plugins/element/tables/TableElement.cjs.map +1 -1
  241. package/dist/production/src/plugins/element/tables/TableElement.js.map +1 -1
  242. package/dist/production/src/plugins/element/tables/TableElementSelection.cjs.map +1 -1
  243. package/dist/production/src/plugins/element/tables/TableElementSelection.js.map +1 -1
  244. package/dist/production/src/plugins/element/tables/TableHtmlDeserializer.cjs.map +1 -1
  245. package/dist/production/src/plugins/element/tables/TableHtmlDeserializer.js.map +1 -1
  246. package/dist/production/src/plugins/element/tables/TableModifications.cjs.map +1 -1
  247. package/dist/production/src/plugins/element/tables/TableModifications.js +1 -1
  248. package/dist/production/src/plugins/element/tables/TableModifications.js.map +1 -1
  249. package/dist/production/src/plugins/element/tables/TableRowElement.cjs.map +1 -1
  250. package/dist/production/src/plugins/element/tables/TableRowElement.js.map +1 -1
  251. package/dist/production/src/plugins/element/tables/gaugeTableColumnCount.cjs.map +1 -1
  252. package/dist/production/src/plugins/element/tables/gaugeTableColumnCount.js.map +1 -1
  253. package/dist/production/src/plugins/element/tables/withTables.cjs.map +1 -1
  254. package/dist/production/src/plugins/element/tables/withTables.js.map +1 -1
  255. package/dist/production/src/plugins/text/bold/withBold.cjs.map +1 -1
  256. package/dist/production/src/plugins/text/bold/withBold.js.map +1 -1
  257. package/dist/production/src/plugins/text/code/withCode.cjs.map +1 -1
  258. package/dist/production/src/plugins/text/highlight/withHighlight.cjs.map +1 -1
  259. package/dist/production/src/plugins/text/italic/withItalic.cjs.map +1 -1
  260. package/dist/production/src/plugins/text/italic/withItalic.js.map +1 -1
  261. package/dist/production/src/plugins/text/newline/withNewline.cjs.map +1 -1
  262. package/dist/production/src/plugins/text/newline/withNewline.js.map +1 -1
  263. package/dist/production/src/plugins/text/strikeThrough/withStrikeThrough.cjs.map +1 -1
  264. package/dist/production/src/plugins/text/strikeThrough/withStrikeThrough.js.map +1 -1
  265. package/dist/production/src/plugins/text/underline/withUnderline.cjs.map +1 -1
  266. package/dist/production/src/plugins/text/underline/withUnderline.js.map +1 -1
  267. package/dist/types/tsconfig.tsbuildinfo +1 -1
  268. package/package.json +5 -4
@@ -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[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\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\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,aAAA;AAAA,EACrE,CAAS,UAAA;AACR,UAAM,SAASC,aAAAA;AACf,UAAM,cAAc,OAAO;AAC3B,UAAM,YAAY,OAAO;AAEzB,UAAM,iBAAiBC,MAAA;AAAA,MACtB,MAAMC,2BAAc,2BAA2B,OAAO,WAAW;AAAA,MACjE,CAAC,aAAa,KAAK;AAAA,IAAA;AAEd,UAAA,gBAAgBD,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C,8BAAA,OAAAC,wBAAA,EACC,UAACD,qCAAAE,aAAAA,OAAA,EAAM,cAAc,MAAM,cAAc,OAAO,MAAM,OAAO,cAAc,MAAM,aAAjF,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAH,MAA+F,EADhG,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAEA,GAAAA,MAAA;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'\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[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\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\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,aAAA;AAAA,EACrE,CAAS,UAAA;AACR,UAAM,SAASC,aAAAA,UAAU;AACzB,UAAM,cAAc,OAAO;AAC3B,UAAM,YAAY,OAAO;AAEz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AA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAEA,GAAAC,MAAA;AAAA,EAEF;AAAA,EACA,CACC,UAAAC,8BAAA,OAAAC,wBAAA,EACC,UAACD,qCAAAE,aAAAA,OAAA,EAAM,cAAc,MAAM,cAAc,OAAO,MAAM,OAAO,cAAc,MAAM,aAAjF,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAH,MAA+F,EADhG,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAEA,GAAAA,MAAA;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[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\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\n"],"names":["editor","SlateElement","fieldAccessor","SlateNode","this"],"mappings":";;;;;;;;AAoBO,MAAM,iBAAyD;AAAA,EACrE,CAAS,UAAA;AACR,UAAM,SAAS;AACf,UAAM,cAAc,OAAO;AAC3B,UAAM,YAAY,OAAO;AAEzB,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AAA,EACC,UAAC,uBAAA,OAAA,EAAM,cAAc,MAAM,cAAc,OAAO,MAAM,OAAO,cAAc,MAAM,aAAjF,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAAA,MAA+F,EADhG,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAEA,GAAAA,MAAA;AAAA,EAED;AACD;"}
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[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\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\n"],"names":["editor","SlateElement","fieldAccessor","SlateNode","this"],"mappings":";;;;;;;;AAoBO,MAAM,iBAAyD;AAAA,EACrE,CAAS,UAAA;AACR,UAAM,SAAS,UAAU;AACzB,UAAM,cAAc,OAAO;AAC3B,UAAM,YAAY,OAAO;AAEzB,UAAM,iBAAiB;AAAA,MACtB,MAAM,cAAc,2BAA2B,OAAO,WAAW;AAAA,MACjE,CAAC,aAAa,KAAK;AAAA,IACpB;AACM,UAAA,gBAAgB,QAAQ,MAAM,OAAO,SAAi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AAAA,EAAA,GAAAA,MAA+F,EADhG,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAEA,GAAAA,MAAA;AAAA,EAED;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EditorElementTrigger.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/components/triggers/EditorElementTrigger.tsx"],"sourcesContent":["import * as React from 'react'\nimport { ReactElement } from 'react'\nimport { useSlate } from 'slate-react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { dataAttribute } from '@contember/utilities'\n\nexport interface EditorElementTriggerProps {\n\telementType: string\n\tsuchThat?: Record<string, unknown>\n\tchildren: ReactElement\n}\n\nexport const EditorElementTrigger = ({ elementType, suchThat, ...props }: EditorElementTriggerProps) => {\n\tconst editor = useSlate()\n\n\tconst isActive = editor.isElementActive(elementType, suchThat)\n\tconst onClick = () => {\n\t\teditor.toggleElement(elementType, suchThat)\n\t}\n\n\treturn <Slot onClick={onClick} data-active={dataAttribute(isActive)} {...props} />\n}\n"],"names":["useSlate","jsxDEV","Slot","dataAttribute","this"],"mappings":";;;;;;AAYO,MAAM,uBAAuB,CAAC,EAAE,aAAa,UAAU,GAAG,YAAuC;AACvG,QAAM,SAASA,WAAAA;AAEf,QAAM,WAAW,OAAO,gBAAgB,aAAa,QAAQ;AAC7D,QAAM,UAAU,MAAM;AACd,WAAA,cAAc,aAAa,QAAQ;AAAA,EAAA;AAGpC,SAAAC,qCAACC,UAAAA,QAAK,SAAkB,eAAaC,UAAAA,cAAc,QAAQ,GAAI,GAAG,MAAlE,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAyE,GAAAC,MAAA;AACjF;;"}
1
+ {"version":3,"file":"EditorElementTrigger.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/components/triggers/EditorElementTrigger.tsx"],"sourcesContent":["import * as React from 'react'\nimport { ReactElement } from 'react'\nimport { useSlate } from 'slate-react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { dataAttribute } from '@contember/utilities'\n\nexport interface EditorElementTriggerProps {\n\telementType: string\n\tsuchThat?: Record<string, unknown>\n\tchildren: ReactElement\n}\n\nexport const EditorElementTrigger = ({ elementType, suchThat, ...props }: EditorElementTriggerProps) => {\n\tconst editor = useSlate()\n\n\tconst isActive = editor.isElementActive(elementType, suchThat)\n\tconst onClick = () => {\n\t\teditor.toggleElement(elementType, suchThat)\n\t}\n\n\treturn <Slot onClick={onClick} data-active={dataAttribute(isActive)} {...props} />\n}\n"],"names":["useSlate","jsxDEV","Slot","dataAttribute","this"],"mappings":";;;;;;AAYO,MAAM,uBAAuB,CAAC,EAAE,aAAa,UAAU,GAAG,YAAuC;AACvG,QAAM,SAASA,WAAAA,SAAS;AAExB,QAAM,WAAW,OAAO,gBAAgB,aAAa,QAAQ;AAC7D,QAAM,UAAU,MAAM;AACd,WAAA,cAAc,aAAa,QAAQ;AAAA,EAC3C;AAEO,SAAAC,qCAACC,UAAAA,QAAK,SAAkB,eAAaC,UAAAA,cAAc,QAAQ,GAAI,GAAG,MAAlE,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAyE,GAAAC,MAAA;AACjF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EditorElementTrigger.js","sources":["../../../../../../packages/react-slate-editor-base/src/components/triggers/EditorElementTrigger.tsx"],"sourcesContent":["import * as React from 'react'\nimport { ReactElement } from 'react'\nimport { useSlate } from 'slate-react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { dataAttribute } from '@contember/utilities'\n\nexport interface EditorElementTriggerProps {\n\telementType: string\n\tsuchThat?: Record<string, unknown>\n\tchildren: ReactElement\n}\n\nexport const EditorElementTrigger = ({ elementType, suchThat, ...props }: EditorElementTriggerProps) => {\n\tconst editor = useSlate()\n\n\tconst isActive = editor.isElementActive(elementType, suchThat)\n\tconst onClick = () => {\n\t\teditor.toggleElement(elementType, suchThat)\n\t}\n\n\treturn <Slot onClick={onClick} data-active={dataAttribute(isActive)} {...props} />\n}\n"],"names":["this"],"mappings":";;;;AAYO,MAAM,uBAAuB,CAAC,EAAE,aAAa,UAAU,GAAG,YAAuC;AACvG,QAAM,SAAS;AAEf,QAAM,WAAW,OAAO,gBAAgB,aAAa,QAAQ;AAC7D,QAAM,UAAU,MAAM;AACd,WAAA,cAAc,aAAa,QAAQ;AAAA,EAAA;AAGpC,SAAA,uBAAC,QAAK,SAAkB,eAAa,cAAc,QAAQ,GAAI,GAAG,MAAlE,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAyE,GAAAA,MAAA;AACjF;"}
1
+ {"version":3,"file":"EditorElementTrigger.js","sources":["../../../../../../packages/react-slate-editor-base/src/components/triggers/EditorElementTrigger.tsx"],"sourcesContent":["import * as React from 'react'\nimport { ReactElement } from 'react'\nimport { useSlate } from 'slate-react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { dataAttribute } from '@contember/utilities'\n\nexport interface EditorElementTriggerProps {\n\telementType: string\n\tsuchThat?: Record<string, unknown>\n\tchildren: ReactElement\n}\n\nexport const EditorElementTrigger = ({ elementType, suchThat, ...props }: EditorElementTriggerProps) => {\n\tconst editor = useSlate()\n\n\tconst isActive = editor.isElementActive(elementType, suchThat)\n\tconst onClick = () => {\n\t\teditor.toggleElement(elementType, suchThat)\n\t}\n\n\treturn <Slot onClick={onClick} data-active={dataAttribute(isActive)} {...props} />\n}\n"],"names":["this"],"mappings":";;;;AAYO,MAAM,uBAAuB,CAAC,EAAE,aAAa,UAAU,GAAG,YAAuC;AACvG,QAAM,SAAS,SAAS;AAExB,QAAM,WAAW,OAAO,gBAAgB,aAAa,QAAQ;AAC7D,QAAM,UAAU,MAAM;AACd,WAAA,cAAc,aAAa,QAAQ;AAAA,EAC3C;AAEO,SAAA,uBAAC,QAAK,SAAkB,eAAa,cAAc,QAAQ,GAAI,GAAG,MAAlE,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAyE,GAAAA,MAAA;AACjF;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EditorGenericTrigger.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/components/triggers/EditorGenericTrigger.tsx"],"sourcesContent":["import * as React from 'react'\nimport { ReactElement } from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { Editor } from 'slate'\nimport { dataAttribute } from '@contember/utilities'\nimport { useSlate } from 'slate-react'\n\nexport interface EditorGenericTriggerProps {\n\tisActive?: (args: { editor: Editor }) => boolean\n\tshouldDisplay?: (args: { editor: Editor }) => boolean\n\ttoggle: (args: { editor: Editor }) => void\n\tchildren: ReactElement\n}\n\nexport const EditorGenericTrigger = ({ toggle, isActive, shouldDisplay, ...props }: EditorGenericTriggerProps) => {\n\n\tconst editor = useSlate()\n\tconst onClick = () => {\n\t\ttoggle({ editor })\n\t}\n\tconst active = isActive?.({ editor }) ?? false\n\tconst display = shouldDisplay?.({ editor }) ?? true\n\tif (!display) {\n\t\treturn null\n\t}\n\treturn <Slot onClick={onClick} data-active={dataAttribute(active)} {...props} />\n}\n"],"names":["useSlate","jsxDEV","Slot","dataAttribute","this"],"mappings":";;;;;;AAca,MAAA,uBAAuB,CAAC,EAAE,QAAQ,UAAU,eAAe,GAAG,YAAuC;AAEjH,QAAM,SAASA,WAAAA;AACf,QAAM,UAAU,MAAM;AACd,WAAA,EAAE,QAAQ;AAAA,EAAA;AAElB,QAAM,SAAS,WAAW,EAAE,OAAQ,CAAA,KAAK;AACzC,QAAM,UAAU,gBAAgB,EAAE,OAAQ,CAAA,KAAK;AAC/C,MAAI,CAAC,SAAS;AACN,WAAA;AAAA,EACR;AACO,SAAAC,qCAACC,UAAAA,QAAK,SAAkB,eAAaC,UAAAA,cAAc,MAAM,GAAI,GAAG,MAAhE,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAuE,GAAAC,MAAA;AAC/E;;"}
1
+ {"version":3,"file":"EditorGenericTrigger.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/components/triggers/EditorGenericTrigger.tsx"],"sourcesContent":["import * as React from 'react'\nimport { ReactElement } from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { Editor } from 'slate'\nimport { dataAttribute } from '@contember/utilities'\nimport { useSlate } from 'slate-react'\n\nexport interface EditorGenericTriggerProps {\n\tisActive?: (args: { editor: Editor }) => boolean\n\tshouldDisplay?: (args: { editor: Editor }) => boolean\n\ttoggle: (args: { editor: Editor }) => void\n\tchildren: ReactElement\n}\n\nexport const EditorGenericTrigger = ({ toggle, isActive, shouldDisplay, ...props }: EditorGenericTriggerProps) => {\n\n\tconst editor = useSlate()\n\tconst onClick = () => {\n\t\ttoggle({ editor })\n\t}\n\tconst active = isActive?.({ editor }) ?? false\n\tconst display = shouldDisplay?.({ editor }) ?? true\n\tif (!display) {\n\t\treturn null\n\t}\n\treturn <Slot onClick={onClick} data-active={dataAttribute(active)} {...props} />\n}\n"],"names":["useSlate","jsxDEV","Slot","dataAttribute","this"],"mappings":";;;;;;AAca,MAAA,uBAAuB,CAAC,EAAE,QAAQ,UAAU,eAAe,GAAG,YAAuC;AAEjH,QAAM,SAASA,WAAAA,SAAS;AACxB,QAAM,UAAU,MAAM;AACd,WAAA,EAAE,QAAQ;AAAA,EAClB;AACA,QAAM,SAAS,WAAW,EAAE,OAAA,CAAQ,KAAK;AACzC,QAAM,UAAU,gBAAgB,EAAE,OAAA,CAAQ,KAAK;AAC/C,MAAI,CAAC,SAAS;AACN,WAAA;AAAA,EAAA;AAED,SAAAC,qCAACC,UAAAA,QAAK,SAAkB,eAAaC,UAAAA,cAAc,MAAM,GAAI,GAAG,MAAhE,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAuE,GAAAC,MAAA;AAC/E;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EditorGenericTrigger.js","sources":["../../../../../../packages/react-slate-editor-base/src/components/triggers/EditorGenericTrigger.tsx"],"sourcesContent":["import * as React from 'react'\nimport { ReactElement } from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { Editor } from 'slate'\nimport { dataAttribute } from '@contember/utilities'\nimport { useSlate } from 'slate-react'\n\nexport interface EditorGenericTriggerProps {\n\tisActive?: (args: { editor: Editor }) => boolean\n\tshouldDisplay?: (args: { editor: Editor }) => boolean\n\ttoggle: (args: { editor: Editor }) => void\n\tchildren: ReactElement\n}\n\nexport const EditorGenericTrigger = ({ toggle, isActive, shouldDisplay, ...props }: EditorGenericTriggerProps) => {\n\n\tconst editor = useSlate()\n\tconst onClick = () => {\n\t\ttoggle({ editor })\n\t}\n\tconst active = isActive?.({ editor }) ?? false\n\tconst display = shouldDisplay?.({ editor }) ?? true\n\tif (!display) {\n\t\treturn null\n\t}\n\treturn <Slot onClick={onClick} data-active={dataAttribute(active)} {...props} />\n}\n"],"names":["this"],"mappings":";;;;AAca,MAAA,uBAAuB,CAAC,EAAE,QAAQ,UAAU,eAAe,GAAG,YAAuC;AAEjH,QAAM,SAAS;AACf,QAAM,UAAU,MAAM;AACd,WAAA,EAAE,QAAQ;AAAA,EAAA;AAElB,QAAM,SAAS,WAAW,EAAE,OAAQ,CAAA,KAAK;AACzC,QAAM,UAAU,gBAAgB,EAAE,OAAQ,CAAA,KAAK;AAC/C,MAAI,CAAC,SAAS;AACN,WAAA;AAAA,EACR;AACO,SAAA,uBAAC,QAAK,SAAkB,eAAa,cAAc,MAAM,GAAI,GAAG,MAAhE,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAuE,GAAAA,MAAA;AAC/E;"}
1
+ {"version":3,"file":"EditorGenericTrigger.js","sources":["../../../../../../packages/react-slate-editor-base/src/components/triggers/EditorGenericTrigger.tsx"],"sourcesContent":["import * as React from 'react'\nimport { ReactElement } from 'react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { Editor } from 'slate'\nimport { dataAttribute } from '@contember/utilities'\nimport { useSlate } from 'slate-react'\n\nexport interface EditorGenericTriggerProps {\n\tisActive?: (args: { editor: Editor }) => boolean\n\tshouldDisplay?: (args: { editor: Editor }) => boolean\n\ttoggle: (args: { editor: Editor }) => void\n\tchildren: ReactElement\n}\n\nexport const EditorGenericTrigger = ({ toggle, isActive, shouldDisplay, ...props }: EditorGenericTriggerProps) => {\n\n\tconst editor = useSlate()\n\tconst onClick = () => {\n\t\ttoggle({ editor })\n\t}\n\tconst active = isActive?.({ editor }) ?? false\n\tconst display = shouldDisplay?.({ editor }) ?? true\n\tif (!display) {\n\t\treturn null\n\t}\n\treturn <Slot onClick={onClick} data-active={dataAttribute(active)} {...props} />\n}\n"],"names":["this"],"mappings":";;;;AAca,MAAA,uBAAuB,CAAC,EAAE,QAAQ,UAAU,eAAe,GAAG,YAAuC;AAEjH,QAAM,SAAS,SAAS;AACxB,QAAM,UAAU,MAAM;AACd,WAAA,EAAE,QAAQ;AAAA,EAClB;AACA,QAAM,SAAS,WAAW,EAAE,OAAA,CAAQ,KAAK;AACzC,QAAM,UAAU,gBAAgB,EAAE,OAAA,CAAQ,KAAK;AAC/C,MAAI,CAAC,SAAS;AACN,WAAA;AAAA,EAAA;AAED,SAAA,uBAAC,QAAK,SAAkB,eAAa,cAAc,MAAM,GAAI,GAAG,MAAhE,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAuE,GAAAA,MAAA;AAC/E;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EditorMarkTrigger.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/components/triggers/EditorMarkTrigger.tsx"],"sourcesContent":["import * as React from 'react'\nimport { ReactElement } from 'react'\nimport { useSlate } from 'slate-react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { dataAttribute } from '@contember/utilities'\n\nexport interface EditorMarkTriggerProps {\n\tmark: string\n\tchildren: ReactElement\n}\n\nexport const EditorMarkTrigger = ({ mark, ...props }: EditorMarkTriggerProps) => {\n\tconst editor = useSlate()\n\n\tconst isActive = editor.hasMarks({ [mark]: true })\n\tconst onClick = () => {\n\t\teditor.toggleMarks({ [mark]: true })\n\t}\n\n\treturn <Slot onClick={onClick} data-active={dataAttribute(isActive)} {...props} />\n}\n"],"names":["useSlate","jsxDEV","Slot","dataAttribute","this"],"mappings":";;;;;;AAWO,MAAM,oBAAoB,CAAC,EAAE,MAAM,GAAG,YAAoC;AAChF,QAAM,SAASA,WAAAA;AAET,QAAA,WAAW,OAAO,SAAS,EAAE,CAAC,IAAI,GAAG,MAAM;AACjD,QAAM,UAAU,MAAM;AACrB,WAAO,YAAY,EAAE,CAAC,IAAI,GAAG,KAAM,CAAA;AAAA,EAAA;AAG7B,SAAAC,qCAACC,UAAAA,QAAK,SAAkB,eAAaC,UAAAA,cAAc,QAAQ,GAAI,GAAG,MAAlE,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAyE,GAAAC,MAAA;AACjF;;"}
1
+ {"version":3,"file":"EditorMarkTrigger.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/components/triggers/EditorMarkTrigger.tsx"],"sourcesContent":["import * as React from 'react'\nimport { ReactElement } from 'react'\nimport { useSlate } from 'slate-react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { dataAttribute } from '@contember/utilities'\n\nexport interface EditorMarkTriggerProps {\n\tmark: string\n\tchildren: ReactElement\n}\n\nexport const EditorMarkTrigger = ({ mark, ...props }: EditorMarkTriggerProps) => {\n\tconst editor = useSlate()\n\n\tconst isActive = editor.hasMarks({ [mark]: true })\n\tconst onClick = () => {\n\t\teditor.toggleMarks({ [mark]: true })\n\t}\n\n\treturn <Slot onClick={onClick} data-active={dataAttribute(isActive)} {...props} />\n}\n"],"names":["useSlate","jsxDEV","Slot","dataAttribute","this"],"mappings":";;;;;;AAWO,MAAM,oBAAoB,CAAC,EAAE,MAAM,GAAG,YAAoC;AAChF,QAAM,SAASA,WAAAA,SAAS;AAElB,QAAA,WAAW,OAAO,SAAS,EAAE,CAAC,IAAI,GAAG,MAAM;AACjD,QAAM,UAAU,MAAM;AACrB,WAAO,YAAY,EAAE,CAAC,IAAI,GAAG,MAAM;AAAA,EACpC;AAEO,SAAAC,qCAACC,UAAAA,QAAK,SAAkB,eAAaC,UAAAA,cAAc,QAAQ,GAAI,GAAG,MAAlE,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAyE,GAAAC,MAAA;AACjF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EditorMarkTrigger.js","sources":["../../../../../../packages/react-slate-editor-base/src/components/triggers/EditorMarkTrigger.tsx"],"sourcesContent":["import * as React from 'react'\nimport { ReactElement } from 'react'\nimport { useSlate } from 'slate-react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { dataAttribute } from '@contember/utilities'\n\nexport interface EditorMarkTriggerProps {\n\tmark: string\n\tchildren: ReactElement\n}\n\nexport const EditorMarkTrigger = ({ mark, ...props }: EditorMarkTriggerProps) => {\n\tconst editor = useSlate()\n\n\tconst isActive = editor.hasMarks({ [mark]: true })\n\tconst onClick = () => {\n\t\teditor.toggleMarks({ [mark]: true })\n\t}\n\n\treturn <Slot onClick={onClick} data-active={dataAttribute(isActive)} {...props} />\n}\n"],"names":["this"],"mappings":";;;;AAWO,MAAM,oBAAoB,CAAC,EAAE,MAAM,GAAG,YAAoC;AAChF,QAAM,SAAS;AAET,QAAA,WAAW,OAAO,SAAS,EAAE,CAAC,IAAI,GAAG,MAAM;AACjD,QAAM,UAAU,MAAM;AACrB,WAAO,YAAY,EAAE,CAAC,IAAI,GAAG,KAAM,CAAA;AAAA,EAAA;AAG7B,SAAA,uBAAC,QAAK,SAAkB,eAAa,cAAc,QAAQ,GAAI,GAAG,MAAlE,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAyE,GAAAA,MAAA;AACjF;"}
1
+ {"version":3,"file":"EditorMarkTrigger.js","sources":["../../../../../../packages/react-slate-editor-base/src/components/triggers/EditorMarkTrigger.tsx"],"sourcesContent":["import * as React from 'react'\nimport { ReactElement } from 'react'\nimport { useSlate } from 'slate-react'\nimport { Slot } from '@radix-ui/react-slot'\nimport { dataAttribute } from '@contember/utilities'\n\nexport interface EditorMarkTriggerProps {\n\tmark: string\n\tchildren: ReactElement\n}\n\nexport const EditorMarkTrigger = ({ mark, ...props }: EditorMarkTriggerProps) => {\n\tconst editor = useSlate()\n\n\tconst isActive = editor.hasMarks({ [mark]: true })\n\tconst onClick = () => {\n\t\teditor.toggleMarks({ [mark]: true })\n\t}\n\n\treturn <Slot onClick={onClick} data-active={dataAttribute(isActive)} {...props} />\n}\n"],"names":["this"],"mappings":";;;;AAWO,MAAM,oBAAoB,CAAC,EAAE,MAAM,GAAG,YAAoC;AAChF,QAAM,SAAS,SAAS;AAElB,QAAA,WAAW,OAAO,SAAS,EAAE,CAAC,IAAI,GAAG,MAAM;AACjD,QAAM,UAAU,MAAM;AACrB,WAAO,YAAY,EAAE,CAAC,IAAI,GAAG,MAAM;AAAA,EACpC;AAEO,SAAA,uBAAC,QAAK,SAAkB,eAAa,cAAc,QAAQ,GAAI,GAAG,MAAlE,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAyE,GAAAA,MAAA;AACjF;"}
@@ -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":";;;;;;;AAgBa,MAAA,wBAAwB,CAAC,EAAE,aAAa,UAAU,WAAW,GAAG,YAAwC;AACpH,QAAM,SAASA,WAAAA;AACf,QAAM,UAAU,MAAM;AACrB,QAAI,WAAW;AACGC,YAAAA,WAAA,OAAO,QAAQ,SAAS;AAAA,IAC1C;AACiBA,UAAAA,WAAA;AAAA,MAChB;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,UAAU,CAAC,EAAE,MAAM,IAAI;AAAA,QACvB,GAAG;AAAA,MACJ;AAAA,MACA,EAAE,OAAO,KAAK;AAAA,IAAA;AAEfA,UAAA,WAAiB,SAAS,QAAQ,EAAE,MAAM,MAAO,CAAA;AAAA,EAAA;AAG3C,SAAAC,8BAAA,OAACC,kBAAM,GAAG,OAAO,SAASC,UAAAA,qBAAqB,MAAM,SAAS,OAAO,EAArE,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAwE,GAAAC,MAAA;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'\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":";;;;;;;AAgBa,MAAA,wBAAwB,CAAC,EAAE,aAAa,UAAU,WAAW,GAAG,YAAwC;AACpH,QAAM,SAASA,WAAAA,SAAS;AACxB,QAAM,UAAU,MAAM;AACrB,QAAI,WAAW;AACGC,uBAAA,OAAO,QAAQ,SAAS;AAAA,IAAA;AAEzBA,UAAAA,WAAA;AAAA,MAChB;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,UAAU,CAAC,EAAE,MAAM,IAAI;AAAA,QACvB,GAAG;AAAA,MACJ;AAAA,MACA,EAAE,OAAO,KAAK;AAAA,IACf;AACAA,UAAAA,WAAiB,SAAS,QAAQ,EAAE,MAAM,OAAO;AAAA,EAClD;AAEO,SAAAC,8BAAA,OAACC,kBAAM,GAAG,OAAO,SAASC,UAAAA,qBAAqB,MAAM,SAAS,OAAO,EAArE,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAwE,GAAAC,MAAA;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":";;;;;AAgBa,MAAA,wBAAwB,CAAC,EAAE,aAAa,UAAU,WAAW,GAAG,YAAwC;AACpH,QAAM,SAAS;AACf,QAAM,UAAU,MAAM;AACrB,QAAI,WAAW;AACGA,iBAAA,OAAO,QAAQ,SAAS;AAAA,IAC1C;AACiBA,eAAA;AAAA,MAChB;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,UAAU,CAAC,EAAE,MAAM,IAAI;AAAA,QACvB,GAAG;AAAA,MACJ;AAAA,MACA,EAAE,OAAO,KAAK;AAAA,IAAA;AAEfA,eAAiB,SAAS,QAAQ,EAAE,MAAM,MAAO,CAAA;AAAA,EAAA;AAG3C,SAAA,uBAAC,QAAM,GAAG,OAAO,SAAS,qBAAqB,MAAM,SAAS,OAAO,EAArE,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAwE,GAAAC,MAAA;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'\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":";;;;;AAgBa,MAAA,wBAAwB,CAAC,EAAE,aAAa,UAAU,WAAW,GAAG,YAAwC;AACpH,QAAM,SAAS,SAAS;AACxB,QAAM,UAAU,MAAM;AACrB,QAAI,WAAW;AACGA,iBAAA,OAAO,QAAQ,SAAS;AAAA,IAAA;AAEzBA,eAAA;AAAA,MAChB;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,UAAU,CAAC,EAAE,MAAM,IAAI;AAAA,QACvB,GAAG;AAAA,MACJ;AAAA,MACA,EAAE,OAAO,KAAK;AAAA,IACf;AACAA,eAAiB,SAAS,QAAQ,EAAE,MAAM,OAAO;AAAA,EAClD;AAEO,SAAA,uBAAC,QAAM,GAAG,OAAO,SAAS,qBAAqB,MAAM,SAAS,OAAO,EAArE,GAAA,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAwE,GAAAC,MAAA;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\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":";;;;AAmBO,MAAM,eAAe,CAAC;AAAA,EAC5B,UAAU,CAAC;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,MAIK;AACJ,QAAM,SAASA,2BAAAA,2BAA2B,EAAE,mBAAoB,CAAA;AAChE,QAAM,gBAA+D,CAAA;AACrE,QAAM,gBAA+D,CAAA;AACrE,WAAS,QAAQ,CAAU,WAAA;AACtB,QAAA,OAAO,WAAW,YAAY;AACjC,aAAO,MAAM;AACb;AAAA,IACD;AACA,WAAO,eAAe,EAAE,QAAQ,UAAU,aAAa,QAAQ;AAC/D,QAAI,QAAQ,cAAc;AACX,oBAAA,KAAK,OAAO,YAAY;AAAA,IACvC;AACA,QAAI,QAAQ,cAAc;AACX,oBAAA,KAAK,OAAO,YAAY;AAAA,IACvC;AAAA,EAAA,CACA;AACM,SAAA;AAAA,IACN;AAAA,IACA,cAAc,CAAC,EAAE,UAAAC,UAAS,MAAM,cAAc,YAAY,CAAC,KAAK,YAAYC,MAAAA,cAAc,SAAS,EAAE,UAAU,GAAG,GAAGD,SAAQ;AAAA,IAC7H,cAAc,CAAC,EAAE,UAAAA,UAAS,MAAM,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'\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\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":";;;;AAmBO,MAAM,eAAe,CAAC;AAAA,EAC5B,UAAU,CAAC;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,MAIK;AACJ,QAAM,SAASA,2BAAAA,2BAA2B,EAAE,oBAAoB;AAChE,QAAM,gBAA+D,CAAC;AACtE,QAAM,gBAA+D,CAAC;AACtE,WAAS,QAAQ,CAAU,WAAA;AACtB,QAAA,OAAO,WAAW,YAAY;AACjC,aAAO,MAAM;AACb;AAAA,IAAA;AAED,WAAO,eAAe,EAAE,QAAQ,UAAU,aAAa,QAAQ;AAC/D,QAAI,QAAQ,cAAc;AACX,oBAAA,KAAK,OAAO,YAAY;AAAA,IAAA;AAEvC,QAAI,QAAQ,cAAc;AACX,oBAAA,KAAK,OAAO,YAAY;AAAA,IAAA;AAAA,EACvC,CACA;AACM,SAAA;AAAA,IACN;AAAA,IACA,cAAc,CAAC,EAAE,UAAAC,UAAS,MAAM,cAAc,YAAY,CAAC,KAAK,YAAYC,MAAAA,cAAc,SAAS,EAAE,UAAU,GAAG,GAAGD,SAAQ;AAAA,IAC7H,cAAc,CAAC,EAAE,UAAAA,UAAS,MAAM,cAAc,YAAY,CAAC,KAAK,YAAYC,oBAAc,SAAS,EAAE,OAAU,GAAA,GAAG,GAAGD,SAAQ;AAAA,EAC9H;AACD;;"}
@@ -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\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":";;AAmBO,MAAM,eAAe,CAAC;AAAA,EAC5B,UAAU,CAAC;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,MAIK;AACJ,QAAM,SAAS,2BAA2B,EAAE,mBAAoB,CAAA;AAChE,QAAM,gBAA+D,CAAA;AACrE,QAAM,gBAA+D,CAAA;AACrE,WAAS,QAAQ,CAAU,WAAA;AACtB,QAAA,OAAO,WAAW,YAAY;AACjC,aAAO,MAAM;AACb;AAAA,IACD;AACA,WAAO,eAAe,EAAE,QAAQ,UAAU,aAAa,QAAQ;AAC/D,QAAI,QAAQ,cAAc;AACX,oBAAA,KAAK,OAAO,YAAY;AAAA,IACvC;AACA,QAAI,QAAQ,cAAc;AACX,oBAAA,KAAK,OAAO,YAAY;AAAA,IACvC;AAAA,EAAA,CACA;AACM,SAAA;AAAA,IACN;AAAA,IACA,cAAc,CAAC,EAAE,UAAAA,UAAS,MAAM,cAAc,YAAY,CAAC,KAAK,YAAY,cAAc,SAAS,EAAE,UAAU,GAAG,GAAGA,SAAQ;AAAA,IAC7H,cAAc,CAAC,EAAE,UAAAA,UAAS,MAAM,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'\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\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":";;AAmBO,MAAM,eAAe,CAAC;AAAA,EAC5B,UAAU,CAAC;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,MAIK;AACJ,QAAM,SAAS,2BAA2B,EAAE,oBAAoB;AAChE,QAAM,gBAA+D,CAAC;AACtE,QAAM,gBAA+D,CAAC;AACtE,WAAS,QAAQ,CAAU,WAAA;AACtB,QAAA,OAAO,WAAW,YAAY;AACjC,aAAO,MAAM;AACb;AAAA,IAAA;AAED,WAAO,eAAe,EAAE,QAAQ,UAAU,aAAa,QAAQ;AAC/D,QAAI,QAAQ,cAAc;AACX,oBAAA,KAAK,OAAO,YAAY;AAAA,IAAA;AAEvC,QAAI,QAAQ,cAAc;AACX,oBAAA,KAAK,OAAO,YAAY;AAAA,IAAA;AAAA,EACvC,CACA;AACM,SAAA;AAAA,IACN;AAAA,IACA,cAAc,CAAC,EAAE,UAAAA,UAAS,MAAM,cAAc,YAAY,CAAC,KAAK,YAAY,cAAc,SAAS,EAAE,UAAU,GAAG,GAAGA,SAAQ;AAAA,IAC7H,cAAc,CAAC,EAAE,UAAAA,UAAS,MAAM,cAAc,YAAY,CAAC,KAAK,YAAY,cAAc,SAAS,EAAE,OAAU,GAAA,GAAG,GAAGA,SAAQ;AAAA,EAC9H;AACD;"}
@@ -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 { createEditor, Descendant, Editor, Element as SlateElement, Node as SlateNode, Path, Range as SlateRange, Text as SlateText, Transforms } from 'slate'\nimport * as Slate from 'slate'\nimport { withHistory } from 'slate-history'\nimport { ReactEditor, withReact } from 'slate-react'\nimport { EditorElementPlugin, EditorMarkPlugin } from '../types/plugins'\nimport { TextSpecifics } from '../types/editor'\nimport { DefaultElement } from '../internal/components/DefaultElement'\nimport { withPaste } from '../plugins/behaviour'\nimport { ContemberEditor } from './index'\n\nexport const createEditorWithEssentials = ({ defaultElementType }: { defaultElementType: string }): Editor => {\n\tconst underlyingEditor = withHistory(withReact(createEditor() as ReactEditor))\n\n\tconst editor = underlyingEditor as unknown as Editor\n\tconst { normalizeNode, isInline, isVoid, deleteBackward } = editor\n\n\tconst elements = new Map<string, EditorElementPlugin<any>>()\n\tconst marks = new Map<string, EditorMarkPlugin>()\n\n\tObject.assign<Editor, Partial<Editor>>(editor, {\n\t\tslate: Slate,\n\t\tformatVersion: 1,\n\t\tdefaultElementType,\n\t\tisDefaultElement: element => 'type' in element && (element as any).type === defaultElementType,\n\t\tcreateDefaultElement: children => ({\n\t\t\ttype: defaultElementType,\n\t\t\tchildren,\n\t\t}),\n\t\tinsertBetweenBlocks: ([element, path], edge) => {\n\t\t\tconst edgeOffset = edge === 'before' ? 0 : 1\n\t\t\tconst targetPath = path.slice(0, -1).concat(path[path.length - 1] + edgeOffset)\n\t\t\tTransforms.insertNodes(editor, editor.createDefaultElement([{ text: '' }]), {\n\t\t\t\tat: targetPath,\n\t\t\t\tselect: true,\n\t\t\t})\n\t\t},\n\n\t\tcanToggleMarks: () => true,\n\t\tcanToggleElement: <E extends SlateElement>() => true,\n\n\t\thasMarks: <T extends SlateText>(marks: TextSpecifics<T>) => ContemberEditor.hasMarks(editor, marks),\n\n\t\t// TODO in the following function, we need to conditionally trim the selection so that it doesn't potentially\n\t\t// \tinclude empty strings at the edges of top-level elements.\n\t\tisElementActive: <E extends SlateElement>(elementType: E['type'], suchThat?: Partial<E>) => {\n\t\t\treturn (\n\t\t\t\telements.get(elementType)?.isActive?.({ editor, suchThat })\n\t\t\t\t?? Array.from(Editor.nodes(editor, {\n\t\t\t\t\tmatch: node => SlateElement.isElement(node) && ContemberEditor.isElementType(node, elementType, suchThat),\n\t\t\t\t\tvoids: false,\n\t\t\t\t})).length > 0\n\t\t\t)\n\t\t},\n\n\t\tacceptsAttributes: <E extends SlateElement>(elementType: E['type'], suchThat: Partial<E>) => {\n\t\t\treturn elements.get(elementType)?.acceptsAttributes?.({ editor, suchThat }) ?? false\n\t\t},\n\n\t\ttoggleMarks: <T extends SlateText>(marks: TextSpecifics<T>) => {\n\t\t\tif (!editor.canToggleMarks(marks)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst isActive = editor.hasMarks(marks)\n\t\t\tif (isActive) {\n\t\t\t\tContemberEditor.removeMarks(editor, marks)\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tContemberEditor.addMarks(editor, marks)\n\t\t\treturn true\n\t\t},\n\t\ttoggleElement: <E extends SlateElement>(elementType: E['type'], suchThat?: Partial<E>) => {\n\t\t\telements.get(elementType)?.toggleElement?.({\n\t\t\t\teditor,\n\t\t\t\tsuchThat,\n\t\t\t})\n\t\t},\n\n\t\tisInline: element => {\n\t\t\treturn elements.get(element.type)?.isInline ?? isInline(element)\n\t\t},\n\n\t\tisVoid: element => {\n\t\t\tconst elIsVoid = elements.get(element.type)?.isVoid\n\t\t\tif (elIsVoid === undefined) {\n\t\t\t\treturn isVoid(element)\n\t\t\t}\n\t\t\tif (typeof elIsVoid === 'boolean') {\n\t\t\t\treturn elIsVoid\n\t\t\t}\n\t\t\treturn elIsVoid({ editor, element })\n\t\t},\n\n\t\tcanContainAnyBlocks: element => {\n\t\t\tif (Editor.isEditor(element)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn !editor.isInline(element)\n\t\t\t\t&& !editor.isVoid(element)\n\t\t\t\t&& (elements.has(element.type) ? elements.get(element.type)!.canContainAnyBlocks ?? false : true)\n\t\t},\n\n\t\tserializeNodes: (nodes, errorMessage) => ContemberEditor.serializeNodes(editor, nodes, errorMessage),\n\t\tdeserializeNodes: (serializedNodes, errorMessage) =>\n\t\t\tContemberEditor.permissivelyDeserializeNodes(editor, serializedNodes, errorMessage),\n\n\t\tupgradeFormatBySingleVersion: (node, oldVersion) => {\n\t\t\tif (SlateElement.isElement(node)) {\n\t\t\t\treturn {\n\t\t\t\t\t...node,\n\t\t\t\t\tchildren: node.children.map(child => editor.upgradeFormatBySingleVersion(child, oldVersion) as Descendant),\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn node\n\t\t},\n\n\t\trenderElement: props => {\n\t\t\tconst component = elements.get(props.element.type)?.render ?? DefaultElement\n\t\t\treturn createElement(component, props)\n\t\t},\n\n\t\trenderLeafChildren: props => props.children,\n\n\t\trenderLeaf: props => {\n\t\t\tlet el: ReactElement = createElement('span', props.attributes, editor.renderLeafChildren(props))\n\t\t\tfor (const [, mark] of marks) {\n\t\t\t\tif (props.leaf[mark.type] === true) {\n\t\t\t\t\tconst markerEl = mark.render({ ...props, children: el })\n\t\t\t\t\tif (markerEl !== null) {\n\t\t\t\t\t\tif (!isValidElement(markerEl)) {\n\t\t\t\t\t\t\tthrow new Error(`Mark plugin ${mark.type} returned a non-React element`)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tel = markerEl\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn el\n\t\t},\n\n\t\t// Just noop functions so that other plugins can safely bubble-call\n\t\tonDOMBeforeInput: () => {},\n\t\tonKeyDown: e => {\n\t\t\tfor (const [, mark] of marks) {\n\t\t\t\tif (mark.isHotKey(e.nativeEvent)) {\n\t\t\t\t\teditor.toggleMarks({ [mark.type]: true })\n\t\t\t\t\te.preventDefault()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\t// Inline void nodes cannot be deleted by default: https://github.com/ianstormtaylor/slate/issues/3456\n\t\t\t// This is a hack to get around this issue. The problem is that when an inline void node is selected, Slate's\n\t\t\t// beforeInput handler doesn't get triggered. However, when we put the caret right after the inline void\n\t\t\t// and press Backspace (or the other way around with Delete), it works just fine. Furthermore, if we deleted the\n\t\t\t// node directly, either we'd lose the selection state or Slate, not knowing about us deleting, would still\n\t\t\t// try to delete things on its own so as to respond to the user interaction. So we take advantage of this and\n\t\t\t// instead of deleting the void node, we just carefully move the selection and have Slate do the deleting.\n\t\t\tif (e.key !== 'Delete' && e.key !== 'Backspace') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst selection = editor.selection\n\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst voidEntry = Editor.void(editor, {\n\t\t\t\t\tat: selection,\n\t\t\t\t\tmode: 'lowest',\n\t\t\t\t\tvoids: true,\n\t\t\t\t})\n\t\t\t\tif (!voidEntry) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst [node, nodePath] = voidEntry\n\t\t\t\tif (editor.isInline(node)) {\n\t\t\t\t\tconst adjacentPoint =\n\t\t\t\t\t\te.key === 'Backspace'\n\t\t\t\t\t\t\t? Editor.point(editor, Path.next(nodePath), {\n\t\t\t\t\t\t\t\tedge: 'start',\n\t\t\t\t\t\t\t })\n\t\t\t\t\t\t\t: Editor.point(editor, Path.previous(nodePath), {\n\t\t\t\t\t\t\t\tedge: 'end',\n\t\t\t\t\t\t\t })\n\t\t\t\t\tTransforms.select(editor, adjacentPoint)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tonFocus: () => {},\n\t\tonBlur: () => {},\n\t\tnormalizeNode: ([node, path]) => {\n\t\t\tif (Editor.isEditor(node) && node.children.length === 0) {\n\t\t\t\tTransforms.insertNodes(editor, editor.createDefaultElement([{ text: '' }]))\n\t\t\t}\n\t\t\tif (!SlateElement.isElement(node)) {\n\t\t\t\tnormalizeNode([node, path])\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlet defaultPrevented = false\n\t\t\telements.get(node.type)?.normalizeNode?.({\n\t\t\t\telement: node,\n\t\t\t\tpath,\n\t\t\t\teditor,\n\t\t\t\tpreventDefault: () => {\n\t\t\t\t\tdefaultPrevented = true\n\t\t\t\t},\n\t\t\t})\n\t\t\tif (!defaultPrevented) {\n\t\t\t\tnormalizeNode([node, path])\n\t\t\t}\n\t\t},\n\t\tregisterElement: plugin => {\n\t\t\telements.set(plugin.type, plugin)\n\t\t},\n\t\tregisterMark: plugin => {\n\t\t\tmarks.set(plugin.type, plugin)\n\t\t},\n\n\t\tdeleteBackward: unit => {\n\t\t\tconst selection = editor.selection\n\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst [node, nodePath] = Editor.node(editor, [selection.focus.path[0]])\n\t\t\t\tif (SlateElement.isElement(node) && SlateNode.string(node) === '') {\n\t\t\t\t\tconst previous = Editor.previous(editor, {\n\t\t\t\t\t\tat: nodePath,\n\t\t\t\t\t\tvoids: true,\n\t\t\t\t\t})\n\n\t\t\t\t\tif (previous) {\n\t\t\t\t\t\tconst [previousNode] = previous\n\t\t\t\t\t\tif (SlateElement.isElement(previousNode) && editor.isVoid(previousNode)) {\n\t\t\t\t\t\t\teditor.apply({\n\t\t\t\t\t\t\t\ttype: 'remove_node',\n\t\t\t\t\t\t\t\tpath: nodePath,\n\t\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tdeleteBackward(unit)\n\t\t},\n\t})\n\n\twithPaste(editor)\n\n\treturn editor\n}\n"],"names":["withHistory","withReact","createEditor","Slate","Transforms","marks","ContemberEditor","Editor","SlateElement","DefaultElement","createElement","isValidElement","SlateRange","Path","SlateNode","withPaste"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAWO,MAAM,6BAA6B,CAAC,EAAE,yBAAiE;AAC7G,QAAM,mBAAmBA,aAAA,YAAYC,WAAU,UAAAC,MAAA,aAAA,CAA6B,CAAC;AAE7E,QAAM,SAAS;AACf,QAAM,EAAE,eAAe,UAAU,QAAQ,mBAAmB;AAEtD,QAAA,+BAAe;AACf,QAAA,4BAAY;AAElB,SAAO,OAAgC,QAAQ;AAAA,IAC9C,OAAOC;AAAAA,IACP,eAAe;AAAA,IACf;AAAA,IACA,kBAAkB,CAAA,YAAW,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;AACzC,YAAA,aAAa,SAAS,WAAW,IAAI;AAC3C,YAAM,aAAa,KAAK,MAAM,GAAG,EAAE,EAAE,OAAO,KAAK,KAAK,SAAS,CAAC,IAAI,UAAU;AACnEC,uBAAA,YAAY,QAAQ,OAAO,qBAAqB,CAAC,EAAE,MAAM,GAAI,CAAA,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;AAC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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 { createEditor, Descendant, Editor, Element as SlateElement, Node as SlateNode, Path, Range as SlateRange, Text as SlateText, Transforms } from 'slate'\nimport * as Slate from 'slate'\nimport { withHistory } from 'slate-history'\nimport { ReactEditor, withReact } from 'slate-react'\nimport { EditorElementPlugin, EditorMarkPlugin } from '../types/plugins'\nimport { TextSpecifics } from '../types/editor'\nimport { DefaultElement } from '../internal/components/DefaultElement'\nimport { withPaste } from '../plugins/behaviour'\nimport { ContemberEditor } from './index'\n\nexport const createEditorWithEssentials = ({ defaultElementType }: { defaultElementType: string }): Editor => {\n\tconst underlyingEditor = withHistory(withReact(createEditor() as ReactEditor))\n\n\tconst editor = underlyingEditor as unknown as Editor\n\tconst { normalizeNode, isInline, isVoid, deleteBackward } = editor\n\n\tconst elements = new Map<string, EditorElementPlugin<any>>()\n\tconst marks = new Map<string, EditorMarkPlugin>()\n\n\tObject.assign<Editor, Partial<Editor>>(editor, {\n\t\tslate: Slate,\n\t\tformatVersion: 1,\n\t\tdefaultElementType,\n\t\tisDefaultElement: element => 'type' in element && (element as any).type === defaultElementType,\n\t\tcreateDefaultElement: children => ({\n\t\t\ttype: defaultElementType,\n\t\t\tchildren,\n\t\t}),\n\t\tinsertBetweenBlocks: ([element, path], edge) => {\n\t\t\tconst edgeOffset = edge === 'before' ? 0 : 1\n\t\t\tconst targetPath = path.slice(0, -1).concat(path[path.length - 1] + edgeOffset)\n\t\t\tTransforms.insertNodes(editor, editor.createDefaultElement([{ text: '' }]), {\n\t\t\t\tat: targetPath,\n\t\t\t\tselect: true,\n\t\t\t})\n\t\t},\n\n\t\tcanToggleMarks: () => true,\n\t\tcanToggleElement: <E extends SlateElement>() => true,\n\n\t\thasMarks: <T extends SlateText>(marks: TextSpecifics<T>) => ContemberEditor.hasMarks(editor, marks),\n\n\t\t// TODO in the following function, we need to conditionally trim the selection so that it doesn't potentially\n\t\t// \tinclude empty strings at the edges of top-level elements.\n\t\tisElementActive: <E extends SlateElement>(elementType: E['type'], suchThat?: Partial<E>) => {\n\t\t\treturn (\n\t\t\t\telements.get(elementType)?.isActive?.({ editor, suchThat })\n\t\t\t\t?? Array.from(Editor.nodes(editor, {\n\t\t\t\t\tmatch: node => SlateElement.isElement(node) && ContemberEditor.isElementType(node, elementType, suchThat),\n\t\t\t\t\tvoids: false,\n\t\t\t\t})).length > 0\n\t\t\t)\n\t\t},\n\n\t\tacceptsAttributes: <E extends SlateElement>(elementType: E['type'], suchThat: Partial<E>) => {\n\t\t\treturn elements.get(elementType)?.acceptsAttributes?.({ editor, suchThat }) ?? false\n\t\t},\n\n\t\ttoggleMarks: <T extends SlateText>(marks: TextSpecifics<T>) => {\n\t\t\tif (!editor.canToggleMarks(marks)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst isActive = editor.hasMarks(marks)\n\t\t\tif (isActive) {\n\t\t\t\tContemberEditor.removeMarks(editor, marks)\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tContemberEditor.addMarks(editor, marks)\n\t\t\treturn true\n\t\t},\n\t\ttoggleElement: <E extends SlateElement>(elementType: E['type'], suchThat?: Partial<E>) => {\n\t\t\telements.get(elementType)?.toggleElement?.({\n\t\t\t\teditor,\n\t\t\t\tsuchThat,\n\t\t\t})\n\t\t},\n\n\t\tisInline: element => {\n\t\t\treturn elements.get(element.type)?.isInline ?? isInline(element)\n\t\t},\n\n\t\tisVoid: element => {\n\t\t\tconst elIsVoid = elements.get(element.type)?.isVoid\n\t\t\tif (elIsVoid === undefined) {\n\t\t\t\treturn isVoid(element)\n\t\t\t}\n\t\t\tif (typeof elIsVoid === 'boolean') {\n\t\t\t\treturn elIsVoid\n\t\t\t}\n\t\t\treturn elIsVoid({ editor, element })\n\t\t},\n\n\t\tcanContainAnyBlocks: element => {\n\t\t\tif (Editor.isEditor(element)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn !editor.isInline(element)\n\t\t\t\t&& !editor.isVoid(element)\n\t\t\t\t&& (elements.has(element.type) ? elements.get(element.type)!.canContainAnyBlocks ?? false : true)\n\t\t},\n\n\t\tserializeNodes: (nodes, errorMessage) => ContemberEditor.serializeNodes(editor, nodes, errorMessage),\n\t\tdeserializeNodes: (serializedNodes, errorMessage) =>\n\t\t\tContemberEditor.permissivelyDeserializeNodes(editor, serializedNodes, errorMessage),\n\n\t\tupgradeFormatBySingleVersion: (node, oldVersion) => {\n\t\t\tif (SlateElement.isElement(node)) {\n\t\t\t\treturn {\n\t\t\t\t\t...node,\n\t\t\t\t\tchildren: node.children.map(child => editor.upgradeFormatBySingleVersion(child, oldVersion) as Descendant),\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn node\n\t\t},\n\n\t\trenderElement: props => {\n\t\t\tconst component = elements.get(props.element.type)?.render ?? DefaultElement\n\t\t\treturn createElement(component, props)\n\t\t},\n\n\t\trenderLeafChildren: props => props.children,\n\n\t\trenderLeaf: props => {\n\t\t\tlet el: ReactElement = createElement('span', props.attributes, editor.renderLeafChildren(props))\n\t\t\tfor (const [, mark] of marks) {\n\t\t\t\tif (props.leaf[mark.type] === true) {\n\t\t\t\t\tconst markerEl = mark.render({ ...props, children: el })\n\t\t\t\t\tif (markerEl !== null) {\n\t\t\t\t\t\tif (!isValidElement(markerEl)) {\n\t\t\t\t\t\t\tthrow new Error(`Mark plugin ${mark.type} returned a non-React element`)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tel = markerEl\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn el\n\t\t},\n\n\t\t// Just noop functions so that other plugins can safely bubble-call\n\t\tonDOMBeforeInput: () => {},\n\t\tonKeyDown: e => {\n\t\t\tfor (const [, mark] of marks) {\n\t\t\t\tif (mark.isHotKey(e.nativeEvent)) {\n\t\t\t\t\teditor.toggleMarks({ [mark.type]: true })\n\t\t\t\t\te.preventDefault()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\t// Inline void nodes cannot be deleted by default: https://github.com/ianstormtaylor/slate/issues/3456\n\t\t\t// This is a hack to get around this issue. The problem is that when an inline void node is selected, Slate's\n\t\t\t// beforeInput handler doesn't get triggered. However, when we put the caret right after the inline void\n\t\t\t// and press Backspace (or the other way around with Delete), it works just fine. Furthermore, if we deleted the\n\t\t\t// node directly, either we'd lose the selection state or Slate, not knowing about us deleting, would still\n\t\t\t// try to delete things on its own so as to respond to the user interaction. So we take advantage of this and\n\t\t\t// instead of deleting the void node, we just carefully move the selection and have Slate do the deleting.\n\t\t\tif (e.key !== 'Delete' && e.key !== 'Backspace') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst selection = editor.selection\n\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst voidEntry = Editor.void(editor, {\n\t\t\t\t\tat: selection,\n\t\t\t\t\tmode: 'lowest',\n\t\t\t\t\tvoids: true,\n\t\t\t\t})\n\t\t\t\tif (!voidEntry) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst [node, nodePath] = voidEntry\n\t\t\t\tif (editor.isInline(node)) {\n\t\t\t\t\tconst adjacentPoint =\n\t\t\t\t\t\te.key === 'Backspace'\n\t\t\t\t\t\t\t? Editor.point(editor, Path.next(nodePath), {\n\t\t\t\t\t\t\t\tedge: 'start',\n\t\t\t\t\t\t\t })\n\t\t\t\t\t\t\t: Editor.point(editor, Path.previous(nodePath), {\n\t\t\t\t\t\t\t\tedge: 'end',\n\t\t\t\t\t\t\t })\n\t\t\t\t\tTransforms.select(editor, adjacentPoint)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tonFocus: () => {},\n\t\tonBlur: () => {},\n\t\tnormalizeNode: ([node, path]) => {\n\t\t\tif (Editor.isEditor(node) && node.children.length === 0) {\n\t\t\t\tTransforms.insertNodes(editor, editor.createDefaultElement([{ text: '' }]))\n\t\t\t}\n\t\t\tif (!SlateElement.isElement(node)) {\n\t\t\t\tnormalizeNode([node, path])\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlet defaultPrevented = false\n\t\t\telements.get(node.type)?.normalizeNode?.({\n\t\t\t\telement: node,\n\t\t\t\tpath,\n\t\t\t\teditor,\n\t\t\t\tpreventDefault: () => {\n\t\t\t\t\tdefaultPrevented = true\n\t\t\t\t},\n\t\t\t})\n\t\t\tif (!defaultPrevented) {\n\t\t\t\tnormalizeNode([node, path])\n\t\t\t}\n\t\t},\n\t\tregisterElement: plugin => {\n\t\t\telements.set(plugin.type, plugin)\n\t\t},\n\t\tregisterMark: plugin => {\n\t\t\tmarks.set(plugin.type, plugin)\n\t\t},\n\n\t\tdeleteBackward: unit => {\n\t\t\tconst selection = editor.selection\n\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst [node, nodePath] = Editor.node(editor, [selection.focus.path[0]])\n\t\t\t\tif (SlateElement.isElement(node) && SlateNode.string(node) === '') {\n\t\t\t\t\tconst previous = Editor.previous(editor, {\n\t\t\t\t\t\tat: nodePath,\n\t\t\t\t\t\tvoids: true,\n\t\t\t\t\t})\n\n\t\t\t\t\tif (previous) {\n\t\t\t\t\t\tconst [previousNode] = previous\n\t\t\t\t\t\tif (SlateElement.isElement(previousNode) && editor.isVoid(previousNode)) {\n\t\t\t\t\t\t\teditor.apply({\n\t\t\t\t\t\t\t\ttype: 'remove_node',\n\t\t\t\t\t\t\t\tpath: nodePath,\n\t\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tdeleteBackward(unit)\n\t\t},\n\t})\n\n\twithPaste(editor)\n\n\treturn editor\n}\n"],"names":["withHistory","withReact","createEditor","Slate","Transforms","marks","ContemberEditor","Editor","SlateElement","DefaultElement","createElement","isValidElement","SlateRange","Path","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,gBAAgB,MAAM;AACF,6BAAA;AAAA,QAAA;AAAA,MACpB,CACA;AACD,UAAI,CAAC,kBAAkB;AACR,sBAAA,CAAC,MAAM,IAAI,CAAC;AAAA,MAAA;AAAA,IAE5B;AAAA,IACA,iBAAiB,CAAU,WAAA;AACjB,eAAA,IAAI,OAAO,MAAM,MAAM;AAAA,IACjC;AAAA,IACA,cAAc,CAAU,WAAA;AACjB,YAAA,IAAI,OAAO,MAAM,MAAM;AAAA,IAC9B;AAAA,IAEA,gBAAgB,CAAQ,SAAA;AACvB,YAAM,YAAY,OAAO;AAEzB,UAAI,aAAaI,MAAAA,MAAW,YAAY,SAAS,GAAG;AACnD,cAAM,CAAC,MAAM,QAAQ,IAAIL,MAAO,OAAA,KAAK,QAAQ,CAAC,UAAU,MAAM,KAAK,CAAC,CAAC,CAAC;AAClE,YAAAC,MAAA,QAAa,UAAU,IAAI,KAAKM,WAAU,OAAO,IAAI,MAAM,IAAI;AAC5D,gBAAA,WAAWP,MAAAA,OAAO,SAAS,QAAQ;AAAA,YACxC,IAAI;AAAA,YACJ,OAAO;AAAA,UAAA,CACP;AAED,cAAI,UAAU;AACP,kBAAA,CAAC,YAAY,IAAI;AACvB,gBAAIC,MAAAA,QAAa,UAAU,YAAY,KAAK,OAAO,OAAO,YAAY,GAAG;AACxE,qBAAO,MAAM;AAAA,gBACZ,MAAM;AAAA,gBACN,MAAM;AAAA,gBACN;AAAA,cAAA,CACA;AACD;AAAA,YAAA;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAED,qBAAe,IAAI;AAAA,IAAA;AAAA,EACpB,CACA;AAEDO,YAAAA,UAAU,MAAM;AAET,SAAA;AACR;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"createEditorWithEssentials.js","sources":["../../../../../packages/react-slate-editor-base/src/editor/createEditorWithEssentials.tsx"],"sourcesContent":["import { createElement, isValidElement, ReactElement } from 'react'\nimport { createEditor, Descendant, Editor, Element as SlateElement, Node as SlateNode, Path, Range as SlateRange, Text as SlateText, Transforms } from 'slate'\nimport * as Slate from 'slate'\nimport { withHistory } from 'slate-history'\nimport { ReactEditor, withReact } from 'slate-react'\nimport { EditorElementPlugin, EditorMarkPlugin } from '../types/plugins'\nimport { TextSpecifics } from '../types/editor'\nimport { DefaultElement } from '../internal/components/DefaultElement'\nimport { withPaste } from '../plugins/behaviour'\nimport { ContemberEditor } from './index'\n\nexport const createEditorWithEssentials = ({ defaultElementType }: { defaultElementType: string }): Editor => {\n\tconst underlyingEditor = withHistory(withReact(createEditor() as ReactEditor))\n\n\tconst editor = underlyingEditor as unknown as Editor\n\tconst { normalizeNode, isInline, isVoid, deleteBackward } = editor\n\n\tconst elements = new Map<string, EditorElementPlugin<any>>()\n\tconst marks = new Map<string, EditorMarkPlugin>()\n\n\tObject.assign<Editor, Partial<Editor>>(editor, {\n\t\tslate: Slate,\n\t\tformatVersion: 1,\n\t\tdefaultElementType,\n\t\tisDefaultElement: element => 'type' in element && (element as any).type === defaultElementType,\n\t\tcreateDefaultElement: children => ({\n\t\t\ttype: defaultElementType,\n\t\t\tchildren,\n\t\t}),\n\t\tinsertBetweenBlocks: ([element, path], edge) => {\n\t\t\tconst edgeOffset = edge === 'before' ? 0 : 1\n\t\t\tconst targetPath = path.slice(0, -1).concat(path[path.length - 1] + edgeOffset)\n\t\t\tTransforms.insertNodes(editor, editor.createDefaultElement([{ text: '' }]), {\n\t\t\t\tat: targetPath,\n\t\t\t\tselect: true,\n\t\t\t})\n\t\t},\n\n\t\tcanToggleMarks: () => true,\n\t\tcanToggleElement: <E extends SlateElement>() => true,\n\n\t\thasMarks: <T extends SlateText>(marks: TextSpecifics<T>) => ContemberEditor.hasMarks(editor, marks),\n\n\t\t// TODO in the following function, we need to conditionally trim the selection so that it doesn't potentially\n\t\t// \tinclude empty strings at the edges of top-level elements.\n\t\tisElementActive: <E extends SlateElement>(elementType: E['type'], suchThat?: Partial<E>) => {\n\t\t\treturn (\n\t\t\t\telements.get(elementType)?.isActive?.({ editor, suchThat })\n\t\t\t\t?? Array.from(Editor.nodes(editor, {\n\t\t\t\t\tmatch: node => SlateElement.isElement(node) && ContemberEditor.isElementType(node, elementType, suchThat),\n\t\t\t\t\tvoids: false,\n\t\t\t\t})).length > 0\n\t\t\t)\n\t\t},\n\n\t\tacceptsAttributes: <E extends SlateElement>(elementType: E['type'], suchThat: Partial<E>) => {\n\t\t\treturn elements.get(elementType)?.acceptsAttributes?.({ editor, suchThat }) ?? false\n\t\t},\n\n\t\ttoggleMarks: <T extends SlateText>(marks: TextSpecifics<T>) => {\n\t\t\tif (!editor.canToggleMarks(marks)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst isActive = editor.hasMarks(marks)\n\t\t\tif (isActive) {\n\t\t\t\tContemberEditor.removeMarks(editor, marks)\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tContemberEditor.addMarks(editor, marks)\n\t\t\treturn true\n\t\t},\n\t\ttoggleElement: <E extends SlateElement>(elementType: E['type'], suchThat?: Partial<E>) => {\n\t\t\telements.get(elementType)?.toggleElement?.({\n\t\t\t\teditor,\n\t\t\t\tsuchThat,\n\t\t\t})\n\t\t},\n\n\t\tisInline: element => {\n\t\t\treturn elements.get(element.type)?.isInline ?? isInline(element)\n\t\t},\n\n\t\tisVoid: element => {\n\t\t\tconst elIsVoid = elements.get(element.type)?.isVoid\n\t\t\tif (elIsVoid === undefined) {\n\t\t\t\treturn isVoid(element)\n\t\t\t}\n\t\t\tif (typeof elIsVoid === 'boolean') {\n\t\t\t\treturn elIsVoid\n\t\t\t}\n\t\t\treturn elIsVoid({ editor, element })\n\t\t},\n\n\t\tcanContainAnyBlocks: element => {\n\t\t\tif (Editor.isEditor(element)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn !editor.isInline(element)\n\t\t\t\t&& !editor.isVoid(element)\n\t\t\t\t&& (elements.has(element.type) ? elements.get(element.type)!.canContainAnyBlocks ?? false : true)\n\t\t},\n\n\t\tserializeNodes: (nodes, errorMessage) => ContemberEditor.serializeNodes(editor, nodes, errorMessage),\n\t\tdeserializeNodes: (serializedNodes, errorMessage) =>\n\t\t\tContemberEditor.permissivelyDeserializeNodes(editor, serializedNodes, errorMessage),\n\n\t\tupgradeFormatBySingleVersion: (node, oldVersion) => {\n\t\t\tif (SlateElement.isElement(node)) {\n\t\t\t\treturn {\n\t\t\t\t\t...node,\n\t\t\t\t\tchildren: node.children.map(child => editor.upgradeFormatBySingleVersion(child, oldVersion) as Descendant),\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn node\n\t\t},\n\n\t\trenderElement: props => {\n\t\t\tconst component = elements.get(props.element.type)?.render ?? DefaultElement\n\t\t\treturn createElement(component, props)\n\t\t},\n\n\t\trenderLeafChildren: props => props.children,\n\n\t\trenderLeaf: props => {\n\t\t\tlet el: ReactElement = createElement('span', props.attributes, editor.renderLeafChildren(props))\n\t\t\tfor (const [, mark] of marks) {\n\t\t\t\tif (props.leaf[mark.type] === true) {\n\t\t\t\t\tconst markerEl = mark.render({ ...props, children: el })\n\t\t\t\t\tif (markerEl !== null) {\n\t\t\t\t\t\tif (!isValidElement(markerEl)) {\n\t\t\t\t\t\t\tthrow new Error(`Mark plugin ${mark.type} returned a non-React element`)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tel = markerEl\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn el\n\t\t},\n\n\t\t// Just noop functions so that other plugins can safely bubble-call\n\t\tonDOMBeforeInput: () => {},\n\t\tonKeyDown: e => {\n\t\t\tfor (const [, mark] of marks) {\n\t\t\t\tif (mark.isHotKey(e.nativeEvent)) {\n\t\t\t\t\teditor.toggleMarks({ [mark.type]: true })\n\t\t\t\t\te.preventDefault()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\t// Inline void nodes cannot be deleted by default: https://github.com/ianstormtaylor/slate/issues/3456\n\t\t\t// This is a hack to get around this issue. The problem is that when an inline void node is selected, Slate's\n\t\t\t// beforeInput handler doesn't get triggered. However, when we put the caret right after the inline void\n\t\t\t// and press Backspace (or the other way around with Delete), it works just fine. Furthermore, if we deleted the\n\t\t\t// node directly, either we'd lose the selection state or Slate, not knowing about us deleting, would still\n\t\t\t// try to delete things on its own so as to respond to the user interaction. So we take advantage of this and\n\t\t\t// instead of deleting the void node, we just carefully move the selection and have Slate do the deleting.\n\t\t\tif (e.key !== 'Delete' && e.key !== 'Backspace') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst selection = editor.selection\n\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst voidEntry = Editor.void(editor, {\n\t\t\t\t\tat: selection,\n\t\t\t\t\tmode: 'lowest',\n\t\t\t\t\tvoids: true,\n\t\t\t\t})\n\t\t\t\tif (!voidEntry) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst [node, nodePath] = voidEntry\n\t\t\t\tif (editor.isInline(node)) {\n\t\t\t\t\tconst adjacentPoint =\n\t\t\t\t\t\te.key === 'Backspace'\n\t\t\t\t\t\t\t? Editor.point(editor, Path.next(nodePath), {\n\t\t\t\t\t\t\t\tedge: 'start',\n\t\t\t\t\t\t\t })\n\t\t\t\t\t\t\t: Editor.point(editor, Path.previous(nodePath), {\n\t\t\t\t\t\t\t\tedge: 'end',\n\t\t\t\t\t\t\t })\n\t\t\t\t\tTransforms.select(editor, adjacentPoint)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tonFocus: () => {},\n\t\tonBlur: () => {},\n\t\tnormalizeNode: ([node, path]) => {\n\t\t\tif (Editor.isEditor(node) && node.children.length === 0) {\n\t\t\t\tTransforms.insertNodes(editor, editor.createDefaultElement([{ text: '' }]))\n\t\t\t}\n\t\t\tif (!SlateElement.isElement(node)) {\n\t\t\t\tnormalizeNode([node, path])\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlet defaultPrevented = false\n\t\t\telements.get(node.type)?.normalizeNode?.({\n\t\t\t\telement: node,\n\t\t\t\tpath,\n\t\t\t\teditor,\n\t\t\t\tpreventDefault: () => {\n\t\t\t\t\tdefaultPrevented = true\n\t\t\t\t},\n\t\t\t})\n\t\t\tif (!defaultPrevented) {\n\t\t\t\tnormalizeNode([node, path])\n\t\t\t}\n\t\t},\n\t\tregisterElement: plugin => {\n\t\t\telements.set(plugin.type, plugin)\n\t\t},\n\t\tregisterMark: plugin => {\n\t\t\tmarks.set(plugin.type, plugin)\n\t\t},\n\n\t\tdeleteBackward: unit => {\n\t\t\tconst selection = editor.selection\n\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst [node, nodePath] = Editor.node(editor, [selection.focus.path[0]])\n\t\t\t\tif (SlateElement.isElement(node) && SlateNode.string(node) === '') {\n\t\t\t\t\tconst previous = Editor.previous(editor, {\n\t\t\t\t\t\tat: nodePath,\n\t\t\t\t\t\tvoids: true,\n\t\t\t\t\t})\n\n\t\t\t\t\tif (previous) {\n\t\t\t\t\t\tconst [previousNode] = previous\n\t\t\t\t\t\tif (SlateElement.isElement(previousNode) && editor.isVoid(previousNode)) {\n\t\t\t\t\t\t\teditor.apply({\n\t\t\t\t\t\t\t\ttype: 'remove_node',\n\t\t\t\t\t\t\t\tpath: nodePath,\n\t\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tdeleteBackward(unit)\n\t\t},\n\t})\n\n\twithPaste(editor)\n\n\treturn editor\n}\n"],"names":["marks","SlateElement","SlateRange","SlateNode"],"mappings":";;;;;;;;AAWO,MAAM,6BAA6B,CAAC,EAAE,yBAAiE;AAC7G,QAAM,mBAAmB,YAAY,UAAU,aAAA,CAA6B,CAAC;AAE7E,QAAM,SAAS;AACf,QAAM,EAAE,eAAe,UAAU,QAAQ,mBAAmB;AAEtD,QAAA,+BAAe;AACf,QAAA,4BAAY;AAElB,SAAO,OAAgC,QAAQ;AAAA,IAC9C,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AD,QAAa,UAAU,IAAI,KAAKE,KAAU,OAAO,IAAI,MAAM,IAAI;AAC5D,gBAAA,WAAW,OAAO,SAAS,QAAQ;AAAA,YACxC,IAAI;AAAA,YACJ,OAAO;AAAA,UAAA,CACP;AAED,cAAI,UAAU;AACP,kBAAA,CAAC,YAAY,IAAI;AACvB,gBAAIF,QAAa,UAAU,YAAY,KAAK,OAAO,OAAO,YAAY,GAAG;AACxE,qBAAO,MAAM;AAAA,gBACZ,MAAM;AAAA,gBACN,MAAM;AAAA,gBACN;AAAA,cAAA,CACA;AACD;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,MACD;AACA,qBAAe,IAAI;AAAA,IACpB;AAAA,EAAA,CACA;AAED,YAAU,MAAM;AAET,SAAA;AACR;"}
1
+ {"version":3,"file":"createEditorWithEssentials.js","sources":["../../../../../packages/react-slate-editor-base/src/editor/createEditorWithEssentials.tsx"],"sourcesContent":["import { createElement, isValidElement, ReactElement } from 'react'\nimport { createEditor, Descendant, Editor, Element as SlateElement, Node as SlateNode, Path, Range as SlateRange, Text as SlateText, Transforms } from 'slate'\nimport * as Slate from 'slate'\nimport { withHistory } from 'slate-history'\nimport { ReactEditor, withReact } from 'slate-react'\nimport { EditorElementPlugin, EditorMarkPlugin } from '../types/plugins'\nimport { TextSpecifics } from '../types/editor'\nimport { DefaultElement } from '../internal/components/DefaultElement'\nimport { withPaste } from '../plugins/behaviour'\nimport { ContemberEditor } from './index'\n\nexport const createEditorWithEssentials = ({ defaultElementType }: { defaultElementType: string }): Editor => {\n\tconst underlyingEditor = withHistory(withReact(createEditor() as ReactEditor))\n\n\tconst editor = underlyingEditor as unknown as Editor\n\tconst { normalizeNode, isInline, isVoid, deleteBackward } = editor\n\n\tconst elements = new Map<string, EditorElementPlugin<any>>()\n\tconst marks = new Map<string, EditorMarkPlugin>()\n\n\tObject.assign<Editor, Partial<Editor>>(editor, {\n\t\tslate: Slate,\n\t\tformatVersion: 1,\n\t\tdefaultElementType,\n\t\tisDefaultElement: element => 'type' in element && (element as any).type === defaultElementType,\n\t\tcreateDefaultElement: children => ({\n\t\t\ttype: defaultElementType,\n\t\t\tchildren,\n\t\t}),\n\t\tinsertBetweenBlocks: ([element, path], edge) => {\n\t\t\tconst edgeOffset = edge === 'before' ? 0 : 1\n\t\t\tconst targetPath = path.slice(0, -1).concat(path[path.length - 1] + edgeOffset)\n\t\t\tTransforms.insertNodes(editor, editor.createDefaultElement([{ text: '' }]), {\n\t\t\t\tat: targetPath,\n\t\t\t\tselect: true,\n\t\t\t})\n\t\t},\n\n\t\tcanToggleMarks: () => true,\n\t\tcanToggleElement: <E extends SlateElement>() => true,\n\n\t\thasMarks: <T extends SlateText>(marks: TextSpecifics<T>) => ContemberEditor.hasMarks(editor, marks),\n\n\t\t// TODO in the following function, we need to conditionally trim the selection so that it doesn't potentially\n\t\t// \tinclude empty strings at the edges of top-level elements.\n\t\tisElementActive: <E extends SlateElement>(elementType: E['type'], suchThat?: Partial<E>) => {\n\t\t\treturn (\n\t\t\t\telements.get(elementType)?.isActive?.({ editor, suchThat })\n\t\t\t\t?? Array.from(Editor.nodes(editor, {\n\t\t\t\t\tmatch: node => SlateElement.isElement(node) && ContemberEditor.isElementType(node, elementType, suchThat),\n\t\t\t\t\tvoids: false,\n\t\t\t\t})).length > 0\n\t\t\t)\n\t\t},\n\n\t\tacceptsAttributes: <E extends SlateElement>(elementType: E['type'], suchThat: Partial<E>) => {\n\t\t\treturn elements.get(elementType)?.acceptsAttributes?.({ editor, suchThat }) ?? false\n\t\t},\n\n\t\ttoggleMarks: <T extends SlateText>(marks: TextSpecifics<T>) => {\n\t\t\tif (!editor.canToggleMarks(marks)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst isActive = editor.hasMarks(marks)\n\t\t\tif (isActive) {\n\t\t\t\tContemberEditor.removeMarks(editor, marks)\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tContemberEditor.addMarks(editor, marks)\n\t\t\treturn true\n\t\t},\n\t\ttoggleElement: <E extends SlateElement>(elementType: E['type'], suchThat?: Partial<E>) => {\n\t\t\telements.get(elementType)?.toggleElement?.({\n\t\t\t\teditor,\n\t\t\t\tsuchThat,\n\t\t\t})\n\t\t},\n\n\t\tisInline: element => {\n\t\t\treturn elements.get(element.type)?.isInline ?? isInline(element)\n\t\t},\n\n\t\tisVoid: element => {\n\t\t\tconst elIsVoid = elements.get(element.type)?.isVoid\n\t\t\tif (elIsVoid === undefined) {\n\t\t\t\treturn isVoid(element)\n\t\t\t}\n\t\t\tif (typeof elIsVoid === 'boolean') {\n\t\t\t\treturn elIsVoid\n\t\t\t}\n\t\t\treturn elIsVoid({ editor, element })\n\t\t},\n\n\t\tcanContainAnyBlocks: element => {\n\t\t\tif (Editor.isEditor(element)) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn !editor.isInline(element)\n\t\t\t\t&& !editor.isVoid(element)\n\t\t\t\t&& (elements.has(element.type) ? elements.get(element.type)!.canContainAnyBlocks ?? false : true)\n\t\t},\n\n\t\tserializeNodes: (nodes, errorMessage) => ContemberEditor.serializeNodes(editor, nodes, errorMessage),\n\t\tdeserializeNodes: (serializedNodes, errorMessage) =>\n\t\t\tContemberEditor.permissivelyDeserializeNodes(editor, serializedNodes, errorMessage),\n\n\t\tupgradeFormatBySingleVersion: (node, oldVersion) => {\n\t\t\tif (SlateElement.isElement(node)) {\n\t\t\t\treturn {\n\t\t\t\t\t...node,\n\t\t\t\t\tchildren: node.children.map(child => editor.upgradeFormatBySingleVersion(child, oldVersion) as Descendant),\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn node\n\t\t},\n\n\t\trenderElement: props => {\n\t\t\tconst component = elements.get(props.element.type)?.render ?? DefaultElement\n\t\t\treturn createElement(component, props)\n\t\t},\n\n\t\trenderLeafChildren: props => props.children,\n\n\t\trenderLeaf: props => {\n\t\t\tlet el: ReactElement = createElement('span', props.attributes, editor.renderLeafChildren(props))\n\t\t\tfor (const [, mark] of marks) {\n\t\t\t\tif (props.leaf[mark.type] === true) {\n\t\t\t\t\tconst markerEl = mark.render({ ...props, children: el })\n\t\t\t\t\tif (markerEl !== null) {\n\t\t\t\t\t\tif (!isValidElement(markerEl)) {\n\t\t\t\t\t\t\tthrow new Error(`Mark plugin ${mark.type} returned a non-React element`)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tel = markerEl\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn el\n\t\t},\n\n\t\t// Just noop functions so that other plugins can safely bubble-call\n\t\tonDOMBeforeInput: () => {},\n\t\tonKeyDown: e => {\n\t\t\tfor (const [, mark] of marks) {\n\t\t\t\tif (mark.isHotKey(e.nativeEvent)) {\n\t\t\t\t\teditor.toggleMarks({ [mark.type]: true })\n\t\t\t\t\te.preventDefault()\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\t// Inline void nodes cannot be deleted by default: https://github.com/ianstormtaylor/slate/issues/3456\n\t\t\t// This is a hack to get around this issue. The problem is that when an inline void node is selected, Slate's\n\t\t\t// beforeInput handler doesn't get triggered. However, when we put the caret right after the inline void\n\t\t\t// and press Backspace (or the other way around with Delete), it works just fine. Furthermore, if we deleted the\n\t\t\t// node directly, either we'd lose the selection state or Slate, not knowing about us deleting, would still\n\t\t\t// try to delete things on its own so as to respond to the user interaction. So we take advantage of this and\n\t\t\t// instead of deleting the void node, we just carefully move the selection and have Slate do the deleting.\n\t\t\tif (e.key !== 'Delete' && e.key !== 'Backspace') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst selection = editor.selection\n\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst voidEntry = Editor.void(editor, {\n\t\t\t\t\tat: selection,\n\t\t\t\t\tmode: 'lowest',\n\t\t\t\t\tvoids: true,\n\t\t\t\t})\n\t\t\t\tif (!voidEntry) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst [node, nodePath] = voidEntry\n\t\t\t\tif (editor.isInline(node)) {\n\t\t\t\t\tconst adjacentPoint =\n\t\t\t\t\t\te.key === 'Backspace'\n\t\t\t\t\t\t\t? Editor.point(editor, Path.next(nodePath), {\n\t\t\t\t\t\t\t\tedge: 'start',\n\t\t\t\t\t\t\t })\n\t\t\t\t\t\t\t: Editor.point(editor, Path.previous(nodePath), {\n\t\t\t\t\t\t\t\tedge: 'end',\n\t\t\t\t\t\t\t })\n\t\t\t\t\tTransforms.select(editor, adjacentPoint)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tonFocus: () => {},\n\t\tonBlur: () => {},\n\t\tnormalizeNode: ([node, path]) => {\n\t\t\tif (Editor.isEditor(node) && node.children.length === 0) {\n\t\t\t\tTransforms.insertNodes(editor, editor.createDefaultElement([{ text: '' }]))\n\t\t\t}\n\t\t\tif (!SlateElement.isElement(node)) {\n\t\t\t\tnormalizeNode([node, path])\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlet defaultPrevented = false\n\t\t\telements.get(node.type)?.normalizeNode?.({\n\t\t\t\telement: node,\n\t\t\t\tpath,\n\t\t\t\teditor,\n\t\t\t\tpreventDefault: () => {\n\t\t\t\t\tdefaultPrevented = true\n\t\t\t\t},\n\t\t\t})\n\t\t\tif (!defaultPrevented) {\n\t\t\t\tnormalizeNode([node, path])\n\t\t\t}\n\t\t},\n\t\tregisterElement: plugin => {\n\t\t\telements.set(plugin.type, plugin)\n\t\t},\n\t\tregisterMark: plugin => {\n\t\t\tmarks.set(plugin.type, plugin)\n\t\t},\n\n\t\tdeleteBackward: unit => {\n\t\t\tconst selection = editor.selection\n\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst [node, nodePath] = Editor.node(editor, [selection.focus.path[0]])\n\t\t\t\tif (SlateElement.isElement(node) && SlateNode.string(node) === '') {\n\t\t\t\t\tconst previous = Editor.previous(editor, {\n\t\t\t\t\t\tat: nodePath,\n\t\t\t\t\t\tvoids: true,\n\t\t\t\t\t})\n\n\t\t\t\t\tif (previous) {\n\t\t\t\t\t\tconst [previousNode] = previous\n\t\t\t\t\t\tif (SlateElement.isElement(previousNode) && editor.isVoid(previousNode)) {\n\t\t\t\t\t\t\teditor.apply({\n\t\t\t\t\t\t\t\ttype: 'remove_node',\n\t\t\t\t\t\t\t\tpath: nodePath,\n\t\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tdeleteBackward(unit)\n\t\t},\n\t})\n\n\twithPaste(editor)\n\n\treturn editor\n}\n"],"names":["marks","SlateElement","SlateRange","SlateNode"],"mappings":";;;;;;;;AAWO,MAAM,6BAA6B,CAAC,EAAE,yBAAiE;AAC7G,QAAM,mBAAmB,YAAY,UAAU,aAA6B,CAAA,CAAC;AAE7E,QAAM,SAAS;AACf,QAAM,EAAE,eAAe,UAAU,QAAQ,eAAmB,IAAA;AAEtD,QAAA,+BAAe,IAAsC;AACrD,QAAA,4BAAY,IAA8B;AAEhD,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;AACzC,YAAA,aAAa,SAAS,WAAW,IAAI;AAC3C,YAAM,aAAa,KAAK,MAAM,GAAG,EAAE,EAAE,OAAO,KAAK,KAAK,SAAS,CAAC,IAAI,UAAU;AACnE,iBAAA,YAAY,QAAQ,OAAO,qBAAqB,CAAC,EAAE,MAAM,GAAI,CAAA,CAAC,GAAG;AAAA,QAC3E,IAAI;AAAA,QACJ,QAAQ;AAAA,MAAA,CACR;AAAA,IACF;AAAA,IAEA,gBAAgB,MAAM;AAAA,IACtB,kBAAkB,MAA8B;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["../../../../../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,SAAA;AAAA,EAAA,eACAC,cAAA;AAAA,EAAA,SACAC,QAAA;AAAA,EAAA,mBACAC,kBAAA;AAAA,EAAA,kCACAC,iCAAA;AAAA,EAAA,cACAC,aAAA;AAAA,EAAA,oBACAC,mBAAA;AAAA,EAAA,0BACAC,yBAAA;AAAA,EAAA,oBACAC,mBAAA;AAAA,EAAA,UACAC,SAAA;AAAA,EAAA,iBACAC,gBAAA;AAAA,EAAA,eACAC,cAAA;AAAA,EAAA,8BACAC,6BAAA;AAAA,EAAA,aACAC,YAAA;AAAA,EAAA,gBACAC,eAAA;AAAA,EAAA,0BACAC,yBAAA;AAAA,EAAA,iBACAC,gBAAA;AAAA,EAAA,gBACAC,eAAA;AAAA,EAAA,eACAC,cAAA;AACD;;"}
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,SAAA;AAAA,EAAA,eACAC,cAAA;AAAA,EAAA,SACAC,QAAA;AAAA,EAAA,mBACAC,kBAAA;AAAA,EAAA,kCACAC,iCAAA;AAAA,EAAA,cACAC,aAAA;AAAA,EAAA,oBACAC,mBAAA;AAAA,EAAA,0BACAC,yBAAA;AAAA,EAAA,oBACAC,mBAAA;AAAA,EAAA,UACAC,SAAA;AAAA,EAAA,iBACAC,gBAAA;AAAA,EAAA,eACAC,cAAA;AAAA,EAAA,8BACAC,6BAAA;AAAA,EAAA,aACAC,YAAA;AAAA,EAAA,gBACAC,eAAA;AAAA,EAAA,0BACAC,yBAAA;AAAA,EAAA,iBACAC,gBAAA;AAAA,EAAA,gBACAC,eAAA;AAAA,EACAC,eAAAA,cAAAA;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"addMarks.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/addMarks.ts"],"sourcesContent":["import { Editor as SlateEditor, Editor, Text as SlateText } from 'slate'\nimport { TextSpecifics } from '../../types/editor'\n\nexport const addMarks = <T extends SlateText, E extends SlateEditor>(editor: E, marks: TextSpecifics<T>) => {\n\tEditor.withoutNormalizing(editor, () => {\n\t\tfor (const mark in marks) {\n\t\t\tEditor.addMark(editor, mark, (marks as any)[mark])\n\t\t}\n\t})\n}\n"],"names":["Editor"],"mappings":";;;AAGa,MAAA,WAAW,CAA6C,QAAW,UAA4B;AACpGA,eAAA,mBAAmB,QAAQ,MAAM;AACvC,eAAW,QAAQ,OAAO;AACzBA,YAAA,OAAO,QAAQ,QAAQ,MAAO,MAAc,IAAI,CAAC;AAAA,IAClD;AAAA,EAAA,CACA;AACF;;"}
1
+ {"version":3,"file":"addMarks.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/addMarks.ts"],"sourcesContent":["import { Editor as SlateEditor, Editor, Text as SlateText } from 'slate'\nimport { TextSpecifics } from '../../types/editor'\n\nexport const addMarks = <T extends SlateText, E extends SlateEditor>(editor: E, marks: TextSpecifics<T>) => {\n\tEditor.withoutNormalizing(editor, () => {\n\t\tfor (const mark in marks) {\n\t\t\tEditor.addMark(editor, mark, (marks as any)[mark])\n\t\t}\n\t})\n}\n"],"names":["Editor"],"mappings":";;;AAGa,MAAA,WAAW,CAA6C,QAAW,UAA4B;AACpGA,eAAA,mBAAmB,QAAQ,MAAM;AACvC,eAAW,QAAQ,OAAO;AACzBA,YAAA,OAAO,QAAQ,QAAQ,MAAO,MAAc,IAAI,CAAC;AAAA,IAAA;AAAA,EAClD,CACA;AACF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"addMarks.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/addMarks.ts"],"sourcesContent":["import { Editor as SlateEditor, Editor, Text as SlateText } from 'slate'\nimport { TextSpecifics } from '../../types/editor'\n\nexport const addMarks = <T extends SlateText, E extends SlateEditor>(editor: E, marks: TextSpecifics<T>) => {\n\tEditor.withoutNormalizing(editor, () => {\n\t\tfor (const mark in marks) {\n\t\t\tEditor.addMark(editor, mark, (marks as any)[mark])\n\t\t}\n\t})\n}\n"],"names":[],"mappings":";AAGa,MAAA,WAAW,CAA6C,QAAW,UAA4B;AACpG,SAAA,mBAAmB,QAAQ,MAAM;AACvC,eAAW,QAAQ,OAAO;AACzB,aAAO,QAAQ,QAAQ,MAAO,MAAc,IAAI,CAAC;AAAA,IAClD;AAAA,EAAA,CACA;AACF;"}
1
+ {"version":3,"file":"addMarks.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/addMarks.ts"],"sourcesContent":["import { Editor as SlateEditor, Editor, Text as SlateText } from 'slate'\nimport { TextSpecifics } from '../../types/editor'\n\nexport const addMarks = <T extends SlateText, E extends SlateEditor>(editor: E, marks: TextSpecifics<T>) => {\n\tEditor.withoutNormalizing(editor, () => {\n\t\tfor (const mark in marks) {\n\t\t\tEditor.addMark(editor, mark, (marks as any)[mark])\n\t\t}\n\t})\n}\n"],"names":[],"mappings":";AAGa,MAAA,WAAW,CAA6C,QAAW,UAA4B;AACpG,SAAA,mBAAmB,QAAQ,MAAM;AACvC,eAAW,QAAQ,OAAO;AACzB,aAAO,QAAQ,QAAQ,MAAO,MAAc,IAAI,CAAC;AAAA,IAAA;AAAA,EAClD,CACA;AACF;"}
@@ -1 +1 @@
1
- {"version":3,"file":"canToggleMark.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/canToggleMark.ts"],"sourcesContent":["import { Editor as SlateEditor, Text as SlateText } from 'slate'\n\nexport const canToggleMark = <T extends SlateText, E extends SlateEditor>(\n\teditor: E,\n\tmarkName: string,\n\tmarkValue: unknown = true,\n) => {\n\treturn editor.canToggleMarks({ [markName]: markValue })\n}\n"],"names":[],"mappings":";;AAEO,MAAM,gBAAgB,CAC5B,QACA,UACA,YAAqB,SACjB;AACJ,SAAO,OAAO,eAAe,EAAE,CAAC,QAAQ,GAAG,UAAW,CAAA;AACvD;;"}
1
+ {"version":3,"file":"canToggleMark.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/canToggleMark.ts"],"sourcesContent":["import { Editor as SlateEditor, Text as SlateText } from 'slate'\n\nexport const canToggleMark = <T extends SlateText, E extends SlateEditor>(\n\teditor: E,\n\tmarkName: string,\n\tmarkValue: unknown = true,\n) => {\n\treturn editor.canToggleMarks({ [markName]: markValue })\n}\n"],"names":[],"mappings":";;AAEO,MAAM,gBAAgB,CAC5B,QACA,UACA,YAAqB,SACjB;AACJ,SAAO,OAAO,eAAe,EAAE,CAAC,QAAQ,GAAG,WAAW;AACvD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"canToggleMark.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/canToggleMark.ts"],"sourcesContent":["import { Editor as SlateEditor, Text as SlateText } from 'slate'\n\nexport const canToggleMark = <T extends SlateText, E extends SlateEditor>(\n\teditor: E,\n\tmarkName: string,\n\tmarkValue: unknown = true,\n) => {\n\treturn editor.canToggleMarks({ [markName]: markValue })\n}\n"],"names":[],"mappings":"AAEO,MAAM,gBAAgB,CAC5B,QACA,UACA,YAAqB,SACjB;AACJ,SAAO,OAAO,eAAe,EAAE,CAAC,QAAQ,GAAG,UAAW,CAAA;AACvD;"}
1
+ {"version":3,"file":"canToggleMark.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/canToggleMark.ts"],"sourcesContent":["import { Editor as SlateEditor, Text as SlateText } from 'slate'\n\nexport const canToggleMark = <T extends SlateText, E extends SlateEditor>(\n\teditor: E,\n\tmarkName: string,\n\tmarkValue: unknown = true,\n) => {\n\treturn editor.canToggleMarks({ [markName]: markValue })\n}\n"],"names":[],"mappings":"AAEO,MAAM,gBAAgB,CAC5B,QACA,UACA,YAAqB,SACjB;AACJ,SAAO,OAAO,eAAe,EAAE,CAAC,QAAQ,GAAG,WAAW;AACvD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"closest.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/closest.ts"],"sourcesContent":["import { Editor as SlateEditor, Editor, Element, Location, NodeEntry, Text } from 'slate'\n\nexport const closest = <E extends SlateEditor>(\n\teditor: E,\n\toptions: {\n\t\tat?: Location\n\t\tmatch: (node: Editor | Element) => boolean\n\t},\n): NodeEntry<Editor | Element> | undefined => {\n\tconst entries = Editor.levels<Editor | Element>(editor, {\n\t\tat: options.at,\n\t\tmatch: node => {\n\t\t\treturn !Text.isText(node) && options.match(node)\n\t\t},\n\t\treverse: true,\n\t})\n\tfor (const entry of entries) {\n\t\treturn entry\n\t}\n\treturn undefined\n}\n"],"names":["Editor","Text"],"mappings":";;;AAEa,MAAA,UAAU,CACtB,QACA,YAI6C;AACvC,QAAA,UAAUA,MAAAA,OAAO,OAAyB,QAAQ;AAAA,IACvD,IAAI,QAAQ;AAAA,IACZ,OAAO,CAAQ,SAAA;AACd,aAAO,CAACC,MAAK,KAAA,OAAO,IAAI,KAAK,QAAQ,MAAM,IAAI;AAAA,IAChD;AAAA,IACA,SAAS;AAAA,EAAA,CACT;AACD,aAAW,SAAS,SAAS;AACrB,WAAA;AAAA,EACR;AACO,SAAA;AACR;;"}
1
+ {"version":3,"file":"closest.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/closest.ts"],"sourcesContent":["import { Editor as SlateEditor, Editor, Element, Location, NodeEntry, Text } from 'slate'\n\nexport const closest = <E extends SlateEditor>(\n\teditor: E,\n\toptions: {\n\t\tat?: Location\n\t\tmatch: (node: Editor | Element) => boolean\n\t},\n): NodeEntry<Editor | Element> | undefined => {\n\tconst entries = Editor.levels<Editor | Element>(editor, {\n\t\tat: options.at,\n\t\tmatch: node => {\n\t\t\treturn !Text.isText(node) && options.match(node)\n\t\t},\n\t\treverse: true,\n\t})\n\tfor (const entry of entries) {\n\t\treturn entry\n\t}\n\treturn undefined\n}\n"],"names":["Editor","Text"],"mappings":";;;AAEa,MAAA,UAAU,CACtB,QACA,YAI6C;AACvC,QAAA,UAAUA,MAAAA,OAAO,OAAyB,QAAQ;AAAA,IACvD,IAAI,QAAQ;AAAA,IACZ,OAAO,CAAQ,SAAA;AACd,aAAO,CAACC,MAAK,KAAA,OAAO,IAAI,KAAK,QAAQ,MAAM,IAAI;AAAA,IAChD;AAAA,IACA,SAAS;AAAA,EAAA,CACT;AACD,aAAW,SAAS,SAAS;AACrB,WAAA;AAAA,EAAA;AAED,SAAA;AACR;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"closest.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/closest.ts"],"sourcesContent":["import { Editor as SlateEditor, Editor, Element, Location, NodeEntry, Text } from 'slate'\n\nexport const closest = <E extends SlateEditor>(\n\teditor: E,\n\toptions: {\n\t\tat?: Location\n\t\tmatch: (node: Editor | Element) => boolean\n\t},\n): NodeEntry<Editor | Element> | undefined => {\n\tconst entries = Editor.levels<Editor | Element>(editor, {\n\t\tat: options.at,\n\t\tmatch: node => {\n\t\t\treturn !Text.isText(node) && options.match(node)\n\t\t},\n\t\treverse: true,\n\t})\n\tfor (const entry of entries) {\n\t\treturn entry\n\t}\n\treturn undefined\n}\n"],"names":[],"mappings":";AAEa,MAAA,UAAU,CACtB,QACA,YAI6C;AACvC,QAAA,UAAU,OAAO,OAAyB,QAAQ;AAAA,IACvD,IAAI,QAAQ;AAAA,IACZ,OAAO,CAAQ,SAAA;AACd,aAAO,CAAC,KAAK,OAAO,IAAI,KAAK,QAAQ,MAAM,IAAI;AAAA,IAChD;AAAA,IACA,SAAS;AAAA,EAAA,CACT;AACD,aAAW,SAAS,SAAS;AACrB,WAAA;AAAA,EACR;AACO,SAAA;AACR;"}
1
+ {"version":3,"file":"closest.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/closest.ts"],"sourcesContent":["import { Editor as SlateEditor, Editor, Element, Location, NodeEntry, Text } from 'slate'\n\nexport const closest = <E extends SlateEditor>(\n\teditor: E,\n\toptions: {\n\t\tat?: Location\n\t\tmatch: (node: Editor | Element) => boolean\n\t},\n): NodeEntry<Editor | Element> | undefined => {\n\tconst entries = Editor.levels<Editor | Element>(editor, {\n\t\tat: options.at,\n\t\tmatch: node => {\n\t\t\treturn !Text.isText(node) && options.match(node)\n\t\t},\n\t\treverse: true,\n\t})\n\tfor (const entry of entries) {\n\t\treturn entry\n\t}\n\treturn undefined\n}\n"],"names":[],"mappings":";AAEa,MAAA,UAAU,CACtB,QACA,YAI6C;AACvC,QAAA,UAAU,OAAO,OAAyB,QAAQ;AAAA,IACvD,IAAI,QAAQ;AAAA,IACZ,OAAO,CAAQ,SAAA;AACd,aAAO,CAAC,KAAK,OAAO,IAAI,KAAK,QAAQ,MAAM,IAAI;AAAA,IAChD;AAAA,IACA,SAAS;AAAA,EAAA,CACT;AACD,aAAW,SAAS,SAAS;AACrB,WAAA;AAAA,EAAA;AAED,SAAA;AACR;"}
@@ -1 +1 @@
1
- {"version":3,"file":"closestBlockEntry.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/closestBlockEntry.ts"],"sourcesContent":["import { Editor as SlateEditor, Editor, Location, Element } 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,CAAQ,SAAA,CAACC,MAAAA,OAAO,SAAS,IAAI,KAAKA,MAAAA,OAAO,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 as SlateEditor, Editor, Location, Element } 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,CAAQ,SAAA,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":"ejectElement.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/ejectElement.ts"],"sourcesContent":["import { Editor as SlateEditor, Element as SlateElement, Node as SlateNode, Path, Transforms } from 'slate'\n\nexport const ejectElement = <E extends SlateEditor>(editor: E, path: Path) => {\n\tconst element = SlateNode.get(editor, path)\n\n\tif (!SlateElement.isElement(element)) {\n\t\treturn\n\t}\n\tconst { children, ...otherProperties } = element\n\n\tTransforms.unsetNodes(editor, Object.keys(otherProperties), {\n\t\tat: path,\n\t})\n}\n"],"names":["SlateNode","SlateElement","Transforms"],"mappings":";;;AAEa,MAAA,eAAe,CAAwB,QAAW,SAAe;AAC7E,QAAM,UAAUA,MAAA,KAAU,IAAI,QAAQ,IAAI;AAE1C,MAAI,CAACC,MAAA,QAAa,UAAU,OAAO,GAAG;AACrC;AAAA,EACD;AACA,QAAM,EAAE,UAAU,GAAG,gBAAA,IAAoB;AAEzCC,QAAA,WAAW,WAAW,QAAQ,OAAO,KAAK,eAAe,GAAG;AAAA,IAC3D,IAAI;AAAA,EAAA,CACJ;AACF;;"}
1
+ {"version":3,"file":"ejectElement.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/ejectElement.ts"],"sourcesContent":["import { Editor as SlateEditor, Element as SlateElement, Node as SlateNode, Path, Transforms } from 'slate'\n\nexport const ejectElement = <E extends SlateEditor>(editor: E, path: Path) => {\n\tconst element = SlateNode.get(editor, path)\n\n\tif (!SlateElement.isElement(element)) {\n\t\treturn\n\t}\n\tconst { children, ...otherProperties } = element\n\n\tTransforms.unsetNodes(editor, Object.keys(otherProperties), {\n\t\tat: path,\n\t})\n}\n"],"names":["SlateNode","SlateElement","Transforms"],"mappings":";;;AAEa,MAAA,eAAe,CAAwB,QAAW,SAAe;AAC7E,QAAM,UAAUA,MAAA,KAAU,IAAI,QAAQ,IAAI;AAE1C,MAAI,CAACC,MAAA,QAAa,UAAU,OAAO,GAAG;AACrC;AAAA,EAAA;AAED,QAAM,EAAE,UAAU,GAAG,gBAAA,IAAoB;AAEzCC,QAAA,WAAW,WAAW,QAAQ,OAAO,KAAK,eAAe,GAAG;AAAA,IAC3D,IAAI;AAAA,EAAA,CACJ;AACF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ejectElement.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/ejectElement.ts"],"sourcesContent":["import { Editor as SlateEditor, Element as SlateElement, Node as SlateNode, Path, Transforms } from 'slate'\n\nexport const ejectElement = <E extends SlateEditor>(editor: E, path: Path) => {\n\tconst element = SlateNode.get(editor, path)\n\n\tif (!SlateElement.isElement(element)) {\n\t\treturn\n\t}\n\tconst { children, ...otherProperties } = element\n\n\tTransforms.unsetNodes(editor, Object.keys(otherProperties), {\n\t\tat: path,\n\t})\n}\n"],"names":["SlateNode","SlateElement"],"mappings":";AAEa,MAAA,eAAe,CAAwB,QAAW,SAAe;AAC7E,QAAM,UAAUA,KAAU,IAAI,QAAQ,IAAI;AAE1C,MAAI,CAACC,QAAa,UAAU,OAAO,GAAG;AACrC;AAAA,EACD;AACA,QAAM,EAAE,UAAU,GAAG,gBAAA,IAAoB;AAEzC,aAAW,WAAW,QAAQ,OAAO,KAAK,eAAe,GAAG;AAAA,IAC3D,IAAI;AAAA,EAAA,CACJ;AACF;"}
1
+ {"version":3,"file":"ejectElement.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/ejectElement.ts"],"sourcesContent":["import { Editor as SlateEditor, Element as SlateElement, Node as SlateNode, Path, Transforms } from 'slate'\n\nexport const ejectElement = <E extends SlateEditor>(editor: E, path: Path) => {\n\tconst element = SlateNode.get(editor, path)\n\n\tif (!SlateElement.isElement(element)) {\n\t\treturn\n\t}\n\tconst { children, ...otherProperties } = element\n\n\tTransforms.unsetNodes(editor, Object.keys(otherProperties), {\n\t\tat: path,\n\t})\n}\n"],"names":["SlateNode","SlateElement"],"mappings":";AAEa,MAAA,eAAe,CAAwB,QAAW,SAAe;AAC7E,QAAM,UAAUA,KAAU,IAAI,QAAQ,IAAI;AAE1C,MAAI,CAACC,QAAa,UAAU,OAAO,GAAG;AACrC;AAAA,EAAA;AAED,QAAM,EAAE,UAAU,GAAG,gBAAA,IAAoB;AAEzC,aAAW,WAAW,QAAQ,OAAO,KAAK,eAAe,GAAG;AAAA,IAC3D,IAAI;AAAA,EAAA,CACJ;AACF;"}
@@ -1 +1 @@
1
- {"version":3,"file":"getElementDataAttributes.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/getElementDataAttributes.ts"],"sourcesContent":["import type { Scalar } from '@contember/react-binding'\nimport { Element as SlateElement } from 'slate'\n\nexport interface ElementDataAttributes {\n\t[dataAttribute: string]: Scalar\n}\n\nexport const getElementDataAttributes = <Element extends SlateElement = SlateElement>(\n\telement: Element,\n\tattributeNamePrefix: string = 'contember',\n): ElementDataAttributes => {\n\tconst { children, ...extendedSpecifics } = element\n\n\treturn Object.fromEntries(\n\t\tObject.entries(extendedSpecifics)\n\t\t\t.filter(([, value]) => {\n\t\t\t\tconst t = typeof value\n\t\t\t\treturn t === 'string' || t === 'number' || t === 'boolean'\n\t\t\t})\n\t\t\t.map(([attribute, value]) => [`data-${attributeNamePrefix}-${attribute.toLowerCase()}`, value as Scalar]),\n\t)\n}\n"],"names":[],"mappings":";;AAOO,MAAM,2BAA2B,CACvC,SACA,sBAA8B,gBACH;AAC3B,QAAM,EAAE,UAAU,GAAG,kBAAA,IAAsB;AAE3C,SAAO,OAAO;AAAA,IACb,OAAO,QAAQ,iBAAiB,EAC9B,OAAO,CAAC,CAAG,EAAA,KAAK,MAAM;AACtB,YAAM,IAAI,OAAO;AACjB,aAAO,MAAM,YAAY,MAAM,YAAY,MAAM;AAAA,IAAA,CACjD,EACA,IAAI,CAAC,CAAC,WAAW,KAAK,MAAM,CAAC,QAAQ,mBAAmB,IAAI,UAAU,YAAa,CAAA,IAAI,KAAe,CAAC;AAAA,EAAA;AAE3G;;"}
1
+ {"version":3,"file":"getElementDataAttributes.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/getElementDataAttributes.ts"],"sourcesContent":["import type { Scalar } from '@contember/react-binding'\nimport { Element as SlateElement } from 'slate'\n\nexport interface ElementDataAttributes {\n\t[dataAttribute: string]: Scalar\n}\n\nexport const getElementDataAttributes = <Element extends SlateElement = SlateElement>(\n\telement: Element,\n\tattributeNamePrefix: string = 'contember',\n): ElementDataAttributes => {\n\tconst { children, ...extendedSpecifics } = element\n\n\treturn Object.fromEntries(\n\t\tObject.entries(extendedSpecifics)\n\t\t\t.filter(([, value]) => {\n\t\t\t\tconst t = typeof value\n\t\t\t\treturn t === 'string' || t === 'number' || t === 'boolean'\n\t\t\t})\n\t\t\t.map(([attribute, value]) => [`data-${attributeNamePrefix}-${attribute.toLowerCase()}`, value as Scalar]),\n\t)\n}\n"],"names":[],"mappings":";;AAOO,MAAM,2BAA2B,CACvC,SACA,sBAA8B,gBACH;AAC3B,QAAM,EAAE,UAAU,GAAG,kBAAA,IAAsB;AAE3C,SAAO,OAAO;AAAA,IACb,OAAO,QAAQ,iBAAiB,EAC9B,OAAO,CAAC,CAAG,EAAA,KAAK,MAAM;AACtB,YAAM,IAAI,OAAO;AACjB,aAAO,MAAM,YAAY,MAAM,YAAY,MAAM;AAAA,IACjD,CAAA,EACA,IAAI,CAAC,CAAC,WAAW,KAAK,MAAM,CAAC,QAAQ,mBAAmB,IAAI,UAAU,aAAa,IAAI,KAAe,CAAC;AAAA,EAC1G;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"getElementDataAttributes.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/getElementDataAttributes.ts"],"sourcesContent":["import type { Scalar } from '@contember/react-binding'\nimport { Element as SlateElement } from 'slate'\n\nexport interface ElementDataAttributes {\n\t[dataAttribute: string]: Scalar\n}\n\nexport const getElementDataAttributes = <Element extends SlateElement = SlateElement>(\n\telement: Element,\n\tattributeNamePrefix: string = 'contember',\n): ElementDataAttributes => {\n\tconst { children, ...extendedSpecifics } = element\n\n\treturn Object.fromEntries(\n\t\tObject.entries(extendedSpecifics)\n\t\t\t.filter(([, value]) => {\n\t\t\t\tconst t = typeof value\n\t\t\t\treturn t === 'string' || t === 'number' || t === 'boolean'\n\t\t\t})\n\t\t\t.map(([attribute, value]) => [`data-${attributeNamePrefix}-${attribute.toLowerCase()}`, value as Scalar]),\n\t)\n}\n"],"names":[],"mappings":"AAOO,MAAM,2BAA2B,CACvC,SACA,sBAA8B,gBACH;AAC3B,QAAM,EAAE,UAAU,GAAG,kBAAA,IAAsB;AAE3C,SAAO,OAAO;AAAA,IACb,OAAO,QAAQ,iBAAiB,EAC9B,OAAO,CAAC,CAAG,EAAA,KAAK,MAAM;AACtB,YAAM,IAAI,OAAO;AACjB,aAAO,MAAM,YAAY,MAAM,YAAY,MAAM;AAAA,IAAA,CACjD,EACA,IAAI,CAAC,CAAC,WAAW,KAAK,MAAM,CAAC,QAAQ,mBAAmB,IAAI,UAAU,YAAa,CAAA,IAAI,KAAe,CAAC;AAAA,EAAA;AAE3G;"}
1
+ {"version":3,"file":"getElementDataAttributes.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/getElementDataAttributes.ts"],"sourcesContent":["import type { Scalar } from '@contember/react-binding'\nimport { Element as SlateElement } from 'slate'\n\nexport interface ElementDataAttributes {\n\t[dataAttribute: string]: Scalar\n}\n\nexport const getElementDataAttributes = <Element extends SlateElement = SlateElement>(\n\telement: Element,\n\tattributeNamePrefix: string = 'contember',\n): ElementDataAttributes => {\n\tconst { children, ...extendedSpecifics } = element\n\n\treturn Object.fromEntries(\n\t\tObject.entries(extendedSpecifics)\n\t\t\t.filter(([, value]) => {\n\t\t\t\tconst t = typeof value\n\t\t\t\treturn t === 'string' || t === 'number' || t === 'boolean'\n\t\t\t})\n\t\t\t.map(([attribute, value]) => [`data-${attributeNamePrefix}-${attribute.toLowerCase()}`, value as Scalar]),\n\t)\n}\n"],"names":[],"mappings":"AAOO,MAAM,2BAA2B,CACvC,SACA,sBAA8B,gBACH;AAC3B,QAAM,EAAE,UAAU,GAAG,kBAAA,IAAsB;AAE3C,SAAO,OAAO;AAAA,IACb,OAAO,QAAQ,iBAAiB,EAC9B,OAAO,CAAC,CAAG,EAAA,KAAK,MAAM;AACtB,YAAM,IAAI,OAAO;AACjB,aAAO,MAAM,YAAY,MAAM,YAAY,MAAM;AAAA,IACjD,CAAA,EACA,IAAI,CAAC,CAAC,WAAW,KAAK,MAAM,CAAC,QAAQ,mBAAmB,IAAI,UAAU,aAAa,IAAI,KAAe,CAAC;AAAA,EAC1G;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"getPreviousSibling.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/getPreviousSibling.ts"],"sourcesContent":["import { Editor as SlateEditor, Node as SlateNode, NodeEntry, Path as SlatePath } from 'slate'\n\nexport const getPreviousSibling = <\n\tE extends SlateEditor = SlateEditor,\n\tCurrentNode extends SlateNode = SlateNode,\n\tPreviousNode extends SlateNode = CurrentNode,\n>(\n\teditor: E,\n\tnode: CurrentNode,\n\tnodePath: SlatePath,\n): NodeEntry<PreviousNode> | undefined => {\n\tconst lastPathIndex = nodePath[nodePath.length - 1]\n\tif (lastPathIndex === 0) {\n\t\treturn undefined\n\t}\n\tconst previousPath = nodePath.slice(0, -1).concat(lastPathIndex - 1)\n\treturn [SlateNode.get(editor, previousPath) as PreviousNode, previousPath]\n}\n"],"names":["SlateNode"],"mappings":";;;AAEO,MAAM,qBAAqB,CAKjC,QACA,MACA,aACyC;AACzC,QAAM,gBAAgB,SAAS,SAAS,SAAS,CAAC;AAClD,MAAI,kBAAkB,GAAG;AACjB,WAAA;AAAA,EACR;AACM,QAAA,eAAe,SAAS,MAAM,GAAG,EAAE,EAAE,OAAO,gBAAgB,CAAC;AACnE,SAAO,CAACA,MAAU,KAAA,IAAI,QAAQ,YAAY,GAAmB,YAAY;AAC1E;;"}
1
+ {"version":3,"file":"getPreviousSibling.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/getPreviousSibling.ts"],"sourcesContent":["import { Editor as SlateEditor, Node as SlateNode, NodeEntry, Path as SlatePath } from 'slate'\n\nexport const getPreviousSibling = <\n\tE extends SlateEditor = SlateEditor,\n\tCurrentNode extends SlateNode = SlateNode,\n\tPreviousNode extends SlateNode = CurrentNode,\n>(\n\teditor: E,\n\tnode: CurrentNode,\n\tnodePath: SlatePath,\n): NodeEntry<PreviousNode> | undefined => {\n\tconst lastPathIndex = nodePath[nodePath.length - 1]\n\tif (lastPathIndex === 0) {\n\t\treturn undefined\n\t}\n\tconst previousPath = nodePath.slice(0, -1).concat(lastPathIndex - 1)\n\treturn [SlateNode.get(editor, previousPath) as PreviousNode, previousPath]\n}\n"],"names":["SlateNode"],"mappings":";;;AAEO,MAAM,qBAAqB,CAKjC,QACA,MACA,aACyC;AACzC,QAAM,gBAAgB,SAAS,SAAS,SAAS,CAAC;AAClD,MAAI,kBAAkB,GAAG;AACjB,WAAA;AAAA,EAAA;AAEF,QAAA,eAAe,SAAS,MAAM,GAAG,EAAE,EAAE,OAAO,gBAAgB,CAAC;AACnE,SAAO,CAACA,MAAU,KAAA,IAAI,QAAQ,YAAY,GAAmB,YAAY;AAC1E;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"getPreviousSibling.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/getPreviousSibling.ts"],"sourcesContent":["import { Editor as SlateEditor, Node as SlateNode, NodeEntry, Path as SlatePath } from 'slate'\n\nexport const getPreviousSibling = <\n\tE extends SlateEditor = SlateEditor,\n\tCurrentNode extends SlateNode = SlateNode,\n\tPreviousNode extends SlateNode = CurrentNode,\n>(\n\teditor: E,\n\tnode: CurrentNode,\n\tnodePath: SlatePath,\n): NodeEntry<PreviousNode> | undefined => {\n\tconst lastPathIndex = nodePath[nodePath.length - 1]\n\tif (lastPathIndex === 0) {\n\t\treturn undefined\n\t}\n\tconst previousPath = nodePath.slice(0, -1).concat(lastPathIndex - 1)\n\treturn [SlateNode.get(editor, previousPath) as PreviousNode, previousPath]\n}\n"],"names":["SlateNode"],"mappings":";AAEO,MAAM,qBAAqB,CAKjC,QACA,MACA,aACyC;AACzC,QAAM,gBAAgB,SAAS,SAAS,SAAS,CAAC;AAClD,MAAI,kBAAkB,GAAG;AACjB,WAAA;AAAA,EACR;AACM,QAAA,eAAe,SAAS,MAAM,GAAG,EAAE,EAAE,OAAO,gBAAgB,CAAC;AACnE,SAAO,CAACA,KAAU,IAAI,QAAQ,YAAY,GAAmB,YAAY;AAC1E;"}
1
+ {"version":3,"file":"getPreviousSibling.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/getPreviousSibling.ts"],"sourcesContent":["import { Editor as SlateEditor, Node as SlateNode, NodeEntry, Path as SlatePath } from 'slate'\n\nexport const getPreviousSibling = <\n\tE extends SlateEditor = SlateEditor,\n\tCurrentNode extends SlateNode = SlateNode,\n\tPreviousNode extends SlateNode = CurrentNode,\n>(\n\teditor: E,\n\tnode: CurrentNode,\n\tnodePath: SlatePath,\n): NodeEntry<PreviousNode> | undefined => {\n\tconst lastPathIndex = nodePath[nodePath.length - 1]\n\tif (lastPathIndex === 0) {\n\t\treturn undefined\n\t}\n\tconst previousPath = nodePath.slice(0, -1).concat(lastPathIndex - 1)\n\treturn [SlateNode.get(editor, previousPath) as PreviousNode, previousPath]\n}\n"],"names":["SlateNode"],"mappings":";AAEO,MAAM,qBAAqB,CAKjC,QACA,MACA,aACyC;AACzC,QAAM,gBAAgB,SAAS,SAAS,SAAS,CAAC;AAClD,MAAI,kBAAkB,GAAG;AACjB,WAAA;AAAA,EAAA;AAEF,QAAA,eAAe,SAAS,MAAM,GAAG,EAAE,EAAE,OAAO,gBAAgB,CAAC;AACnE,SAAO,CAACA,KAAU,IAAI,QAAQ,YAAY,GAAmB,YAAY;AAC1E;"}
@@ -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 (const [text] of SlateNode.texts(editor, {\n\t\tfrom,\n\t\tto,\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;AAE7C,MAAA,CAAC,QAAQ,CAAC,IAAI;AACV,WAAA;AAAA,EACR;AAEA,aAAW,CAAC,IAAI,KAAKA,MAAAA,KAAU,MAAM,QAAQ;AAAA,IAC5C;AAAA,IACA;AAAA,EAAA,CACA,GAAG;AACH,eAAW,YAAY,OAAO;AACzB,UAAA,EAAE,YAAY,SAAS,KAAK,QAAQ,MAAO,MAAc,QAAQ,GAAG;AAChE,eAAA;AAAA,MACR;AAAA,IACD;AAAA,EACD;AACO,SAAA;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'\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 (const [text] of SlateNode.texts(editor, {\n\t\tfrom,\n\t\tto,\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;AAE7C,MAAA,CAAC,QAAQ,CAAC,IAAI;AACV,WAAA;AAAA,EAAA;AAGR,aAAW,CAAC,IAAI,KAAKA,MAAAA,KAAU,MAAM,QAAQ;AAAA,IAC5C;AAAA,IACA;AAAA,EAAA,CACA,GAAG;AACH,eAAW,YAAY,OAAO;AACzB,UAAA,EAAE,YAAY,SAAS,KAAK,QAAQ,MAAO,MAAc,QAAQ,GAAG;AAChE,eAAA;AAAA,MAAA;AAAA,IACR;AAAA,EACD;AAEM,SAAA;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 (const [text] of SlateNode.texts(editor, {\n\t\tfrom,\n\t\tto,\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;AAE7C,MAAA,CAAC,QAAQ,CAAC,IAAI;AACV,WAAA;AAAA,EACR;AAEA,aAAW,CAAC,IAAI,KAAKA,KAAU,MAAM,QAAQ;AAAA,IAC5C;AAAA,IACA;AAAA,EAAA,CACA,GAAG;AACH,eAAW,YAAY,OAAO;AACzB,UAAA,EAAE,YAAY,SAAS,KAAK,QAAQ,MAAO,MAAc,QAAQ,GAAG;AAChE,eAAA;AAAA,MACR;AAAA,IACD;AAAA,EACD;AACO,SAAA;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'\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 (const [text] of SlateNode.texts(editor, {\n\t\tfrom,\n\t\tto,\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;AAE7C,MAAA,CAAC,QAAQ,CAAC,IAAI;AACV,WAAA;AAAA,EAAA;AAGR,aAAW,CAAC,IAAI,KAAKA,KAAU,MAAM,QAAQ;AAAA,IAC5C;AAAA,IACA;AAAA,EAAA,CACA,GAAG;AACH,eAAW,YAAY,OAAO;AACzB,UAAA,EAAE,YAAY,SAAS,KAAK,QAAQ,MAAO,MAAc,QAAQ,GAAG;AAChE,eAAA;AAAA,MAAA;AAAA,IACR;AAAA,EACD;AAEM,SAAA;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;AACP,QAAA,CAAG,EAAA,IAAI,IAAI;AACb,MAAA,KAAK,WAAW,GAAG;AACf,WAAA;AAAA,EACR;AACM,QAAA,aAAaA,MAAAA,KAAU,OAAO,IAAI;AACxC,QAAM,SAASC,MAAA,KAAU,IAAI,QAAQ,UAAU;AAE/C,SAAOC,MAAgB,gBAAA,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'\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;AACP,QAAA,CAAA,EAAG,IAAI,IAAI;AACb,MAAA,KAAK,WAAW,GAAG;AACf,WAAA;AAAA,EAAA;AAEF,QAAA,aAAaA,MAAAA,KAAU,OAAO,IAAI;AACxC,QAAM,SAASC,MAAA,KAAU,IAAI,QAAQ,UAAU;AAE/C,SAAOC,MAAgB,gBAAA,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;AACP,QAAA,CAAG,EAAA,IAAI,IAAI;AACb,MAAA,KAAK,WAAW,GAAG;AACf,WAAA;AAAA,EACR;AACM,QAAA,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'\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;AACP,QAAA,CAAA,EAAG,IAAI,IAAI;AACb,MAAA,KAAK,WAAW,GAAG;AACf,WAAA;AAAA,EAAA;AAEF,QAAA,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":"isElementType.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/isElementType.ts"],"sourcesContent":["import { Element as SlateElement, Node as SlateNode } from 'slate'\n\nexport const isElementType = <Element extends SlateElement>(\n\telement: SlateNode,\n\ttype: Element['type'],\n\tsuchThat?: Partial<Element>,\n): boolean => {\n\tif (!SlateElement.isElement(element) || element.type !== type) {\n\t\treturn false\n\t}\n\tif (suchThat === undefined) {\n\t\treturn true\n\t}\n\n\tfor (const prop in suchThat) {\n\t\tconst propValue = suchThat[prop]\n\t\tconst propPresent = prop in element\n\n\t\tif (!propValue && !propPresent) {\n\t\t\t// Falsy values get special treatment.\n\t\t\tcontinue\n\t\t}\n\n\t\tif (!propPresent || (element as Element)[prop as keyof Element] !== propValue) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n"],"names":["SlateElement"],"mappings":";;;AAEO,MAAM,gBAAgB,CAC5B,SACA,MACA,aACa;AACb,MAAI,CAACA,MAAa,QAAA,UAAU,OAAO,KAAK,QAAQ,SAAS,MAAM;AACvD,WAAA;AAAA,EACR;AACA,MAAI,aAAa,QAAW;AACpB,WAAA;AAAA,EACR;AAEA,aAAW,QAAQ,UAAU;AACtB,UAAA,YAAY,SAAS,IAAI;AAC/B,UAAM,cAAc,QAAQ;AAExB,QAAA,CAAC,aAAa,CAAC,aAAa;AAE/B;AAAA,IACD;AAEA,QAAI,CAAC,eAAgB,QAAoB,IAAqB,MAAM,WAAW;AACvE,aAAA;AAAA,IACR;AAAA,EACD;AACO,SAAA;AACR;;"}
1
+ {"version":3,"file":"isElementType.cjs","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/isElementType.ts"],"sourcesContent":["import { Element as SlateElement, Node as SlateNode } from 'slate'\n\nexport const isElementType = <Element extends SlateElement>(\n\telement: SlateNode,\n\ttype: Element['type'],\n\tsuchThat?: Partial<Element>,\n): boolean => {\n\tif (!SlateElement.isElement(element) || element.type !== type) {\n\t\treturn false\n\t}\n\tif (suchThat === undefined) {\n\t\treturn true\n\t}\n\n\tfor (const prop in suchThat) {\n\t\tconst propValue = suchThat[prop]\n\t\tconst propPresent = prop in element\n\n\t\tif (!propValue && !propPresent) {\n\t\t\t// Falsy values get special treatment.\n\t\t\tcontinue\n\t\t}\n\n\t\tif (!propPresent || (element as Element)[prop as keyof Element] !== propValue) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n"],"names":["SlateElement"],"mappings":";;;AAEO,MAAM,gBAAgB,CAC5B,SACA,MACA,aACa;AACb,MAAI,CAACA,MAAa,QAAA,UAAU,OAAO,KAAK,QAAQ,SAAS,MAAM;AACvD,WAAA;AAAA,EAAA;AAER,MAAI,aAAa,QAAW;AACpB,WAAA;AAAA,EAAA;AAGR,aAAW,QAAQ,UAAU;AACtB,UAAA,YAAY,SAAS,IAAI;AAC/B,UAAM,cAAc,QAAQ;AAExB,QAAA,CAAC,aAAa,CAAC,aAAa;AAE/B;AAAA,IAAA;AAGD,QAAI,CAAC,eAAgB,QAAoB,IAAqB,MAAM,WAAW;AACvE,aAAA;AAAA,IAAA;AAAA,EACR;AAEM,SAAA;AACR;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"isElementType.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/isElementType.ts"],"sourcesContent":["import { Element as SlateElement, Node as SlateNode } from 'slate'\n\nexport const isElementType = <Element extends SlateElement>(\n\telement: SlateNode,\n\ttype: Element['type'],\n\tsuchThat?: Partial<Element>,\n): boolean => {\n\tif (!SlateElement.isElement(element) || element.type !== type) {\n\t\treturn false\n\t}\n\tif (suchThat === undefined) {\n\t\treturn true\n\t}\n\n\tfor (const prop in suchThat) {\n\t\tconst propValue = suchThat[prop]\n\t\tconst propPresent = prop in element\n\n\t\tif (!propValue && !propPresent) {\n\t\t\t// Falsy values get special treatment.\n\t\t\tcontinue\n\t\t}\n\n\t\tif (!propPresent || (element as Element)[prop as keyof Element] !== propValue) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n"],"names":["SlateElement"],"mappings":";AAEO,MAAM,gBAAgB,CAC5B,SACA,MACA,aACa;AACb,MAAI,CAACA,QAAa,UAAU,OAAO,KAAK,QAAQ,SAAS,MAAM;AACvD,WAAA;AAAA,EACR;AACA,MAAI,aAAa,QAAW;AACpB,WAAA;AAAA,EACR;AAEA,aAAW,QAAQ,UAAU;AACtB,UAAA,YAAY,SAAS,IAAI;AAC/B,UAAM,cAAc,QAAQ;AAExB,QAAA,CAAC,aAAa,CAAC,aAAa;AAE/B;AAAA,IACD;AAEA,QAAI,CAAC,eAAgB,QAAoB,IAAqB,MAAM,WAAW;AACvE,aAAA;AAAA,IACR;AAAA,EACD;AACO,SAAA;AACR;"}
1
+ {"version":3,"file":"isElementType.js","sources":["../../../../../../packages/react-slate-editor-base/src/editor/methods/isElementType.ts"],"sourcesContent":["import { Element as SlateElement, Node as SlateNode } from 'slate'\n\nexport const isElementType = <Element extends SlateElement>(\n\telement: SlateNode,\n\ttype: Element['type'],\n\tsuchThat?: Partial<Element>,\n): boolean => {\n\tif (!SlateElement.isElement(element) || element.type !== type) {\n\t\treturn false\n\t}\n\tif (suchThat === undefined) {\n\t\treturn true\n\t}\n\n\tfor (const prop in suchThat) {\n\t\tconst propValue = suchThat[prop]\n\t\tconst propPresent = prop in element\n\n\t\tif (!propValue && !propPresent) {\n\t\t\t// Falsy values get special treatment.\n\t\t\tcontinue\n\t\t}\n\n\t\tif (!propPresent || (element as Element)[prop as keyof Element] !== propValue) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n"],"names":["SlateElement"],"mappings":";AAEO,MAAM,gBAAgB,CAC5B,SACA,MACA,aACa;AACb,MAAI,CAACA,QAAa,UAAU,OAAO,KAAK,QAAQ,SAAS,MAAM;AACvD,WAAA;AAAA,EAAA;AAER,MAAI,aAAa,QAAW;AACpB,WAAA;AAAA,EAAA;AAGR,aAAW,QAAQ,UAAU;AACtB,UAAA,YAAY,SAAS,IAAI;AAC/B,UAAM,cAAc,QAAQ;AAExB,QAAA,CAAC,aAAa,CAAC,aAAa;AAE/B;AAAA,IAAA;AAGD,QAAI,CAAC,eAAgB,QAAoB,IAAqB,MAAM,WAAW;AACvE,aAAA;AAAA,IAAA;AAAA,EACR;AAEM,SAAA;AACR;"}
@@ -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;AAC7D,MAAA;AAGY,mBAAA,KAAK,MAAM,iBAAiB;AAAA,WACnC,GAAG;AAAA,EAAC;AAEb,MAAI,OAAO,iBAAiB,YAAY,iBAAiB,MAAM;AACvD,WAAA,CAAC,OAAO,qBAAqB,CAAC,EAAE,MAAM,kBAAA,CAAmB,CAAC,CAAC;AAAA,EACnE;AAEA,MAAI,mBAAmB,cAAc;AAC7B,WAAAA,8BAAe,QAAQ,YAAsC,EAAE;AAAA,EACvE;AAGA,SAAOA,eAAAA,eAAe,QAAQ;AAAA,IAC7B,eAAe;AAAA,IACf,UAAU,CAAC,YAAY;AAAA,EACvB,CAAA,EAAE;AACJ;;"}
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;AAC7D,MAAA;AAGY,mBAAA,KAAK,MAAM,iBAAiB;AAAA,WACnC,GAAG;AAAA,EAAA;AAEZ,MAAI,OAAO,iBAAiB,YAAY,iBAAiB,MAAM;AACvD,WAAA,CAAC,OAAO,qBAAqB,CAAC,EAAE,MAAM,kBAAmB,CAAA,CAAC,CAAC;AAAA,EAAA;AAGnE,MAAI,mBAAmB,cAAc;AAC7B,WAAAA,8BAAe,QAAQ,YAAsC,EAAE;AAAA,EAAA;AAIvE,SAAOA,eAAAA,eAAe,QAAQ;AAAA,IAC7B,eAAe;AAAA,IACf,UAAU,CAAC,YAAY;AAAA,EACvB,CAAA,EAAE;AACJ;;"}