@contember/react-slate-editor-base 2.0.0-alpha.32 → 2.0.0-alpha.36

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":"TableRowElement.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableRowElement.ts"],"sourcesContent":["import { Editor as SlateEditor, Element as SlateElement, Element, Node, Node as SlateNode, Transforms } from 'slate'\nimport { createEmptyTableCellElement, isTableCellElement, tableCellElementType } from './TableCellElement'\nimport { ContemberEditor } from '../../../editor'\nimport { tableElementType } from './TableElement'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const tableRowElementType = 'tableRow' as const\n\nexport interface TableRowElement extends SlateElement {\n\ttype: typeof tableRowElementType\n\tchildren: SlateEditor['children']\n\theaderScope?: 'table'\n}\n\nexport const isTableRowElement = (element: Node): element is TableRowElement => Element.isElement(element) && element.type === tableRowElementType\n\nexport const createEmptyTableRowElement = (columnCount = 2) => ({\n\ttype: tableRowElementType,\n\tchildren: Array.from({ length: columnCount }, () => createEmptyTableCellElement()),\n})\n\nexport const tableRowElementPlugin = ({ render }: {render: ElementRenderer<TableRowElement>}): EditorElementPlugin<TableRowElement> => ({\n\ttype: tableRowElementType,\n\trender,\n\tnormalizeNode: ({ editor, path, element, preventDefault }) => {\n\t\tfor (const [child, childPath] of SlateNode.children(editor, path)) {\n\t\t\tif (SlateElement.isElement(child)) {\n\t\t\t\tif (!isTableCellElement(child)) {\n\t\t\t\t\tContemberEditor.ejectElement(editor, childPath)\n\t\t\t\t\tTransforms.setNodes(editor, { type: tableCellElementType }, { at: childPath })\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tTransforms.removeNodes(editor, { at: path })\n\t\t\t\treturn preventDefault()\n\t\t\t}\n\t\t}\n\t\tif (!ContemberEditor.hasParentOfType(editor, [element, path], tableElementType)) {\n\t\t\tTransforms.unwrapNodes(editor, { at: path })\n\t\t\treturn preventDefault()\n\t\t}\n\t\tif (path[path.length - 1] > 0 && element.headerScope) {\n\t\t\tTransforms.setNodes(editor, { headerScope: null }, { at: path })\n\t\t\treturn preventDefault()\n\t\t}\n\t},\n\tcanContainAnyBlocks: false,\n})\n"],"names":["Element","createEmptyTableCellElement","SlateNode","SlateElement","isTableCellElement","ContemberEditor","Transforms","tableCellElementType","tableElementType"],"mappings":";;;;;;AAMO,MAAM,sBAAsB;AAQtB,MAAA,oBAAoB,CAAC,YAA8CA,cAAQ,UAAU,OAAO,KAAK,QAAQ,SAAS;AAElH,MAAA,6BAA6B,CAAC,cAAc,OAAO;AAAA,EAC/D,MAAM;AAAA,EACN,UAAU,MAAM,KAAK,EAAE,QAAQ,YAAY,GAAG,MAAMC,iBAAAA,6BAA6B;AAClF;AAEO,MAAM,wBAAwB,CAAC,EAAE,cAAgG;AAAA,EACvI,MAAM;AAAA,EACN;AAAA,EACA,eAAe,CAAC,EAAE,QAAQ,MAAM,SAAS,qBAAqB;AAClD,eAAA,CAAC,OAAO,SAAS,KAAKC,WAAU,SAAS,QAAQ,IAAI,GAAG;AAC9D,UAAAC,MAAA,QAAa,UAAU,KAAK,GAAG;AAC9B,YAAA,CAACC,iBAAAA,mBAAmB,KAAK,GAAG;AACfC,gBAAAA,gBAAA,aAAa,QAAQ,SAAS;AACnCC,2BAAA,SAAS,QAAQ,EAAE,MAAMC,yCAAwB,EAAE,IAAI,UAAA,CAAW;AAAA,QAC9E;AAAA,MAAA,OACM;AACND,cAAA,WAAW,YAAY,QAAQ,EAAE,IAAI,KAAM,CAAA;AAC3C,eAAO,eAAe;AAAA,MACvB;AAAA,IACD;AACI,QAAA,CAACD,MAAAA,gBAAgB,gBAAgB,QAAQ,CAAC,SAAS,IAAI,GAAGG,aAAAA,gBAAgB,GAAG;AAChFF,YAAA,WAAW,YAAY,QAAQ,EAAE,IAAI,KAAM,CAAA;AAC3C,aAAO,eAAe;AAAA,IACvB;AACA,QAAI,KAAK,KAAK,SAAS,CAAC,IAAI,KAAK,QAAQ,aAAa;AAC1CA,uBAAA,SAAS,QAAQ,EAAE,aAAa,QAAQ,EAAE,IAAI,KAAA,CAAM;AAC/D,aAAO,eAAe;AAAA,IACvB;AAAA,EACD;AAAA,EACA,qBAAqB;AACtB;;;;;"}
1
+ {"version":3,"file":"TableRowElement.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableRowElement.ts"],"sourcesContent":["import { Editor as SlateEditor, Element as SlateElement, Element, Node, Node as SlateNode, Transforms } from 'slate'\nimport { createEmptyTableCellElement, isTableCellElement, tableCellElementType } from './TableCellElement'\nimport { ContemberEditor } from '../../../editor'\nimport { tableElementType } from './TableElement'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const tableRowElementType = 'tableRow' as const\n\nexport interface TableRowElement extends SlateElement {\n\ttype: typeof tableRowElementType\n\tchildren: SlateEditor['children']\n\theaderScope?: 'table'\n}\n\nexport const isTableRowElement = (element: Node): element is TableRowElement => Element.isElement(element) && element.type === tableRowElementType\n\nexport const createEmptyTableRowElement = (columnCount = 2) => ({\n\ttype: tableRowElementType,\n\tchildren: Array.from({ length: columnCount }, () => createEmptyTableCellElement()),\n})\n\nexport const tableRowElementPlugin = ({ render }: {render: ElementRenderer<TableRowElement>}): EditorElementPlugin<TableRowElement> => ({\n\ttype: tableRowElementType,\n\trender,\n\tnormalizeNode: ({ editor, path, element, preventDefault }) => {\n\t\tfor (const [child, childPath] of SlateNode.children(editor, path)) {\n\t\t\tif (SlateElement.isElement(child)) {\n\t\t\t\tif (!isTableCellElement(child)) {\n\t\t\t\t\tContemberEditor.ejectElement(editor, childPath)\n\t\t\t\t\tTransforms.setNodes(editor, { type: tableCellElementType }, { at: childPath })\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tTransforms.removeNodes(editor, { at: path })\n\t\t\t\treturn preventDefault()\n\t\t\t}\n\t\t}\n\t\tif (!ContemberEditor.hasParentOfType(editor, [element, path], tableElementType)) {\n\t\t\tTransforms.unwrapNodes(editor, { at: path })\n\t\t\treturn preventDefault()\n\t\t}\n\t\tif (path[path.length - 1] > 0 && element.headerScope) {\n\t\t\tTransforms.setNodes(editor, { headerScope: null }, { at: path })\n\t\t\treturn preventDefault()\n\t\t}\n\t},\n\tcanContainAnyBlocks: false,\n})\n"],"names":["Element","createEmptyTableCellElement","SlateNode","SlateElement","isTableCellElement","ContemberEditor","Transforms","tableCellElementType","tableElementType"],"mappings":";;;;;;AAMO,MAAM,sBAAsB;AAQtB,MAAA,oBAAoB,CAAC,YAA8CA,MAAA,QAAQ,UAAU,OAAO,KAAK,QAAQ,SAAS;AAElH,MAAA,6BAA6B,CAAC,cAAc,OAAO;AAAA,EAC/D,MAAM;AAAA,EACN,UAAU,MAAM,KAAK,EAAE,QAAQ,YAAY,GAAG,MAAMC,6CAA6B,CAAA;AAClF;AAEO,MAAM,wBAAwB,CAAC,EAAE,cAAgG;AAAA,EACvI,MAAM;AAAA,EACN;AAAA,EACA,eAAe,CAAC,EAAE,QAAQ,MAAM,SAAS,qBAAqB;AAClD,eAAA,CAAC,OAAO,SAAS,KAAKC,WAAU,SAAS,QAAQ,IAAI,GAAG;AAC9D,UAAAC,MAAA,QAAa,UAAU,KAAK,GAAG;AAC9B,YAAA,CAACC,iBAAAA,mBAAmB,KAAK,GAAG;AACfC,gCAAA,aAAa,QAAQ,SAAS;AACnCC,2BAAA,SAAS,QAAQ,EAAE,MAAMC,iBAAAA,wBAAwB,EAAE,IAAI,WAAW;AAAA,QAAA;AAAA,MAC9E,OACM;AACND,cAAAA,WAAW,YAAY,QAAQ,EAAE,IAAI,MAAM;AAC3C,eAAO,eAAe;AAAA,MAAA;AAAA,IACvB;AAEG,QAAA,CAACD,MAAAA,gBAAgB,gBAAgB,QAAQ,CAAC,SAAS,IAAI,GAAGG,aAAAA,gBAAgB,GAAG;AAChFF,YAAAA,WAAW,YAAY,QAAQ,EAAE,IAAI,MAAM;AAC3C,aAAO,eAAe;AAAA,IAAA;AAEvB,QAAI,KAAK,KAAK,SAAS,CAAC,IAAI,KAAK,QAAQ,aAAa;AAC1CA,uBAAA,SAAS,QAAQ,EAAE,aAAa,QAAQ,EAAE,IAAI,MAAM;AAC/D,aAAO,eAAe;AAAA,IAAA;AAAA,EAExB;AAAA,EACA,qBAAqB;AACtB;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TableRowElement.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableRowElement.ts"],"sourcesContent":["import { Editor as SlateEditor, Element as SlateElement, Element, Node, Node as SlateNode, Transforms } from 'slate'\nimport { createEmptyTableCellElement, isTableCellElement, tableCellElementType } from './TableCellElement'\nimport { ContemberEditor } from '../../../editor'\nimport { tableElementType } from './TableElement'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const tableRowElementType = 'tableRow' as const\n\nexport interface TableRowElement extends SlateElement {\n\ttype: typeof tableRowElementType\n\tchildren: SlateEditor['children']\n\theaderScope?: 'table'\n}\n\nexport const isTableRowElement = (element: Node): element is TableRowElement => Element.isElement(element) && element.type === tableRowElementType\n\nexport const createEmptyTableRowElement = (columnCount = 2) => ({\n\ttype: tableRowElementType,\n\tchildren: Array.from({ length: columnCount }, () => createEmptyTableCellElement()),\n})\n\nexport const tableRowElementPlugin = ({ render }: {render: ElementRenderer<TableRowElement>}): EditorElementPlugin<TableRowElement> => ({\n\ttype: tableRowElementType,\n\trender,\n\tnormalizeNode: ({ editor, path, element, preventDefault }) => {\n\t\tfor (const [child, childPath] of SlateNode.children(editor, path)) {\n\t\t\tif (SlateElement.isElement(child)) {\n\t\t\t\tif (!isTableCellElement(child)) {\n\t\t\t\t\tContemberEditor.ejectElement(editor, childPath)\n\t\t\t\t\tTransforms.setNodes(editor, { type: tableCellElementType }, { at: childPath })\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tTransforms.removeNodes(editor, { at: path })\n\t\t\t\treturn preventDefault()\n\t\t\t}\n\t\t}\n\t\tif (!ContemberEditor.hasParentOfType(editor, [element, path], tableElementType)) {\n\t\t\tTransforms.unwrapNodes(editor, { at: path })\n\t\t\treturn preventDefault()\n\t\t}\n\t\tif (path[path.length - 1] > 0 && element.headerScope) {\n\t\t\tTransforms.setNodes(editor, { headerScope: null }, { at: path })\n\t\t\treturn preventDefault()\n\t\t}\n\t},\n\tcanContainAnyBlocks: false,\n})\n"],"names":["SlateNode","SlateElement"],"mappings":";;;;AAMO,MAAM,sBAAsB;AAQtB,MAAA,oBAAoB,CAAC,YAA8C,QAAQ,UAAU,OAAO,KAAK,QAAQ,SAAS;AAElH,MAAA,6BAA6B,CAAC,cAAc,OAAO;AAAA,EAC/D,MAAM;AAAA,EACN,UAAU,MAAM,KAAK,EAAE,QAAQ,YAAY,GAAG,MAAM,6BAA6B;AAClF;AAEO,MAAM,wBAAwB,CAAC,EAAE,cAAgG;AAAA,EACvI,MAAM;AAAA,EACN;AAAA,EACA,eAAe,CAAC,EAAE,QAAQ,MAAM,SAAS,qBAAqB;AAClD,eAAA,CAAC,OAAO,SAAS,KAAKA,KAAU,SAAS,QAAQ,IAAI,GAAG;AAC9D,UAAAC,QAAa,UAAU,KAAK,GAAG;AAC9B,YAAA,CAAC,mBAAmB,KAAK,GAAG;AACf,0BAAA,aAAa,QAAQ,SAAS;AACnC,qBAAA,SAAS,QAAQ,EAAE,MAAM,wBAAwB,EAAE,IAAI,UAAA,CAAW;AAAA,QAC9E;AAAA,MAAA,OACM;AACN,mBAAW,YAAY,QAAQ,EAAE,IAAI,KAAM,CAAA;AAC3C,eAAO,eAAe;AAAA,MACvB;AAAA,IACD;AACI,QAAA,CAAC,gBAAgB,gBAAgB,QAAQ,CAAC,SAAS,IAAI,GAAG,gBAAgB,GAAG;AAChF,iBAAW,YAAY,QAAQ,EAAE,IAAI,KAAM,CAAA;AAC3C,aAAO,eAAe;AAAA,IACvB;AACA,QAAI,KAAK,KAAK,SAAS,CAAC,IAAI,KAAK,QAAQ,aAAa;AAC1C,iBAAA,SAAS,QAAQ,EAAE,aAAa,QAAQ,EAAE,IAAI,KAAA,CAAM;AAC/D,aAAO,eAAe;AAAA,IACvB;AAAA,EACD;AAAA,EACA,qBAAqB;AACtB;"}
1
+ {"version":3,"file":"TableRowElement.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableRowElement.ts"],"sourcesContent":["import { Editor as SlateEditor, Element as SlateElement, Element, Node, Node as SlateNode, Transforms } from 'slate'\nimport { createEmptyTableCellElement, isTableCellElement, tableCellElementType } from './TableCellElement'\nimport { ContemberEditor } from '../../../editor'\nimport { tableElementType } from './TableElement'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const tableRowElementType = 'tableRow' as const\n\nexport interface TableRowElement extends SlateElement {\n\ttype: typeof tableRowElementType\n\tchildren: SlateEditor['children']\n\theaderScope?: 'table'\n}\n\nexport const isTableRowElement = (element: Node): element is TableRowElement => Element.isElement(element) && element.type === tableRowElementType\n\nexport const createEmptyTableRowElement = (columnCount = 2) => ({\n\ttype: tableRowElementType,\n\tchildren: Array.from({ length: columnCount }, () => createEmptyTableCellElement()),\n})\n\nexport const tableRowElementPlugin = ({ render }: {render: ElementRenderer<TableRowElement>}): EditorElementPlugin<TableRowElement> => ({\n\ttype: tableRowElementType,\n\trender,\n\tnormalizeNode: ({ editor, path, element, preventDefault }) => {\n\t\tfor (const [child, childPath] of SlateNode.children(editor, path)) {\n\t\t\tif (SlateElement.isElement(child)) {\n\t\t\t\tif (!isTableCellElement(child)) {\n\t\t\t\t\tContemberEditor.ejectElement(editor, childPath)\n\t\t\t\t\tTransforms.setNodes(editor, { type: tableCellElementType }, { at: childPath })\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tTransforms.removeNodes(editor, { at: path })\n\t\t\t\treturn preventDefault()\n\t\t\t}\n\t\t}\n\t\tif (!ContemberEditor.hasParentOfType(editor, [element, path], tableElementType)) {\n\t\t\tTransforms.unwrapNodes(editor, { at: path })\n\t\t\treturn preventDefault()\n\t\t}\n\t\tif (path[path.length - 1] > 0 && element.headerScope) {\n\t\t\tTransforms.setNodes(editor, { headerScope: null }, { at: path })\n\t\t\treturn preventDefault()\n\t\t}\n\t},\n\tcanContainAnyBlocks: false,\n})\n"],"names":["SlateNode","SlateElement"],"mappings":";;;;AAMO,MAAM,sBAAsB;AAQtB,MAAA,oBAAoB,CAAC,YAA8C,QAAQ,UAAU,OAAO,KAAK,QAAQ,SAAS;AAElH,MAAA,6BAA6B,CAAC,cAAc,OAAO;AAAA,EAC/D,MAAM;AAAA,EACN,UAAU,MAAM,KAAK,EAAE,QAAQ,YAAY,GAAG,MAAM,4BAA6B,CAAA;AAClF;AAEO,MAAM,wBAAwB,CAAC,EAAE,cAAgG;AAAA,EACvI,MAAM;AAAA,EACN;AAAA,EACA,eAAe,CAAC,EAAE,QAAQ,MAAM,SAAS,qBAAqB;AAClD,eAAA,CAAC,OAAO,SAAS,KAAKA,KAAU,SAAS,QAAQ,IAAI,GAAG;AAC9D,UAAAC,QAAa,UAAU,KAAK,GAAG;AAC9B,YAAA,CAAC,mBAAmB,KAAK,GAAG;AACf,0BAAA,aAAa,QAAQ,SAAS;AACnC,qBAAA,SAAS,QAAQ,EAAE,MAAM,wBAAwB,EAAE,IAAI,WAAW;AAAA,QAAA;AAAA,MAC9E,OACM;AACN,mBAAW,YAAY,QAAQ,EAAE,IAAI,MAAM;AAC3C,eAAO,eAAe;AAAA,MAAA;AAAA,IACvB;AAEG,QAAA,CAAC,gBAAgB,gBAAgB,QAAQ,CAAC,SAAS,IAAI,GAAG,gBAAgB,GAAG;AAChF,iBAAW,YAAY,QAAQ,EAAE,IAAI,MAAM;AAC3C,aAAO,eAAe;AAAA,IAAA;AAEvB,QAAI,KAAK,KAAK,SAAS,CAAC,IAAI,KAAK,QAAQ,aAAa;AAC1C,iBAAA,SAAS,QAAQ,EAAE,aAAa,QAAQ,EAAE,IAAI,MAAM;AAC/D,aAAO,eAAe;AAAA,IAAA;AAAA,EAExB;AAAA,EACA,qBAAqB;AACtB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"gaugeTableColumnCount.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/gaugeTableColumnCount.ts"],"sourcesContent":["import type { TableElement } from './TableElement'\nimport type { TableRowElement } from './TableRowElement'\n\nexport const gaugeTableColumnCount = (table: TableElement): number => {\n\t// This whole function is obviously very heuristic. It's intended to be called during normalizations (i.e. often),\n\t// and so it aims to be reasonably fast. We want to use this return value to repair corrupted tables.\n\n\tif (table.children.length === 0) {\n\t\treturn 0\n\t}\n\n\tconst rowSampleStart = table.children[0] as TableRowElement\n\tconst rowSampleMiddle = table.children[Math.floor(table.children.length / 2)] as TableRowElement\n\tconst rowSampleEnd = table.children[table.children.length - 1] as TableRowElement\n\n\tconst columnSampleStart = rowSampleStart.children.length\n\tconst columnSampleMiddle = rowSampleMiddle.children.length\n\tconst columnSampleEnd = rowSampleEnd.children.length\n\n\t// Tables most often get corrupted either at the beginning or at the end. Thus we assume that out of these three\n\t// values, two will likely be the same.\n\tif (columnSampleStart === columnSampleEnd) {\n\t\treturn columnSampleStart\n\t}\n\tif (columnSampleStart === columnSampleMiddle) {\n\t\treturn columnSampleStart\n\t}\n\tif (columnSampleMiddle === columnSampleEnd) {\n\t\treturn columnSampleMiddle\n\t}\n\n\t// If we make it here, then all three are different and the table is completely broken. We could consult more rows\n\t// but really, odds are that it wouldn't really help.\n\treturn columnSampleStart\n}\n"],"names":[],"mappings":";;AAGa,MAAA,wBAAwB,CAAC,UAAgC;AAIjE,MAAA,MAAM,SAAS,WAAW,GAAG;AACzB,WAAA;AAAA,EACR;AAEM,QAAA,iBAAiB,MAAM,SAAS,CAAC;AACjC,QAAA,kBAAkB,MAAM,SAAS,KAAK,MAAM,MAAM,SAAS,SAAS,CAAC,CAAC;AAC5E,QAAM,eAAe,MAAM,SAAS,MAAM,SAAS,SAAS,CAAC;AAEvD,QAAA,oBAAoB,eAAe,SAAS;AAC5C,QAAA,qBAAqB,gBAAgB,SAAS;AAC9C,QAAA,kBAAkB,aAAa,SAAS;AAI9C,MAAI,sBAAsB,iBAAiB;AACnC,WAAA;AAAA,EACR;AACA,MAAI,sBAAsB,oBAAoB;AACtC,WAAA;AAAA,EACR;AACA,MAAI,uBAAuB,iBAAiB;AACpC,WAAA;AAAA,EACR;AAIO,SAAA;AACR;;"}
1
+ {"version":3,"file":"gaugeTableColumnCount.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/gaugeTableColumnCount.ts"],"sourcesContent":["import type { TableElement } from './TableElement'\nimport type { TableRowElement } from './TableRowElement'\n\nexport const gaugeTableColumnCount = (table: TableElement): number => {\n\t// This whole function is obviously very heuristic. It's intended to be called during normalizations (i.e. often),\n\t// and so it aims to be reasonably fast. We want to use this return value to repair corrupted tables.\n\n\tif (table.children.length === 0) {\n\t\treturn 0\n\t}\n\n\tconst rowSampleStart = table.children[0] as TableRowElement\n\tconst rowSampleMiddle = table.children[Math.floor(table.children.length / 2)] as TableRowElement\n\tconst rowSampleEnd = table.children[table.children.length - 1] as TableRowElement\n\n\tconst columnSampleStart = rowSampleStart.children.length\n\tconst columnSampleMiddle = rowSampleMiddle.children.length\n\tconst columnSampleEnd = rowSampleEnd.children.length\n\n\t// Tables most often get corrupted either at the beginning or at the end. Thus we assume that out of these three\n\t// values, two will likely be the same.\n\tif (columnSampleStart === columnSampleEnd) {\n\t\treturn columnSampleStart\n\t}\n\tif (columnSampleStart === columnSampleMiddle) {\n\t\treturn columnSampleStart\n\t}\n\tif (columnSampleMiddle === columnSampleEnd) {\n\t\treturn columnSampleMiddle\n\t}\n\n\t// If we make it here, then all three are different and the table is completely broken. We could consult more rows\n\t// but really, odds are that it wouldn't really help.\n\treturn columnSampleStart\n}\n"],"names":[],"mappings":";;AAGa,MAAA,wBAAwB,CAAC,UAAgC;AAIjE,MAAA,MAAM,SAAS,WAAW,GAAG;AACzB,WAAA;AAAA,EAAA;AAGF,QAAA,iBAAiB,MAAM,SAAS,CAAC;AACjC,QAAA,kBAAkB,MAAM,SAAS,KAAK,MAAM,MAAM,SAAS,SAAS,CAAC,CAAC;AAC5E,QAAM,eAAe,MAAM,SAAS,MAAM,SAAS,SAAS,CAAC;AAEvD,QAAA,oBAAoB,eAAe,SAAS;AAC5C,QAAA,qBAAqB,gBAAgB,SAAS;AAC9C,QAAA,kBAAkB,aAAa,SAAS;AAI9C,MAAI,sBAAsB,iBAAiB;AACnC,WAAA;AAAA,EAAA;AAER,MAAI,sBAAsB,oBAAoB;AACtC,WAAA;AAAA,EAAA;AAER,MAAI,uBAAuB,iBAAiB;AACpC,WAAA;AAAA,EAAA;AAKD,SAAA;AACR;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"gaugeTableColumnCount.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/gaugeTableColumnCount.ts"],"sourcesContent":["import type { TableElement } from './TableElement'\nimport type { TableRowElement } from './TableRowElement'\n\nexport const gaugeTableColumnCount = (table: TableElement): number => {\n\t// This whole function is obviously very heuristic. It's intended to be called during normalizations (i.e. often),\n\t// and so it aims to be reasonably fast. We want to use this return value to repair corrupted tables.\n\n\tif (table.children.length === 0) {\n\t\treturn 0\n\t}\n\n\tconst rowSampleStart = table.children[0] as TableRowElement\n\tconst rowSampleMiddle = table.children[Math.floor(table.children.length / 2)] as TableRowElement\n\tconst rowSampleEnd = table.children[table.children.length - 1] as TableRowElement\n\n\tconst columnSampleStart = rowSampleStart.children.length\n\tconst columnSampleMiddle = rowSampleMiddle.children.length\n\tconst columnSampleEnd = rowSampleEnd.children.length\n\n\t// Tables most often get corrupted either at the beginning or at the end. Thus we assume that out of these three\n\t// values, two will likely be the same.\n\tif (columnSampleStart === columnSampleEnd) {\n\t\treturn columnSampleStart\n\t}\n\tif (columnSampleStart === columnSampleMiddle) {\n\t\treturn columnSampleStart\n\t}\n\tif (columnSampleMiddle === columnSampleEnd) {\n\t\treturn columnSampleMiddle\n\t}\n\n\t// If we make it here, then all three are different and the table is completely broken. We could consult more rows\n\t// but really, odds are that it wouldn't really help.\n\treturn columnSampleStart\n}\n"],"names":[],"mappings":"AAGa,MAAA,wBAAwB,CAAC,UAAgC;AAIjE,MAAA,MAAM,SAAS,WAAW,GAAG;AACzB,WAAA;AAAA,EACR;AAEM,QAAA,iBAAiB,MAAM,SAAS,CAAC;AACjC,QAAA,kBAAkB,MAAM,SAAS,KAAK,MAAM,MAAM,SAAS,SAAS,CAAC,CAAC;AAC5E,QAAM,eAAe,MAAM,SAAS,MAAM,SAAS,SAAS,CAAC;AAEvD,QAAA,oBAAoB,eAAe,SAAS;AAC5C,QAAA,qBAAqB,gBAAgB,SAAS;AAC9C,QAAA,kBAAkB,aAAa,SAAS;AAI9C,MAAI,sBAAsB,iBAAiB;AACnC,WAAA;AAAA,EACR;AACA,MAAI,sBAAsB,oBAAoB;AACtC,WAAA;AAAA,EACR;AACA,MAAI,uBAAuB,iBAAiB;AACpC,WAAA;AAAA,EACR;AAIO,SAAA;AACR;"}
1
+ {"version":3,"file":"gaugeTableColumnCount.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/gaugeTableColumnCount.ts"],"sourcesContent":["import type { TableElement } from './TableElement'\nimport type { TableRowElement } from './TableRowElement'\n\nexport const gaugeTableColumnCount = (table: TableElement): number => {\n\t// This whole function is obviously very heuristic. It's intended to be called during normalizations (i.e. often),\n\t// and so it aims to be reasonably fast. We want to use this return value to repair corrupted tables.\n\n\tif (table.children.length === 0) {\n\t\treturn 0\n\t}\n\n\tconst rowSampleStart = table.children[0] as TableRowElement\n\tconst rowSampleMiddle = table.children[Math.floor(table.children.length / 2)] as TableRowElement\n\tconst rowSampleEnd = table.children[table.children.length - 1] as TableRowElement\n\n\tconst columnSampleStart = rowSampleStart.children.length\n\tconst columnSampleMiddle = rowSampleMiddle.children.length\n\tconst columnSampleEnd = rowSampleEnd.children.length\n\n\t// Tables most often get corrupted either at the beginning or at the end. Thus we assume that out of these three\n\t// values, two will likely be the same.\n\tif (columnSampleStart === columnSampleEnd) {\n\t\treturn columnSampleStart\n\t}\n\tif (columnSampleStart === columnSampleMiddle) {\n\t\treturn columnSampleStart\n\t}\n\tif (columnSampleMiddle === columnSampleEnd) {\n\t\treturn columnSampleMiddle\n\t}\n\n\t// If we make it here, then all three are different and the table is completely broken. We could consult more rows\n\t// but really, odds are that it wouldn't really help.\n\treturn columnSampleStart\n}\n"],"names":[],"mappings":"AAGa,MAAA,wBAAwB,CAAC,UAAgC;AAIjE,MAAA,MAAM,SAAS,WAAW,GAAG;AACzB,WAAA;AAAA,EAAA;AAGF,QAAA,iBAAiB,MAAM,SAAS,CAAC;AACjC,QAAA,kBAAkB,MAAM,SAAS,KAAK,MAAM,MAAM,SAAS,SAAS,CAAC,CAAC;AAC5E,QAAM,eAAe,MAAM,SAAS,MAAM,SAAS,SAAS,CAAC;AAEvD,QAAA,oBAAoB,eAAe,SAAS;AAC5C,QAAA,qBAAqB,gBAAgB,SAAS;AAC9C,QAAA,kBAAkB,aAAa,SAAS;AAI9C,MAAI,sBAAsB,iBAAiB;AACnC,WAAA;AAAA,EAAA;AAER,MAAI,sBAAsB,oBAAoB;AACtC,WAAA;AAAA,EAAA;AAER,MAAI,uBAAuB,iBAAiB;AACpC,WAAA;AAAA,EAAA;AAKD,SAAA;AACR;"}
@@ -1 +1 @@
1
- {"version":3,"file":"withTables.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/withTables.ts"],"sourcesContent":["import { Editor, Element, Node as SlateNode, NodeEntry, Path as SlatePath, Point, Range as SlateRange, Text, Transforms } from 'slate'\nimport { ContemberEditor } from '../../../editor'\nimport { isTableCellElement, TableCellElement, tableCellElementPlugin } from './TableCellElement'\nimport { getTableElementColumnCount, getTableElementRowCount, isTableElement, TableElement, tableElementPlugin } from './TableElement'\nimport { getTableCellCoordinates, selectTableCellContents } from './TableElementSelection'\nimport { tableHTMLDeserializer } from './TableHtmlDeserializer'\nimport { TableModifications } from './TableModifications'\nimport { isTableRowElement, TableRowElement, tableRowElementPlugin } from './TableRowElement'\nimport { ElementRenderer } from '../../../types'\n\nexport const withTables = ({ renderTable, renderTableCell, renderTableRow }: {\n\trenderTable: ElementRenderer<TableElement>\n\trenderTableCell: ElementRenderer<TableCellElement>\n\trenderTableRow: ElementRenderer<TableRowElement>\n}) => <E extends Editor>(editor: E): E => {\n\tconst {\n\t\tdeleteForward,\n\t\tdeleteBackward,\n\t\tdeleteFragment,\n\t\tinsertBreak,\n\t\tonKeyDown,\n\t} = editor\n\n\teditor.registerElement(tableElementPlugin({ render: renderTable }))\n\teditor.registerElement(tableCellElementPlugin({ render: renderTableCell }))\n\teditor.registerElement(tableRowElementPlugin({ render: renderTableRow }))\n\n\teditor.htmlDeserializer.registerPlugin(tableHTMLDeserializer)\n\n\tObject.assign<Editor, Partial<Editor>>(editor, {\n\t\tinsertBreak: () => {\n\t\t\tconst closestBlockEntry = ContemberEditor.closestBlockEntry(editor)\n\t\t\tif (closestBlockEntry && isTableCellElement(closestBlockEntry[0])) {\n\t\t\t\tconst selection = editor.selection\n\t\t\t\tconst [, closestBlockPath] = closestBlockEntry\n\t\t\t\tconst [cellStart, cellEnd] = Editor.edges(editor, closestBlockPath)\n\n\t\t\t\tif (!selection) {\n\t\t\t\t\treturn insertBreak()\n\t\t\t\t}\n\n\t\t\t\treturn Editor.withoutNormalizing(editor, () => {\n\t\t\t\t\tTransforms.wrapNodes(editor, editor.createDefaultElement([]), {\n\t\t\t\t\t\tat: {\n\t\t\t\t\t\t\tanchor: cellStart,\n\t\t\t\t\t\t\tfocus: cellEnd,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tmatch: node => Text.isText(node) || (Element.isElement(node) && editor.isInline(node)),\n\t\t\t\t\t})\n\n\t\t\t\t\tconst relative = SlatePath.relative(selection.focus.path, closestBlockPath)\n\t\t\t\t\tTransforms.splitNodes(editor, {\n\t\t\t\t\t\t// The zero should be the newly created default element.\n\t\t\t\t\t\tat: {\n\t\t\t\t\t\t\tpath: [...closestBlockPath, 0, ...relative],\n\t\t\t\t\t\t\toffset: selection.focus.offset,\n\t\t\t\t\t\t},\n\t\t\t\t\t\talways: true,\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t}\n\t\t\tinsertBreak()\n\t\t},\n\t\tdeleteBackward: unit => {\n\t\t\tconst selection = editor.selection\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst closestBlockEntry = ContemberEditor.closestBlockEntry(editor)\n\t\t\t\tif (\n\t\t\t\t\tclosestBlockEntry &&\n\t\t\t\t\tisTableCellElement(closestBlockEntry[0]) &&\n\t\t\t\t\tPoint.equals(selection.focus, Editor.start(editor, closestBlockEntry[1]))\n\t\t\t\t) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\tdeleteBackward(unit)\n\t\t},\n\t\tdeleteForward: unit => {\n\t\t\tconst selection = editor.selection\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst closestBlockEntry = ContemberEditor.closestBlockEntry(editor)\n\t\t\t\tif (\n\t\t\t\t\tclosestBlockEntry &&\n\t\t\t\t\tisTableCellElement(closestBlockEntry[0]) &&\n\t\t\t\t\tPoint.equals(selection.focus, Editor.end(editor, closestBlockEntry[1]))\n\t\t\t\t) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\tdeleteForward(unit)\n\t\t},\n\t\tdeleteFragment: () => {\n\t\t\tconst selection = editor.selection\n\t\t\tif (!selection || SlateRange.isCollapsed(selection)) {\n\t\t\t\treturn deleteFragment()\n\t\t\t}\n\t\t\tconst lowestCommonAncestorPath = SlatePath.common(selection.anchor.path, selection.focus.path)\n\t\t\tconst [lowestCommonAncestor] = Editor.node(editor, lowestCommonAncestorPath)\n\n\t\t\tif (isTableElement(lowestCommonAncestor) || isTableRowElement(lowestCommonAncestor)) {\n\t\t\t\treturn // TODO nope for now\n\t\t\t}\n\t\t\tdeleteFragment()\n\t\t},\n\t\tonKeyDown: event => {\n\t\t\tconst selection = editor.selection\n\t\t\tif (\n\t\t\t\t!selection ||\n\t\t\t\t!(\n\t\t\t\t\tevent.key === 'Tab' ||\n\t\t\t\t\tevent.key === 'ArrowUp' ||\n\t\t\t\t\tevent.key === 'ArrowRight' ||\n\t\t\t\t\tevent.key === 'ArrowDown' ||\n\t\t\t\t\tevent.key === 'ArrowLeft' ||\n\t\t\t\t\tevent.key === 'Enter' ||\n\t\t\t\t\tevent.key === 'Backspace'\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn onKeyDown(event)\n\t\t\t}\n\t\t\tconst closestBlockEntry = ContemberEditor.closestBlockEntry(editor, { at: selection })\n\n\t\t\tif (!closestBlockEntry) {\n\t\t\t\treturn onKeyDown(event)\n\t\t\t}\n\t\t\tlet cellElement: TableCellElement\n\t\t\tlet cellPath: SlatePath\n\n\t\t\tif (!isTableCellElement(closestBlockEntry[0])) {\n\t\t\t\tconst parent = SlateNode.parent(editor, closestBlockEntry[1])\n\t\t\t\tif (Element.isElement(closestBlockEntry[0]) && editor.isDefaultElement(closestBlockEntry[0]) && isTableCellElement(parent)) {\n\t\t\t\t\tcellElement = parent\n\t\t\t\t\tcellPath = SlatePath.parent(closestBlockEntry[1])\n\t\t\t\t} else {\n\t\t\t\t\treturn onKeyDown(event)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t[cellElement, cellPath] = closestBlockEntry\n\t\t\t}\n\t\t\tif (cellPath.length < 3) {\n\t\t\t\treturn onKeyDown(event)\n\t\t\t}\n\t\t\tconst [rowIndex, columnIndex] = getTableCellCoordinates(editor, cellElement)\n\t\t\tconst tablePath = cellPath.slice(0, -2)\n\t\t\tconst tableElement = SlateNode.get(editor, tablePath) as TableElement\n\t\t\tconst rowCount = getTableElementRowCount(tableElement)\n\t\t\tconst columnCount = getTableElementColumnCount(tableElement)\n\n\t\t\tif (rowCount === 0 || columnCount === 0) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst moveSelectionBeforeTable = () => {\n\t\t\t\tconst pointBeforeTable = Editor.before(editor, tablePath)\n\t\t\t\tif (!pointBeforeTable) {\n\t\t\t\t\treturn onKeyDown(event)\n\t\t\t\t}\n\t\t\t\tevent.preventDefault()\n\t\t\t\treturn Transforms.select(editor, pointBeforeTable)\n\t\t\t}\n\t\t\tconst moveSelectionAfterTable = () => {\n\t\t\t\tconst pointAfterTable = Editor.after(editor, tablePath)\n\t\t\t\tif (!pointAfterTable) {\n\t\t\t\t\treturn onKeyDown(event)\n\t\t\t\t}\n\t\t\t\tevent.preventDefault()\n\t\t\t\treturn Transforms.select(editor, pointAfterTable)\n\t\t\t}\n\n\t\t\tif (event.key === 'Tab') {\n\t\t\t\tif (event.shiftKey) {\n\t\t\t\t\t// Moving backwards\n\t\t\t\t\tif (columnIndex > 0) {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\treturn selectTableCellContents(editor, tablePath, rowIndex, columnIndex - 1)\n\t\t\t\t\t} else if (columnIndex === 0) {\n\t\t\t\t\t\tif (rowIndex > 0) {\n\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\treturn selectTableCellContents(editor, tablePath, rowIndex - 1, columnCount - 1)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn moveSelectionBeforeTable()\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Moving forwards\n\t\t\t\t\tif (columnIndex < columnCount - 1) {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\treturn selectTableCellContents(editor, tablePath, rowIndex, columnIndex + 1)\n\t\t\t\t\t} else if (columnIndex === columnCount - 1) {\n\t\t\t\t\t\t// We're at the right edge of the table\n\t\t\t\t\t\tif (rowIndex < rowCount - 1) {\n\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\treturn selectTableCellContents(editor, tablePath, rowIndex + 1, 0)\n\t\t\t\t\t\t} else if (rowIndex === rowCount - 1) {\n\t\t\t\t\t\t\treturn moveSelectionAfterTable()\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (event.key === 'ArrowLeft') {\n\t\t\t\tif (!SlateRange.isCollapsed(selection)) {\n\t\t\t\t\treturn onKeyDown(event)\n\t\t\t\t}\n\t\t\t\tif (Point.equals(selection.focus, Editor.start(editor, cellPath))) {\n\t\t\t\t\tif (columnIndex > 0) {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\treturn Transforms.select(editor, Editor.end(editor, [...tablePath, rowIndex, columnIndex - 1]))\n\t\t\t\t\t} else if (columnIndex === 0) {\n\t\t\t\t\t\tif (rowIndex > 0) {\n\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\treturn Transforms.select(editor, Editor.end(editor, [...tablePath, rowIndex - 1, columnCount - 1]))\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn moveSelectionBeforeTable()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (event.key === 'ArrowRight') {\n\t\t\t\tif (!SlateRange.isCollapsed(selection)) {\n\t\t\t\t\treturn onKeyDown(event)\n\t\t\t\t}\n\t\t\t\tif (Point.equals(selection.focus, Editor.end(editor, cellPath))) {\n\t\t\t\t\tif (columnIndex < columnCount - 1) {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\treturn Transforms.select(editor, Editor.start(editor, [...tablePath, rowIndex, columnIndex + 1]))\n\t\t\t\t\t} else if (columnIndex === columnCount - 1) {\n\t\t\t\t\t\tif (rowIndex < rowCount - 1) {\n\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\treturn Transforms.select(editor, Editor.start(editor, [...tablePath, rowIndex + 1, 0]))\n\t\t\t\t\t\t} else if (rowIndex === rowCount - 1) {\n\t\t\t\t\t\t\treturn moveSelectionAfterTable()\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n\t\t\t\tconst withinDefault = editor.isDefaultElement(closestBlockEntry[0])\n\t\t\t\tif (withinDefault) {\n\t\t\t\t\tconst relative = SlatePath.relative(closestBlockEntry[1], cellPath)\n\t\t\t\t\tconst defaultIndex = relative[0]\n\t\t\t\t\tif (\n\t\t\t\t\t\t(event.key === 'ArrowUp' && defaultIndex !== 0) ||\n\t\t\t\t\t\t(event.key === 'ArrowDown' && defaultIndex !== cellElement.children.length - 1)\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn onKeyDown(event)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (event.key === 'ArrowUp') {\n\t\t\t\t\tif (rowIndex > 0) {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\tconst rowAboveEndPoint = Editor.end(editor, [...tablePath, rowIndex - 1, columnIndex])\n\n\t\t\t\t\t\tif (!SlateRange.isCollapsed(selection)) {\n\t\t\t\t\t\t\treturn Transforms.select(editor, rowAboveEndPoint)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst minOffset = Math.min(selection.focus.offset, rowAboveEndPoint.offset)\n\t\t\t\t\t\treturn Transforms.select(editor, {\n\t\t\t\t\t\t\tpath: rowAboveEndPoint.path,\n\t\t\t\t\t\t\toffset: minOffset,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t\treturn moveSelectionBeforeTable()\n\t\t\t\t} else if (event.key === 'ArrowDown') {\n\t\t\t\t\tif (rowIndex < rowCount - 1) {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\tconst rowBelowStatPoint = Editor.start(editor, [...tablePath, rowIndex + 1, columnIndex])\n\n\t\t\t\t\t\tif (!SlateRange.isCollapsed(selection)) {\n\t\t\t\t\t\t\treturn Transforms.select(editor, rowBelowStatPoint)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst [rowBelowStatPointNode] = Editor.node(editor, rowBelowStatPoint) as NodeEntry<Text>\n\n\t\t\t\t\t\treturn Transforms.select(editor, {\n\t\t\t\t\t\t\tpath: rowBelowStatPoint.path,\n\t\t\t\t\t\t\toffset: Math.min(selection.focus.offset, rowBelowStatPointNode.text.length),\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t\treturn moveSelectionAfterTable()\n\t\t\t\t}\n\t\t\t} else if (event.ctrlKey || event.metaKey) {\n\t\t\t\tif (event.key === 'Backspace') {\n\t\t\t\t\tevent.preventDefault()\n\n\t\t\t\t\tif (event.altKey) {\n\t\t\t\t\t\tTableModifications.deleteTableColumn(editor, tableElement, columnIndex)\n\n\t\t\t\t\t\tif (columnCount > 1) {\n\t\t\t\t\t\t\tconst columnBefore = Editor.start(editor, [...tablePath, rowIndex, Math.max(0, columnIndex - 1)])\n\n\t\t\t\t\t\t\treturn Transforms.select(editor, columnBefore)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn moveSelectionBeforeTable()\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tTableModifications.deleteTableRow(editor, tableElement, rowIndex)\n\n\t\t\t\t\t\tif (rowCount > 1) {\n\t\t\t\t\t\t\tconst rowAbove = Editor.start(editor, [...tablePath, Math.max(0, rowIndex - 1), columnIndex])\n\n\t\t\t\t\t\t\treturn Transforms.select(editor, rowAbove)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn moveSelectionBeforeTable()\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if (event.key === 'Enter') {\n\t\t\t\t\tevent.preventDefault()\n\n\t\t\t\t\tif (event.altKey) {\n\t\t\t\t\t\tif (event.shiftKey) {\n\t\t\t\t\t\t\tTableModifications.addTableColumn(editor, tableElement, columnIndex)\n\t\t\t\t\t\t\tconst columnBefore = Editor.start(editor, [...tablePath, rowIndex, Math.max(0, columnIndex)])\n\n\t\t\t\t\t\t\treturn Transforms.select(editor, columnBefore)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tTableModifications.addTableColumn(editor, tableElement, columnIndex + 1)\n\t\t\t\t\t\t\tconst columnAfter = Editor.start(editor, [...tablePath, rowIndex, columnIndex + 1])\n\n\t\t\t\t\t\t\treturn Transforms.select(editor, columnAfter)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (event.shiftKey) {\n\t\t\t\t\t\t\tTableModifications.addTableRow(editor, tableElement, rowIndex)\n\t\t\t\t\t\t\tconst rowAbove = Editor.start(editor, [...tablePath, Math.max(0, rowIndex), columnIndex])\n\n\t\t\t\t\t\t\treturn Transforms.select(editor, rowAbove)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tTableModifications.addTableRow(editor, tableElement, rowIndex + 1)\n\t\t\t\t\t\t\tconst rowBelowStat = Editor.start(editor, [...tablePath, rowIndex + 1, columnIndex])\n\n\t\t\t\t\t\t\treturn Transforms.select(editor, rowBelowStat)\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\tonKeyDown(event)\n\t\t},\n\n\t})\n\n\treturn editor\n}\n"],"names":["tableElementPlugin","tableCellElementPlugin","tableRowElementPlugin","tableHTMLDeserializer","ContemberEditor","isTableCellElement","Editor","Transforms","Text","Element","SlatePath","SlateRange","Point","isTableElement","isTableRowElement","SlateNode","getTableCellCoordinates","getTableElementRowCount","getTableElementColumnCount","selectTableCellContents","TableModifications"],"mappings":";;;;;;;;;;AAUa,MAAA,aAAa,CAAC,EAAE,aAAa,iBAAiB,eAAe,MAIpE,CAAmB,WAAiB;AACnC,QAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACG,IAAA;AAEJ,SAAO,gBAAgBA,aAAmB,mBAAA,EAAE,QAAQ,YAAa,CAAA,CAAC;AAClE,SAAO,gBAAgBC,iBAAuB,uBAAA,EAAE,QAAQ,gBAAiB,CAAA,CAAC;AAC1E,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AO,QAAQ,QAAQ;AAAA,YAAA,OACnC;AACNa,iCAAA,mBAAmB,YAAY,QAAQ,cAAc,WAAW,CAAC;AAC3D,oBAAA,eAAed,MAAAA,OAAO,MAAM,QAAQ,CAAC,GAAG,WAAW,WAAW,GAAG,WAAW,CAAC;AAE5E,qBAAAC,iBAAW,OAAO,QAAQ,YAAY;AAAA,YAC9C;AAAA,UACD;AAAA,QACD;AAAA,MACD;AACA,gBAAU,KAAK;AAAA,IAChB;AAAA,EAAA,CAEA;AAEM,SAAA;AACR;;"}
1
+ {"version":3,"file":"withTables.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/withTables.ts"],"sourcesContent":["import { Editor, Element, Node as SlateNode, NodeEntry, Path as SlatePath, Point, Range as SlateRange, Text, Transforms } from 'slate'\nimport { ContemberEditor } from '../../../editor'\nimport { isTableCellElement, TableCellElement, tableCellElementPlugin } from './TableCellElement'\nimport { getTableElementColumnCount, getTableElementRowCount, isTableElement, TableElement, tableElementPlugin } from './TableElement'\nimport { getTableCellCoordinates, selectTableCellContents } from './TableElementSelection'\nimport { tableHTMLDeserializer } from './TableHtmlDeserializer'\nimport { TableModifications } from './TableModifications'\nimport { isTableRowElement, TableRowElement, tableRowElementPlugin } from './TableRowElement'\nimport { ElementRenderer } from '../../../types'\n\nexport const withTables = ({ renderTable, renderTableCell, renderTableRow }: {\n\trenderTable: ElementRenderer<TableElement>\n\trenderTableCell: ElementRenderer<TableCellElement>\n\trenderTableRow: ElementRenderer<TableRowElement>\n}) => <E extends Editor>(editor: E): E => {\n\tconst {\n\t\tdeleteForward,\n\t\tdeleteBackward,\n\t\tdeleteFragment,\n\t\tinsertBreak,\n\t\tonKeyDown,\n\t} = editor\n\n\teditor.registerElement(tableElementPlugin({ render: renderTable }))\n\teditor.registerElement(tableCellElementPlugin({ render: renderTableCell }))\n\teditor.registerElement(tableRowElementPlugin({ render: renderTableRow }))\n\n\teditor.htmlDeserializer.registerPlugin(tableHTMLDeserializer)\n\n\tObject.assign<Editor, Partial<Editor>>(editor, {\n\t\tinsertBreak: () => {\n\t\t\tconst closestBlockEntry = ContemberEditor.closestBlockEntry(editor)\n\t\t\tif (closestBlockEntry && isTableCellElement(closestBlockEntry[0])) {\n\t\t\t\tconst selection = editor.selection\n\t\t\t\tconst [, closestBlockPath] = closestBlockEntry\n\t\t\t\tconst [cellStart, cellEnd] = Editor.edges(editor, closestBlockPath)\n\n\t\t\t\tif (!selection) {\n\t\t\t\t\treturn insertBreak()\n\t\t\t\t}\n\n\t\t\t\treturn Editor.withoutNormalizing(editor, () => {\n\t\t\t\t\tTransforms.wrapNodes(editor, editor.createDefaultElement([]), {\n\t\t\t\t\t\tat: {\n\t\t\t\t\t\t\tanchor: cellStart,\n\t\t\t\t\t\t\tfocus: cellEnd,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tmatch: node => Text.isText(node) || (Element.isElement(node) && editor.isInline(node)),\n\t\t\t\t\t})\n\n\t\t\t\t\tconst relative = SlatePath.relative(selection.focus.path, closestBlockPath)\n\t\t\t\t\tTransforms.splitNodes(editor, {\n\t\t\t\t\t\t// The zero should be the newly created default element.\n\t\t\t\t\t\tat: {\n\t\t\t\t\t\t\tpath: [...closestBlockPath, 0, ...relative],\n\t\t\t\t\t\t\toffset: selection.focus.offset,\n\t\t\t\t\t\t},\n\t\t\t\t\t\talways: true,\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t}\n\t\t\tinsertBreak()\n\t\t},\n\t\tdeleteBackward: unit => {\n\t\t\tconst selection = editor.selection\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst closestBlockEntry = ContemberEditor.closestBlockEntry(editor)\n\t\t\t\tif (\n\t\t\t\t\tclosestBlockEntry &&\n\t\t\t\t\tisTableCellElement(closestBlockEntry[0]) &&\n\t\t\t\t\tPoint.equals(selection.focus, Editor.start(editor, closestBlockEntry[1]))\n\t\t\t\t) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\tdeleteBackward(unit)\n\t\t},\n\t\tdeleteForward: unit => {\n\t\t\tconst selection = editor.selection\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst closestBlockEntry = ContemberEditor.closestBlockEntry(editor)\n\t\t\t\tif (\n\t\t\t\t\tclosestBlockEntry &&\n\t\t\t\t\tisTableCellElement(closestBlockEntry[0]) &&\n\t\t\t\t\tPoint.equals(selection.focus, Editor.end(editor, closestBlockEntry[1]))\n\t\t\t\t) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\tdeleteForward(unit)\n\t\t},\n\t\tdeleteFragment: () => {\n\t\t\tconst selection = editor.selection\n\t\t\tif (!selection || SlateRange.isCollapsed(selection)) {\n\t\t\t\treturn deleteFragment()\n\t\t\t}\n\t\t\tconst lowestCommonAncestorPath = SlatePath.common(selection.anchor.path, selection.focus.path)\n\t\t\tconst [lowestCommonAncestor] = Editor.node(editor, lowestCommonAncestorPath)\n\n\t\t\tif (isTableElement(lowestCommonAncestor) || isTableRowElement(lowestCommonAncestor)) {\n\t\t\t\treturn // TODO nope for now\n\t\t\t}\n\t\t\tdeleteFragment()\n\t\t},\n\t\tonKeyDown: event => {\n\t\t\tconst selection = editor.selection\n\t\t\tif (\n\t\t\t\t!selection ||\n\t\t\t\t!(\n\t\t\t\t\tevent.key === 'Tab' ||\n\t\t\t\t\tevent.key === 'ArrowUp' ||\n\t\t\t\t\tevent.key === 'ArrowRight' ||\n\t\t\t\t\tevent.key === 'ArrowDown' ||\n\t\t\t\t\tevent.key === 'ArrowLeft' ||\n\t\t\t\t\tevent.key === 'Enter' ||\n\t\t\t\t\tevent.key === 'Backspace'\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn onKeyDown(event)\n\t\t\t}\n\t\t\tconst closestBlockEntry = ContemberEditor.closestBlockEntry(editor, { at: selection })\n\n\t\t\tif (!closestBlockEntry) {\n\t\t\t\treturn onKeyDown(event)\n\t\t\t}\n\t\t\tlet cellElement: TableCellElement\n\t\t\tlet cellPath: SlatePath\n\n\t\t\tif (!isTableCellElement(closestBlockEntry[0])) {\n\t\t\t\tconst parent = SlateNode.parent(editor, closestBlockEntry[1])\n\t\t\t\tif (Element.isElement(closestBlockEntry[0]) && editor.isDefaultElement(closestBlockEntry[0]) && isTableCellElement(parent)) {\n\t\t\t\t\tcellElement = parent\n\t\t\t\t\tcellPath = SlatePath.parent(closestBlockEntry[1])\n\t\t\t\t} else {\n\t\t\t\t\treturn onKeyDown(event)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t[cellElement, cellPath] = closestBlockEntry\n\t\t\t}\n\t\t\tif (cellPath.length < 3) {\n\t\t\t\treturn onKeyDown(event)\n\t\t\t}\n\t\t\tconst [rowIndex, columnIndex] = getTableCellCoordinates(editor, cellElement)\n\t\t\tconst tablePath = cellPath.slice(0, -2)\n\t\t\tconst tableElement = SlateNode.get(editor, tablePath) as TableElement\n\t\t\tconst rowCount = getTableElementRowCount(tableElement)\n\t\t\tconst columnCount = getTableElementColumnCount(tableElement)\n\n\t\t\tif (rowCount === 0 || columnCount === 0) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst moveSelectionBeforeTable = () => {\n\t\t\t\tconst pointBeforeTable = Editor.before(editor, tablePath)\n\t\t\t\tif (!pointBeforeTable) {\n\t\t\t\t\treturn onKeyDown(event)\n\t\t\t\t}\n\t\t\t\tevent.preventDefault()\n\t\t\t\treturn Transforms.select(editor, pointBeforeTable)\n\t\t\t}\n\t\t\tconst moveSelectionAfterTable = () => {\n\t\t\t\tconst pointAfterTable = Editor.after(editor, tablePath)\n\t\t\t\tif (!pointAfterTable) {\n\t\t\t\t\treturn onKeyDown(event)\n\t\t\t\t}\n\t\t\t\tevent.preventDefault()\n\t\t\t\treturn Transforms.select(editor, pointAfterTable)\n\t\t\t}\n\n\t\t\tif (event.key === 'Tab') {\n\t\t\t\tif (event.shiftKey) {\n\t\t\t\t\t// Moving backwards\n\t\t\t\t\tif (columnIndex > 0) {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\treturn selectTableCellContents(editor, tablePath, rowIndex, columnIndex - 1)\n\t\t\t\t\t} else if (columnIndex === 0) {\n\t\t\t\t\t\tif (rowIndex > 0) {\n\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\treturn selectTableCellContents(editor, tablePath, rowIndex - 1, columnCount - 1)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn moveSelectionBeforeTable()\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Moving forwards\n\t\t\t\t\tif (columnIndex < columnCount - 1) {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\treturn selectTableCellContents(editor, tablePath, rowIndex, columnIndex + 1)\n\t\t\t\t\t} else if (columnIndex === columnCount - 1) {\n\t\t\t\t\t\t// We're at the right edge of the table\n\t\t\t\t\t\tif (rowIndex < rowCount - 1) {\n\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\treturn selectTableCellContents(editor, tablePath, rowIndex + 1, 0)\n\t\t\t\t\t\t} else if (rowIndex === rowCount - 1) {\n\t\t\t\t\t\t\treturn moveSelectionAfterTable()\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (event.key === 'ArrowLeft') {\n\t\t\t\tif (!SlateRange.isCollapsed(selection)) {\n\t\t\t\t\treturn onKeyDown(event)\n\t\t\t\t}\n\t\t\t\tif (Point.equals(selection.focus, Editor.start(editor, cellPath))) {\n\t\t\t\t\tif (columnIndex > 0) {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\treturn Transforms.select(editor, Editor.end(editor, [...tablePath, rowIndex, columnIndex - 1]))\n\t\t\t\t\t} else if (columnIndex === 0) {\n\t\t\t\t\t\tif (rowIndex > 0) {\n\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\treturn Transforms.select(editor, Editor.end(editor, [...tablePath, rowIndex - 1, columnCount - 1]))\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn moveSelectionBeforeTable()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (event.key === 'ArrowRight') {\n\t\t\t\tif (!SlateRange.isCollapsed(selection)) {\n\t\t\t\t\treturn onKeyDown(event)\n\t\t\t\t}\n\t\t\t\tif (Point.equals(selection.focus, Editor.end(editor, cellPath))) {\n\t\t\t\t\tif (columnIndex < columnCount - 1) {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\treturn Transforms.select(editor, Editor.start(editor, [...tablePath, rowIndex, columnIndex + 1]))\n\t\t\t\t\t} else if (columnIndex === columnCount - 1) {\n\t\t\t\t\t\tif (rowIndex < rowCount - 1) {\n\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\treturn Transforms.select(editor, Editor.start(editor, [...tablePath, rowIndex + 1, 0]))\n\t\t\t\t\t\t} else if (rowIndex === rowCount - 1) {\n\t\t\t\t\t\t\treturn moveSelectionAfterTable()\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n\t\t\t\tconst withinDefault = editor.isDefaultElement(closestBlockEntry[0])\n\t\t\t\tif (withinDefault) {\n\t\t\t\t\tconst relative = SlatePath.relative(closestBlockEntry[1], cellPath)\n\t\t\t\t\tconst defaultIndex = relative[0]\n\t\t\t\t\tif (\n\t\t\t\t\t\t(event.key === 'ArrowUp' && defaultIndex !== 0) ||\n\t\t\t\t\t\t(event.key === 'ArrowDown' && defaultIndex !== cellElement.children.length - 1)\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn onKeyDown(event)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (event.key === 'ArrowUp') {\n\t\t\t\t\tif (rowIndex > 0) {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\tconst rowAboveEndPoint = Editor.end(editor, [...tablePath, rowIndex - 1, columnIndex])\n\n\t\t\t\t\t\tif (!SlateRange.isCollapsed(selection)) {\n\t\t\t\t\t\t\treturn Transforms.select(editor, rowAboveEndPoint)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst minOffset = Math.min(selection.focus.offset, rowAboveEndPoint.offset)\n\t\t\t\t\t\treturn Transforms.select(editor, {\n\t\t\t\t\t\t\tpath: rowAboveEndPoint.path,\n\t\t\t\t\t\t\toffset: minOffset,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t\treturn moveSelectionBeforeTable()\n\t\t\t\t} else if (event.key === 'ArrowDown') {\n\t\t\t\t\tif (rowIndex < rowCount - 1) {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\tconst rowBelowStatPoint = Editor.start(editor, [...tablePath, rowIndex + 1, columnIndex])\n\n\t\t\t\t\t\tif (!SlateRange.isCollapsed(selection)) {\n\t\t\t\t\t\t\treturn Transforms.select(editor, rowBelowStatPoint)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst [rowBelowStatPointNode] = Editor.node(editor, rowBelowStatPoint) as NodeEntry<Text>\n\n\t\t\t\t\t\treturn Transforms.select(editor, {\n\t\t\t\t\t\t\tpath: rowBelowStatPoint.path,\n\t\t\t\t\t\t\toffset: Math.min(selection.focus.offset, rowBelowStatPointNode.text.length),\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t\treturn moveSelectionAfterTable()\n\t\t\t\t}\n\t\t\t} else if (event.ctrlKey || event.metaKey) {\n\t\t\t\tif (event.key === 'Backspace') {\n\t\t\t\t\tevent.preventDefault()\n\n\t\t\t\t\tif (event.altKey) {\n\t\t\t\t\t\tTableModifications.deleteTableColumn(editor, tableElement, columnIndex)\n\n\t\t\t\t\t\tif (columnCount > 1) {\n\t\t\t\t\t\t\tconst columnBefore = Editor.start(editor, [...tablePath, rowIndex, Math.max(0, columnIndex - 1)])\n\n\t\t\t\t\t\t\treturn Transforms.select(editor, columnBefore)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn moveSelectionBeforeTable()\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tTableModifications.deleteTableRow(editor, tableElement, rowIndex)\n\n\t\t\t\t\t\tif (rowCount > 1) {\n\t\t\t\t\t\t\tconst rowAbove = Editor.start(editor, [...tablePath, Math.max(0, rowIndex - 1), columnIndex])\n\n\t\t\t\t\t\t\treturn Transforms.select(editor, rowAbove)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn moveSelectionBeforeTable()\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if (event.key === 'Enter') {\n\t\t\t\t\tevent.preventDefault()\n\n\t\t\t\t\tif (event.altKey) {\n\t\t\t\t\t\tif (event.shiftKey) {\n\t\t\t\t\t\t\tTableModifications.addTableColumn(editor, tableElement, columnIndex)\n\t\t\t\t\t\t\tconst columnBefore = Editor.start(editor, [...tablePath, rowIndex, Math.max(0, columnIndex)])\n\n\t\t\t\t\t\t\treturn Transforms.select(editor, columnBefore)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tTableModifications.addTableColumn(editor, tableElement, columnIndex + 1)\n\t\t\t\t\t\t\tconst columnAfter = Editor.start(editor, [...tablePath, rowIndex, columnIndex + 1])\n\n\t\t\t\t\t\t\treturn Transforms.select(editor, columnAfter)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (event.shiftKey) {\n\t\t\t\t\t\t\tTableModifications.addTableRow(editor, tableElement, rowIndex)\n\t\t\t\t\t\t\tconst rowAbove = Editor.start(editor, [...tablePath, Math.max(0, rowIndex), columnIndex])\n\n\t\t\t\t\t\t\treturn Transforms.select(editor, rowAbove)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tTableModifications.addTableRow(editor, tableElement, rowIndex + 1)\n\t\t\t\t\t\t\tconst rowBelowStat = Editor.start(editor, [...tablePath, rowIndex + 1, columnIndex])\n\n\t\t\t\t\t\t\treturn Transforms.select(editor, rowBelowStat)\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\tonKeyDown(event)\n\t\t},\n\n\t})\n\n\treturn editor\n}\n"],"names":["tableElementPlugin","tableCellElementPlugin","tableRowElementPlugin","tableHTMLDeserializer","ContemberEditor","isTableCellElement","Editor","Transforms","Text","Element","SlatePath","SlateRange","Point","isTableElement","isTableRowElement","SlateNode","getTableCellCoordinates","getTableElementRowCount","getTableElementColumnCount","selectTableCellContents","TableModifications"],"mappings":";;;;;;;;;;AAUa,MAAA,aAAa,CAAC,EAAE,aAAa,iBAAiB,eAAe,MAIpE,CAAmB,WAAiB;AACnC,QAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACG;AAEJ,SAAO,gBAAgBA,aAAmB,mBAAA,EAAE,QAAQ,YAAa,CAAA,CAAC;AAClE,SAAO,gBAAgBC,iBAAuB,uBAAA,EAAE,QAAQ,gBAAiB,CAAA,CAAC;AAC1E,SAAO,gBAAgBC,gBAAsB,sBAAA,EAAE,QAAQ,eAAgB,CAAA,CAAC;AAEjE,SAAA,iBAAiB,eAAeC,2CAAqB;AAE5D,SAAO,OAAgC,QAAQ;AAAA,IAC9C,aAAa,MAAM;AACZ,YAAA,oBAAoBC,MAAAA,gBAAgB,kBAAkB,MAAM;AAClE,UAAI,qBAAqBC,iBAAA,mBAAmB,kBAAkB,CAAC,CAAC,GAAG;AAClE,cAAM,YAAY,OAAO;AACnB,cAAA,CAAA,EAAG,gBAAgB,IAAI;AAC7B,cAAM,CAAC,WAAW,OAAO,IAAIC,MAAO,OAAA,MAAM,QAAQ,gBAAgB;AAElE,YAAI,CAAC,WAAW;AACf,iBAAO,YAAY;AAAA,QAAA;AAGb,eAAAA,MAAA,OAAO,mBAAmB,QAAQ,MAAM;AAC9CC,gBAAA,WAAW,UAAU,QAAQ,OAAO,qBAAqB,C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C;AAAA,QACD,WACU,MAAM,QAAQ,SAAS;AACjC,gBAAM,eAAe;AAErB,cAAI,MAAM,QAAQ;AACjB,gBAAI,MAAM,UAAU;AACAa,iCAAAA,mBAAA,eAAe,QAAQ,cAAc,WAAW;AACnE,oBAAM,eAAed,MAAA,OAAO,MAAM,QAAQ,CAAC,GAAG,WAAW,UAAU,KAAK,IAAI,GAAG,WAAW,CAAC,CAAC;AAErF,qBAAAC,iBAAW,OAAO,QAAQ,YAAY;AAAA,YAAA,OACvC;AACNa,iCAAAA,mBAAmB,eAAe,QAAQ,cAAc,cAAc,CAAC;AACjE,oBAAA,cAAcd,aAAO,MAAM,QAAQ,CAAC,GAAG,WAAW,UAAU,cAAc,CAAC,CAAC;AAE3E,qBAAAC,iBAAW,OAAO,QAAQ,WAAW;AAAA,YAAA;AAAA,UAC7C,OACM;AACN,gBAAI,MAAM,UAAU;AACAa,iCAAAA,mBAAA,YAAY,QAAQ,cAAc,QAAQ;AAC7D,oBAAM,WAAWd,MAAA,OAAO,MAAM,QAAQ,CAAC,GAAG,WAAW,KAAK,IAAI,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEjF,qBAAAC,iBAAW,OAAO,QAAQ,QAAQ;AAAA,YAAA,OACnC;AACNa,iCAAAA,mBAAmB,YAAY,QAAQ,cAAc,WAAW,CAAC;AAC3D,oBAAA,eAAed,aAAO,MAAM,QAAQ,CAAC,GAAG,WAAW,WAAW,GAAG,WAAW,CAAC;AAE5E,qBAAAC,iBAAW,OAAO,QAAQ,YAAY;AAAA,YAAA;AAAA,UAC9C;AAAA,QACD;AAAA,MACD;AAED,gBAAU,KAAK;AAAA,IAAA;AAAA,EAChB,CAEA;AAEM,SAAA;AACR;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"withTables.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/withTables.ts"],"sourcesContent":["import { Editor, Element, Node as SlateNode, NodeEntry, Path as SlatePath, Point, Range as SlateRange, Text, Transforms } from 'slate'\nimport { ContemberEditor } from '../../../editor'\nimport { isTableCellElement, TableCellElement, tableCellElementPlugin } from './TableCellElement'\nimport { getTableElementColumnCount, getTableElementRowCount, isTableElement, TableElement, tableElementPlugin } from './TableElement'\nimport { getTableCellCoordinates, selectTableCellContents } from './TableElementSelection'\nimport { tableHTMLDeserializer } from './TableHtmlDeserializer'\nimport { TableModifications } from './TableModifications'\nimport { isTableRowElement, TableRowElement, tableRowElementPlugin } from './TableRowElement'\nimport { ElementRenderer } from '../../../types'\n\nexport const withTables = ({ renderTable, renderTableCell, renderTableRow }: {\n\trenderTable: ElementRenderer<TableElement>\n\trenderTableCell: ElementRenderer<TableCellElement>\n\trenderTableRow: ElementRenderer<TableRowElement>\n}) => <E extends Editor>(editor: E): E => {\n\tconst {\n\t\tdeleteForward,\n\t\tdeleteBackward,\n\t\tdeleteFragment,\n\t\tinsertBreak,\n\t\tonKeyDown,\n\t} = editor\n\n\teditor.registerElement(tableElementPlugin({ render: renderTable }))\n\teditor.registerElement(tableCellElementPlugin({ render: renderTableCell }))\n\teditor.registerElement(tableRowElementPlugin({ render: renderTableRow }))\n\n\teditor.htmlDeserializer.registerPlugin(tableHTMLDeserializer)\n\n\tObject.assign<Editor, Partial<Editor>>(editor, {\n\t\tinsertBreak: () => {\n\t\t\tconst closestBlockEntry = ContemberEditor.closestBlockEntry(editor)\n\t\t\tif (closestBlockEntry && isTableCellElement(closestBlockEntry[0])) {\n\t\t\t\tconst selection = editor.selection\n\t\t\t\tconst [, closestBlockPath] = closestBlockEntry\n\t\t\t\tconst [cellStart, cellEnd] = Editor.edges(editor, closestBlockPath)\n\n\t\t\t\tif (!selection) {\n\t\t\t\t\treturn insertBreak()\n\t\t\t\t}\n\n\t\t\t\treturn Editor.withoutNormalizing(editor, () => {\n\t\t\t\t\tTransforms.wrapNodes(editor, editor.createDefaultElement([]), {\n\t\t\t\t\t\tat: {\n\t\t\t\t\t\t\tanchor: cellStart,\n\t\t\t\t\t\t\tfocus: cellEnd,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tmatch: node => Text.isText(node) || (Element.isElement(node) && editor.isInline(node)),\n\t\t\t\t\t})\n\n\t\t\t\t\tconst relative = SlatePath.relative(selection.focus.path, closestBlockPath)\n\t\t\t\t\tTransforms.splitNodes(editor, {\n\t\t\t\t\t\t// The zero should be the newly created default element.\n\t\t\t\t\t\tat: {\n\t\t\t\t\t\t\tpath: [...closestBlockPath, 0, ...relative],\n\t\t\t\t\t\t\toffset: selection.focus.offset,\n\t\t\t\t\t\t},\n\t\t\t\t\t\talways: true,\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t}\n\t\t\tinsertBreak()\n\t\t},\n\t\tdeleteBackward: unit => {\n\t\t\tconst selection = editor.selection\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst closestBlockEntry = ContemberEditor.closestBlockEntry(editor)\n\t\t\t\tif (\n\t\t\t\t\tclosestBlockEntry &&\n\t\t\t\t\tisTableCellElement(closestBlockEntry[0]) &&\n\t\t\t\t\tPoint.equals(selection.focus, Editor.start(editor, closestBlockEntry[1]))\n\t\t\t\t) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\tdeleteBackward(unit)\n\t\t},\n\t\tdeleteForward: unit => {\n\t\t\tconst selection = editor.selection\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst closestBlockEntry = ContemberEditor.closestBlockEntry(editor)\n\t\t\t\tif (\n\t\t\t\t\tclosestBlockEntry &&\n\t\t\t\t\tisTableCellElement(closestBlockEntry[0]) &&\n\t\t\t\t\tPoint.equals(selection.focus, Editor.end(editor, closestBlockEntry[1]))\n\t\t\t\t) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\tdeleteForward(unit)\n\t\t},\n\t\tdeleteFragment: () => {\n\t\t\tconst selection = editor.selection\n\t\t\tif (!selection || SlateRange.isCollapsed(selection)) {\n\t\t\t\treturn deleteFragment()\n\t\t\t}\n\t\t\tconst lowestCommonAncestorPath = SlatePath.common(selection.anchor.path, selection.focus.path)\n\t\t\tconst [lowestCommonAncestor] = Editor.node(editor, lowestCommonAncestorPath)\n\n\t\t\tif (isTableElement(lowestCommonAncestor) || isTableRowElement(lowestCommonAncestor)) {\n\t\t\t\treturn // TODO nope for now\n\t\t\t}\n\t\t\tdeleteFragment()\n\t\t},\n\t\tonKeyDown: event => {\n\t\t\tconst selection = editor.selection\n\t\t\tif (\n\t\t\t\t!selection ||\n\t\t\t\t!(\n\t\t\t\t\tevent.key === 'Tab' ||\n\t\t\t\t\tevent.key === 'ArrowUp' ||\n\t\t\t\t\tevent.key === 'ArrowRight' ||\n\t\t\t\t\tevent.key === 'ArrowDown' ||\n\t\t\t\t\tevent.key === 'ArrowLeft' ||\n\t\t\t\t\tevent.key === 'Enter' ||\n\t\t\t\t\tevent.key === 'Backspace'\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn onKeyDown(event)\n\t\t\t}\n\t\t\tconst closestBlockEntry = ContemberEditor.closestBlockEntry(editor, { at: selection })\n\n\t\t\tif (!closestBlockEntry) {\n\t\t\t\treturn onKeyDown(event)\n\t\t\t}\n\t\t\tlet cellElement: TableCellElement\n\t\t\tlet cellPath: SlatePath\n\n\t\t\tif (!isTableCellElement(closestBlockEntry[0])) {\n\t\t\t\tconst parent = SlateNode.parent(editor, closestBlockEntry[1])\n\t\t\t\tif (Element.isElement(closestBlockEntry[0]) && editor.isDefaultElement(closestBlockEntry[0]) && isTableCellElement(parent)) {\n\t\t\t\t\tcellElement = parent\n\t\t\t\t\tcellPath = SlatePath.parent(closestBlockEntry[1])\n\t\t\t\t} else {\n\t\t\t\t\treturn onKeyDown(event)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t[cellElement, cellPath] = closestBlockEntry\n\t\t\t}\n\t\t\tif (cellPath.length < 3) {\n\t\t\t\treturn onKeyDown(event)\n\t\t\t}\n\t\t\tconst [rowIndex, columnIndex] = getTableCellCoordinates(editor, cellElement)\n\t\t\tconst tablePath = cellPath.slice(0, -2)\n\t\t\tconst tableElement = SlateNode.get(editor, tablePath) as TableElement\n\t\t\tconst rowCount = getTableElementRowCount(tableElement)\n\t\t\tconst columnCount = getTableElementColumnCount(tableElement)\n\n\t\t\tif (rowCount === 0 || columnCount === 0) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst moveSelectionBeforeTable = () => {\n\t\t\t\tconst pointBeforeTable = Editor.before(editor, tablePath)\n\t\t\t\tif (!pointBeforeTable) {\n\t\t\t\t\treturn onKeyDown(event)\n\t\t\t\t}\n\t\t\t\tevent.preventDefault()\n\t\t\t\treturn Transforms.select(editor, pointBeforeTable)\n\t\t\t}\n\t\t\tconst moveSelectionAfterTable = () => {\n\t\t\t\tconst pointAfterTable = Editor.after(editor, tablePath)\n\t\t\t\tif (!pointAfterTable) {\n\t\t\t\t\treturn onKeyDown(event)\n\t\t\t\t}\n\t\t\t\tevent.preventDefault()\n\t\t\t\treturn Transforms.select(editor, pointAfterTable)\n\t\t\t}\n\n\t\t\tif (event.key === 'Tab') {\n\t\t\t\tif (event.shiftKey) {\n\t\t\t\t\t// Moving backwards\n\t\t\t\t\tif (columnIndex > 0) {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\treturn selectTableCellContents(editor, tablePath, rowIndex, columnIndex - 1)\n\t\t\t\t\t} else if (columnIndex === 0) {\n\t\t\t\t\t\tif (rowIndex > 0) {\n\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\treturn selectTableCellContents(editor, tablePath, rowIndex - 1, columnCount - 1)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn moveSelectionBeforeTable()\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Moving forwards\n\t\t\t\t\tif (columnIndex < columnCount - 1) {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\treturn selectTableCellContents(editor, tablePath, rowIndex, columnIndex + 1)\n\t\t\t\t\t} else if (columnIndex === columnCount - 1) {\n\t\t\t\t\t\t// We're at the right edge of the table\n\t\t\t\t\t\tif (rowIndex < rowCount - 1) {\n\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\treturn selectTableCellContents(editor, tablePath, rowIndex + 1, 0)\n\t\t\t\t\t\t} else if (rowIndex === rowCount - 1) {\n\t\t\t\t\t\t\treturn moveSelectionAfterTable()\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (event.key === 'ArrowLeft') {\n\t\t\t\tif (!SlateRange.isCollapsed(selection)) {\n\t\t\t\t\treturn onKeyDown(event)\n\t\t\t\t}\n\t\t\t\tif (Point.equals(selection.focus, Editor.start(editor, cellPath))) {\n\t\t\t\t\tif (columnIndex > 0) {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\treturn Transforms.select(editor, Editor.end(editor, [...tablePath, rowIndex, columnIndex - 1]))\n\t\t\t\t\t} else if (columnIndex === 0) {\n\t\t\t\t\t\tif (rowIndex > 0) {\n\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\treturn Transforms.select(editor, Editor.end(editor, [...tablePath, rowIndex - 1, columnCount - 1]))\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn moveSelectionBeforeTable()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (event.key === 'ArrowRight') {\n\t\t\t\tif (!SlateRange.isCollapsed(selection)) {\n\t\t\t\t\treturn onKeyDown(event)\n\t\t\t\t}\n\t\t\t\tif (Point.equals(selection.focus, Editor.end(editor, cellPath))) {\n\t\t\t\t\tif (columnIndex < columnCount - 1) {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\treturn Transforms.select(editor, Editor.start(editor, [...tablePath, rowIndex, columnIndex + 1]))\n\t\t\t\t\t} else if (columnIndex === columnCount - 1) {\n\t\t\t\t\t\tif (rowIndex < rowCount - 1) {\n\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\treturn Transforms.select(editor, Editor.start(editor, [...tablePath, rowIndex + 1, 0]))\n\t\t\t\t\t\t} else if (rowIndex === rowCount - 1) {\n\t\t\t\t\t\t\treturn moveSelectionAfterTable()\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n\t\t\t\tconst withinDefault = editor.isDefaultElement(closestBlockEntry[0])\n\t\t\t\tif (withinDefault) {\n\t\t\t\t\tconst relative = SlatePath.relative(closestBlockEntry[1], cellPath)\n\t\t\t\t\tconst defaultIndex = relative[0]\n\t\t\t\t\tif (\n\t\t\t\t\t\t(event.key === 'ArrowUp' && defaultIndex !== 0) ||\n\t\t\t\t\t\t(event.key === 'ArrowDown' && defaultIndex !== cellElement.children.length - 1)\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn onKeyDown(event)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (event.key === 'ArrowUp') {\n\t\t\t\t\tif (rowIndex > 0) {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\tconst rowAboveEndPoint = Editor.end(editor, [...tablePath, rowIndex - 1, columnIndex])\n\n\t\t\t\t\t\tif (!SlateRange.isCollapsed(selection)) {\n\t\t\t\t\t\t\treturn Transforms.select(editor, rowAboveEndPoint)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst minOffset = Math.min(selection.focus.offset, rowAboveEndPoint.offset)\n\t\t\t\t\t\treturn Transforms.select(editor, {\n\t\t\t\t\t\t\tpath: rowAboveEndPoint.path,\n\t\t\t\t\t\t\toffset: minOffset,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t\treturn moveSelectionBeforeTable()\n\t\t\t\t} else if (event.key === 'ArrowDown') {\n\t\t\t\t\tif (rowIndex < rowCount - 1) {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\tconst rowBelowStatPoint = Editor.start(editor, [...tablePath, rowIndex + 1, columnIndex])\n\n\t\t\t\t\t\tif (!SlateRange.isCollapsed(selection)) {\n\t\t\t\t\t\t\treturn Transforms.select(editor, rowBelowStatPoint)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst [rowBelowStatPointNode] = Editor.node(editor, rowBelowStatPoint) as NodeEntry<Text>\n\n\t\t\t\t\t\treturn Transforms.select(editor, {\n\t\t\t\t\t\t\tpath: rowBelowStatPoint.path,\n\t\t\t\t\t\t\toffset: Math.min(selection.focus.offset, rowBelowStatPointNode.text.length),\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t\treturn moveSelectionAfterTable()\n\t\t\t\t}\n\t\t\t} else if (event.ctrlKey || event.metaKey) {\n\t\t\t\tif (event.key === 'Backspace') {\n\t\t\t\t\tevent.preventDefault()\n\n\t\t\t\t\tif (event.altKey) {\n\t\t\t\t\t\tTableModifications.deleteTableColumn(editor, tableElement, columnIndex)\n\n\t\t\t\t\t\tif (columnCount > 1) {\n\t\t\t\t\t\t\tconst columnBefore = Editor.start(editor, [...tablePath, rowIndex, Math.max(0, columnIndex - 1)])\n\n\t\t\t\t\t\t\treturn Transforms.select(editor, columnBefore)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn moveSelectionBeforeTable()\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tTableModifications.deleteTableRow(editor, tableElement, rowIndex)\n\n\t\t\t\t\t\tif (rowCount > 1) {\n\t\t\t\t\t\t\tconst rowAbove = Editor.start(editor, [...tablePath, Math.max(0, rowIndex - 1), columnIndex])\n\n\t\t\t\t\t\t\treturn Transforms.select(editor, rowAbove)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn moveSelectionBeforeTable()\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if (event.key === 'Enter') {\n\t\t\t\t\tevent.preventDefault()\n\n\t\t\t\t\tif (event.altKey) {\n\t\t\t\t\t\tif (event.shiftKey) {\n\t\t\t\t\t\t\tTableModifications.addTableColumn(editor, tableElement, columnIndex)\n\t\t\t\t\t\t\tconst columnBefore = Editor.start(editor, [...tablePath, rowIndex, Math.max(0, columnIndex)])\n\n\t\t\t\t\t\t\treturn Transforms.select(editor, columnBefore)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tTableModifications.addTableColumn(editor, tableElement, columnIndex + 1)\n\t\t\t\t\t\t\tconst columnAfter = Editor.start(editor, [...tablePath, rowIndex, columnIndex + 1])\n\n\t\t\t\t\t\t\treturn Transforms.select(editor, columnAfter)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (event.shiftKey) {\n\t\t\t\t\t\t\tTableModifications.addTableRow(editor, tableElement, rowIndex)\n\t\t\t\t\t\t\tconst rowAbove = Editor.start(editor, [...tablePath, Math.max(0, rowIndex), columnIndex])\n\n\t\t\t\t\t\t\treturn Transforms.select(editor, rowAbove)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tTableModifications.addTableRow(editor, tableElement, rowIndex + 1)\n\t\t\t\t\t\t\tconst rowBelowStat = Editor.start(editor, [...tablePath, rowIndex + 1, columnIndex])\n\n\t\t\t\t\t\t\treturn Transforms.select(editor, rowBelowStat)\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\tonKeyDown(event)\n\t\t},\n\n\t})\n\n\treturn editor\n}\n"],"names":["SlatePath","SlateRange","SlateNode"],"mappings":";;;;;;;;AAUa,MAAA,aAAa,CAAC,EAAE,aAAa,iBAAiB,eAAe,MAIpE,CAAmB,WAAiB;AACnC,QAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACG,IAAA;AAEJ,SAAO,gBAAgB,mBAAmB,EAAE,QAAQ,YAAa,CAAA,CAAC;AAClE,SAAO,gBAAgB,uBAAuB,EAAE,QAAQ,gBAAiB,CAAA,CAAC;AAC1E,SA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AAAA,UACD;AAAA,QAAA,WACU,MAAM,QAAQ,SAAS;AACjC,gBAAM,eAAe;AAErB,cAAI,MAAM,QAAQ;AACjB,gBAAI,MAAM,UAAU;AACA,iCAAA,eAAe,QAAQ,cAAc,WAAW;AACnE,oBAAM,eAAe,OAAO,MAAM,QAAQ,CAAC,GAAG,WAAW,UAAU,KAAK,IAAI,GAAG,WAAW,CAAC,CAAC;AAErF,qBAAA,WAAW,OAAO,QAAQ,YAAY;AAAA,YAAA,OACvC;AACN,iCAAmB,eAAe,QAAQ,cAAc,cAAc,CAAC;AACjE,oBAAA,cAAc,OAAO,MAAM,QAAQ,CAAC,GAAG,WAAW,UAAU,cAAc,CAAC,CAAC;AAE3E,qBAAA,WAAW,OAAO,QAAQ,WAAW;AAAA,YAC7C;AAAA,UAAA,OACM;AACN,gBAAI,MAAM,UAAU;AACA,iCAAA,YAAY,QAAQ,cAAc,QAAQ;AAC7D,oBAAM,WAAW,OAAO,MAAM,QAAQ,CAAC,GAAG,WAAW,KAAK,IAAI,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEjF,qBAAA,WAAW,OAAO,QAAQ,QAAQ;AAAA,YAAA,OACnC;AACN,iCAAmB,YAAY,QAAQ,cAAc,WAAW,CAAC;AAC3D,oBAAA,eAAe,OAAO,MAAM,QAAQ,CAAC,GAAG,WAAW,WAAW,GAAG,WAAW,CAAC;AAE5E,qBAAA,WAAW,OAAO,QAAQ,YAAY;AAAA,YAC9C;AAAA,UACD;AAAA,QACD;AAAA,MACD;AACA,gBAAU,KAAK;AAAA,IAChB;AAAA,EAAA,CAEA;AAEM,SAAA;AACR;"}
1
+ {"version":3,"file":"withTables.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/withTables.ts"],"sourcesContent":["import { Editor, Element, Node as SlateNode, NodeEntry, Path as SlatePath, Point, Range as SlateRange, Text, Transforms } from 'slate'\nimport { ContemberEditor } from '../../../editor'\nimport { isTableCellElement, TableCellElement, tableCellElementPlugin } from './TableCellElement'\nimport { getTableElementColumnCount, getTableElementRowCount, isTableElement, TableElement, tableElementPlugin } from './TableElement'\nimport { getTableCellCoordinates, selectTableCellContents } from './TableElementSelection'\nimport { tableHTMLDeserializer } from './TableHtmlDeserializer'\nimport { TableModifications } from './TableModifications'\nimport { isTableRowElement, TableRowElement, tableRowElementPlugin } from './TableRowElement'\nimport { ElementRenderer } from '../../../types'\n\nexport const withTables = ({ renderTable, renderTableCell, renderTableRow }: {\n\trenderTable: ElementRenderer<TableElement>\n\trenderTableCell: ElementRenderer<TableCellElement>\n\trenderTableRow: ElementRenderer<TableRowElement>\n}) => <E extends Editor>(editor: E): E => {\n\tconst {\n\t\tdeleteForward,\n\t\tdeleteBackward,\n\t\tdeleteFragment,\n\t\tinsertBreak,\n\t\tonKeyDown,\n\t} = editor\n\n\teditor.registerElement(tableElementPlugin({ render: renderTable }))\n\teditor.registerElement(tableCellElementPlugin({ render: renderTableCell }))\n\teditor.registerElement(tableRowElementPlugin({ render: renderTableRow }))\n\n\teditor.htmlDeserializer.registerPlugin(tableHTMLDeserializer)\n\n\tObject.assign<Editor, Partial<Editor>>(editor, {\n\t\tinsertBreak: () => {\n\t\t\tconst closestBlockEntry = ContemberEditor.closestBlockEntry(editor)\n\t\t\tif (closestBlockEntry && isTableCellElement(closestBlockEntry[0])) {\n\t\t\t\tconst selection = editor.selection\n\t\t\t\tconst [, closestBlockPath] = closestBlockEntry\n\t\t\t\tconst [cellStart, cellEnd] = Editor.edges(editor, closestBlockPath)\n\n\t\t\t\tif (!selection) {\n\t\t\t\t\treturn insertBreak()\n\t\t\t\t}\n\n\t\t\t\treturn Editor.withoutNormalizing(editor, () => {\n\t\t\t\t\tTransforms.wrapNodes(editor, editor.createDefaultElement([]), {\n\t\t\t\t\t\tat: {\n\t\t\t\t\t\t\tanchor: cellStart,\n\t\t\t\t\t\t\tfocus: cellEnd,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tmatch: node => Text.isText(node) || (Element.isElement(node) && editor.isInline(node)),\n\t\t\t\t\t})\n\n\t\t\t\t\tconst relative = SlatePath.relative(selection.focus.path, closestBlockPath)\n\t\t\t\t\tTransforms.splitNodes(editor, {\n\t\t\t\t\t\t// The zero should be the newly created default element.\n\t\t\t\t\t\tat: {\n\t\t\t\t\t\t\tpath: [...closestBlockPath, 0, ...relative],\n\t\t\t\t\t\t\toffset: selection.focus.offset,\n\t\t\t\t\t\t},\n\t\t\t\t\t\talways: true,\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t}\n\t\t\tinsertBreak()\n\t\t},\n\t\tdeleteBackward: unit => {\n\t\t\tconst selection = editor.selection\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst closestBlockEntry = ContemberEditor.closestBlockEntry(editor)\n\t\t\t\tif (\n\t\t\t\t\tclosestBlockEntry &&\n\t\t\t\t\tisTableCellElement(closestBlockEntry[0]) &&\n\t\t\t\t\tPoint.equals(selection.focus, Editor.start(editor, closestBlockEntry[1]))\n\t\t\t\t) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\tdeleteBackward(unit)\n\t\t},\n\t\tdeleteForward: unit => {\n\t\t\tconst selection = editor.selection\n\t\t\tif (selection && SlateRange.isCollapsed(selection)) {\n\t\t\t\tconst closestBlockEntry = ContemberEditor.closestBlockEntry(editor)\n\t\t\t\tif (\n\t\t\t\t\tclosestBlockEntry &&\n\t\t\t\t\tisTableCellElement(closestBlockEntry[0]) &&\n\t\t\t\t\tPoint.equals(selection.focus, Editor.end(editor, closestBlockEntry[1]))\n\t\t\t\t) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\tdeleteForward(unit)\n\t\t},\n\t\tdeleteFragment: () => {\n\t\t\tconst selection = editor.selection\n\t\t\tif (!selection || SlateRange.isCollapsed(selection)) {\n\t\t\t\treturn deleteFragment()\n\t\t\t}\n\t\t\tconst lowestCommonAncestorPath = SlatePath.common(selection.anchor.path, selection.focus.path)\n\t\t\tconst [lowestCommonAncestor] = Editor.node(editor, lowestCommonAncestorPath)\n\n\t\t\tif (isTableElement(lowestCommonAncestor) || isTableRowElement(lowestCommonAncestor)) {\n\t\t\t\treturn // TODO nope for now\n\t\t\t}\n\t\t\tdeleteFragment()\n\t\t},\n\t\tonKeyDown: event => {\n\t\t\tconst selection = editor.selection\n\t\t\tif (\n\t\t\t\t!selection ||\n\t\t\t\t!(\n\t\t\t\t\tevent.key === 'Tab' ||\n\t\t\t\t\tevent.key === 'ArrowUp' ||\n\t\t\t\t\tevent.key === 'ArrowRight' ||\n\t\t\t\t\tevent.key === 'ArrowDown' ||\n\t\t\t\t\tevent.key === 'ArrowLeft' ||\n\t\t\t\t\tevent.key === 'Enter' ||\n\t\t\t\t\tevent.key === 'Backspace'\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn onKeyDown(event)\n\t\t\t}\n\t\t\tconst closestBlockEntry = ContemberEditor.closestBlockEntry(editor, { at: selection })\n\n\t\t\tif (!closestBlockEntry) {\n\t\t\t\treturn onKeyDown(event)\n\t\t\t}\n\t\t\tlet cellElement: TableCellElement\n\t\t\tlet cellPath: SlatePath\n\n\t\t\tif (!isTableCellElement(closestBlockEntry[0])) {\n\t\t\t\tconst parent = SlateNode.parent(editor, closestBlockEntry[1])\n\t\t\t\tif (Element.isElement(closestBlockEntry[0]) && editor.isDefaultElement(closestBlockEntry[0]) && isTableCellElement(parent)) {\n\t\t\t\t\tcellElement = parent\n\t\t\t\t\tcellPath = SlatePath.parent(closestBlockEntry[1])\n\t\t\t\t} else {\n\t\t\t\t\treturn onKeyDown(event)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t[cellElement, cellPath] = closestBlockEntry\n\t\t\t}\n\t\t\tif (cellPath.length < 3) {\n\t\t\t\treturn onKeyDown(event)\n\t\t\t}\n\t\t\tconst [rowIndex, columnIndex] = getTableCellCoordinates(editor, cellElement)\n\t\t\tconst tablePath = cellPath.slice(0, -2)\n\t\t\tconst tableElement = SlateNode.get(editor, tablePath) as TableElement\n\t\t\tconst rowCount = getTableElementRowCount(tableElement)\n\t\t\tconst columnCount = getTableElementColumnCount(tableElement)\n\n\t\t\tif (rowCount === 0 || columnCount === 0) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst moveSelectionBeforeTable = () => {\n\t\t\t\tconst pointBeforeTable = Editor.before(editor, tablePath)\n\t\t\t\tif (!pointBeforeTable) {\n\t\t\t\t\treturn onKeyDown(event)\n\t\t\t\t}\n\t\t\t\tevent.preventDefault()\n\t\t\t\treturn Transforms.select(editor, pointBeforeTable)\n\t\t\t}\n\t\t\tconst moveSelectionAfterTable = () => {\n\t\t\t\tconst pointAfterTable = Editor.after(editor, tablePath)\n\t\t\t\tif (!pointAfterTable) {\n\t\t\t\t\treturn onKeyDown(event)\n\t\t\t\t}\n\t\t\t\tevent.preventDefault()\n\t\t\t\treturn Transforms.select(editor, pointAfterTable)\n\t\t\t}\n\n\t\t\tif (event.key === 'Tab') {\n\t\t\t\tif (event.shiftKey) {\n\t\t\t\t\t// Moving backwards\n\t\t\t\t\tif (columnIndex > 0) {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\treturn selectTableCellContents(editor, tablePath, rowIndex, columnIndex - 1)\n\t\t\t\t\t} else if (columnIndex === 0) {\n\t\t\t\t\t\tif (rowIndex > 0) {\n\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\treturn selectTableCellContents(editor, tablePath, rowIndex - 1, columnCount - 1)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn moveSelectionBeforeTable()\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Moving forwards\n\t\t\t\t\tif (columnIndex < columnCount - 1) {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\treturn selectTableCellContents(editor, tablePath, rowIndex, columnIndex + 1)\n\t\t\t\t\t} else if (columnIndex === columnCount - 1) {\n\t\t\t\t\t\t// We're at the right edge of the table\n\t\t\t\t\t\tif (rowIndex < rowCount - 1) {\n\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\treturn selectTableCellContents(editor, tablePath, rowIndex + 1, 0)\n\t\t\t\t\t\t} else if (rowIndex === rowCount - 1) {\n\t\t\t\t\t\t\treturn moveSelectionAfterTable()\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (event.key === 'ArrowLeft') {\n\t\t\t\tif (!SlateRange.isCollapsed(selection)) {\n\t\t\t\t\treturn onKeyDown(event)\n\t\t\t\t}\n\t\t\t\tif (Point.equals(selection.focus, Editor.start(editor, cellPath))) {\n\t\t\t\t\tif (columnIndex > 0) {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\treturn Transforms.select(editor, Editor.end(editor, [...tablePath, rowIndex, columnIndex - 1]))\n\t\t\t\t\t} else if (columnIndex === 0) {\n\t\t\t\t\t\tif (rowIndex > 0) {\n\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\treturn Transforms.select(editor, Editor.end(editor, [...tablePath, rowIndex - 1, columnCount - 1]))\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn moveSelectionBeforeTable()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (event.key === 'ArrowRight') {\n\t\t\t\tif (!SlateRange.isCollapsed(selection)) {\n\t\t\t\t\treturn onKeyDown(event)\n\t\t\t\t}\n\t\t\t\tif (Point.equals(selection.focus, Editor.end(editor, cellPath))) {\n\t\t\t\t\tif (columnIndex < columnCount - 1) {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\treturn Transforms.select(editor, Editor.start(editor, [...tablePath, rowIndex, columnIndex + 1]))\n\t\t\t\t\t} else if (columnIndex === columnCount - 1) {\n\t\t\t\t\t\tif (rowIndex < rowCount - 1) {\n\t\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\t\treturn Transforms.select(editor, Editor.start(editor, [...tablePath, rowIndex + 1, 0]))\n\t\t\t\t\t\t} else if (rowIndex === rowCount - 1) {\n\t\t\t\t\t\t\treturn moveSelectionAfterTable()\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {\n\t\t\t\tconst withinDefault = editor.isDefaultElement(closestBlockEntry[0])\n\t\t\t\tif (withinDefault) {\n\t\t\t\t\tconst relative = SlatePath.relative(closestBlockEntry[1], cellPath)\n\t\t\t\t\tconst defaultIndex = relative[0]\n\t\t\t\t\tif (\n\t\t\t\t\t\t(event.key === 'ArrowUp' && defaultIndex !== 0) ||\n\t\t\t\t\t\t(event.key === 'ArrowDown' && defaultIndex !== cellElement.children.length - 1)\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn onKeyDown(event)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (event.key === 'ArrowUp') {\n\t\t\t\t\tif (rowIndex > 0) {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\tconst rowAboveEndPoint = Editor.end(editor, [...tablePath, rowIndex - 1, columnIndex])\n\n\t\t\t\t\t\tif (!SlateRange.isCollapsed(selection)) {\n\t\t\t\t\t\t\treturn Transforms.select(editor, rowAboveEndPoint)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst minOffset = Math.min(selection.focus.offset, rowAboveEndPoint.offset)\n\t\t\t\t\t\treturn Transforms.select(editor, {\n\t\t\t\t\t\t\tpath: rowAboveEndPoint.path,\n\t\t\t\t\t\t\toffset: minOffset,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t\treturn moveSelectionBeforeTable()\n\t\t\t\t} else if (event.key === 'ArrowDown') {\n\t\t\t\t\tif (rowIndex < rowCount - 1) {\n\t\t\t\t\t\tevent.preventDefault()\n\t\t\t\t\t\tconst rowBelowStatPoint = Editor.start(editor, [...tablePath, rowIndex + 1, columnIndex])\n\n\t\t\t\t\t\tif (!SlateRange.isCollapsed(selection)) {\n\t\t\t\t\t\t\treturn Transforms.select(editor, rowBelowStatPoint)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst [rowBelowStatPointNode] = Editor.node(editor, rowBelowStatPoint) as NodeEntry<Text>\n\n\t\t\t\t\t\treturn Transforms.select(editor, {\n\t\t\t\t\t\t\tpath: rowBelowStatPoint.path,\n\t\t\t\t\t\t\toffset: Math.min(selection.focus.offset, rowBelowStatPointNode.text.length),\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t\treturn moveSelectionAfterTable()\n\t\t\t\t}\n\t\t\t} else if (event.ctrlKey || event.metaKey) {\n\t\t\t\tif (event.key === 'Backspace') {\n\t\t\t\t\tevent.preventDefault()\n\n\t\t\t\t\tif (event.altKey) {\n\t\t\t\t\t\tTableModifications.deleteTableColumn(editor, tableElement, columnIndex)\n\n\t\t\t\t\t\tif (columnCount > 1) {\n\t\t\t\t\t\t\tconst columnBefore = Editor.start(editor, [...tablePath, rowIndex, Math.max(0, columnIndex - 1)])\n\n\t\t\t\t\t\t\treturn Transforms.select(editor, columnBefore)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn moveSelectionBeforeTable()\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tTableModifications.deleteTableRow(editor, tableElement, rowIndex)\n\n\t\t\t\t\t\tif (rowCount > 1) {\n\t\t\t\t\t\t\tconst rowAbove = Editor.start(editor, [...tablePath, Math.max(0, rowIndex - 1), columnIndex])\n\n\t\t\t\t\t\t\treturn Transforms.select(editor, rowAbove)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn moveSelectionBeforeTable()\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if (event.key === 'Enter') {\n\t\t\t\t\tevent.preventDefault()\n\n\t\t\t\t\tif (event.altKey) {\n\t\t\t\t\t\tif (event.shiftKey) {\n\t\t\t\t\t\t\tTableModifications.addTableColumn(editor, tableElement, columnIndex)\n\t\t\t\t\t\t\tconst columnBefore = Editor.start(editor, [...tablePath, rowIndex, Math.max(0, columnIndex)])\n\n\t\t\t\t\t\t\treturn Transforms.select(editor, columnBefore)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tTableModifications.addTableColumn(editor, tableElement, columnIndex + 1)\n\t\t\t\t\t\t\tconst columnAfter = Editor.start(editor, [...tablePath, rowIndex, columnIndex + 1])\n\n\t\t\t\t\t\t\treturn Transforms.select(editor, columnAfter)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (event.shiftKey) {\n\t\t\t\t\t\t\tTableModifications.addTableRow(editor, tableElement, rowIndex)\n\t\t\t\t\t\t\tconst rowAbove = Editor.start(editor, [...tablePath, Math.max(0, rowIndex), columnIndex])\n\n\t\t\t\t\t\t\treturn Transforms.select(editor, rowAbove)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tTableModifications.addTableRow(editor, tableElement, rowIndex + 1)\n\t\t\t\t\t\t\tconst rowBelowStat = Editor.start(editor, [...tablePath, rowIndex + 1, columnIndex])\n\n\t\t\t\t\t\t\treturn Transforms.select(editor, rowBelowStat)\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\tonKeyDown(event)\n\t\t},\n\n\t})\n\n\treturn editor\n}\n"],"names":["SlatePath","SlateRange","SlateNode"],"mappings":";;;;;;;;AAUa,MAAA,aAAa,CAAC,EAAE,aAAa,iBAAiB,eAAe,MAIpE,CAAmB,WAAiB;AACnC,QAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACG;AAEJ,SAAO,gBAAgB,mBAAmB,EAAE,QAAQ,YAAa,CAAA,CAAC;AAClE,SAAO,gBAAgB,uBAAuB,EAAE,QAAQ,gBAAiB,CAAA,CAAC;AAC1E,SAAO,gBAAgB,sBAAsB,EAAE,QAAQ,eAAgB,CAAA,CAAC;AAEjE,SAAA,iB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AA;AAAA,UACjC;AAAA,QACD,WACU,MAAM,QAAQ,SAAS;AACjC,gBAAM,eAAe;AAErB,cAAI,MAAM,QAAQ;AACjB,gBAAI,MAAM,UAAU;AACA,iCAAA,eAAe,QAAQ,cAAc,WAAW;AACnE,oBAAM,eAAe,OAAO,MAAM,QAAQ,CAAC,GAAG,WAAW,UAAU,KAAK,IAAI,GAAG,WAAW,CAAC,CAAC;AAErF,qBAAA,WAAW,OAAO,QAAQ,YAAY;AAAA,YAAA,OACvC;AACN,iCAAmB,eAAe,QAAQ,cAAc,cAAc,CAAC;AACjE,oBAAA,cAAc,OAAO,MAAM,QAAQ,CAAC,GAAG,WAAW,UAAU,cAAc,CAAC,CAAC;AAE3E,qBAAA,WAAW,OAAO,QAAQ,WAAW;AAAA,YAAA;AAAA,UAC7C,OACM;AACN,gBAAI,MAAM,UAAU;AACA,iCAAA,YAAY,QAAQ,cAAc,QAAQ;AAC7D,oBAAM,WAAW,OAAO,MAAM,QAAQ,CAAC,GAAG,WAAW,KAAK,IAAI,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEjF,qBAAA,WAAW,OAAO,QAAQ,QAAQ;AAAA,YAAA,OACnC;AACN,iCAAmB,YAAY,QAAQ,cAAc,WAAW,CAAC;AAC3D,oBAAA,eAAe,OAAO,MAAM,QAAQ,CAAC,GAAG,WAAW,WAAW,GAAG,WAAW,CAAC;AAE5E,qBAAA,WAAW,OAAO,QAAQ,YAAY;AAAA,YAAA;AAAA,UAC9C;AAAA,QACD;AAAA,MACD;AAED,gBAAU,KAAK;AAAA,IAAA;AAAA,EAChB,CAEA;AAEM,SAAA;AACR;"}
@@ -1 +1 @@
1
- {"version":3,"file":"withBold.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/text/bold/withBold.ts"],"sourcesContent":["import { boldMark, boldMarkPlugin } from './boldMark'\nimport { EditorPlugin } from '../../../types'\nimport { createMarkHtmlDeserializer } from '../../behaviour'\n\n\nexport const withBold = (): EditorPlugin => editor => {\n\teditor.registerMark(boldMarkPlugin)\n\teditor.htmlDeserializer.registerPlugin(\n\t\tcreateMarkHtmlDeserializer(\n\t\t\tboldMark,\n\t\t\tel => el.nodeName === 'STRONG' || (el.nodeName === 'B' && !el.id.startsWith('docs-internal-guid')),\n\t\t\tel => ['italic', 'oblique'].includes(el.style.fontWeight),\n\t\t),\n\t)\n}\n"],"names":["boldMarkPlugin","createMarkHtmlDeserializer","boldMark"],"mappings":";;;;AAKa,MAAA,WAAW,MAAoB,CAAU,WAAA;AACrD,SAAO,aAAaA,SAAAA,cAAc;AAClC,SAAO,iBAAiB;AAAA,IACvBC,2BAAA;AAAA,MACCC,SAAA;AAAA,MACA,CAAA,OAAM,GAAG,aAAa,YAAa,GAAG,aAAa,OAAO,CAAC,GAAG,GAAG,WAAW,oBAAoB;AAAA,MAChG,CAAA,OAAM,CAAC,UAAU,SAAS,EAAE,SAAS,GAAG,MAAM,UAAU;AAAA,IACzD;AAAA,EAAA;AAEF;;"}
1
+ {"version":3,"file":"withBold.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/text/bold/withBold.ts"],"sourcesContent":["import { boldMark, boldMarkPlugin } from './boldMark'\nimport { EditorPlugin } from '../../../types'\nimport { createMarkHtmlDeserializer } from '../../behaviour'\n\n\nexport const withBold = (): EditorPlugin => editor => {\n\teditor.registerMark(boldMarkPlugin)\n\teditor.htmlDeserializer.registerPlugin(\n\t\tcreateMarkHtmlDeserializer(\n\t\t\tboldMark,\n\t\t\tel => el.nodeName === 'STRONG' || (el.nodeName === 'B' && !el.id.startsWith('docs-internal-guid')),\n\t\t\tel => ['italic', 'oblique'].includes(el.style.fontWeight),\n\t\t),\n\t)\n}\n"],"names":["boldMarkPlugin","createMarkHtmlDeserializer","boldMark"],"mappings":";;;;AAKa,MAAA,WAAW,MAAoB,CAAU,WAAA;AACrD,SAAO,aAAaA,uBAAc;AAClC,SAAO,iBAAiB;AAAA,IACvBC,2BAAA;AAAA,MACCC,SAAA;AAAA,MACA,CAAA,OAAM,GAAG,aAAa,YAAa,GAAG,aAAa,OAAO,CAAC,GAAG,GAAG,WAAW,oBAAoB;AAAA,MAChG,CAAA,OAAM,CAAC,UAAU,SAAS,EAAE,SAAS,GAAG,MAAM,UAAU;AAAA,IAAA;AAAA,EAE1D;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"withBold.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/text/bold/withBold.ts"],"sourcesContent":["import { boldMark, boldMarkPlugin } from './boldMark'\nimport { EditorPlugin } from '../../../types'\nimport { createMarkHtmlDeserializer } from '../../behaviour'\n\n\nexport const withBold = (): EditorPlugin => editor => {\n\teditor.registerMark(boldMarkPlugin)\n\teditor.htmlDeserializer.registerPlugin(\n\t\tcreateMarkHtmlDeserializer(\n\t\t\tboldMark,\n\t\t\tel => el.nodeName === 'STRONG' || (el.nodeName === 'B' && !el.id.startsWith('docs-internal-guid')),\n\t\t\tel => ['italic', 'oblique'].includes(el.style.fontWeight),\n\t\t),\n\t)\n}\n"],"names":[],"mappings":";;AAKa,MAAA,WAAW,MAAoB,CAAU,WAAA;AACrD,SAAO,aAAa,cAAc;AAClC,SAAO,iBAAiB;AAAA,IACvB;AAAA,MACC;AAAA,MACA,CAAA,OAAM,GAAG,aAAa,YAAa,GAAG,aAAa,OAAO,CAAC,GAAG,GAAG,WAAW,oBAAoB;AAAA,MAChG,CAAA,OAAM,CAAC,UAAU,SAAS,EAAE,SAAS,GAAG,MAAM,UAAU;AAAA,IACzD;AAAA,EAAA;AAEF;"}
1
+ {"version":3,"file":"withBold.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/text/bold/withBold.ts"],"sourcesContent":["import { boldMark, boldMarkPlugin } from './boldMark'\nimport { EditorPlugin } from '../../../types'\nimport { createMarkHtmlDeserializer } from '../../behaviour'\n\n\nexport const withBold = (): EditorPlugin => editor => {\n\teditor.registerMark(boldMarkPlugin)\n\teditor.htmlDeserializer.registerPlugin(\n\t\tcreateMarkHtmlDeserializer(\n\t\t\tboldMark,\n\t\t\tel => el.nodeName === 'STRONG' || (el.nodeName === 'B' && !el.id.startsWith('docs-internal-guid')),\n\t\t\tel => ['italic', 'oblique'].includes(el.style.fontWeight),\n\t\t),\n\t)\n}\n"],"names":[],"mappings":";;AAKa,MAAA,WAAW,MAAoB,CAAU,WAAA;AACrD,SAAO,aAAa,cAAc;AAClC,SAAO,iBAAiB;AAAA,IACvB;AAAA,MACC;AAAA,MACA,CAAA,OAAM,GAAG,aAAa,YAAa,GAAG,aAAa,OAAO,CAAC,GAAG,GAAG,WAAW,oBAAoB;AAAA,MAChG,CAAA,OAAM,CAAC,UAAU,SAAS,EAAE,SAAS,GAAG,MAAM,UAAU;AAAA,IAAA;AAAA,EAE1D;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"withCode.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/text/code/withCode.ts"],"sourcesContent":["import { Editor as SlateEditor } from 'slate'\nimport { codeMarkPlugin } from './codeMark'\nimport { EditorPlugin } from '../../../types'\n\n\nexport const withCode = (): EditorPlugin => editor => {\n\teditor.registerMark(codeMarkPlugin)\n\n\treturn editor\n}\n"],"names":["codeMarkPlugin"],"mappings":";;;AAKa,MAAA,WAAW,MAAoB,CAAU,WAAA;AACrD,SAAO,aAAaA,SAAAA,cAAc;AAE3B,SAAA;AACR;;"}
1
+ {"version":3,"file":"withCode.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/text/code/withCode.ts"],"sourcesContent":["import { Editor as SlateEditor } from 'slate'\nimport { codeMarkPlugin } from './codeMark'\nimport { EditorPlugin } from '../../../types'\n\n\nexport const withCode = (): EditorPlugin => editor => {\n\teditor.registerMark(codeMarkPlugin)\n\n\treturn editor\n}\n"],"names":["codeMarkPlugin"],"mappings":";;;AAKa,MAAA,WAAW,MAAoB,CAAU,WAAA;AACrD,SAAO,aAAaA,uBAAc;AAE3B,SAAA;AACR;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"withHighlight.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/text/highlight/withHighlight.ts"],"sourcesContent":["import { Editor as SlateEditor } from 'slate'\nimport { highlightMarkPlugin } from './highlightMark'\nimport { EditorPlugin } from '../../../types'\n\n\nexport const withHighlight = (): EditorPlugin => editor => {\n\teditor.registerMark(highlightMarkPlugin)\n\n\treturn editor\n}\n"],"names":["highlightMarkPlugin"],"mappings":";;;AAKa,MAAA,gBAAgB,MAAoB,CAAU,WAAA;AAC1D,SAAO,aAAaA,cAAAA,mBAAmB;AAEhC,SAAA;AACR;;"}
1
+ {"version":3,"file":"withHighlight.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/text/highlight/withHighlight.ts"],"sourcesContent":["import { Editor as SlateEditor } from 'slate'\nimport { highlightMarkPlugin } from './highlightMark'\nimport { EditorPlugin } from '../../../types'\n\n\nexport const withHighlight = (): EditorPlugin => editor => {\n\teditor.registerMark(highlightMarkPlugin)\n\n\treturn editor\n}\n"],"names":["highlightMarkPlugin"],"mappings":";;;AAKa,MAAA,gBAAgB,MAAoB,CAAU,WAAA;AAC1D,SAAO,aAAaA,iCAAmB;AAEhC,SAAA;AACR;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"withItalic.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/text/italic/withItalic.ts"],"sourcesContent":["import { italicMark, italicMarkPlugin } from './italicMark'\nimport { EditorPlugin } from '../../../types'\nimport { createMarkHtmlDeserializer } from '../../behaviour'\n\n\nexport const withItalic = (): EditorPlugin => editor => {\n\teditor.registerMark(italicMarkPlugin)\n\teditor.htmlDeserializer.registerPlugin(\n\t\tcreateMarkHtmlDeserializer(\n\t\t\titalicMark,\n\t\t\tel => ['I', 'EM'].includes(el.nodeName),\n\t\t\tel => ['italic', 'oblique'].includes(el.style.fontWeight),\n\t\t),\n\t)\n}\n"],"names":["italicMarkPlugin","createMarkHtmlDeserializer","italicMark"],"mappings":";;;;AAKa,MAAA,aAAa,MAAoB,CAAU,WAAA;AACvD,SAAO,aAAaA,WAAAA,gBAAgB;AACpC,SAAO,iBAAiB;AAAA,IACvBC,2BAAA;AAAA,MACCC,WAAA;AAAA,MACA,QAAM,CAAC,KAAK,IAAI,EAAE,SAAS,GAAG,QAAQ;AAAA,MACtC,CAAA,OAAM,CAAC,UAAU,SAAS,EAAE,SAAS,GAAG,MAAM,UAAU;AAAA,IACzD;AAAA,EAAA;AAEF;;"}
1
+ {"version":3,"file":"withItalic.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/text/italic/withItalic.ts"],"sourcesContent":["import { italicMark, italicMarkPlugin } from './italicMark'\nimport { EditorPlugin } from '../../../types'\nimport { createMarkHtmlDeserializer } from '../../behaviour'\n\n\nexport const withItalic = (): EditorPlugin => editor => {\n\teditor.registerMark(italicMarkPlugin)\n\teditor.htmlDeserializer.registerPlugin(\n\t\tcreateMarkHtmlDeserializer(\n\t\t\titalicMark,\n\t\t\tel => ['I', 'EM'].includes(el.nodeName),\n\t\t\tel => ['italic', 'oblique'].includes(el.style.fontWeight),\n\t\t),\n\t)\n}\n"],"names":["italicMarkPlugin","createMarkHtmlDeserializer","italicMark"],"mappings":";;;;AAKa,MAAA,aAAa,MAAoB,CAAU,WAAA;AACvD,SAAO,aAAaA,2BAAgB;AACpC,SAAO,iBAAiB;AAAA,IACvBC,2BAAA;AAAA,MACCC,WAAA;AAAA,MACA,QAAM,CAAC,KAAK,IAAI,EAAE,SAAS,GAAG,QAAQ;AAAA,MACtC,CAAA,OAAM,CAAC,UAAU,SAAS,EAAE,SAAS,GAAG,MAAM,UAAU;AAAA,IAAA;AAAA,EAE1D;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"withItalic.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/text/italic/withItalic.ts"],"sourcesContent":["import { italicMark, italicMarkPlugin } from './italicMark'\nimport { EditorPlugin } from '../../../types'\nimport { createMarkHtmlDeserializer } from '../../behaviour'\n\n\nexport const withItalic = (): EditorPlugin => editor => {\n\teditor.registerMark(italicMarkPlugin)\n\teditor.htmlDeserializer.registerPlugin(\n\t\tcreateMarkHtmlDeserializer(\n\t\t\titalicMark,\n\t\t\tel => ['I', 'EM'].includes(el.nodeName),\n\t\t\tel => ['italic', 'oblique'].includes(el.style.fontWeight),\n\t\t),\n\t)\n}\n"],"names":[],"mappings":";;AAKa,MAAA,aAAa,MAAoB,CAAU,WAAA;AACvD,SAAO,aAAa,gBAAgB;AACpC,SAAO,iBAAiB;AAAA,IACvB;AAAA,MACC;AAAA,MACA,QAAM,CAAC,KAAK,IAAI,EAAE,SAAS,GAAG,QAAQ;AAAA,MACtC,CAAA,OAAM,CAAC,UAAU,SAAS,EAAE,SAAS,GAAG,MAAM,UAAU;AAAA,IACzD;AAAA,EAAA;AAEF;"}
1
+ {"version":3,"file":"withItalic.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/text/italic/withItalic.ts"],"sourcesContent":["import { italicMark, italicMarkPlugin } from './italicMark'\nimport { EditorPlugin } from '../../../types'\nimport { createMarkHtmlDeserializer } from '../../behaviour'\n\n\nexport const withItalic = (): EditorPlugin => editor => {\n\teditor.registerMark(italicMarkPlugin)\n\teditor.htmlDeserializer.registerPlugin(\n\t\tcreateMarkHtmlDeserializer(\n\t\t\titalicMark,\n\t\t\tel => ['I', 'EM'].includes(el.nodeName),\n\t\t\tel => ['italic', 'oblique'].includes(el.style.fontWeight),\n\t\t),\n\t)\n}\n"],"names":[],"mappings":";;AAKa,MAAA,aAAa,MAAoB,CAAU,WAAA;AACvD,SAAO,aAAa,gBAAgB;AACpC,SAAO,iBAAiB;AAAA,IACvB;AAAA,MACC;AAAA,MACA,QAAM,CAAC,KAAK,IAAI,EAAE,SAAS,GAAG,QAAQ;AAAA,MACtC,CAAA,OAAM,CAAC,UAAU,SAAS,EAAE,SAAS,GAAG,MAAM,UAAU;AAAA,IAAA;AAAA,EAE1D;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"withNewline.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/text/newline/withNewline.ts"],"sourcesContent":["import { Transforms } from 'slate'\nimport { EditorPlugin } from '../../../types'\n\nexport const withNewline = (): EditorPlugin => editor => {\n\tconst { onKeyDown } = editor\n\teditor.onKeyDown = e => {\n\t\tif (e.key !== 'Enter' || !e.shiftKey) {\n\t\t\treturn onKeyDown(e)\n\t\t}\n\t\te.preventDefault()\n\t\tTransforms.insertText(editor, '\\n')\n\t}\n}\n"],"names":["Transforms"],"mappings":";;;AAGa,MAAA,cAAc,MAAoB,CAAU,WAAA;AAClD,QAAA,EAAE,UAAc,IAAA;AACtB,SAAO,YAAY,CAAK,MAAA;AACvB,QAAI,EAAE,QAAQ,WAAW,CAAC,EAAE,UAAU;AACrC,aAAO,UAAU,CAAC;AAAA,IACnB;AACA,MAAE,eAAe;AACNA,UAAAA,WAAA,WAAW,QAAQ,IAAI;AAAA,EAAA;AAEpC;;"}
1
+ {"version":3,"file":"withNewline.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/text/newline/withNewline.ts"],"sourcesContent":["import { Transforms } from 'slate'\nimport { EditorPlugin } from '../../../types'\n\nexport const withNewline = (): EditorPlugin => editor => {\n\tconst { onKeyDown } = editor\n\teditor.onKeyDown = e => {\n\t\tif (e.key !== 'Enter' || !e.shiftKey) {\n\t\t\treturn onKeyDown(e)\n\t\t}\n\t\te.preventDefault()\n\t\tTransforms.insertText(editor, '\\n')\n\t}\n}\n"],"names":["Transforms"],"mappings":";;;AAGa,MAAA,cAAc,MAAoB,CAAU,WAAA;AAClD,QAAA,EAAE,cAAc;AACtB,SAAO,YAAY,CAAK,MAAA;AACvB,QAAI,EAAE,QAAQ,WAAW,CAAC,EAAE,UAAU;AACrC,aAAO,UAAU,CAAC;AAAA,IAAA;AAEnB,MAAE,eAAe;AACNA,qBAAA,WAAW,QAAQ,IAAI;AAAA,EACnC;AACD;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"withNewline.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/text/newline/withNewline.ts"],"sourcesContent":["import { Transforms } from 'slate'\nimport { EditorPlugin } from '../../../types'\n\nexport const withNewline = (): EditorPlugin => editor => {\n\tconst { onKeyDown } = editor\n\teditor.onKeyDown = e => {\n\t\tif (e.key !== 'Enter' || !e.shiftKey) {\n\t\t\treturn onKeyDown(e)\n\t\t}\n\t\te.preventDefault()\n\t\tTransforms.insertText(editor, '\\n')\n\t}\n}\n"],"names":[],"mappings":";AAGa,MAAA,cAAc,MAAoB,CAAU,WAAA;AAClD,QAAA,EAAE,UAAc,IAAA;AACtB,SAAO,YAAY,CAAK,MAAA;AACvB,QAAI,EAAE,QAAQ,WAAW,CAAC,EAAE,UAAU;AACrC,aAAO,UAAU,CAAC;AAAA,IACnB;AACA,MAAE,eAAe;AACN,eAAA,WAAW,QAAQ,IAAI;AAAA,EAAA;AAEpC;"}
1
+ {"version":3,"file":"withNewline.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/text/newline/withNewline.ts"],"sourcesContent":["import { Transforms } from 'slate'\nimport { EditorPlugin } from '../../../types'\n\nexport const withNewline = (): EditorPlugin => editor => {\n\tconst { onKeyDown } = editor\n\teditor.onKeyDown = e => {\n\t\tif (e.key !== 'Enter' || !e.shiftKey) {\n\t\t\treturn onKeyDown(e)\n\t\t}\n\t\te.preventDefault()\n\t\tTransforms.insertText(editor, '\\n')\n\t}\n}\n"],"names":[],"mappings":";AAGa,MAAA,cAAc,MAAoB,CAAU,WAAA;AAClD,QAAA,EAAE,cAAc;AACtB,SAAO,YAAY,CAAK,MAAA;AACvB,QAAI,EAAE,QAAQ,WAAW,CAAC,EAAE,UAAU;AACrC,aAAO,UAAU,CAAC;AAAA,IAAA;AAEnB,MAAE,eAAe;AACN,eAAA,WAAW,QAAQ,IAAI;AAAA,EACnC;AACD;"}
@@ -1 +1 @@
1
- {"version":3,"file":"withStrikeThrough.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/text/strikeThrough/withStrikeThrough.ts"],"sourcesContent":["import { Editor as SlateEditor } from 'slate'\nimport { strikeThroughMark, strikeThroughPlugin } from './strikeThroughMark'\nimport { EditorPlugin } from '../../../types'\nimport { createMarkHtmlDeserializer } from '../../behaviour'\n\n\nexport const withStrikeThrough = (): EditorPlugin => editor => {\n\teditor.registerMark(strikeThroughPlugin)\n\teditor.htmlDeserializer.registerPlugin(\n\t\tcreateMarkHtmlDeserializer(\n\t\t\tstrikeThroughMark,\n\t\t\tel => el.nodeName === 'S',\n\t\t\tel => el.style.textDecoration === 'line-through',\n\t\t),\n\t)\n\n\treturn editor\n}\n"],"names":["strikeThroughPlugin","createMarkHtmlDeserializer","strikeThroughMark"],"mappings":";;;;AAMa,MAAA,oBAAoB,MAAoB,CAAU,WAAA;AAC9D,SAAO,aAAaA,kBAAAA,mBAAmB;AACvC,SAAO,iBAAiB;AAAA,IACvBC,2BAAA;AAAA,MACCC,kBAAA;AAAA,MACA,CAAA,OAAM,GAAG,aAAa;AAAA,MACtB,CAAA,OAAM,GAAG,MAAM,mBAAmB;AAAA,IACnC;AAAA,EAAA;AAGM,SAAA;AACR;;"}
1
+ {"version":3,"file":"withStrikeThrough.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/text/strikeThrough/withStrikeThrough.ts"],"sourcesContent":["import { Editor as SlateEditor } from 'slate'\nimport { strikeThroughMark, strikeThroughPlugin } from './strikeThroughMark'\nimport { EditorPlugin } from '../../../types'\nimport { createMarkHtmlDeserializer } from '../../behaviour'\n\n\nexport const withStrikeThrough = (): EditorPlugin => editor => {\n\teditor.registerMark(strikeThroughPlugin)\n\teditor.htmlDeserializer.registerPlugin(\n\t\tcreateMarkHtmlDeserializer(\n\t\t\tstrikeThroughMark,\n\t\t\tel => el.nodeName === 'S',\n\t\t\tel => el.style.textDecoration === 'line-through',\n\t\t),\n\t)\n\n\treturn editor\n}\n"],"names":["strikeThroughPlugin","createMarkHtmlDeserializer","strikeThroughMark"],"mappings":";;;;AAMa,MAAA,oBAAoB,MAAoB,CAAU,WAAA;AAC9D,SAAO,aAAaA,qCAAmB;AACvC,SAAO,iBAAiB;AAAA,IACvBC,2BAAA;AAAA,MACCC,kBAAA;AAAA,MACA,CAAA,OAAM,GAAG,aAAa;AAAA,MACtB,CAAA,OAAM,GAAG,MAAM,mBAAmB;AAAA,IAAA;AAAA,EAEpC;AAEO,SAAA;AACR;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"withStrikeThrough.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/text/strikeThrough/withStrikeThrough.ts"],"sourcesContent":["import { Editor as SlateEditor } from 'slate'\nimport { strikeThroughMark, strikeThroughPlugin } from './strikeThroughMark'\nimport { EditorPlugin } from '../../../types'\nimport { createMarkHtmlDeserializer } from '../../behaviour'\n\n\nexport const withStrikeThrough = (): EditorPlugin => editor => {\n\teditor.registerMark(strikeThroughPlugin)\n\teditor.htmlDeserializer.registerPlugin(\n\t\tcreateMarkHtmlDeserializer(\n\t\t\tstrikeThroughMark,\n\t\t\tel => el.nodeName === 'S',\n\t\t\tel => el.style.textDecoration === 'line-through',\n\t\t),\n\t)\n\n\treturn editor\n}\n"],"names":[],"mappings":";;AAMa,MAAA,oBAAoB,MAAoB,CAAU,WAAA;AAC9D,SAAO,aAAa,mBAAmB;AACvC,SAAO,iBAAiB;AAAA,IACvB;AAAA,MACC;AAAA,MACA,CAAA,OAAM,GAAG,aAAa;AAAA,MACtB,CAAA,OAAM,GAAG,MAAM,mBAAmB;AAAA,IACnC;AAAA,EAAA;AAGM,SAAA;AACR;"}
1
+ {"version":3,"file":"withStrikeThrough.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/text/strikeThrough/withStrikeThrough.ts"],"sourcesContent":["import { Editor as SlateEditor } from 'slate'\nimport { strikeThroughMark, strikeThroughPlugin } from './strikeThroughMark'\nimport { EditorPlugin } from '../../../types'\nimport { createMarkHtmlDeserializer } from '../../behaviour'\n\n\nexport const withStrikeThrough = (): EditorPlugin => editor => {\n\teditor.registerMark(strikeThroughPlugin)\n\teditor.htmlDeserializer.registerPlugin(\n\t\tcreateMarkHtmlDeserializer(\n\t\t\tstrikeThroughMark,\n\t\t\tel => el.nodeName === 'S',\n\t\t\tel => el.style.textDecoration === 'line-through',\n\t\t),\n\t)\n\n\treturn editor\n}\n"],"names":[],"mappings":";;AAMa,MAAA,oBAAoB,MAAoB,CAAU,WAAA;AAC9D,SAAO,aAAa,mBAAmB;AACvC,SAAO,iBAAiB;AAAA,IACvB;AAAA,MACC;AAAA,MACA,CAAA,OAAM,GAAG,aAAa;AAAA,MACtB,CAAA,OAAM,GAAG,MAAM,mBAAmB;AAAA,IAAA;AAAA,EAEpC;AAEO,SAAA;AACR;"}
@@ -1 +1 @@
1
- {"version":3,"file":"withUnderline.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/text/underline/withUnderline.ts"],"sourcesContent":["import { underlineMark, underlineMarkPlugin } from './underlineMark'\nimport { createMarkHtmlDeserializer } from '../../behaviour'\nimport { EditorPlugin } from '../../../types'\n\n\nexport const withUnderline = (): EditorPlugin => editor => {\n\teditor.registerMark(underlineMarkPlugin)\n\teditor.htmlDeserializer.registerPlugin(\n\t\tcreateMarkHtmlDeserializer(\n\t\t\tunderlineMark,\n\t\t\tel => el.nodeName === 'U',\n\t\t\tel => el.style.textDecoration === 'underline',\n\t\t),\n\t)\n\n\treturn editor\n}\n"],"names":["underlineMarkPlugin","createMarkHtmlDeserializer","underlineMark"],"mappings":";;;;AAKa,MAAA,gBAAgB,MAAoB,CAAU,WAAA;AAC1D,SAAO,aAAaA,cAAAA,mBAAmB;AACvC,SAAO,iBAAiB;AAAA,IACvBC,2BAAA;AAAA,MACCC,cAAA;AAAA,MACA,CAAA,OAAM,GAAG,aAAa;AAAA,MACtB,CAAA,OAAM,GAAG,MAAM,mBAAmB;AAAA,IACnC;AAAA,EAAA;AAGM,SAAA;AACR;;"}
1
+ {"version":3,"file":"withUnderline.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/text/underline/withUnderline.ts"],"sourcesContent":["import { underlineMark, underlineMarkPlugin } from './underlineMark'\nimport { createMarkHtmlDeserializer } from '../../behaviour'\nimport { EditorPlugin } from '../../../types'\n\n\nexport const withUnderline = (): EditorPlugin => editor => {\n\teditor.registerMark(underlineMarkPlugin)\n\teditor.htmlDeserializer.registerPlugin(\n\t\tcreateMarkHtmlDeserializer(\n\t\t\tunderlineMark,\n\t\t\tel => el.nodeName === 'U',\n\t\t\tel => el.style.textDecoration === 'underline',\n\t\t),\n\t)\n\n\treturn editor\n}\n"],"names":["underlineMarkPlugin","createMarkHtmlDeserializer","underlineMark"],"mappings":";;;;AAKa,MAAA,gBAAgB,MAAoB,CAAU,WAAA;AAC1D,SAAO,aAAaA,iCAAmB;AACvC,SAAO,iBAAiB;AAAA,IACvBC,2BAAA;AAAA,MACCC,cAAA;AAAA,MACA,CAAA,OAAM,GAAG,aAAa;AAAA,MACtB,CAAA,OAAM,GAAG,MAAM,mBAAmB;AAAA,IAAA;AAAA,EAEpC;AAEO,SAAA;AACR;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"withUnderline.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/text/underline/withUnderline.ts"],"sourcesContent":["import { underlineMark, underlineMarkPlugin } from './underlineMark'\nimport { createMarkHtmlDeserializer } from '../../behaviour'\nimport { EditorPlugin } from '../../../types'\n\n\nexport const withUnderline = (): EditorPlugin => editor => {\n\teditor.registerMark(underlineMarkPlugin)\n\teditor.htmlDeserializer.registerPlugin(\n\t\tcreateMarkHtmlDeserializer(\n\t\t\tunderlineMark,\n\t\t\tel => el.nodeName === 'U',\n\t\t\tel => el.style.textDecoration === 'underline',\n\t\t),\n\t)\n\n\treturn editor\n}\n"],"names":[],"mappings":";;AAKa,MAAA,gBAAgB,MAAoB,CAAU,WAAA;AAC1D,SAAO,aAAa,mBAAmB;AACvC,SAAO,iBAAiB;AAAA,IACvB;AAAA,MACC;AAAA,MACA,CAAA,OAAM,GAAG,aAAa;AAAA,MACtB,CAAA,OAAM,GAAG,MAAM,mBAAmB;AAAA,IACnC;AAAA,EAAA;AAGM,SAAA;AACR;"}
1
+ {"version":3,"file":"withUnderline.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/text/underline/withUnderline.ts"],"sourcesContent":["import { underlineMark, underlineMarkPlugin } from './underlineMark'\nimport { createMarkHtmlDeserializer } from '../../behaviour'\nimport { EditorPlugin } from '../../../types'\n\n\nexport const withUnderline = (): EditorPlugin => editor => {\n\teditor.registerMark(underlineMarkPlugin)\n\teditor.htmlDeserializer.registerPlugin(\n\t\tcreateMarkHtmlDeserializer(\n\t\t\tunderlineMark,\n\t\t\tel => el.nodeName === 'U',\n\t\t\tel => el.style.textDecoration === 'underline',\n\t\t),\n\t)\n\n\treturn editor\n}\n"],"names":[],"mappings":";;AAKa,MAAA,gBAAgB,MAAoB,CAAU,WAAA;AAC1D,SAAO,aAAa,mBAAmB;AACvC,SAAO,iBAAiB;AAAA,IACvB;AAAA,MACC;AAAA,MACA,CAAA,OAAM,GAAG,aAAa;AAAA,MACtB,CAAA,OAAM,GAAG,MAAM,mBAAmB;AAAA,IAAA;AAAA,EAEpC;AAEO,SAAA;AACR;"}
@@ -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","jsx","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,cAAQ,MAAM,OAAO,SAAiB,cAAc,GAAG,CAAC,QAAQ,cAAc,CAAC;AAGrG,UAAM,CAAC,0BAA0B,IAAIE,MAAAA,SAAS,MAAM,oBAAI,QAAgD,CAAA;AAGxG,UAAM,CAAC,MAAM,IAAIA,MAAAA,SAAS,MAAM;AAC/B,YAAM,EAAE,QAAAC,QAAO,IAAIC,0BAAa;AAAA,QAC/B,SAAS,MAAM;AAAA,QACf,oBAAoBC,iBAAA;AAAA,QACpB;AAAA,QACA;AAAA,QACA,UAAU,MAAM;AAAA,MAAA,CAChB;AAEK,YAAA,EAAE,cAAkBF,IAAAA;AAC1B,aAAO,OAAOA,SAAQ;AAAA,QACrB,aAAa,MAAM;AACPG,gBAAAA,WAAA,WAAWH,SAAQ,IAAI;AAAA,QACnC;AAAA,QACA,eAAe,CAAC,cAAyB;AAClC,gBAAA,CAAC,MAAM,IAAI,IAAI;AACrB,cAAI,KAAK,WAAW,KAAKI,MAAAA,QAAa,WAAW,IAAI,GAAG;AAEnD,gBAAA,KAAK,SAAS,SAA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MAAM,SAAS,UAAU,MAAM,CAAC,MAAM,MAAMD,eAAc,kBAAkB,MAAM;AACxGA,2BAAc,YAAY,IAAI;AAC9B;AAAA,UACD;AAEA,cAAIJ,MAAa,QAAA,UAAU,MAAM,CAAC,CAAC,GAAG;AACrCI,2BAAc,YAAY,UAAU,MAAM,CAAC,EAAE,QAAQ,CAAC;AACtD,uCAA2B,IAAI,YAAY,EAAE,SAAS,cAAc,GAAG,KAAuB;AAAA,UAC/F;AAAA,QAAA,CACA;AAAA,MACF;AAAA,MACA,CAAC,WAAW,4BAA4B,gBAAgB,SAAS;AAAA,IAAA;AAGlE,0CACEE,WAAAA,OAAM,EAAA,QAAgB,cAAc,YAAY,UAC/C,gBAAM,SACR,CAAA;AAAA,EAEF;AAAA,EACA,CACC,UAAAC,2BAAAA,IAAAC,WAAA,UAAA,EACC,UAACD,2BAAA,IAAAE,aAAA,OAAA,EAAM,cAAc,MAAM,cAAc,OAAO,MAAM,OAAO,cAAc,MAAM,aAAc,CAAA,GAChG;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","jsx","Fragment","Field"],"mappings":";;;;;;;;;;AAoBO,MAAM,iBAAyDA,aAAA;AAAA,EACrE,CAAS,UAAA;AACR,UAAM,SAASC,aAAAA,UAAU;AACzB,UAAM,cAAc,OAAO;AAC3B,UAAM,YAAY,OAAO;AAEzB,UAAM,iBAAiBC,MAAA;AAAA,MACtB,MAAMC,2BAAc,2BAA2B,OAAO,WAAW;AAAA,MACjE,CAAC,aAAa,KAAK;AAAA,IACpB;AACM,UAAA,gBAAgBD,cAAQ,MAAM,OAAO,SAAiB,cAAc,GAAG,CAAC,QAAQ,cAAc,CAAC;AAGrG,UAAM,CAAC,0BAA0B,IAAIE,eAAS,MAAM,oBAAI,SAAgD;AAGxG,UAAM,CAAC,MAAM,IAAIA,MAAAA,SAAS,MAAM;AAC/B,YAAM,EAAE,QAAAC,QAAO,IAAIC,0BAAa;AAAA,QAC/B,SAAS,MAAM;AAAA,QACf,oBAAoBC,iBAAA;AAAA,QACpB;AAAA,QACA;AAAA,QACA,UAAU,MAAM;AAAA,MAAA,CAChB;AAEK,YAAA,EAAE,kBAAkBF;AAC1B,aAAO,OAAOA,SAAQ;AAAA,QACrB,aAAa,MAAM;AACPG,2BAAA,WAAWH,SAAQ,IAAI;AAAA,QACnC;AAAA,QACA,eAAe,CAAC,cAAyB;AAClC,gBAAA,CAAC,MAAM,IAAI,IAAI;AACrB,cAAI,KAAK,WAAW,KAAKI,MAAAA,QAAa,WAAW,IAAI,GAAG;AAEnD,gBAAA,KAAK,SAAS,SAAS,GAAG;AACtB,qBAAAC,MAAA,OAAO,mBAAmBL,SAAQ,MAAM;AACxC,sBAAA,aAAa,CAAC,GAAIA,QAAO,SAAS,CAAC,EAAmB,SAAS,MAAM;AAC3EG,sBAAA,WAAW,UAAUH,SAAQ;AAAA,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ACrCI,2BAAc,YAAY,UAAU,MAAM,CAAC,EAAE,QAAQ,CAAC;AACtD,uCAA2B,IAAI,YAAY,EAAE,SAAS,cAAc,GAAG,KAAuB;AAAA,UAAA;AAAA,QAC/F,CACA;AAAA,MACF;AAAA,MACA,CAAC,WAAW,4BAA4B,gBAAgB,SAAS;AAAA,IAClE;AAEA,0CACEE,WAAAA,OAAM,EAAA,QAAgB,cAAc,YAAY,UAC/C,gBAAM,UACR;AAAA,EAEF;AAAA,EACA,CACC,UAAAC,2BAAAA,IAAAC,WAAA,UAAA,EACC,UAACD,2BAAA,IAAAE,aAAA,OAAA,EAAM,cAAc,MAAM,cAAc,OAAO,MAAM,OAAO,cAAc,MAAM,aAAc,CAAA,GAChG;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"],"mappings":";;;;;;;;AAoBO,MAAM,iBAAyD;AAAA,EACrE,CAAS,UAAA;AACR,UAAM,SAAS;AACf,UAAM,cAAc,OAAO;AAC3B,U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AO,cAAc,MAAM,aAAc,CAAA,GAChG;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"],"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,SAAiB,cAAc,GAAG,CAAC,QAAQ,cAAc,CAAC;AAGrG,UAAM,CAAC,0BAA0B,IAAI,SAAS,MAAM,oBAAI,SAAgD;AAGxG,UAAM,CAAC,MAAM,IAAI,SAAS,MAAM;AAC/B,YAAM,EAAE,QAAAA,QAAO,IAAI,aAAa;AAAA,QAC/B,SAAS,MAAM;AAAA,QACf,oBAAoB;AAAA,QACpB;AAAA,QACA;AAAA,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sBAAsB;AAAA,MACxC;AAAA,MACA;AAAA,MACA;AAAA,IAAA,CACA;AAED,UAAM,YAAY,OAAO;AACzB,UAAM,WAAW;AAAA,MAChB,CAAC,UAAwB;AACd,kBAAA,EAAE,aAAa,CAAe,gBAAA;AACvC,gBAAME,iBAAgB,cAAc,SAAS,cAAc;AAE3D,cAAIC,KAAU,OAAO,EAAE,MAAM,SAAS,UAAU,MAAM,CAAC,MAAM,MAAMD,eAAc,kBAAkB,MAAM;AACxGA,2BAAc,YAAY,IAAI;AAC9B;AAAA,UAAA;AAGD,cAAID,QAAa,UAAU,MAAM,CAAC,CAAC,GAAG;AACrCC,2BAAc,YAAY,UAAU,MAAM,CAAC,EAAE,QAAQ,CAAC;AACtD,uCAA2B,IAAI,YAAY,EAAE,SAAS,cAAc,GAAG,KAAuB;AAAA,UAAA;AAAA,QAC/F,CACA;AAAA,MACF;AAAA,MACA,CAAC,WAAW,4BAA4B,gBAAgB,SAAS;AAAA,IAClE;AAEA,+BACE,OAAM,EAAA,QAAgB,cAAc,YAAY,UAC/C,gBAAM,UACR;AAAA,EAEF;AAAA,EACA,CACC,UAAA,oBAAA,UAAA,EACC,UAAC,oBAAA,OAAA,EAAM,cAAc,MAAM,cAAc,OAAO,MAAM,OAAO,cAAc,MAAM,aAAc,CAAA,GAChG;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","jsx","Slot","dataAttribute"],"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,2BAAA,IAACC,kBAAK,SAAkB,eAAaC,wBAAc,QAAQ,GAAI,GAAG,MAAO,CAAA;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","jsx","Slot","dataAttribute"],"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,2BAAA,IAACC,kBAAK,SAAkB,eAAaC,UAAAA,cAAc,QAAQ,GAAI,GAAG,OAAO;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":[],"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,oBAAC,QAAK,SAAkB,eAAa,cAAc,QAAQ,GAAI,GAAG,MAAO,CAAA;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":[],"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,oBAAC,QAAK,SAAkB,eAAa,cAAc,QAAQ,GAAI,GAAG,OAAO;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","jsx","Slot","dataAttribute"],"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,2BAAA,IAACC,kBAAK,SAAkB,eAAaC,wBAAc,MAAM,GAAI,GAAG,MAAO,CAAA;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","jsx","Slot","dataAttribute"],"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,2BAAA,IAACC,kBAAK,SAAkB,eAAaC,UAAAA,cAAc,MAAM,GAAI,GAAG,OAAO;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":[],"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,oBAAC,QAAK,SAAkB,eAAa,cAAc,MAAM,GAAI,GAAG,MAAO,CAAA;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":[],"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,oBAAC,QAAK,SAAkB,eAAa,cAAc,MAAM,GAAI,GAAG,OAAO;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","jsx","Slot","dataAttribute"],"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,2BAAA,IAACC,kBAAK,SAAkB,eAAaC,wBAAc,QAAQ,GAAI,GAAG,MAAO,CAAA;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","jsx","Slot","dataAttribute"],"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,2BAAA,IAACC,kBAAK,SAAkB,eAAaC,UAAAA,cAAc,QAAQ,GAAI,GAAG,OAAO;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":[],"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,oBAAC,QAAK,SAAkB,eAAa,cAAc,QAAQ,GAAI,GAAG,MAAO,CAAA;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":[],"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,oBAAC,QAAK,SAAkB,eAAa,cAAc,QAAQ,GAAI,GAAG,OAAO;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","jsx","Slot","composeEventHandlers"],"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,+BAACC,UAAAA,QAAM,GAAG,OAAO,SAASC,UAAqB,qBAAA,MAAM,SAAS,OAAO,EAAG,CAAA;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","jsx","Slot","composeEventHandlers"],"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,+BAACC,UAAAA,QAAM,GAAG,OAAO,SAASC,UAAqB,qBAAA,MAAM,SAAS,OAAO,GAAG;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"],"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,oBAAC,QAAM,GAAG,OAAO,SAAS,qBAAqB,MAAM,SAAS,OAAO,EAAG,CAAA;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"],"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,oBAAC,QAAM,GAAG,OAAO,SAAS,qBAAqB,MAAM,SAAS,OAAO,GAAG;AAChF;"}