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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (268) hide show
  1. package/dist/development/src/components/RichTextEditor.cjs.map +1 -1
  2. package/dist/development/src/components/RichTextEditor.js.map +1 -1
  3. package/dist/development/src/components/triggers/EditorElementTrigger.cjs.map +1 -1
  4. package/dist/development/src/components/triggers/EditorElementTrigger.js.map +1 -1
  5. package/dist/development/src/components/triggers/EditorGenericTrigger.cjs.map +1 -1
  6. package/dist/development/src/components/triggers/EditorGenericTrigger.js.map +1 -1
  7. package/dist/development/src/components/triggers/EditorMarkTrigger.cjs.map +1 -1
  8. package/dist/development/src/components/triggers/EditorMarkTrigger.js.map +1 -1
  9. package/dist/development/src/components/triggers/EditorWrapNodeTrigger.cjs.map +1 -1
  10. package/dist/development/src/components/triggers/EditorWrapNodeTrigger.js.map +1 -1
  11. package/dist/development/src/editor/createEditor.cjs.map +1 -1
  12. package/dist/development/src/editor/createEditor.js.map +1 -1
  13. package/dist/development/src/editor/createEditorWithEssentials.cjs.map +1 -1
  14. package/dist/development/src/editor/createEditorWithEssentials.js.map +1 -1
  15. package/dist/development/src/editor/index.cjs.map +1 -1
  16. package/dist/development/src/editor/methods/addMarks.cjs.map +1 -1
  17. package/dist/development/src/editor/methods/addMarks.js.map +1 -1
  18. package/dist/development/src/editor/methods/canToggleMark.cjs.map +1 -1
  19. package/dist/development/src/editor/methods/canToggleMark.js.map +1 -1
  20. package/dist/development/src/editor/methods/closest.cjs.map +1 -1
  21. package/dist/development/src/editor/methods/closest.js.map +1 -1
  22. package/dist/development/src/editor/methods/closestBlockEntry.cjs.map +1 -1
  23. package/dist/development/src/editor/methods/ejectElement.cjs.map +1 -1
  24. package/dist/development/src/editor/methods/ejectElement.js.map +1 -1
  25. package/dist/development/src/editor/methods/getElementDataAttributes.cjs.map +1 -1
  26. package/dist/development/src/editor/methods/getElementDataAttributes.js.map +1 -1
  27. package/dist/development/src/editor/methods/getPreviousSibling.cjs.map +1 -1
  28. package/dist/development/src/editor/methods/getPreviousSibling.js.map +1 -1
  29. package/dist/development/src/editor/methods/hasMarks.cjs.map +1 -1
  30. package/dist/development/src/editor/methods/hasMarks.js.map +1 -1
  31. package/dist/development/src/editor/methods/hasParentOfType.cjs.map +1 -1
  32. package/dist/development/src/editor/methods/hasParentOfType.js.map +1 -1
  33. package/dist/development/src/editor/methods/isElementType.cjs.map +1 -1
  34. package/dist/development/src/editor/methods/isElementType.js.map +1 -1
  35. package/dist/development/src/editor/methods/permissivelyDeserializeNodes.cjs.map +1 -1
  36. package/dist/development/src/editor/methods/permissivelyDeserializeNodes.js.map +1 -1
  37. package/dist/development/src/editor/methods/removeMarks.cjs.map +1 -1
  38. package/dist/development/src/editor/methods/removeMarks.js.map +1 -1
  39. package/dist/development/src/editor/methods/serializeNodes.cjs.map +1 -1
  40. package/dist/development/src/editor/methods/serializeNodes.js.map +1 -1
  41. package/dist/development/src/editor/methods/strictlyDeserializeNodes.cjs.map +1 -1
  42. package/dist/development/src/editor/methods/strictlyDeserializeNodes.js.map +1 -1
  43. package/dist/development/src/editor/methods/toLatestFormat.cjs.map +1 -1
  44. package/dist/development/src/editor/methods/toLatestFormat.js.map +1 -1
  45. package/dist/development/src/internal/components/DefaultElement.cjs.map +1 -1
  46. package/dist/development/src/internal/components/DefaultElement.js.map +1 -1
  47. package/dist/development/src/internal/hooks/useRichTextFieldNodes.cjs.map +1 -1
  48. package/dist/development/src/internal/hooks/useRichTextFieldNodes.js.map +1 -1
  49. package/dist/development/src/internal/utils/EditorPasteUtils.cjs.map +1 -1
  50. package/dist/development/src/internal/utils/EditorPasteUtils.js.map +1 -1
  51. package/dist/development/src/internal/utils/parseUrl.cjs.map +1 -1
  52. package/dist/development/src/internal/utils/parseUrl.js.map +1 -1
  53. package/dist/development/src/plugins/attributes/alignment/alignButton.cjs.map +1 -1
  54. package/dist/development/src/plugins/attributes/alignment/alignButton.js.map +1 -1
  55. package/dist/development/src/plugins/behaviour/paste/HtmlDeserializer.cjs.map +1 -1
  56. package/dist/development/src/plugins/behaviour/paste/HtmlDeserializer.js.map +1 -1
  57. package/dist/development/src/plugins/behaviour/paste/createMarkHtmlDeserializer.cjs.map +1 -1
  58. package/dist/development/src/plugins/behaviour/paste/createMarkHtmlDeserializer.js.map +1 -1
  59. package/dist/development/src/plugins/behaviour/paste/withPaste.cjs.map +1 -1
  60. package/dist/development/src/plugins/behaviour/paste/withPaste.js.map +1 -1
  61. package/dist/development/src/plugins/element/anchors/AnchorElement.cjs.map +1 -1
  62. package/dist/development/src/plugins/element/anchors/AnchorElement.js.map +1 -1
  63. package/dist/development/src/plugins/element/anchors/AnchorHtmlDeserializer.cjs.map +1 -1
  64. package/dist/development/src/plugins/element/anchors/AnchorHtmlDeserializer.js.map +1 -1
  65. package/dist/development/src/plugins/element/anchors/AnchorModifications.cjs.map +1 -1
  66. package/dist/development/src/plugins/element/anchors/AnchorModifications.js.map +1 -1
  67. package/dist/development/src/plugins/element/anchors/withAnchors.cjs.map +1 -1
  68. package/dist/development/src/plugins/element/anchors/withAnchors.js.map +1 -1
  69. package/dist/development/src/plugins/element/headings/HeadingElement.cjs.map +1 -1
  70. package/dist/development/src/plugins/element/headings/HeadingElement.js.map +1 -1
  71. package/dist/development/src/plugins/element/headings/HeadingHtmlDeserializer.cjs.map +1 -1
  72. package/dist/development/src/plugins/element/headings/HeadingHtmlDeserializer.js.map +1 -1
  73. package/dist/development/src/plugins/element/headings/withHeadings.cjs.map +1 -1
  74. package/dist/development/src/plugins/element/headings/withHeadings.js.map +1 -1
  75. package/dist/development/src/plugins/element/horizonalRules/HorizontalRuleElement.cjs.map +1 -1
  76. package/dist/development/src/plugins/element/horizonalRules/HorizontalRuleElement.js.map +1 -1
  77. package/dist/development/src/plugins/element/horizonalRules/withHorizontalRules.cjs.map +1 -1
  78. package/dist/development/src/plugins/element/horizonalRules/withHorizontalRules.js.map +1 -1
  79. package/dist/development/src/plugins/element/lists/ListElement.cjs.map +1 -1
  80. package/dist/development/src/plugins/element/lists/ListElement.js.map +1 -1
  81. package/dist/development/src/plugins/element/lists/ListHtmlDeserializer.cjs.map +1 -1
  82. package/dist/development/src/plugins/element/lists/ListHtmlDeserializer.js.map +1 -1
  83. package/dist/development/src/plugins/element/lists/ListItemElement.cjs.map +1 -1
  84. package/dist/development/src/plugins/element/lists/ListItemElement.js.map +1 -1
  85. package/dist/development/src/plugins/element/lists/OrderedListElement.cjs.map +1 -1
  86. package/dist/development/src/plugins/element/lists/UnorderedListElement.cjs.map +1 -1
  87. package/dist/development/src/plugins/element/lists/transforms/dedentListItem.cjs.map +1 -1
  88. package/dist/development/src/plugins/element/lists/transforms/dedentListItem.js.map +1 -1
  89. package/dist/development/src/plugins/element/lists/transforms/indentListItem.cjs.map +1 -1
  90. package/dist/development/src/plugins/element/lists/transforms/indentListItem.js.map +1 -1
  91. package/dist/development/src/plugins/element/lists/transforms/normalizeListElement.cjs.map +1 -1
  92. package/dist/development/src/plugins/element/lists/transforms/normalizeListElement.js.map +1 -1
  93. package/dist/development/src/plugins/element/lists/transforms/toggleListElement.cjs.map +1 -1
  94. package/dist/development/src/plugins/element/lists/transforms/toggleListElement.js.map +1 -1
  95. package/dist/development/src/plugins/element/lists/withLists.cjs.map +1 -1
  96. package/dist/development/src/plugins/element/lists/withLists.js.map +1 -1
  97. package/dist/development/src/plugins/element/paragraphs/ParagraphElement.cjs.map +1 -1
  98. package/dist/development/src/plugins/element/paragraphs/ParagraphElement.js.map +1 -1
  99. package/dist/development/src/plugins/element/paragraphs/withParagraphs.cjs.map +1 -1
  100. package/dist/development/src/plugins/element/paragraphs/withParagraphs.js.map +1 -1
  101. package/dist/development/src/plugins/element/scrollTargets/ScrollTargetElement.cjs.map +1 -1
  102. package/dist/development/src/plugins/element/scrollTargets/ScrollTargetElement.js.map +1 -1
  103. package/dist/development/src/plugins/element/scrollTargets/withScrollTargets.cjs.map +1 -1
  104. package/dist/development/src/plugins/element/scrollTargets/withScrollTargets.js.map +1 -1
  105. package/dist/development/src/plugins/element/tables/TableCellElement.cjs.map +1 -1
  106. package/dist/development/src/plugins/element/tables/TableCellElement.js.map +1 -1
  107. package/dist/development/src/plugins/element/tables/TableElement.cjs.map +1 -1
  108. package/dist/development/src/plugins/element/tables/TableElement.js.map +1 -1
  109. package/dist/development/src/plugins/element/tables/TableElementSelection.cjs.map +1 -1
  110. package/dist/development/src/plugins/element/tables/TableElementSelection.js.map +1 -1
  111. package/dist/development/src/plugins/element/tables/TableHtmlDeserializer.cjs.map +1 -1
  112. package/dist/development/src/plugins/element/tables/TableHtmlDeserializer.js.map +1 -1
  113. package/dist/development/src/plugins/element/tables/TableModifications.cjs.map +1 -1
  114. package/dist/development/src/plugins/element/tables/TableModifications.js +1 -1
  115. package/dist/development/src/plugins/element/tables/TableModifications.js.map +1 -1
  116. package/dist/development/src/plugins/element/tables/TableRowElement.cjs.map +1 -1
  117. package/dist/development/src/plugins/element/tables/TableRowElement.js.map +1 -1
  118. package/dist/development/src/plugins/element/tables/gaugeTableColumnCount.cjs.map +1 -1
  119. package/dist/development/src/plugins/element/tables/gaugeTableColumnCount.js.map +1 -1
  120. package/dist/development/src/plugins/element/tables/withTables.cjs.map +1 -1
  121. package/dist/development/src/plugins/element/tables/withTables.js.map +1 -1
  122. package/dist/development/src/plugins/text/bold/withBold.cjs.map +1 -1
  123. package/dist/development/src/plugins/text/bold/withBold.js.map +1 -1
  124. package/dist/development/src/plugins/text/code/withCode.cjs.map +1 -1
  125. package/dist/development/src/plugins/text/highlight/withHighlight.cjs.map +1 -1
  126. package/dist/development/src/plugins/text/italic/withItalic.cjs.map +1 -1
  127. package/dist/development/src/plugins/text/italic/withItalic.js.map +1 -1
  128. package/dist/development/src/plugins/text/newline/withNewline.cjs.map +1 -1
  129. package/dist/development/src/plugins/text/newline/withNewline.js.map +1 -1
  130. package/dist/development/src/plugins/text/strikeThrough/withStrikeThrough.cjs.map +1 -1
  131. package/dist/development/src/plugins/text/strikeThrough/withStrikeThrough.js.map +1 -1
  132. package/dist/development/src/plugins/text/underline/withUnderline.cjs.map +1 -1
  133. package/dist/development/src/plugins/text/underline/withUnderline.js.map +1 -1
  134. package/dist/production/src/components/RichTextEditor.cjs.map +1 -1
  135. package/dist/production/src/components/RichTextEditor.js.map +1 -1
  136. package/dist/production/src/components/triggers/EditorElementTrigger.cjs.map +1 -1
  137. package/dist/production/src/components/triggers/EditorElementTrigger.js.map +1 -1
  138. package/dist/production/src/components/triggers/EditorGenericTrigger.cjs.map +1 -1
  139. package/dist/production/src/components/triggers/EditorGenericTrigger.js.map +1 -1
  140. package/dist/production/src/components/triggers/EditorMarkTrigger.cjs.map +1 -1
  141. package/dist/production/src/components/triggers/EditorMarkTrigger.js.map +1 -1
  142. package/dist/production/src/components/triggers/EditorWrapNodeTrigger.cjs.map +1 -1
  143. package/dist/production/src/components/triggers/EditorWrapNodeTrigger.js.map +1 -1
  144. package/dist/production/src/editor/createEditor.cjs.map +1 -1
  145. package/dist/production/src/editor/createEditor.js.map +1 -1
  146. package/dist/production/src/editor/createEditorWithEssentials.cjs.map +1 -1
  147. package/dist/production/src/editor/createEditorWithEssentials.js.map +1 -1
  148. package/dist/production/src/editor/index.cjs.map +1 -1
  149. package/dist/production/src/editor/methods/addMarks.cjs.map +1 -1
  150. package/dist/production/src/editor/methods/addMarks.js.map +1 -1
  151. package/dist/production/src/editor/methods/canToggleMark.cjs.map +1 -1
  152. package/dist/production/src/editor/methods/canToggleMark.js.map +1 -1
  153. package/dist/production/src/editor/methods/closest.cjs.map +1 -1
  154. package/dist/production/src/editor/methods/closest.js.map +1 -1
  155. package/dist/production/src/editor/methods/closestBlockEntry.cjs.map +1 -1
  156. package/dist/production/src/editor/methods/ejectElement.cjs.map +1 -1
  157. package/dist/production/src/editor/methods/ejectElement.js.map +1 -1
  158. package/dist/production/src/editor/methods/getElementDataAttributes.cjs.map +1 -1
  159. package/dist/production/src/editor/methods/getElementDataAttributes.js.map +1 -1
  160. package/dist/production/src/editor/methods/getPreviousSibling.cjs.map +1 -1
  161. package/dist/production/src/editor/methods/getPreviousSibling.js.map +1 -1
  162. package/dist/production/src/editor/methods/hasMarks.cjs.map +1 -1
  163. package/dist/production/src/editor/methods/hasMarks.js.map +1 -1
  164. package/dist/production/src/editor/methods/hasParentOfType.cjs.map +1 -1
  165. package/dist/production/src/editor/methods/hasParentOfType.js.map +1 -1
  166. package/dist/production/src/editor/methods/isElementType.cjs.map +1 -1
  167. package/dist/production/src/editor/methods/isElementType.js.map +1 -1
  168. package/dist/production/src/editor/methods/permissivelyDeserializeNodes.cjs.map +1 -1
  169. package/dist/production/src/editor/methods/permissivelyDeserializeNodes.js.map +1 -1
  170. package/dist/production/src/editor/methods/removeMarks.cjs.map +1 -1
  171. package/dist/production/src/editor/methods/removeMarks.js.map +1 -1
  172. package/dist/production/src/editor/methods/serializeNodes.cjs.map +1 -1
  173. package/dist/production/src/editor/methods/serializeNodes.js.map +1 -1
  174. package/dist/production/src/editor/methods/strictlyDeserializeNodes.cjs.map +1 -1
  175. package/dist/production/src/editor/methods/strictlyDeserializeNodes.js.map +1 -1
  176. package/dist/production/src/editor/methods/toLatestFormat.cjs.map +1 -1
  177. package/dist/production/src/editor/methods/toLatestFormat.js.map +1 -1
  178. package/dist/production/src/internal/components/DefaultElement.cjs.map +1 -1
  179. package/dist/production/src/internal/components/DefaultElement.js.map +1 -1
  180. package/dist/production/src/internal/hooks/useRichTextFieldNodes.cjs.map +1 -1
  181. package/dist/production/src/internal/hooks/useRichTextFieldNodes.js.map +1 -1
  182. package/dist/production/src/internal/utils/EditorPasteUtils.cjs.map +1 -1
  183. package/dist/production/src/internal/utils/EditorPasteUtils.js.map +1 -1
  184. package/dist/production/src/internal/utils/parseUrl.cjs.map +1 -1
  185. package/dist/production/src/internal/utils/parseUrl.js.map +1 -1
  186. package/dist/production/src/plugins/attributes/alignment/alignButton.cjs.map +1 -1
  187. package/dist/production/src/plugins/attributes/alignment/alignButton.js.map +1 -1
  188. package/dist/production/src/plugins/behaviour/paste/HtmlDeserializer.cjs.map +1 -1
  189. package/dist/production/src/plugins/behaviour/paste/HtmlDeserializer.js.map +1 -1
  190. package/dist/production/src/plugins/behaviour/paste/createMarkHtmlDeserializer.cjs.map +1 -1
  191. package/dist/production/src/plugins/behaviour/paste/createMarkHtmlDeserializer.js.map +1 -1
  192. package/dist/production/src/plugins/behaviour/paste/withPaste.cjs.map +1 -1
  193. package/dist/production/src/plugins/behaviour/paste/withPaste.js.map +1 -1
  194. package/dist/production/src/plugins/element/anchors/AnchorElement.cjs.map +1 -1
  195. package/dist/production/src/plugins/element/anchors/AnchorElement.js.map +1 -1
  196. package/dist/production/src/plugins/element/anchors/AnchorHtmlDeserializer.cjs.map +1 -1
  197. package/dist/production/src/plugins/element/anchors/AnchorHtmlDeserializer.js.map +1 -1
  198. package/dist/production/src/plugins/element/anchors/AnchorModifications.cjs.map +1 -1
  199. package/dist/production/src/plugins/element/anchors/AnchorModifications.js.map +1 -1
  200. package/dist/production/src/plugins/element/anchors/withAnchors.cjs.map +1 -1
  201. package/dist/production/src/plugins/element/anchors/withAnchors.js.map +1 -1
  202. package/dist/production/src/plugins/element/headings/HeadingElement.cjs.map +1 -1
  203. package/dist/production/src/plugins/element/headings/HeadingElement.js.map +1 -1
  204. package/dist/production/src/plugins/element/headings/HeadingHtmlDeserializer.cjs.map +1 -1
  205. package/dist/production/src/plugins/element/headings/HeadingHtmlDeserializer.js.map +1 -1
  206. package/dist/production/src/plugins/element/headings/withHeadings.cjs.map +1 -1
  207. package/dist/production/src/plugins/element/headings/withHeadings.js.map +1 -1
  208. package/dist/production/src/plugins/element/horizonalRules/HorizontalRuleElement.cjs.map +1 -1
  209. package/dist/production/src/plugins/element/horizonalRules/HorizontalRuleElement.js.map +1 -1
  210. package/dist/production/src/plugins/element/horizonalRules/withHorizontalRules.cjs.map +1 -1
  211. package/dist/production/src/plugins/element/horizonalRules/withHorizontalRules.js.map +1 -1
  212. package/dist/production/src/plugins/element/lists/ListElement.cjs.map +1 -1
  213. package/dist/production/src/plugins/element/lists/ListElement.js.map +1 -1
  214. package/dist/production/src/plugins/element/lists/ListHtmlDeserializer.cjs.map +1 -1
  215. package/dist/production/src/plugins/element/lists/ListHtmlDeserializer.js.map +1 -1
  216. package/dist/production/src/plugins/element/lists/ListItemElement.cjs.map +1 -1
  217. package/dist/production/src/plugins/element/lists/ListItemElement.js.map +1 -1
  218. package/dist/production/src/plugins/element/lists/OrderedListElement.cjs.map +1 -1
  219. package/dist/production/src/plugins/element/lists/UnorderedListElement.cjs.map +1 -1
  220. package/dist/production/src/plugins/element/lists/transforms/dedentListItem.cjs.map +1 -1
  221. package/dist/production/src/plugins/element/lists/transforms/dedentListItem.js.map +1 -1
  222. package/dist/production/src/plugins/element/lists/transforms/indentListItem.cjs.map +1 -1
  223. package/dist/production/src/plugins/element/lists/transforms/indentListItem.js.map +1 -1
  224. package/dist/production/src/plugins/element/lists/transforms/normalizeListElement.cjs.map +1 -1
  225. package/dist/production/src/plugins/element/lists/transforms/normalizeListElement.js.map +1 -1
  226. package/dist/production/src/plugins/element/lists/transforms/toggleListElement.cjs.map +1 -1
  227. package/dist/production/src/plugins/element/lists/transforms/toggleListElement.js.map +1 -1
  228. package/dist/production/src/plugins/element/lists/withLists.cjs.map +1 -1
  229. package/dist/production/src/plugins/element/lists/withLists.js.map +1 -1
  230. package/dist/production/src/plugins/element/paragraphs/ParagraphElement.cjs.map +1 -1
  231. package/dist/production/src/plugins/element/paragraphs/ParagraphElement.js.map +1 -1
  232. package/dist/production/src/plugins/element/paragraphs/withParagraphs.cjs.map +1 -1
  233. package/dist/production/src/plugins/element/paragraphs/withParagraphs.js.map +1 -1
  234. package/dist/production/src/plugins/element/scrollTargets/ScrollTargetElement.cjs.map +1 -1
  235. package/dist/production/src/plugins/element/scrollTargets/ScrollTargetElement.js.map +1 -1
  236. package/dist/production/src/plugins/element/scrollTargets/withScrollTargets.cjs.map +1 -1
  237. package/dist/production/src/plugins/element/scrollTargets/withScrollTargets.js.map +1 -1
  238. package/dist/production/src/plugins/element/tables/TableCellElement.cjs.map +1 -1
  239. package/dist/production/src/plugins/element/tables/TableCellElement.js.map +1 -1
  240. package/dist/production/src/plugins/element/tables/TableElement.cjs.map +1 -1
  241. package/dist/production/src/plugins/element/tables/TableElement.js.map +1 -1
  242. package/dist/production/src/plugins/element/tables/TableElementSelection.cjs.map +1 -1
  243. package/dist/production/src/plugins/element/tables/TableElementSelection.js.map +1 -1
  244. package/dist/production/src/plugins/element/tables/TableHtmlDeserializer.cjs.map +1 -1
  245. package/dist/production/src/plugins/element/tables/TableHtmlDeserializer.js.map +1 -1
  246. package/dist/production/src/plugins/element/tables/TableModifications.cjs.map +1 -1
  247. package/dist/production/src/plugins/element/tables/TableModifications.js +1 -1
  248. package/dist/production/src/plugins/element/tables/TableModifications.js.map +1 -1
  249. package/dist/production/src/plugins/element/tables/TableRowElement.cjs.map +1 -1
  250. package/dist/production/src/plugins/element/tables/TableRowElement.js.map +1 -1
  251. package/dist/production/src/plugins/element/tables/gaugeTableColumnCount.cjs.map +1 -1
  252. package/dist/production/src/plugins/element/tables/gaugeTableColumnCount.js.map +1 -1
  253. package/dist/production/src/plugins/element/tables/withTables.cjs.map +1 -1
  254. package/dist/production/src/plugins/element/tables/withTables.js.map +1 -1
  255. package/dist/production/src/plugins/text/bold/withBold.cjs.map +1 -1
  256. package/dist/production/src/plugins/text/bold/withBold.js.map +1 -1
  257. package/dist/production/src/plugins/text/code/withCode.cjs.map +1 -1
  258. package/dist/production/src/plugins/text/highlight/withHighlight.cjs.map +1 -1
  259. package/dist/production/src/plugins/text/italic/withItalic.cjs.map +1 -1
  260. package/dist/production/src/plugins/text/italic/withItalic.js.map +1 -1
  261. package/dist/production/src/plugins/text/newline/withNewline.cjs.map +1 -1
  262. package/dist/production/src/plugins/text/newline/withNewline.js.map +1 -1
  263. package/dist/production/src/plugins/text/strikeThrough/withStrikeThrough.cjs.map +1 -1
  264. package/dist/production/src/plugins/text/strikeThrough/withStrikeThrough.js.map +1 -1
  265. package/dist/production/src/plugins/text/underline/withUnderline.cjs.map +1 -1
  266. package/dist/production/src/plugins/text/underline/withUnderline.js.map +1 -1
  267. package/dist/types/tsconfig.tsbuildinfo +1 -1
  268. package/package.json +5 -4
@@ -1 +1 @@
1
- {"version":3,"file":"withParagraphs.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/paragraphs/withParagraphs.ts"],"sourcesContent":["import { Editor, Element as SlateElement, Point, Range as SlateRange, Transforms } from 'slate'\nimport { ContemberEditor } from '../../../editor'\nimport { isParagraphElement, ParagraphElement, paragraphElementPlugin, paragraphElementType } from './ParagraphElement'\nimport { paragraphHtmlDeserializer } from './ParagraphHtmlDeserializer'\nimport { ElementRenderer } from '../../../types'\n\nexport const withParagraphs = ({ render }: { render: ElementRenderer<ParagraphElement> }) => <E extends Editor>(editor: E): E => {\n\tconst {\n\t\tcanToggleElement,\n\t\tdeleteBackward,\n\t} = editor\n\n\teditor.registerElement(paragraphElementPlugin({ render }))\n\n\n\teditor.canToggleElement = (elementType, suchThat) => {\n\t\t// This only allows numbered paragraphs at the top level.\n\t\t// TODO this is pretty bad but in order to fix this, we'd also have to fix toggleElement and there's no time now.\n\n\t\tif (elementType !== paragraphElementType || suchThat === undefined) {\n\t\t\treturn canToggleElement(elementType, suchThat)\n\t\t}\n\t\tconst isNumbered = suchThat.isNumbered\n\n\t\tif (isNumbered !== true) {\n\t\t\treturn canToggleElement(elementType, suchThat)\n\t\t}\n\n\t\tif (!editor.selection) {\n\t\t\treturn false\n\t\t}\n\t\tconst closestBlockEntry = ContemberEditor.closestBlockEntry(editor)\n\t\tif (closestBlockEntry === undefined) {\n\t\t\treturn true\n\t\t}\n\t\tconst [closestBlockElement, closestBlockPath] = closestBlockEntry\n\n\t\treturn closestBlockPath.length === 1 && SlateElement.isElement(closestBlockElement) && closestBlockElement.type === paragraphElementType\n\t}\n\n\teditor.deleteBackward = unit => {\n\t\tconst selection = editor.selection\n\t\tif (unit !== 'character' || !selection || !SlateRange.isCollapsed(selection) || selection.focus.offset !== 0) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\t// The offset being zero doesn't necessarily imply that selection refers to the start of a paragraph.\n\t\t// It's just a way to early-exit.\n\n\t\tconst closestNumberedEntry = Editor.above<ParagraphElement>(editor, {\n\t\t\tmatch: node => SlateElement.isElement(node) && isParagraphElement(node, { isNumbered: true }),\n\t\t})\n\t\tif (closestNumberedEntry === undefined) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\tconst [, paragraphPath] = closestNumberedEntry\n\t\tconst paragraphStartPoint = Editor.start(editor, paragraphPath)\n\n\t\tif (!Point.equals(paragraphStartPoint, selection.focus)) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\tTransforms.setNodes(\n\t\t\teditor,\n\t\t\t{ isNumbered: null }, // null removes the key altogether\n\t\t\t{ at: paragraphPath },\n\t\t)\n\t}\n\teditor.htmlDeserializer.registerPlugin(paragraphHtmlDeserializer)\n\n\treturn editor\n}\n"],"names":["paragraphElementPlugin","paragraphElementType","ContemberEditor","SlateElement","SlateRange","Editor","isParagraphElement","Point","Transforms","paragraphHtmlDeserializer"],"mappings":";;;;;;AAMO,MAAM,iBAAiB,CAAC,EAAE,OAAO,MAAqD,CAAmB,WAAiB;AAC1H,QAAA;AAAA,IACL;AAAA,IACA;AAAA,EACG,IAAA;AAEJ,SAAO,gBAAgBA,iBAAAA,uBAAuB,EAAE,OAAA,CAAQ,CAAC;AAGlD,SAAA,mBAAmB,CAAC,aAAa,aAAa;AAIhD,QAAA,gBAAgBC,iBAAAA,wBAAwB,aAAa,QAAW;AAC5D,aAAA,iBAAiB,aAAa,QAAQ;AAAA,IAC9C;AACA,UAAM,aAAa,SAAS;AAE5B,QAAI,eAAe,MAAM;AACjB,aAAA,iBAAiB,aAAa,QAAQ;AAAA,IAC9C;AAEI,QAAA,CAAC,OAAO,WAAW;AACf,aAAA;AAAA,IACR;AACM,UAAA,oBAAoBC,MAAAA,gBAAgB,kBAAkB,MAAM;AAClE,QAAI,sBAAsB,QAAW;AAC7B,aAAA;AAAA,IACR;AACM,UAAA,CAAC,qBAAqB,gBAAgB,IAAI;AAEzC,WAAA,iBAAiB,WAAW,KAAMC,MAAA,QAAa,UAAU,mBAAmB,KAAK,oBAAoB,SAASF;EAAA;AAGtH,SAAO,iBAAiB,CAAQ,SAAA;AAC/B,UAAM,YAAY,OAAO;AACzB,QAAI,SAAS,eAAe,CAAC,aAAa,CAACG,MAAA,MAAW,YAAY,SAAS,KAAK,UAAU,MAAM,WAAW,GAAG;AAC7G,aAAO,eAAe,IAAI;AAAA,IAC3B;AAIM,UAAA,uBAAuBC,MAAAA,OAAO,MAAwB,QAAQ;AAAA,MACnE,OAAO,CAAQ,SAAAF,MAAA,QAAa,UAAU,IAAI,KAAKG,iBAAAA,mBAAmB,MAAM,EAAE,YAAY,KAAA,CAAM;AAAA,IAAA,CAC5F;AACD,QAAI,yBAAyB,QAAW;AACvC,aAAO,eAAe,IAAI;AAAA,IAC3B;AACM,UAAA,CAAG,EAAA,aAAa,IAAI;AAC1B,UAAM,sBAAsBD,MAAA,OAAO,MAAM,QAAQ,aAAa;AAE9D,QAAI,CAACE,MAAM,MAAA,OAAO,qBAAqB,UAAU,KAAK,GAAG;AACxD,aAAO,eAAe,IAAI;AAAA,IAC3B;AACWC,UAAAA,WAAA;AAAA,MACV;AAAA,MACA,EAAE,YAAY,KAAK;AAAA;AAAA,MACnB,EAAE,IAAI,cAAc;AAAA,IAAA;AAAA,EACrB;AAEM,SAAA,iBAAiB,eAAeC,0BAAAA,yBAAyB;AAEzD,SAAA;AACR;;"}
1
+ {"version":3,"file":"withParagraphs.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/paragraphs/withParagraphs.ts"],"sourcesContent":["import { Editor, Element as SlateElement, Point, Range as SlateRange, Transforms } from 'slate'\nimport { ContemberEditor } from '../../../editor'\nimport { isParagraphElement, ParagraphElement, paragraphElementPlugin, paragraphElementType } from './ParagraphElement'\nimport { paragraphHtmlDeserializer } from './ParagraphHtmlDeserializer'\nimport { ElementRenderer } from '../../../types'\n\nexport const withParagraphs = ({ render }: { render: ElementRenderer<ParagraphElement> }) => <E extends Editor>(editor: E): E => {\n\tconst {\n\t\tcanToggleElement,\n\t\tdeleteBackward,\n\t} = editor\n\n\teditor.registerElement(paragraphElementPlugin({ render }))\n\n\n\teditor.canToggleElement = (elementType, suchThat) => {\n\t\t// This only allows numbered paragraphs at the top level.\n\t\t// TODO this is pretty bad but in order to fix this, we'd also have to fix toggleElement and there's no time now.\n\n\t\tif (elementType !== paragraphElementType || suchThat === undefined) {\n\t\t\treturn canToggleElement(elementType, suchThat)\n\t\t}\n\t\tconst isNumbered = suchThat.isNumbered\n\n\t\tif (isNumbered !== true) {\n\t\t\treturn canToggleElement(elementType, suchThat)\n\t\t}\n\n\t\tif (!editor.selection) {\n\t\t\treturn false\n\t\t}\n\t\tconst closestBlockEntry = ContemberEditor.closestBlockEntry(editor)\n\t\tif (closestBlockEntry === undefined) {\n\t\t\treturn true\n\t\t}\n\t\tconst [closestBlockElement, closestBlockPath] = closestBlockEntry\n\n\t\treturn closestBlockPath.length === 1 && SlateElement.isElement(closestBlockElement) && closestBlockElement.type === paragraphElementType\n\t}\n\n\teditor.deleteBackward = unit => {\n\t\tconst selection = editor.selection\n\t\tif (unit !== 'character' || !selection || !SlateRange.isCollapsed(selection) || selection.focus.offset !== 0) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\t// The offset being zero doesn't necessarily imply that selection refers to the start of a paragraph.\n\t\t// It's just a way to early-exit.\n\n\t\tconst closestNumberedEntry = Editor.above<ParagraphElement>(editor, {\n\t\t\tmatch: node => SlateElement.isElement(node) && isParagraphElement(node, { isNumbered: true }),\n\t\t})\n\t\tif (closestNumberedEntry === undefined) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\tconst [, paragraphPath] = closestNumberedEntry\n\t\tconst paragraphStartPoint = Editor.start(editor, paragraphPath)\n\n\t\tif (!Point.equals(paragraphStartPoint, selection.focus)) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\tTransforms.setNodes(\n\t\t\teditor,\n\t\t\t{ isNumbered: null }, // null removes the key altogether\n\t\t\t{ at: paragraphPath },\n\t\t)\n\t}\n\teditor.htmlDeserializer.registerPlugin(paragraphHtmlDeserializer)\n\n\treturn editor\n}\n"],"names":["paragraphElementPlugin","paragraphElementType","ContemberEditor","SlateElement","SlateRange","Editor","isParagraphElement","Point","Transforms","paragraphHtmlDeserializer"],"mappings":";;;;;;AAMO,MAAM,iBAAiB,CAAC,EAAE,OAAO,MAAqD,CAAmB,WAAiB;AAC1H,QAAA;AAAA,IACL;AAAA,IACA;AAAA,EAAA,IACG;AAEJ,SAAO,gBAAgBA,iBAAAA,uBAAuB,EAAE,OAAQ,CAAA,CAAC;AAGlD,SAAA,mBAAmB,CAAC,aAAa,aAAa;AAIhD,QAAA,gBAAgBC,iBAAAA,wBAAwB,aAAa,QAAW;AAC5D,aAAA,iBAAiB,aAAa,QAAQ;AAAA,IAAA;AAE9C,UAAM,aAAa,SAAS;AAE5B,QAAI,eAAe,MAAM;AACjB,aAAA,iBAAiB,aAAa,QAAQ;AAAA,IAAA;AAG1C,QAAA,CAAC,OAAO,WAAW;AACf,aAAA;AAAA,IAAA;AAEF,UAAA,oBAAoBC,MAAAA,gBAAgB,kBAAkB,MAAM;AAClE,QAAI,sBAAsB,QAAW;AAC7B,aAAA;AAAA,IAAA;AAEF,UAAA,CAAC,qBAAqB,gBAAgB,IAAI;AAEzC,WAAA,iBAAiB,WAAW,KAAMC,MAAA,QAAa,UAAU,mBAAmB,KAAK,oBAAoB,SAASF,iBAAA;AAAA,EACtH;AAEA,SAAO,iBAAiB,CAAQ,SAAA;AAC/B,UAAM,YAAY,OAAO;AACzB,QAAI,SAAS,eAAe,CAAC,aAAa,CAACG,MAAA,MAAW,YAAY,SAAS,KAAK,UAAU,MAAM,WAAW,GAAG;AAC7G,aAAO,eAAe,IAAI;AAAA,IAAA;AAKrB,UAAA,uBAAuBC,MAAAA,OAAO,MAAwB,QAAQ;AAAA,MACnE,OAAO,CAAQ,SAAAF,MAAA,QAAa,UAAU,IAAI,KAAKG,iBAAAA,mBAAmB,MAAM,EAAE,YAAY,KAAM,CAAA;AAAA,IAAA,CAC5F;AACD,QAAI,yBAAyB,QAAW;AACvC,aAAO,eAAe,IAAI;AAAA,IAAA;AAErB,UAAA,CAAA,EAAG,aAAa,IAAI;AAC1B,UAAM,sBAAsBD,MAAA,OAAO,MAAM,QAAQ,aAAa;AAE9D,QAAI,CAACE,MAAM,MAAA,OAAO,qBAAqB,UAAU,KAAK,GAAG;AACxD,aAAO,eAAe,IAAI;AAAA,IAAA;AAEhBC,UAAAA,WAAA;AAAA,MACV;AAAA,MACA,EAAE,YAAY,KAAK;AAAA;AAAA,MACnB,EAAE,IAAI,cAAc;AAAA,IACrB;AAAA,EACD;AACO,SAAA,iBAAiB,eAAeC,mDAAyB;AAEzD,SAAA;AACR;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"withParagraphs.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/paragraphs/withParagraphs.ts"],"sourcesContent":["import { Editor, Element as SlateElement, Point, Range as SlateRange, Transforms } from 'slate'\nimport { ContemberEditor } from '../../../editor'\nimport { isParagraphElement, ParagraphElement, paragraphElementPlugin, paragraphElementType } from './ParagraphElement'\nimport { paragraphHtmlDeserializer } from './ParagraphHtmlDeserializer'\nimport { ElementRenderer } from '../../../types'\n\nexport const withParagraphs = ({ render }: { render: ElementRenderer<ParagraphElement> }) => <E extends Editor>(editor: E): E => {\n\tconst {\n\t\tcanToggleElement,\n\t\tdeleteBackward,\n\t} = editor\n\n\teditor.registerElement(paragraphElementPlugin({ render }))\n\n\n\teditor.canToggleElement = (elementType, suchThat) => {\n\t\t// This only allows numbered paragraphs at the top level.\n\t\t// TODO this is pretty bad but in order to fix this, we'd also have to fix toggleElement and there's no time now.\n\n\t\tif (elementType !== paragraphElementType || suchThat === undefined) {\n\t\t\treturn canToggleElement(elementType, suchThat)\n\t\t}\n\t\tconst isNumbered = suchThat.isNumbered\n\n\t\tif (isNumbered !== true) {\n\t\t\treturn canToggleElement(elementType, suchThat)\n\t\t}\n\n\t\tif (!editor.selection) {\n\t\t\treturn false\n\t\t}\n\t\tconst closestBlockEntry = ContemberEditor.closestBlockEntry(editor)\n\t\tif (closestBlockEntry === undefined) {\n\t\t\treturn true\n\t\t}\n\t\tconst [closestBlockElement, closestBlockPath] = closestBlockEntry\n\n\t\treturn closestBlockPath.length === 1 && SlateElement.isElement(closestBlockElement) && closestBlockElement.type === paragraphElementType\n\t}\n\n\teditor.deleteBackward = unit => {\n\t\tconst selection = editor.selection\n\t\tif (unit !== 'character' || !selection || !SlateRange.isCollapsed(selection) || selection.focus.offset !== 0) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\t// The offset being zero doesn't necessarily imply that selection refers to the start of a paragraph.\n\t\t// It's just a way to early-exit.\n\n\t\tconst closestNumberedEntry = Editor.above<ParagraphElement>(editor, {\n\t\t\tmatch: node => SlateElement.isElement(node) && isParagraphElement(node, { isNumbered: true }),\n\t\t})\n\t\tif (closestNumberedEntry === undefined) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\tconst [, paragraphPath] = closestNumberedEntry\n\t\tconst paragraphStartPoint = Editor.start(editor, paragraphPath)\n\n\t\tif (!Point.equals(paragraphStartPoint, selection.focus)) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\tTransforms.setNodes(\n\t\t\teditor,\n\t\t\t{ isNumbered: null }, // null removes the key altogether\n\t\t\t{ at: paragraphPath },\n\t\t)\n\t}\n\teditor.htmlDeserializer.registerPlugin(paragraphHtmlDeserializer)\n\n\treturn editor\n}\n"],"names":["SlateElement","SlateRange"],"mappings":";;;;AAMO,MAAM,iBAAiB,CAAC,EAAE,OAAO,MAAq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MACA,EAAE,YAAY,KAAK;AAAA;AAAA,MACnB,EAAE,IAAI,cAAc;AAAA,IAAA;AAAA,EACrB;AAEM,SAAA,iBAAiB,eAAe,yBAAyB;AAEzD,SAAA;AACR;"}
1
+ {"version":3,"file":"withParagraphs.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/paragraphs/withParagraphs.ts"],"sourcesContent":["import { Editor, Element as SlateElement, Point, Range as SlateRange, Transforms } from 'slate'\nimport { ContemberEditor } from '../../../editor'\nimport { isParagraphElement, ParagraphElement, paragraphElementPlugin, paragraphElementType } from './ParagraphElement'\nimport { paragraphHtmlDeserializer } from './ParagraphHtmlDeserializer'\nimport { ElementRenderer } from '../../../types'\n\nexport const withParagraphs = ({ render }: { render: ElementRenderer<ParagraphElement> }) => <E extends Editor>(editor: E): E => {\n\tconst {\n\t\tcanToggleElement,\n\t\tdeleteBackward,\n\t} = editor\n\n\teditor.registerElement(paragraphElementPlugin({ render }))\n\n\n\teditor.canToggleElement = (elementType, suchThat) => {\n\t\t// This only allows numbered paragraphs at the top level.\n\t\t// TODO this is pretty bad but in order to fix this, we'd also have to fix toggleElement and there's no time now.\n\n\t\tif (elementType !== paragraphElementType || suchThat === undefined) {\n\t\t\treturn canToggleElement(elementType, suchThat)\n\t\t}\n\t\tconst isNumbered = suchThat.isNumbered\n\n\t\tif (isNumbered !== true) {\n\t\t\treturn canToggleElement(elementType, suchThat)\n\t\t}\n\n\t\tif (!editor.selection) {\n\t\t\treturn false\n\t\t}\n\t\tconst closestBlockEntry = ContemberEditor.closestBlockEntry(editor)\n\t\tif (closestBlockEntry === undefined) {\n\t\t\treturn true\n\t\t}\n\t\tconst [closestBlockElement, closestBlockPath] = closestBlockEntry\n\n\t\treturn closestBlockPath.length === 1 && SlateElement.isElement(closestBlockElement) && closestBlockElement.type === paragraphElementType\n\t}\n\n\teditor.deleteBackward = unit => {\n\t\tconst selection = editor.selection\n\t\tif (unit !== 'character' || !selection || !SlateRange.isCollapsed(selection) || selection.focus.offset !== 0) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\t// The offset being zero doesn't necessarily imply that selection refers to the start of a paragraph.\n\t\t// It's just a way to early-exit.\n\n\t\tconst closestNumberedEntry = Editor.above<ParagraphElement>(editor, {\n\t\t\tmatch: node => SlateElement.isElement(node) && isParagraphElement(node, { isNumbered: true }),\n\t\t})\n\t\tif (closestNumberedEntry === undefined) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\tconst [, paragraphPath] = closestNumberedEntry\n\t\tconst paragraphStartPoint = Editor.start(editor, paragraphPath)\n\n\t\tif (!Point.equals(paragraphStartPoint, selection.focus)) {\n\t\t\treturn deleteBackward(unit)\n\t\t}\n\t\tTransforms.setNodes(\n\t\t\teditor,\n\t\t\t{ isNumbered: null }, // null removes the key altogether\n\t\t\t{ at: paragraphPath },\n\t\t)\n\t}\n\teditor.htmlDeserializer.registerPlugin(paragraphHtmlDeserializer)\n\n\treturn editor\n}\n"],"names":["SlateElement","SlateRange"],"mappings":";;;;AAMO,MAAM,iBAAiB,CAAC,EAAE,OAAO,MAAqD,CAAmB,WAAiB;AAC1H,QAAA;AAAA,IACL;AAAA,IACA;AAAA,EAAA,IACG;AAEJ,SAAO,gBAAgB,uBAAuB,EAAE,OAAQ,CAAA,CAAC;AAGlD,SAAA,mBAAmB,CAAC,aAAa,aAAa;AAIhD,QAAA,gBAAgB,wBAAwB,aAAa,QAAW;AAC5D,aAAA,iBAAiB,aAAa,QAAQ;AAAA,IAAA;AAE9C,UAAM,aAAa,SAAS;AAE5B,QAAI,eAAe,MAAM;AACjB,aAAA,iBAAiB,aAAa,QAAQ;AAAA,IAAA;AAG1C,QAAA,CAAC,OAAO,WAAW;AACf,aAAA;AAAA,IAAA;AAEF,UAAA,oBAAoB,gBAAgB,kBAAkB,MAAM;AAClE,QAAI,sBAAsB,QAAW;AAC7B,aAAA;AAAA,IAAA;AAEF,UAAA,CAAC,qBAAqB,gBAAgB,IAAI;AAEzC,WAAA,iBAAiB,WAAW,KAAMA,QAAa,UAAU,mBAAmB,KAAK,oBAAoB,SAAS;AAAA,EACtH;AAEA,SAAO,iBAAiB,CAAQ,SAAA;AAC/B,UAAM,YAAY,OAAO;AACzB,QAAI,SAAS,eAAe,CAAC,aAAa,CAACC,MAAW,YAAY,SAAS,KAAK,UAAU,MAAM,WAAW,GAAG;AAC7G,aAAO,eAAe,IAAI;AAAA,IAAA;AAKrB,UAAA,uBAAuB,OAAO,MAAwB,QAAQ;AAAA,MACnE,OAAO,CAAQ,SAAAD,QAAa,UAAU,IAAI,KAAK,mBAAmB,MAAM,EAAE,YAAY,KAAM,CAAA;AAAA,IAAA,CAC5F;AACD,QAAI,yBAAyB,QAAW;AACvC,aAAO,eAAe,IAAI;AAAA,IAAA;AAErB,UAAA,CAAA,EAAG,aAAa,IAAI;AAC1B,UAAM,sBAAsB,OAAO,MAAM,QAAQ,aAAa;AAE9D,QAAI,CAAC,MAAM,OAAO,qBAAqB,UAAU,KAAK,GAAG;AACxD,aAAO,eAAe,IAAI;AAAA,IAAA;AAEhB,eAAA;AAAA,MACV;AAAA,MACA,EAAE,YAAY,KAAK;AAAA;AAAA,MACnB,EAAE,IAAI,cAAc;AAAA,IACrB;AAAA,EACD;AACO,SAAA,iBAAiB,eAAe,yBAAyB;AAEzD,SAAA;AACR;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScrollTargetElement.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/scrollTargets/ScrollTargetElement.ts"],"sourcesContent":["import { Editor as SlateEditor, Editor, Element as SlateElement, Node as SlateNode, Range as SlateRange, Transforms } from 'slate'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const scrollTargetElementType = 'scrollTarget' as const\n\nexport interface ScrollTargetElement extends SlateElement {\n\ttype: typeof scrollTargetElementType\n\tidentifier: string\n\tchildren: SlateEditor['children']\n}\n\nexport const isScrollTargetElement = (element: SlateNode): element is ScrollTargetElement =>\n\tSlateElement.isElement(element) && element.type === scrollTargetElementType\n\nexport const isScrollTargetElementActive = (editor: Editor) => {\n\tconst [link] = Editor.nodes(editor, { match: isScrollTargetElement })\n\treturn !!link\n}\n\nexport const scrollTargetElementPlugin = ({ render }: { render: ElementRenderer<ScrollTargetElement> }): EditorElementPlugin<ScrollTargetElement> => ({\n\ttype: scrollTargetElementType,\n\trender,\n\tisActive: ({ editor }) => isScrollTargetElementActive(editor),\n\tisInline: true,\n\tisVoid: true,\n\ttoggleElement: ({ editor, suchThat }) => {\n\t\tif (isScrollTargetElementActive(editor)) {\n\t\t\tunwrapScrollTarget(editor)\n\t\t} else {\n\t\t\tlet identifier =\n\t\t\t\tsuchThat?.identifier ??\n\t\t\t\tprompt('Insert the identifier:')\n\n\t\t\tif (!identifier) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\twrapScrollTarget(editor, identifier)\n\t\t}\n\t},\n})\nconst unwrapScrollTarget = (editor: Editor) => {\n\tTransforms.removeNodes(editor, { match: isScrollTargetElement })\n}\nconst wrapScrollTarget = (editor: Editor, identifier: string) => {\n\tif (isScrollTargetElementActive(editor)) {\n\t\tunwrapScrollTarget(editor)\n\t}\n\n\tconst selection = editor.selection\n\tconst isCollapsed = selection ? SlateRange.isCollapsed(selection!) : false\n\tconst ScrollTarget: ScrollTargetElement = {\n\t\ttype: scrollTargetElementType,\n\t\tidentifier,\n\t\tchildren: [{ text: '' }],\n\t}\n\n\tif (!isCollapsed) {\n\t\tTransforms.collapse(editor, { edge: 'start' })\n\t}\n\tTransforms.insertNodes(editor, ScrollTarget)\n}\n"],"names":["SlateElement","Editor","Transforms","SlateRange"],"mappings":";;;AAGO,MAAM,0BAA0B;AAQ1B,MAAA,wBAAwB,CAAC,YACrCA,cAAa,UAAU,OAAO,KAAK,QAAQ,SAAS;AAExC,MAAA,8BAA8B,CAAC,WAAmB;AACxD,QAAA,CAAC,IAAI,IAAIC,aAAO,MAAM,QAAQ,EAAE,OAAO,sBAAA,CAAuB;AACpE,SAAO,CAAC,CAAC;AACV;AAEO,MAAM,4BAA4B,CAAC,EAAE,cAA0G;AAAA,EACrJ,MAAM;AAAA,EACN;AAAA,EACA,UAAU,CAAC,EAAE,aAAa,4BAA4B,MAAM;AAAA,EAC5D,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,eAAe,CAAC,EAAE,QAAQ,eAAe;AACpC,QAAA,4BAA4B,MAAM,GAAG;AACxC,yBAAmB,MAAM;AAAA,IAAA,OACnB;AACN,UAAI,aACH,UAAU,cACV,OAAO,wBAAwB;AAEhC,UAAI,CAAC,YAAY;AAChB;AAAA,MACD;AACA,uBAAiB,QAAQ,UAAU;AAAA,IACpC;AAAA,EACD;AACD;AACA,MAAM,qBAAqB,CAAC,WAAmB;AAC9CC,QAAA,WAAW,YAAY,QAAQ,EAAE,OAAO,sBAAuB,CAAA;AAChE;AACA,MAAM,mBAAmB,CAAC,QAAgB,eAAuB;AAC5D,MAAA,4BAA4B,MAAM,GAAG;AACxC,uBAAmB,MAAM;AAAA,EAC1B;AAEA,QAAM,YAAY,OAAO;AACzB,QAAM,cAAc,YAAYC,MAAAA,MAAW,YAAY,SAAU,IAAI;AACrE,QAAM,eAAoC;AAAA,IACzC,MAAM;AAAA,IACN;AAAA,IACA,UAAU,CAAC,EAAE,MAAM,IAAI;AAAA,EAAA;AAGxB,MAAI,CAAC,aAAa;AACjBD,UAAA,WAAW,SAAS,QAAQ,EAAE,MAAM,QAAS,CAAA;AAAA,EAC9C;AACWA,QAAAA,WAAA,YAAY,QAAQ,YAAY;AAC5C;;;;;"}
1
+ {"version":3,"file":"ScrollTargetElement.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/scrollTargets/ScrollTargetElement.ts"],"sourcesContent":["import { Editor as SlateEditor, Editor, Element as SlateElement, Node as SlateNode, Range as SlateRange, Transforms } from 'slate'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const scrollTargetElementType = 'scrollTarget' as const\n\nexport interface ScrollTargetElement extends SlateElement {\n\ttype: typeof scrollTargetElementType\n\tidentifier: string\n\tchildren: SlateEditor['children']\n}\n\nexport const isScrollTargetElement = (element: SlateNode): element is ScrollTargetElement =>\n\tSlateElement.isElement(element) && element.type === scrollTargetElementType\n\nexport const isScrollTargetElementActive = (editor: Editor) => {\n\tconst [link] = Editor.nodes(editor, { match: isScrollTargetElement })\n\treturn !!link\n}\n\nexport const scrollTargetElementPlugin = ({ render }: { render: ElementRenderer<ScrollTargetElement> }): EditorElementPlugin<ScrollTargetElement> => ({\n\ttype: scrollTargetElementType,\n\trender,\n\tisActive: ({ editor }) => isScrollTargetElementActive(editor),\n\tisInline: true,\n\tisVoid: true,\n\ttoggleElement: ({ editor, suchThat }) => {\n\t\tif (isScrollTargetElementActive(editor)) {\n\t\t\tunwrapScrollTarget(editor)\n\t\t} else {\n\t\t\tlet identifier =\n\t\t\t\tsuchThat?.identifier ??\n\t\t\t\tprompt('Insert the identifier:')\n\n\t\t\tif (!identifier) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\twrapScrollTarget(editor, identifier)\n\t\t}\n\t},\n})\nconst unwrapScrollTarget = (editor: Editor) => {\n\tTransforms.removeNodes(editor, { match: isScrollTargetElement })\n}\nconst wrapScrollTarget = (editor: Editor, identifier: string) => {\n\tif (isScrollTargetElementActive(editor)) {\n\t\tunwrapScrollTarget(editor)\n\t}\n\n\tconst selection = editor.selection\n\tconst isCollapsed = selection ? SlateRange.isCollapsed(selection!) : false\n\tconst ScrollTarget: ScrollTargetElement = {\n\t\ttype: scrollTargetElementType,\n\t\tidentifier,\n\t\tchildren: [{ text: '' }],\n\t}\n\n\tif (!isCollapsed) {\n\t\tTransforms.collapse(editor, { edge: 'start' })\n\t}\n\tTransforms.insertNodes(editor, ScrollTarget)\n}\n"],"names":["SlateElement","Editor","Transforms","SlateRange"],"mappings":";;;AAGO,MAAM,0BAA0B;AAQ1B,MAAA,wBAAwB,CAAC,YACrCA,MAAA,QAAa,UAAU,OAAO,KAAK,QAAQ,SAAS;AAExC,MAAA,8BAA8B,CAAC,WAAmB;AACxD,QAAA,CAAC,IAAI,IAAIC,aAAO,MAAM,QAAQ,EAAE,OAAO,uBAAuB;AACpE,SAAO,CAAC,CAAC;AACV;AAEO,MAAM,4BAA4B,CAAC,EAAE,cAA0G;AAAA,EACrJ,MAAM;AAAA,EACN;AAAA,EACA,UAAU,CAAC,EAAE,aAAa,4BAA4B,MAAM;AAAA,EAC5D,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,eAAe,CAAC,EAAE,QAAQ,eAAe;AACpC,QAAA,4BAA4B,MAAM,GAAG;AACxC,yBAAmB,MAAM;AAAA,IAAA,OACnB;AACN,UAAI,aACH,UAAU,cACV,OAAO,wBAAwB;AAEhC,UAAI,CAAC,YAAY;AAChB;AAAA,MAAA;AAED,uBAAiB,QAAQ,UAAU;AAAA,IAAA;AAAA,EACpC;AAEF;AACA,MAAM,qBAAqB,CAAC,WAAmB;AAC9CC,QAAAA,WAAW,YAAY,QAAQ,EAAE,OAAO,uBAAuB;AAChE;AACA,MAAM,mBAAmB,CAAC,QAAgB,eAAuB;AAC5D,MAAA,4BAA4B,MAAM,GAAG;AACxC,uBAAmB,MAAM;AAAA,EAAA;AAG1B,QAAM,YAAY,OAAO;AACzB,QAAM,cAAc,YAAYC,MAAAA,MAAW,YAAY,SAAU,IAAI;AACrE,QAAM,eAAoC;AAAA,IACzC,MAAM;AAAA,IACN;AAAA,IACA,UAAU,CAAC,EAAE,MAAM,GAAI,CAAA;AAAA,EACxB;AAEA,MAAI,CAAC,aAAa;AACjBD,UAAAA,WAAW,SAAS,QAAQ,EAAE,MAAM,SAAS;AAAA,EAAA;AAEnCA,mBAAA,YAAY,QAAQ,YAAY;AAC5C;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ScrollTargetElement.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/scrollTargets/ScrollTargetElement.ts"],"sourcesContent":["import { Editor as SlateEditor, Editor, Element as SlateElement, Node as SlateNode, Range as SlateRange, Transforms } from 'slate'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const scrollTargetElementType = 'scrollTarget' as const\n\nexport interface ScrollTargetElement extends SlateElement {\n\ttype: typeof scrollTargetElementType\n\tidentifier: string\n\tchildren: SlateEditor['children']\n}\n\nexport const isScrollTargetElement = (element: SlateNode): element is ScrollTargetElement =>\n\tSlateElement.isElement(element) && element.type === scrollTargetElementType\n\nexport const isScrollTargetElementActive = (editor: Editor) => {\n\tconst [link] = Editor.nodes(editor, { match: isScrollTargetElement })\n\treturn !!link\n}\n\nexport const scrollTargetElementPlugin = ({ render }: { render: ElementRenderer<ScrollTargetElement> }): EditorElementPlugin<ScrollTargetElement> => ({\n\ttype: scrollTargetElementType,\n\trender,\n\tisActive: ({ editor }) => isScrollTargetElementActive(editor),\n\tisInline: true,\n\tisVoid: true,\n\ttoggleElement: ({ editor, suchThat }) => {\n\t\tif (isScrollTargetElementActive(editor)) {\n\t\t\tunwrapScrollTarget(editor)\n\t\t} else {\n\t\t\tlet identifier =\n\t\t\t\tsuchThat?.identifier ??\n\t\t\t\tprompt('Insert the identifier:')\n\n\t\t\tif (!identifier) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\twrapScrollTarget(editor, identifier)\n\t\t}\n\t},\n})\nconst unwrapScrollTarget = (editor: Editor) => {\n\tTransforms.removeNodes(editor, { match: isScrollTargetElement })\n}\nconst wrapScrollTarget = (editor: Editor, identifier: string) => {\n\tif (isScrollTargetElementActive(editor)) {\n\t\tunwrapScrollTarget(editor)\n\t}\n\n\tconst selection = editor.selection\n\tconst isCollapsed = selection ? SlateRange.isCollapsed(selection!) : false\n\tconst ScrollTarget: ScrollTargetElement = {\n\t\ttype: scrollTargetElementType,\n\t\tidentifier,\n\t\tchildren: [{ text: '' }],\n\t}\n\n\tif (!isCollapsed) {\n\t\tTransforms.collapse(editor, { edge: 'start' })\n\t}\n\tTransforms.insertNodes(editor, ScrollTarget)\n}\n"],"names":["SlateElement","SlateRange"],"mappings":";AAGO,MAAM,0BAA0B;AAQ1B,MAAA,wBAAwB,CAAC,YACrCA,QAAa,UAAU,OAAO,KAAK,QAAQ,SAAS;AAExC,MAAA,8BAA8B,CAAC,WAAmB;AACxD,QAAA,CAAC,IAAI,IAAI,OAAO,MAAM,QAAQ,EAAE,OAAO,sBAAA,CAAuB;AACpE,SAAO,CAAC,CAAC;AACV;AAEO,MAAM,4BAA4B,CAAC,EAAE,cAA0G;AAAA,EACrJ,MAAM;AAAA,EACN;AAAA,EACA,UAAU,CAAC,EAAE,aAAa,4BAA4B,MAAM;AAAA,EAC5D,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,eAAe,CAAC,EAAE,QAAQ,eAAe;AACpC,QAAA,4BAA4B,MAAM,GAAG;AACxC,yBAAmB,MAAM;AAAA,IAAA,OACnB;AACN,UAAI,aACH,UAAU,cACV,OAAO,wBAAwB;AAEhC,UAAI,CAAC,YAAY;AAChB;AAAA,MACD;AACA,uBAAiB,QAAQ,UAAU;AAAA,IACpC;AAAA,EACD;AACD;AACA,MAAM,qBAAqB,CAAC,WAAmB;AAC9C,aAAW,YAAY,QAAQ,EAAE,OAAO,sBAAuB,CAAA;AAChE;AACA,MAAM,mBAAmB,CAAC,QAAgB,eAAuB;AAC5D,MAAA,4BAA4B,MAAM,GAAG;AACxC,uBAAmB,MAAM;AAAA,EAC1B;AAEA,QAAM,YAAY,OAAO;AACzB,QAAM,cAAc,YAAYC,MAAW,YAAY,SAAU,IAAI;AACrE,QAAM,eAAoC;AAAA,IACzC,MAAM;AAAA,IACN;AAAA,IACA,UAAU,CAAC,EAAE,MAAM,IAAI;AAAA,EAAA;AAGxB,MAAI,CAAC,aAAa;AACjB,eAAW,SAAS,QAAQ,EAAE,MAAM,QAAS,CAAA;AAAA,EAC9C;AACW,aAAA,YAAY,QAAQ,YAAY;AAC5C;"}
1
+ {"version":3,"file":"ScrollTargetElement.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/scrollTargets/ScrollTargetElement.ts"],"sourcesContent":["import { Editor as SlateEditor, Editor, Element as SlateElement, Node as SlateNode, Range as SlateRange, Transforms } from 'slate'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const scrollTargetElementType = 'scrollTarget' as const\n\nexport interface ScrollTargetElement extends SlateElement {\n\ttype: typeof scrollTargetElementType\n\tidentifier: string\n\tchildren: SlateEditor['children']\n}\n\nexport const isScrollTargetElement = (element: SlateNode): element is ScrollTargetElement =>\n\tSlateElement.isElement(element) && element.type === scrollTargetElementType\n\nexport const isScrollTargetElementActive = (editor: Editor) => {\n\tconst [link] = Editor.nodes(editor, { match: isScrollTargetElement })\n\treturn !!link\n}\n\nexport const scrollTargetElementPlugin = ({ render }: { render: ElementRenderer<ScrollTargetElement> }): EditorElementPlugin<ScrollTargetElement> => ({\n\ttype: scrollTargetElementType,\n\trender,\n\tisActive: ({ editor }) => isScrollTargetElementActive(editor),\n\tisInline: true,\n\tisVoid: true,\n\ttoggleElement: ({ editor, suchThat }) => {\n\t\tif (isScrollTargetElementActive(editor)) {\n\t\t\tunwrapScrollTarget(editor)\n\t\t} else {\n\t\t\tlet identifier =\n\t\t\t\tsuchThat?.identifier ??\n\t\t\t\tprompt('Insert the identifier:')\n\n\t\t\tif (!identifier) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\twrapScrollTarget(editor, identifier)\n\t\t}\n\t},\n})\nconst unwrapScrollTarget = (editor: Editor) => {\n\tTransforms.removeNodes(editor, { match: isScrollTargetElement })\n}\nconst wrapScrollTarget = (editor: Editor, identifier: string) => {\n\tif (isScrollTargetElementActive(editor)) {\n\t\tunwrapScrollTarget(editor)\n\t}\n\n\tconst selection = editor.selection\n\tconst isCollapsed = selection ? SlateRange.isCollapsed(selection!) : false\n\tconst ScrollTarget: ScrollTargetElement = {\n\t\ttype: scrollTargetElementType,\n\t\tidentifier,\n\t\tchildren: [{ text: '' }],\n\t}\n\n\tif (!isCollapsed) {\n\t\tTransforms.collapse(editor, { edge: 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":3,"file":"withScrollTargets.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/scrollTargets/withScrollTargets.ts"],"sourcesContent":["import { Editor } from 'slate'\nimport { ScrollTargetElement, scrollTargetElementPlugin } from './ScrollTargetElement'\nimport { ElementRenderer } from '../../../types'\n\nexport const withScrollTargets = ({ render }: { render: ElementRenderer<ScrollTargetElement> }) => <E extends Editor>(editor: E): E => {\n\teditor.registerElement(scrollTargetElementPlugin({ render }))\n\treturn editor\n}\n"],"names":["scrollTargetElementPlugin"],"mappings":";;;AAIO,MAAM,oBAAoB,CAAC,EAAE,OAAO,MAAwD,CAAmB,WAAiB;AACtI,SAAO,gBAAgBA,oBAAAA,0BAA0B,EAAE,OAAA,CAAQ,CAAC;AACrD,SAAA;AACR;;"}
1
+ {"version":3,"file":"withScrollTargets.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/scrollTargets/withScrollTargets.ts"],"sourcesContent":["import { Editor } from 'slate'\nimport { ScrollTargetElement, scrollTargetElementPlugin } from './ScrollTargetElement'\nimport { ElementRenderer } from '../../../types'\n\nexport const withScrollTargets = ({ render }: { render: ElementRenderer<ScrollTargetElement> }) => <E extends Editor>(editor: E): E => {\n\teditor.registerElement(scrollTargetElementPlugin({ render }))\n\treturn editor\n}\n"],"names":["scrollTargetElementPlugin"],"mappings":";;;AAIO,MAAM,oBAAoB,CAAC,EAAE,OAAO,MAAwD,CAAmB,WAAiB;AACtI,SAAO,gBAAgBA,oBAAAA,0BAA0B,EAAE,OAAQ,CAAA,CAAC;AACrD,SAAA;AACR;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"withScrollTargets.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/scrollTargets/withScrollTargets.ts"],"sourcesContent":["import { Editor } from 'slate'\nimport { ScrollTargetElement, scrollTargetElementPlugin } from './ScrollTargetElement'\nimport { ElementRenderer } from '../../../types'\n\nexport const withScrollTargets = ({ render }: { render: ElementRenderer<ScrollTargetElement> }) => <E extends Editor>(editor: E): E => {\n\teditor.registerElement(scrollTargetElementPlugin({ render }))\n\treturn editor\n}\n"],"names":[],"mappings":";AAIO,MAAM,oBAAoB,CAAC,EAAE,OAAO,MAAwD,CAAmB,WAAiB;AACtI,SAAO,gBAAgB,0BAA0B,EAAE,OAAA,CAAQ,CAAC;AACrD,SAAA;AACR;"}
1
+ {"version":3,"file":"withScrollTargets.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/scrollTargets/withScrollTargets.ts"],"sourcesContent":["import { Editor } from 'slate'\nimport { ScrollTargetElement, scrollTargetElementPlugin } from './ScrollTargetElement'\nimport { ElementRenderer } from '../../../types'\n\nexport const withScrollTargets = ({ render }: { render: ElementRenderer<ScrollTargetElement> }) => <E extends Editor>(editor: E): E => {\n\teditor.registerElement(scrollTargetElementPlugin({ render }))\n\treturn editor\n}\n"],"names":[],"mappings":";AAIO,MAAM,oBAAoB,CAAC,EAAE,OAAO,MAAwD,CAAmB,WAAiB;AACtI,SAAO,gBAAgB,0BAA0B,EAAE,OAAQ,CAAA,CAAC;AACrD,SAAA;AACR;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TableCellElement.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableCellElement.ts"],"sourcesContent":["import { Editor as SlateEditor, Element, Element as SlateElement, Node, Transforms } from 'slate'\nimport { ContemberEditor } from '../../../editor'\nimport { tableRowElementType } from './TableRowElement'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const tableCellElementType = 'tableCell' as const\n\nexport interface TableCellElement extends SlateElement {\n\ttype: typeof tableCellElementType\n\tchildren: SlateEditor['children']\n\theaderScope?: 'row'\n\tjustify?: 'start' | 'center' | 'end'\n}\n\nexport const isTableCellElement = (element: Node): element is TableCellElement => Element.isElement(element) && element.type === tableCellElementType\n\nexport const createEmptyTableCellElement = () => ({\n\ttype: tableCellElementType,\n\tchildren: [{ text: '' }],\n})\n\n\nexport const tableCellElementPlugin = ({ render }: {render: ElementRenderer<TableCellElement>}): EditorElementPlugin<TableCellElement> => ({\n\ttype: tableCellElementType,\n\trender,\n\tnormalizeNode: ({ element, editor, path, preventDefault }) => {\n\t\tif (element.children.length === 1) {\n\t\t\tconst onlyChild = element.children[0]\n\t\t\tif (SlateElement.isElement(onlyChild) && editor.isDefaultElement(onlyChild)) {\n\t\t\t\tTransforms.unwrapNodes(editor, {\n\t\t\t\t\tat: [...path, 0],\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\tif (!ContemberEditor.hasParentOfType(editor, [element, path], tableRowElementType)) {\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: true,\n})\n"],"names":["Element","SlateElement","Transforms","ContemberEditor","tableRowElementType"],"mappings":";;;;;AAKO,MAAM,uBAAuB;AASvB,MAAA,qBAAqB,CAAC,YAA+CA,cAAQ,UAAU,OAAO,KAAK,QAAQ,SAAS;AAE1H,MAAM,8BAA8B,OAAO;AAAA,EACjD,MAAM;AAAA,EACN,UAAU,CAAC,EAAE,MAAM,IAAI;AACxB;AAGO,MAAM,yBAAyB,CAAC,EAAE,cAAkG;AAAA,EAC1I,MAAM;AAAA,EACN;AAAA,EACA,eAAe,CAAC,EAAE,SAAS,QAAQ,MAAM,qBAAqB;AACzD,QAAA,QAAQ,SAAS,WAAW,GAAG;AAC5B,YAAA,YAAY,QAAQ,SAAS,CAAC;AACpC,UAAIC,MAAAA,QAAa,UAAU,SAAS,KAAK,OAAO,iBAAiB,SAAS,GAAG;AAC5EC,cAAA,WAAW,YAAY,QAAQ;AAAA,UAC9B,IAAI,CAAC,GAAG,MAAM,CAAC;AAAA,QAAA,CACf;AAAA,MACF;AAAA,IACD;AACI,QAAA,CAACC,MAAAA,gBAAgB,gBAAgB,QAAQ,CAAC,SAAS,IAAI,GAAGC,gBAAAA,mBAAmB,GAAG;AACnFF,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":"TableCellElement.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableCellElement.ts"],"sourcesContent":["import { Editor as SlateEditor, Element, Element as SlateElement, Node, Transforms } from 'slate'\nimport { ContemberEditor } from '../../../editor'\nimport { tableRowElementType } from './TableRowElement'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const tableCellElementType = 'tableCell' as const\n\nexport interface TableCellElement extends SlateElement {\n\ttype: typeof tableCellElementType\n\tchildren: SlateEditor['children']\n\theaderScope?: 'row'\n\tjustify?: 'start' | 'center' | 'end'\n}\n\nexport const isTableCellElement = (element: Node): element is TableCellElement => Element.isElement(element) && element.type === tableCellElementType\n\nexport const createEmptyTableCellElement = () => ({\n\ttype: tableCellElementType,\n\tchildren: [{ text: '' }],\n})\n\n\nexport const tableCellElementPlugin = ({ render }: {render: ElementRenderer<TableCellElement>}): EditorElementPlugin<TableCellElement> => ({\n\ttype: tableCellElementType,\n\trender,\n\tnormalizeNode: ({ element, editor, path, preventDefault }) => {\n\t\tif (element.children.length === 1) {\n\t\t\tconst onlyChild = element.children[0]\n\t\t\tif (SlateElement.isElement(onlyChild) && editor.isDefaultElement(onlyChild)) {\n\t\t\t\tTransforms.unwrapNodes(editor, {\n\t\t\t\t\tat: [...path, 0],\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\tif (!ContemberEditor.hasParentOfType(editor, [element, path], tableRowElementType)) {\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: true,\n})\n"],"names":["Element","SlateElement","Transforms","ContemberEditor","tableRowElementType"],"mappings":";;;;;AAKO,MAAM,uBAAuB;AASvB,MAAA,qBAAqB,CAAC,YAA+CA,MAAA,QAAQ,UAAU,OAAO,KAAK,QAAQ,SAAS;AAE1H,MAAM,8BAA8B,OAAO;AAAA,EACjD,MAAM;AAAA,EACN,UAAU,CAAC,EAAE,MAAM,GAAI,CAAA;AACxB;AAGO,MAAM,yBAAyB,CAAC,EAAE,cAAkG;AAAA,EAC1I,MAAM;AAAA,EACN;AAAA,EACA,eAAe,CAAC,EAAE,SAAS,QAAQ,MAAM,qBAAqB;AACzD,QAAA,QAAQ,SAAS,WAAW,GAAG;AAC5B,YAAA,YAAY,QAAQ,SAAS,CAAC;AACpC,UAAIC,MAAAA,QAAa,UAAU,SAAS,KAAK,OAAO,iBAAiB,SAAS,GAAG;AAC5EC,cAAA,WAAW,YAAY,QAAQ;AAAA,UAC9B,IAAI,CAAC,GAAG,MAAM,CAAC;AAAA,QAAA,CACf;AAAA,MAAA;AAAA,IACF;AAEG,QAAA,CAACC,MAAAA,gBAAgB,gBAAgB,QAAQ,CAAC,SAAS,IAAI,GAAGC,gBAAAA,mBAAmB,GAAG;AACnFF,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":"TableCellElement.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableCellElement.ts"],"sourcesContent":["import { Editor as SlateEditor, Element, Element as SlateElement, Node, Transforms } from 'slate'\nimport { ContemberEditor } from '../../../editor'\nimport { tableRowElementType } from './TableRowElement'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const tableCellElementType = 'tableCell' as const\n\nexport interface TableCellElement extends SlateElement {\n\ttype: typeof tableCellElementType\n\tchildren: SlateEditor['children']\n\theaderScope?: 'row'\n\tjustify?: 'start' | 'center' | 'end'\n}\n\nexport const isTableCellElement = (element: Node): element is TableCellElement => Element.isElement(element) && element.type === tableCellElementType\n\nexport const createEmptyTableCellElement = () => ({\n\ttype: tableCellElementType,\n\tchildren: [{ text: '' }],\n})\n\n\nexport const tableCellElementPlugin = ({ render }: {render: ElementRenderer<TableCellElement>}): EditorElementPlugin<TableCellElement> => ({\n\ttype: tableCellElementType,\n\trender,\n\tnormalizeNode: ({ element, editor, path, preventDefault }) => {\n\t\tif (element.children.length === 1) {\n\t\t\tconst onlyChild = element.children[0]\n\t\t\tif (SlateElement.isElement(onlyChild) && editor.isDefaultElement(onlyChild)) {\n\t\t\t\tTransforms.unwrapNodes(editor, {\n\t\t\t\t\tat: [...path, 0],\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\tif (!ContemberEditor.hasParentOfType(editor, [element, path], tableRowElementType)) {\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: true,\n})\n"],"names":["SlateElement"],"mappings":";;;AAKO,MAAM,uBAAuB;AASvB,MAAA,qBAAqB,CAAC,YAA+C,QAAQ,UAAU,OAAO,KAAK,QAAQ,SAAS;AAE1H,MAAM,8BAA8B,OAAO;AAAA,EACjD,MAAM;AAAA,EACN,UAAU,CAAC,EAAE,MAAM,IAAI;AACxB;AAGO,MAAM,yBAAyB,CAAC,EAAE,cAAkG;AAAA,EAC1I,MAAM;AAAA,EACN;AAAA,EACA,eAAe,CAAC,EAAE,SAAS,QAAQ,MAAM,qBAAqB;AACzD,QAAA,QAAQ,SAAS,WAAW,GAAG;AAC5B,YAAA,YAAY,QAAQ,SAAS,CAAC;AACpC,UAAIA,QAAa,UAAU,SAAS,KAAK,OAAO,iBAAiB,SAAS,GAAG;AAC5E,mBAAW,YAAY,QAAQ;AAAA,UAC9B,IAAI,CAAC,GAAG,MAAM,CAAC;AAAA,QAAA,CACf;AAAA,MACF;AAAA,IACD;AACI,QAAA,CAAC,gBAAgB,gBAAgB,QAAQ,CAAC,SAAS,IAAI,GAAG,mBAAmB,GAAG;AACnF,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":"TableCellElement.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableCellElement.ts"],"sourcesContent":["import { Editor as SlateEditor, Element, Element as SlateElement, Node, Transforms } from 'slate'\nimport { ContemberEditor } from '../../../editor'\nimport { tableRowElementType } from './TableRowElement'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const tableCellElementType = 'tableCell' as const\n\nexport interface TableCellElement extends SlateElement {\n\ttype: typeof tableCellElementType\n\tchildren: SlateEditor['children']\n\theaderScope?: 'row'\n\tjustify?: 'start' | 'center' | 'end'\n}\n\nexport const isTableCellElement = (element: Node): element is TableCellElement => Element.isElement(element) && element.type === tableCellElementType\n\nexport const createEmptyTableCellElement = () => ({\n\ttype: tableCellElementType,\n\tchildren: [{ text: '' }],\n})\n\n\nexport const tableCellElementPlugin = ({ render }: {render: ElementRenderer<TableCellElement>}): EditorElementPlugin<TableCellElement> => ({\n\ttype: tableCellElementType,\n\trender,\n\tnormalizeNode: ({ element, editor, path, preventDefault }) => {\n\t\tif (element.children.length === 1) {\n\t\t\tconst onlyChild = element.children[0]\n\t\t\tif (SlateElement.isElement(onlyChild) && editor.isDefaultElement(onlyChild)) {\n\t\t\t\tTransforms.unwrapNodes(editor, {\n\t\t\t\t\tat: [...path, 0],\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\tif (!ContemberEditor.hasParentOfType(editor, [element, path], tableRowElementType)) {\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: true,\n})\n"],"names":["SlateElement"],"mappings":";;;AAKO,MAAM,uBAAuB;AASvB,MAAA,qBAAqB,CAAC,YAA+C,QAAQ,UAAU,OAAO,KAAK,QAAQ,SAAS;AAE1H,MAAM,8BAA8B,OAAO;AAAA,EACjD,MAAM;AAAA,EACN,UAAU,CAAC,EAAE,MAAM,GAAI,CAAA;AACxB;AAGO,MAAM,yBAAyB,CAAC,EAAE,cAAkG;AAAA,EAC1I,MAAM;AAAA,EACN;AAAA,EACA,eAAe,CAAC,EAAE,SAAS,QAAQ,MAAM,qBAAqB;AACzD,QAAA,QAAQ,SAAS,WAAW,GAAG;AAC5B,YAAA,YAAY,QAAQ,SAAS,CAAC;AACpC,UAAIA,QAAa,UAAU,SAAS,KAAK,OAAO,iBAAiB,SAAS,GAAG;AAC5E,mBAAW,YAAY,QAAQ;AAAA,UAC9B,IAAI,CAAC,GAAG,MAAM,CAAC;AAAA,QAAA,CACf;AAAA,MAAA;AAAA,IACF;AAEG,QAAA,CAAC,gBAAgB,gBAAgB,QAAQ,CAAC,SAAS,IAAI,GAAG,mBAAmB,GAAG;AACnF,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":"TableElement.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableElement.ts"],"sourcesContent":["import { Editor as SlateEditor, Editor, Element as SlateElement, Element, Node as SlateNode, Node, NodeEntry, Path as SlatePath, Range as SlateRange, Transforms } from 'slate'\nimport { createEmptyTableRowElement, isTableRowElement, TableRowElement, tableRowElementType } from './TableRowElement'\nimport { ContemberEditor } from '../../../editor'\nimport { gaugeTableColumnCount } from './gaugeTableColumnCount'\nimport { createEmptyTableCellElement } from './TableCellElement'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const tableElementType = 'table' as const\n\nexport interface TableElement extends SlateElement {\n\ttype: typeof tableElementType\n\tchildren: SlateEditor['children']\n}\n\nexport const isTableElement = (element: Node): element is TableElement => Element.isElement(element) && element.type === tableElementType\n\nexport const createEmptyTableElement = (rowCount = 3, columnCount = 2) => ({\n\ttype: tableElementType,\n\tchildren: Array.from({ length: rowCount }, () => createEmptyTableRowElement(columnCount)),\n})\n\nexport const getTableElementRowCount = (element: TableElement): number => {\n\treturn element.children.length\n}\n\nexport const getTableElementColumnCount = (element: TableElement): number => {\n\tconst firstRow = element.children[0] as TableRowElement | undefined\n\treturn firstRow?.children.length ?? 0\n}\n\nexport const tableElementPlugin = ({ render }: {render: ElementRenderer<TableElement>}): EditorElementPlugin<TableElement> => ({\n\ttype: tableElementType,\n\trender,\n\tnormalizeNode: ({ editor, element, path, preventDefault }) => {\n\t\tif (element.children.length === 0) {\n\t\t\tTransforms.removeNodes(editor, { at: path })\n\t\t\treturn preventDefault()\n\t\t}\n\n\t\tlet didTransform = false\n\t\tfor (const [child, childPath] of SlateNode.children(editor, path)) {\n\t\t\tif (SlateElement.isElement(child)) {\n\t\t\t\tif (!isTableRowElement(child)) {\n\t\t\t\t\tContemberEditor.ejectElement(editor, childPath)\n\t\t\t\t\tTransforms.setNodes(editor, { type: tableRowElementType }, { at: childPath })\n\t\t\t\t\tdidTransform = true\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 (didTransform) {\n\t\t\treturn preventDefault()\n\t\t}\n\t\tconst columnCount = gaugeTableColumnCount(element)\n\t\tfor (const [row, childPath] of SlateNode.children(editor, path) as Iterable<NodeEntry<TableRowElement>>) {\n\t\t\tconst currentColumnCount = row.children.length\n\t\t\tif (currentColumnCount === columnCount) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// For the first row, we prepend or insert at the start which in most cases will likely preserve the\n\t\t\t// already existing cells' positions.\n\t\t\tif (currentColumnCount > columnCount) {\n\t\t\t\tconst shouldBiasTowardsStart = childPath[childPath.length - 1] === 0\n\t\t\t\tfor (let i = columnCount; i < currentColumnCount; i++) {\n\t\t\t\t\tTransforms.removeNodes(editor, { at: [...childPath, shouldBiasTowardsStart ? 0 : i] })\n\t\t\t\t}\n\t\t\t} else if (currentColumnCount < columnCount) {\n\t\t\t\tconst shouldBiasTowardsStart = childPath[childPath.length - 1] === 0\n\t\t\t\tfor (let i = currentColumnCount; i < columnCount; i++) {\n\t\t\t\t\tTransforms.insertNodes(editor, createEmptyTableCellElement(), {\n\t\t\t\t\t\tat: [...childPath, shouldBiasTowardsStart ? 0 : i],\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\tcanContainAnyBlocks: false,\n\ttoggleElement: ({ editor }) => {\n\t\tconst closestTableEntry = Editor.above(editor, {\n\t\t\tmode: 'lowest',\n\t\t\tmatch: matchedNode => SlateElement.isElement(matchedNode) && isTableElement(matchedNode),\n\t\t})\n\t\tif (closestTableEntry) {\n\t\t\treturn\n\t\t}\n\t\tconst { selection } = editor\n\t\tif (!selection || SlateRange.isExpanded(selection)) {\n\t\t\treturn\n\t\t}\n\n\t\tconst closestDefaultEntry: NodeEntry | undefined = Editor.above(editor, {\n\t\t\tat: selection.focus,\n\t\t\tmode: 'lowest',\n\t\t\tmatch: matchedNode => SlateElement.isElement(matchedNode) && editor.isDefaultElement(matchedNode),\n\t\t})\n\t\tif (!closestDefaultEntry) {\n\t\t\treturn\n\t\t}\n\t\tconst [closestDefault, closestDefaultPath] = closestDefaultEntry\n\n\t\tif (closestDefaultPath.length !== 1) {\n\t\t\treturn // We only support tables at the very top level\n\t\t}\n\n\t\tEditor.withoutNormalizing(editor, () => {\n\t\t\tlet targetPath: SlatePath\n\t\t\tif (SlateNode.string(closestDefault) === '') {\n\t\t\t\tTransforms.removeNodes(editor, {\n\t\t\t\t\tat: closestDefaultPath,\n\t\t\t\t})\n\t\t\t\ttargetPath = closestDefaultPath\n\t\t\t} else {\n\t\t\t\ttargetPath = [closestDefaultPath[0] + 1]\n\t\t\t}\n\t\t\tconst table = createEmptyTableElement()\n\n\t\t\tTransforms.insertNodes(editor, table, {\n\t\t\t\tat: targetPath,\n\t\t\t})\n\t\t})\n\t},\n})\n"],"names":["Element","createEmptyTableRowElement","Transforms","SlateNode","SlateElement","isTableRowElement","ContemberEditor","tableRowElementType","gaugeTableColumnCount","createEmptyTableCellElement","Editor","SlateRange"],"mappings":";;;;;;;AAOO,MAAM,mBAAmB;AAOnB,MAAA,iBAAiB,CAAC,YAA2CA,cAAQ,UAAU,OAAO,KAAK,QA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,QAAQ,MAAM;AACnC,UAAA;AACJ,UAAIP,WAAU,OAAO,cAAc,MAAM,IAAI;AAC5CD,cAAA,WAAW,YAAY,QAAQ;AAAA,UAC9B,IAAI;AAAA,QAAA,CACJ;AACY,qBAAA;AAAA,MAAA,OACP;AACN,qBAAa,CAAC,mBAAmB,CAAC,IAAI,CAAC;AAAA,MACxC;AACA,YAAM,QAAQ;AAEHA,uBAAA,YAAY,QAAQ,OAAO;AAAA,QACrC,IAAI;AAAA,MAAA,CACJ;AAAA,IAAA,CACD;AAAA,EACF;AACD;;;;;;;"}
1
+ {"version":3,"file":"TableElement.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableElement.ts"],"sourcesContent":["import { Editor as SlateEditor, Editor, Element as SlateElement, Element, Node as SlateNode, Node, NodeEntry, Path as SlatePath, Range as SlateRange, Transforms } from 'slate'\nimport { createEmptyTableRowElement, isTableRowElement, TableRowElement, tableRowElementType } from './TableRowElement'\nimport { ContemberEditor } from '../../../editor'\nimport { gaugeTableColumnCount } from './gaugeTableColumnCount'\nimport { createEmptyTableCellElement } from './TableCellElement'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const tableElementType = 'table' as const\n\nexport interface TableElement extends SlateElement {\n\ttype: typeof tableElementType\n\tchildren: SlateEditor['children']\n}\n\nexport const isTableElement = (element: Node): element is TableElement => Element.isElement(element) && element.type === tableElementType\n\nexport const createEmptyTableElement = (rowCount = 3, columnCount = 2) => ({\n\ttype: tableElementType,\n\tchildren: Array.from({ length: rowCount }, () => createEmptyTableRowElement(columnCount)),\n})\n\nexport const getTableElementRowCount = (element: TableElement): number => {\n\treturn element.children.length\n}\n\nexport const getTableElementColumnCount = (element: TableElement): number => {\n\tconst firstRow = element.children[0] as TableRowElement | undefined\n\treturn firstRow?.children.length ?? 0\n}\n\nexport const tableElementPlugin = ({ render }: {render: ElementRenderer<TableElement>}): EditorElementPlugin<TableElement> => ({\n\ttype: tableElementType,\n\trender,\n\tnormalizeNode: ({ editor, element, path, preventDefault }) => {\n\t\tif (element.children.length === 0) {\n\t\t\tTransforms.removeNodes(editor, { at: path })\n\t\t\treturn preventDefault()\n\t\t}\n\n\t\tlet didTransform = false\n\t\tfor (const [child, childPath] of SlateNode.children(editor, path)) {\n\t\t\tif (SlateElement.isElement(child)) {\n\t\t\t\tif (!isTableRowElement(child)) {\n\t\t\t\t\tContemberEditor.ejectElement(editor, childPath)\n\t\t\t\t\tTransforms.setNodes(editor, { type: tableRowElementType }, { at: childPath })\n\t\t\t\t\tdidTransform = true\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 (didTransform) {\n\t\t\treturn preventDefault()\n\t\t}\n\t\tconst columnCount = gaugeTableColumnCount(element)\n\t\tfor (const [row, childPath] of SlateNode.children(editor, path) as Iterable<NodeEntry<TableRowElement>>) {\n\t\t\tconst currentColumnCount = row.children.length\n\t\t\tif (currentColumnCount === columnCount) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// For the first row, we prepend or insert at the start which in most cases will likely preserve the\n\t\t\t// already existing cells' positions.\n\t\t\tif (currentColumnCount > columnCount) {\n\t\t\t\tconst shouldBiasTowardsStart = childPath[childPath.length - 1] === 0\n\t\t\t\tfor (let i = columnCount; i < currentColumnCount; i++) {\n\t\t\t\t\tTransforms.removeNodes(editor, { at: [...childPath, shouldBiasTowardsStart ? 0 : i] })\n\t\t\t\t}\n\t\t\t} else if (currentColumnCount < columnCount) {\n\t\t\t\tconst shouldBiasTowardsStart = childPath[childPath.length - 1] === 0\n\t\t\t\tfor (let i = currentColumnCount; i < columnCount; i++) {\n\t\t\t\t\tTransforms.insertNodes(editor, createEmptyTableCellElement(), {\n\t\t\t\t\t\tat: [...childPath, shouldBiasTowardsStart ? 0 : i],\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\tcanContainAnyBlocks: false,\n\ttoggleElement: ({ editor }) => {\n\t\tconst closestTableEntry = Editor.above(editor, {\n\t\t\tmode: 'lowest',\n\t\t\tmatch: matchedNode => SlateElement.isElement(matchedNode) && isTableElement(matchedNode),\n\t\t})\n\t\tif (closestTableEntry) {\n\t\t\treturn\n\t\t}\n\t\tconst { selection } = editor\n\t\tif (!selection || SlateRange.isExpanded(selection)) {\n\t\t\treturn\n\t\t}\n\n\t\tconst closestDefaultEntry: NodeEntry | undefined = Editor.above(editor, {\n\t\t\tat: selection.focus,\n\t\t\tmode: 'lowest',\n\t\t\tmatch: matchedNode => SlateElement.isElement(matchedNode) && editor.isDefaultElement(matchedNode),\n\t\t})\n\t\tif (!closestDefaultEntry) {\n\t\t\treturn\n\t\t}\n\t\tconst [closestDefault, closestDefaultPath] = closestDefaultEntry\n\n\t\tif (closestDefaultPath.length !== 1) {\n\t\t\treturn // We only support tables at the very top level\n\t\t}\n\n\t\tEditor.withoutNormalizing(editor, () => {\n\t\t\tlet targetPath: SlatePath\n\t\t\tif (SlateNode.string(closestDefault) === '') {\n\t\t\t\tTransforms.removeNodes(editor, {\n\t\t\t\t\tat: closestDefaultPath,\n\t\t\t\t})\n\t\t\t\ttargetPath = closestDefaultPath\n\t\t\t} else {\n\t\t\t\ttargetPath = [closestDefaultPath[0] + 1]\n\t\t\t}\n\t\t\tconst table = createEmptyTableElement()\n\n\t\t\tTransforms.insertNodes(editor, table, {\n\t\t\t\tat: targetPath,\n\t\t\t})\n\t\t})\n\t},\n})\n"],"names":["Element","createEmptyTableRowElement","Transforms","SlateNode","SlateElement","isTableRowElement","ContemberEditor","tableRowElementType","gaugeTableColumnCount","createEmptyTableCellElement","Editor","SlateRange"],"mappings":";;;;;;;AAOO,MAAM,mBAAmB;AAOnB,MAAA,iBAAiB,CAAC,YAA2CA,MAAA,QAAQ,UAAU,OAAO,KAAK,QAAQ,SAAS;AAElH,MAAM,0BAA0B,CAAC,WAAW,GAAG,cAAc,OAAO;AAAA,EAC1E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cAAA,WAAW,YAAY,QAAQ;AAAA,UAC9B,IAAI;AAAA,QAAA,CACJ;AACY,qBAAA;AAAA,MAAA,OACP;AACN,qBAAa,CAAC,mBAAmB,CAAC,IAAI,CAAC;AAAA,MAAA;AAExC,YAAM,QAAQ,wBAAwB;AAE3BA,uBAAA,YAAY,QAAQ,OAAO;AAAA,QACrC,IAAI;AAAA,MAAA,CACJ;AAAA,IAAA,CACD;AAAA,EAAA;AAEH;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TableElement.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableElement.ts"],"sourcesContent":["import { Editor as SlateEditor, Editor, Element as SlateElement, Element, Node as SlateNode, Node, NodeEntry, Path as SlatePath, Range as SlateRange, Transforms } from 'slate'\nimport { createEmptyTableRowElement, isTableRowElement, TableRowElement, tableRowElementType } from './TableRowElement'\nimport { ContemberEditor } from '../../../editor'\nimport { gaugeTableColumnCount } from './gaugeTableColumnCount'\nimport { createEmptyTableCellElement } from './TableCellElement'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const tableElementType = 'table' as const\n\nexport interface TableElement extends SlateElement {\n\ttype: typeof tableElementType\n\tchildren: SlateEditor['children']\n}\n\nexport const isTableElement = (element: Node): element is TableElement => Element.isElement(element) && element.type === tableElementType\n\nexport const createEmptyTableElement = (rowCount = 3, columnCount = 2) => ({\n\ttype: tableElementType,\n\tchildren: Array.from({ length: rowCount }, () => createEmptyTableRowElement(columnCount)),\n})\n\nexport const getTableElementRowCount = (element: TableElement): number => {\n\treturn element.children.length\n}\n\nexport const getTableElementColumnCount = (element: TableElement): number => {\n\tconst firstRow = element.children[0] as TableRowElement | undefined\n\treturn firstRow?.children.length ?? 0\n}\n\nexport const tableElementPlugin = ({ render }: {render: ElementRenderer<TableElement>}): EditorElementPlugin<TableElement> => ({\n\ttype: tableElementType,\n\trender,\n\tnormalizeNode: ({ editor, element, path, preventDefault }) => {\n\t\tif (element.children.length === 0) {\n\t\t\tTransforms.removeNodes(editor, { at: path })\n\t\t\treturn preventDefault()\n\t\t}\n\n\t\tlet didTransform = false\n\t\tfor (const [child, childPath] of SlateNode.children(editor, path)) {\n\t\t\tif (SlateElement.isElement(child)) {\n\t\t\t\tif (!isTableRowElement(child)) {\n\t\t\t\t\tContemberEditor.ejectElement(editor, childPath)\n\t\t\t\t\tTransforms.setNodes(editor, { type: tableRowElementType }, { at: childPath })\n\t\t\t\t\tdidTransform = true\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 (didTransform) {\n\t\t\treturn preventDefault()\n\t\t}\n\t\tconst columnCount = gaugeTableColumnCount(element)\n\t\tfor (const [row, childPath] of SlateNode.children(editor, path) as Iterable<NodeEntry<TableRowElement>>) {\n\t\t\tconst currentColumnCount = row.children.length\n\t\t\tif (currentColumnCount === columnCount) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// For the first row, we prepend or insert at the start which in most cases will likely preserve the\n\t\t\t// already existing cells' positions.\n\t\t\tif (currentColumnCount > columnCount) {\n\t\t\t\tconst shouldBiasTowardsStart = childPath[childPath.length - 1] === 0\n\t\t\t\tfor (let i = columnCount; i < currentColumnCount; i++) {\n\t\t\t\t\tTransforms.removeNodes(editor, { at: [...childPath, shouldBiasTowardsStart ? 0 : i] })\n\t\t\t\t}\n\t\t\t} else if (currentColumnCount < columnCount) {\n\t\t\t\tconst shouldBiasTowardsStart = childPath[childPath.length - 1] === 0\n\t\t\t\tfor (let i = currentColumnCount; i < columnCount; i++) {\n\t\t\t\t\tTransforms.insertNodes(editor, createEmptyTableCellElement(), {\n\t\t\t\t\t\tat: [...childPath, shouldBiasTowardsStart ? 0 : i],\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\tcanContainAnyBlocks: false,\n\ttoggleElement: ({ editor }) => {\n\t\tconst closestTableEntry = Editor.above(editor, {\n\t\t\tmode: 'lowest',\n\t\t\tmatch: matchedNode => SlateElement.isElement(matchedNode) && isTableElement(matchedNode),\n\t\t})\n\t\tif (closestTableEntry) {\n\t\t\treturn\n\t\t}\n\t\tconst { selection } = editor\n\t\tif (!selection || SlateRange.isExpanded(selection)) {\n\t\t\treturn\n\t\t}\n\n\t\tconst closestDefaultEntry: NodeEntry | undefined = Editor.above(editor, {\n\t\t\tat: selection.focus,\n\t\t\tmode: 'lowest',\n\t\t\tmatch: matchedNode => SlateElement.isElement(matchedNode) && editor.isDefaultElement(matchedNode),\n\t\t})\n\t\tif (!closestDefaultEntry) {\n\t\t\treturn\n\t\t}\n\t\tconst [closestDefault, closestDefaultPath] = closestDefaultEntry\n\n\t\tif (closestDefaultPath.length !== 1) {\n\t\t\treturn // We only support tables at the very top level\n\t\t}\n\n\t\tEditor.withoutNormalizing(editor, () => {\n\t\t\tlet targetPath: SlatePath\n\t\t\tif (SlateNode.string(closestDefault) === '') {\n\t\t\t\tTransforms.removeNodes(editor, {\n\t\t\t\t\tat: closestDefaultPath,\n\t\t\t\t})\n\t\t\t\ttargetPath = closestDefaultPath\n\t\t\t} else {\n\t\t\t\ttargetPath = [closestDefaultPath[0] + 1]\n\t\t\t}\n\t\t\tconst table = createEmptyTableElement()\n\n\t\t\tTransforms.insertNodes(editor, table, {\n\t\t\t\tat: targetPath,\n\t\t\t})\n\t\t})\n\t},\n})\n"],"names":["SlateNode","SlateElement","SlateRange"],"mappings":";;;;;AAOO,MAAM,mBAAmB;AAOnB,MAAA,iBAAiB,CAAC,YAA2C,QAAQ,UAAU,OAAO,KAAK,QAAQ,SAAS;AAElH,MAAM,0BAA0B,CAAC,WAAW,GAAG,cAAc,OAAO;AAAA,EAC1E,MAAM;AAAA,EACN,UAAU,MAAM,KAAK,EAAE,QAAQ,YAAY,MAAM,2BAA2B,WAAW,CAAC;AACzF;AAEa,MAAA,0BAA0B,CAAC,YAAkC;AACzE,SAAO,QAAQ,SAAS;AACz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AAA,EACF;AACD;"}
1
+ {"version":3,"file":"TableElement.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableElement.ts"],"sourcesContent":["import { Editor as SlateEditor, Editor, Element as SlateElement, Element, Node as SlateNode, Node, NodeEntry, Path as SlatePath, Range as SlateRange, Transforms } from 'slate'\nimport { createEmptyTableRowElement, isTableRowElement, TableRowElement, tableRowElementType } from './TableRowElement'\nimport { ContemberEditor } from '../../../editor'\nimport { gaugeTableColumnCount } from './gaugeTableColumnCount'\nimport { createEmptyTableCellElement } from './TableCellElement'\nimport { EditorElementPlugin, ElementRenderer } from '../../../types'\n\nexport const tableElementType = 'table' as const\n\nexport interface TableElement extends SlateElement {\n\ttype: typeof tableElementType\n\tchildren: SlateEditor['children']\n}\n\nexport const isTableElement = (element: Node): element is TableElement => Element.isElement(element) && element.type === tableElementType\n\nexport const createEmptyTableElement = (rowCount = 3, columnCount = 2) => ({\n\ttype: tableElementType,\n\tchildren: Array.from({ length: rowCount }, () => createEmptyTableRowElement(columnCount)),\n})\n\nexport const getTableElementRowCount = (element: TableElement): number => {\n\treturn element.children.length\n}\n\nexport const getTableElementColumnCount = (element: TableElement): number => {\n\tconst firstRow = element.children[0] as TableRowElement | undefined\n\treturn firstRow?.children.length ?? 0\n}\n\nexport const tableElementPlugin = ({ render }: {render: ElementRenderer<TableElement>}): EditorElementPlugin<TableElement> => ({\n\ttype: tableElementType,\n\trender,\n\tnormalizeNode: ({ editor, element, path, preventDefault }) => {\n\t\tif (element.children.length === 0) {\n\t\t\tTransforms.removeNodes(editor, { at: path })\n\t\t\treturn preventDefault()\n\t\t}\n\n\t\tlet didTransform = false\n\t\tfor (const [child, childPath] of SlateNode.children(editor, path)) {\n\t\t\tif (SlateElement.isElement(child)) {\n\t\t\t\tif (!isTableRowElement(child)) {\n\t\t\t\t\tContemberEditor.ejectElement(editor, childPath)\n\t\t\t\t\tTransforms.setNodes(editor, { type: tableRowElementType }, { at: childPath })\n\t\t\t\t\tdidTransform = true\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 (didTransform) {\n\t\t\treturn preventDefault()\n\t\t}\n\t\tconst columnCount = gaugeTableColumnCount(element)\n\t\tfor (const [row, childPath] of SlateNode.children(editor, path) as Iterable<NodeEntry<TableRowElement>>) {\n\t\t\tconst currentColumnCount = row.children.length\n\t\t\tif (currentColumnCount === columnCount) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// For the first row, we prepend or insert at the start which in most cases will likely preserve the\n\t\t\t// already existing cells' positions.\n\t\t\tif (currentColumnCount > columnCount) {\n\t\t\t\tconst shouldBiasTowardsStart = childPath[childPath.length - 1] === 0\n\t\t\t\tfor (let i = columnCount; i < currentColumnCount; i++) {\n\t\t\t\t\tTransforms.removeNodes(editor, { at: [...childPath, shouldBiasTowardsStart ? 0 : i] })\n\t\t\t\t}\n\t\t\t} else if (currentColumnCount < columnCount) {\n\t\t\t\tconst shouldBiasTowardsStart = childPath[childPath.length - 1] === 0\n\t\t\t\tfor (let i = currentColumnCount; i < columnCount; i++) {\n\t\t\t\t\tTransforms.insertNodes(editor, createEmptyTableCellElement(), {\n\t\t\t\t\t\tat: [...childPath, shouldBiasTowardsStart ? 0 : i],\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\tcanContainAnyBlocks: false,\n\ttoggleElement: ({ editor }) => {\n\t\tconst closestTableEntry = Editor.above(editor, {\n\t\t\tmode: 'lowest',\n\t\t\tmatch: matchedNode => SlateElement.isElement(matchedNode) && isTableElement(matchedNode),\n\t\t})\n\t\tif (closestTableEntry) {\n\t\t\treturn\n\t\t}\n\t\tconst { selection } = editor\n\t\tif (!selection || SlateRange.isExpanded(selection)) {\n\t\t\treturn\n\t\t}\n\n\t\tconst closestDefaultEntry: NodeEntry | undefined = Editor.above(editor, {\n\t\t\tat: selection.focus,\n\t\t\tmode: 'lowest',\n\t\t\tmatch: matchedNode => SlateElement.isElement(matchedNode) && editor.isDefaultElement(matchedNode),\n\t\t})\n\t\tif (!closestDefaultEntry) {\n\t\t\treturn\n\t\t}\n\t\tconst [closestDefault, closestDefaultPath] = closestDefaultEntry\n\n\t\tif (closestDefaultPath.length !== 1) {\n\t\t\treturn // We only support tables at the very top level\n\t\t}\n\n\t\tEditor.withoutNormalizing(editor, () => {\n\t\t\tlet targetPath: SlatePath\n\t\t\tif (SlateNode.string(closestDefault) === '') {\n\t\t\t\tTransforms.removeNodes(editor, {\n\t\t\t\t\tat: closestDefaultPath,\n\t\t\t\t})\n\t\t\t\ttargetPath = closestDefaultPath\n\t\t\t} else {\n\t\t\t\ttargetPath = [closestDefaultPath[0] + 1]\n\t\t\t}\n\t\t\tconst table = createEmptyTableElement()\n\n\t\t\tTransforms.insertNodes(editor, table, {\n\t\t\t\tat: targetPath,\n\t\t\t})\n\t\t})\n\t},\n})\n"],"names":["SlateNode","SlateElement","SlateRange"],"mappings":";;;;;AAOO,MAAM,mBAAmB;AAOnB,MAAA,iBAAiB,CAAC,YAA2C,QAAQ,UAAU,OAAO,KAAK,QAAQ,SAAS;AAElH,MAAM,0BAA0B,CAAC,WAAW,GAAG,cAAc,OAAO;AAAA,EAC1E,MAAM;AAAA,EACN,UAAU,MAAM,KAAK,EAAE,QAAQ,YAAY,MAAM,2BAA2B,WAAW,CAAC;AACzF;AAEa,MAAA,0BAA0B,CAAC,YAAkC;AACzE,SAAO,QAAQ,SAAS;AACzB;AAEa,MAAA,6BAA6B,CAAC,YAAkC;AACtE,QAAA,WAAW,QAAQ,SAAS,CAAC;AAC5B,SAAA,UAAU,SAAS,UAAU;AACrC;AAEO,MAAM,qBAAqB,CAAC,EAAE,cAA0F;AAAA,EAC9H,MAAM;AAAA,EACN;AAAA,EACA,eAAe,CAAC,EAAE,QAAQ,SAAS,MAAM,qBAAqB;AACzD,QAAA,QAAQ,SAAS,WAAW,GAAG;AAClC,iBAAW,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AE,aAAa;AACxB,UAAA,oBAAoB,OAAO,MAAM,QAAQ;AAAA,MAC9C,MAAM;AAAA,MACN,OAAO,CAAe,gBAAAC,QAAa,UAAU,WAAW,KAAK,eAAe,WAAW;AAAA,IAAA,CACvF;AACD,QAAI,mBAAmB;AACtB;AAAA,IAAA;AAEK,UAAA,EAAE,cAAc;AACtB,QAAI,CAAC,aAAaC,MAAW,WAAW,SAAS,GAAG;AACnD;AAAA,IAAA;AAGK,UAAA,sBAA6C,OAAO,MAAM,QAAQ;AAAA,MACvE,IAAI,UAAU;AAAA,MACd,MAAM;AAAA,MACN,OAAO,iBAAeD,QAAa,UAAU,WAAW,KAAK,OAAO,iBAAiB,WAAW;AAAA,IAAA,CAChG;AACD,QAAI,CAAC,qBAAqB;AACzB;AAAA,IAAA;AAEK,UAAA,CAAC,gBAAgB,kBAAkB,IAAI;AAEzC,QAAA,mBAAmB,WAAW,GAAG;AACpC;AAAA,IAAA;AAGM,WAAA,mBAAmB,QAAQ,MAAM;AACnC,UAAA;AACJ,UAAID,KAAU,OAAO,cAAc,MAAM,IAAI;AAC5C,mBAAW,YAAY,QAAQ;AAAA,UAC9B,IAAI;AAAA,QAAA,CACJ;AACY,qBAAA;AAAA,MAAA,OACP;AACN,qBAAa,CAAC,mBAAmB,CAAC,IAAI,CAAC;AAAA,MAAA;AAExC,YAAM,QAAQ,wBAAwB;AAE3B,iBAAA,YAAY,QAAQ,OAAO;AAAA,QACrC,IAAI;AAAA,MAAA,CACJ;AAAA,IAAA,CACD;AAAA,EAAA;AAEH;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TableElementSelection.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableElementSelection.ts"],"sourcesContent":["import { ReactEditor } from 'slate-react'\nimport { Editor, Path as SlatePath, Transforms } from 'slate'\nimport { TableCellElement } from './TableCellElement'\nimport { TableElement } from './TableElement'\n\nexport const selectTableCellContents = (editor: Editor, table: TableElement | SlatePath, rowIndex: number, columnIndex: number) => {\n\tif (!Array.isArray(table)) {\n\t\ttable = ReactEditor.findPath(editor, table)\n\t}\n\tTransforms.select(editor, {\n\t\tanchor: Editor.start(editor, [...table, rowIndex, columnIndex]),\n\t\tfocus: Editor.end(editor, [...table, rowIndex, columnIndex]),\n\t})\n}\n\nexport const getTableCellCoordinates = (editor: Editor, element: TableCellElement) => {\n\tconst cellPath = ReactEditor.findPath(editor, element)\n\treturn cellPath.slice(-2) as [number, number]\n}\n"],"names":["ReactEditor","Transforms","Editor"],"mappings":";;;;AAKO,MAAM,0BAA0B,CAAC,QAAgB,OAAiC,UAAkB,gBAAwB;AAClI,MAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AAClB,YAAAA,WAAAA,YAAY,SAAS,QAAQ,KAAK;AAAA,EAC3C;AACAC,QAAA,WAAW,OAAO,QAAQ;AAAA,IACzB,QAAQC,MAAAA,OAAO,MAAM,QAAQ,CAAC,GAAG,OAAO,UAAU,WAAW,CAAC;AAAA,IAC9D,OAAOA,MAAAA,OAAO,IAAI,QAAQ,CAAC,GAAG,OAAO,UAAU,WAAW,CAAC;AAAA,EAAA,CAC3D;AACF;AAEa,MAAA,0BAA0B,CAAC,QAAgB,YAA8B;AACrF,QAAM,WAAWF,WAAA,YAAY,SAAS,QAAQ,OAAO;AAC9C,SAAA,SAAS,MAAM,EAAE;AACzB;;;"}
1
+ {"version":3,"file":"TableElementSelection.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableElementSelection.ts"],"sourcesContent":["import { ReactEditor } from 'slate-react'\nimport { Editor, Path as SlatePath, Transforms } from 'slate'\nimport { TableCellElement } from './TableCellElement'\nimport { TableElement } from './TableElement'\n\nexport const selectTableCellContents = (editor: Editor, table: TableElement | SlatePath, rowIndex: number, columnIndex: number) => {\n\tif (!Array.isArray(table)) {\n\t\ttable = ReactEditor.findPath(editor, table)\n\t}\n\tTransforms.select(editor, {\n\t\tanchor: Editor.start(editor, [...table, rowIndex, columnIndex]),\n\t\tfocus: Editor.end(editor, [...table, rowIndex, columnIndex]),\n\t})\n}\n\nexport const getTableCellCoordinates = (editor: Editor, element: TableCellElement) => {\n\tconst cellPath = ReactEditor.findPath(editor, element)\n\treturn cellPath.slice(-2) as [number, number]\n}\n"],"names":["ReactEditor","Transforms","Editor"],"mappings":";;;;AAKO,MAAM,0BAA0B,CAAC,QAAgB,OAAiC,UAAkB,gBAAwB;AAClI,MAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AAClB,YAAAA,WAAA,YAAY,SAAS,QAAQ,KAAK;AAAA,EAAA;AAE3CC,QAAA,WAAW,OAAO,QAAQ;AAAA,IACzB,QAAQC,MAAAA,OAAO,MAAM,QAAQ,CAAC,GAAG,OAAO,UAAU,WAAW,CAAC;AAAA,IAC9D,OAAOA,aAAO,IAAI,QAAQ,CAAC,GAAG,OAAO,UAAU,WAAW,CAAC;AAAA,EAAA,CAC3D;AACF;AAEa,MAAA,0BAA0B,CAAC,QAAgB,YAA8B;AACrF,QAAM,WAAWF,WAAA,YAAY,SAAS,QAAQ,OAAO;AAC9C,SAAA,SAAS,MAAM,EAAE;AACzB;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TableElementSelection.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableElementSelection.ts"],"sourcesContent":["import { ReactEditor } from 'slate-react'\nimport { Editor, Path as SlatePath, Transforms } from 'slate'\nimport { TableCellElement } from './TableCellElement'\nimport { TableElement } from './TableElement'\n\nexport const selectTableCellContents = (editor: Editor, table: TableElement | SlatePath, rowIndex: number, columnIndex: number) => {\n\tif (!Array.isArray(table)) {\n\t\ttable = ReactEditor.findPath(editor, table)\n\t}\n\tTransforms.select(editor, {\n\t\tanchor: Editor.start(editor, [...table, rowIndex, columnIndex]),\n\t\tfocus: Editor.end(editor, [...table, rowIndex, columnIndex]),\n\t})\n}\n\nexport const getTableCellCoordinates = (editor: Editor, element: TableCellElement) => {\n\tconst cellPath = ReactEditor.findPath(editor, element)\n\treturn cellPath.slice(-2) as [number, number]\n}\n"],"names":[],"mappings":";;AAKO,MAAM,0BAA0B,CAAC,QAAgB,OAAiC,UAAkB,gBAAwB;AAClI,MAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AAClB,YAAA,YAAY,SAAS,QAAQ,KAAK;AAAA,EAC3C;AACA,aAAW,OAAO,QAAQ;AAAA,IACzB,QAAQ,OAAO,MAAM,QAAQ,CAAC,GAAG,OAAO,UAAU,WAAW,CAAC;AAAA,IAC9D,OAAO,OAAO,IAAI,QAAQ,CAAC,GAAG,OAAO,UAAU,WAAW,CAAC;AAAA,EAAA,CAC3D;AACF;AAEa,MAAA,0BAA0B,CAAC,QAAgB,YAA8B;AACrF,QAAM,WAAW,YAAY,SAAS,QAAQ,OAAO;AAC9C,SAAA,SAAS,MAAM,EAAE;AACzB;"}
1
+ {"version":3,"file":"TableElementSelection.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableElementSelection.ts"],"sourcesContent":["import { ReactEditor } from 'slate-react'\nimport { Editor, Path as SlatePath, Transforms } from 'slate'\nimport { TableCellElement } from './TableCellElement'\nimport { TableElement } from './TableElement'\n\nexport const selectTableCellContents = (editor: Editor, table: TableElement | SlatePath, rowIndex: number, columnIndex: number) => {\n\tif (!Array.isArray(table)) {\n\t\ttable = ReactEditor.findPath(editor, table)\n\t}\n\tTransforms.select(editor, {\n\t\tanchor: Editor.start(editor, [...table, rowIndex, columnIndex]),\n\t\tfocus: Editor.end(editor, [...table, rowIndex, columnIndex]),\n\t})\n}\n\nexport const getTableCellCoordinates = (editor: Editor, element: TableCellElement) => {\n\tconst cellPath = ReactEditor.findPath(editor, element)\n\treturn cellPath.slice(-2) as [number, number]\n}\n"],"names":[],"mappings":";;AAKO,MAAM,0BAA0B,CAAC,QAAgB,OAAiC,UAAkB,gBAAwB;AAClI,MAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AAClB,YAAA,YAAY,SAAS,QAAQ,KAAK;AAAA,EAAA;AAE3C,aAAW,OAAO,QAAQ;AAAA,IACzB,QAAQ,OAAO,MAAM,QAAQ,CAAC,GAAG,OAAO,UAAU,WAAW,CAAC;AAAA,IAC9D,OAAO,OAAO,IAAI,QAAQ,CAAC,GAAG,OAAO,UAAU,WAAW,CAAC;AAAA,EAAA,CAC3D;AACF;AAEa,MAAA,0BAA0B,CAAC,QAAgB,YAA8B;AACrF,QAAM,WAAW,YAAY,SAAS,QAAQ,OAAO;AAC9C,SAAA,SAAS,MAAM,EAAE;AACzB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TableHtmlDeserializer.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableHtmlDeserializer.ts"],"sourcesContent":["import { HtmlDeserializerPlugin } from '../../../types'\nimport { tableCellElementType } from './TableCellElement'\nimport { tableElementType } from './TableElement'\nimport { tableRowElementType } from './TableRowElement'\n\nexport const tableHTMLDeserializer: HtmlDeserializerPlugin = {\n\tprocessBlockPaste: ({ element, next, cumulativeTextAttrs }) => {\n\t\tif (element.tagName === 'TABLE') {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: tableElementType,\n\t\t\t\t\tchildren: next(element.childNodes, cumulativeTextAttrs),\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\n\t\tif (element.tagName === 'TR') {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: tableRowElementType,\n\t\t\t\t\tchildren: next(element.childNodes, cumulativeTextAttrs),\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\n\t\tif (element.tagName === 'TD' || element.tagName === 'TH') {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: tableCellElementType,\n\t\t\t\t\tchildren: next(element.childNodes, cumulativeTextAttrs),\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\n\t\treturn null\n\t},\n}\n"],"names":["tableElementType","tableRowElementType","tableCellElementType"],"mappings":";;;;;AAKO,MAAM,wBAAgD;AAAA,EAC5D,mBAAmB,CAAC,EAAE,SAAS,MAAM,0BAA0B;AAC1D,QAAA,QAAQ,YAAY,SAAS;AACzB,aAAA;AAAA,QACN;AAAA,UACC,MAAMA,aAAA;AAAA,UACN,UAAU,KAAK,QAAQ,YAAY,mBAAmB;AAAA,QACvD;AAAA,MAAA;AAAA,IAEF;AAEI,QAAA,QAAQ,YAAY,MAAM;AACtB,aAAA;AAAA,QACN;AAAA,UACC,MAAMC,gBAAA;AAAA,UACN,UAAU,KAAK,QAAQ,YAAY,mBAAmB;AAAA,QACvD;AAAA,MAAA;AAAA,IAEF;AAEA,QAAI,QAAQ,YAAY,QAAQ,QAAQ,YAAY,MAAM;AAClD,aAAA;AAAA,QACN;AAAA,UACC,MAAMC,iBAAA;AAAA,UACN,UAAU,KAAK,QAAQ,YAAY,mBAAmB;AAAA,QACvD;AAAA,MAAA;AAAA,IAEF;AAEO,WAAA;AAAA,EACR;AACD;;"}
1
+ {"version":3,"file":"TableHtmlDeserializer.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableHtmlDeserializer.ts"],"sourcesContent":["import { HtmlDeserializerPlugin } from '../../../types'\nimport { tableCellElementType } from './TableCellElement'\nimport { tableElementType } from './TableElement'\nimport { tableRowElementType } from './TableRowElement'\n\nexport const tableHTMLDeserializer: HtmlDeserializerPlugin = {\n\tprocessBlockPaste: ({ element, next, cumulativeTextAttrs }) => {\n\t\tif (element.tagName === 'TABLE') {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: tableElementType,\n\t\t\t\t\tchildren: next(element.childNodes, cumulativeTextAttrs),\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\n\t\tif (element.tagName === 'TR') {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: tableRowElementType,\n\t\t\t\t\tchildren: next(element.childNodes, cumulativeTextAttrs),\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\n\t\tif (element.tagName === 'TD' || element.tagName === 'TH') {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: tableCellElementType,\n\t\t\t\t\tchildren: next(element.childNodes, cumulativeTextAttrs),\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\n\t\treturn null\n\t},\n}\n"],"names":["tableElementType","tableRowElementType","tableCellElementType"],"mappings":";;;;;AAKO,MAAM,wBAAgD;AAAA,EAC5D,mBAAmB,CAAC,EAAE,SAAS,MAAM,0BAA0B;AAC1D,QAAA,QAAQ,YAAY,SAAS;AACzB,aAAA;AAAA,QACN;AAAA,UACC,MAAMA,aAAA;AAAA,UACN,UAAU,KAAK,QAAQ,YAAY,mBAAmB;AAAA,QAAA;AAAA,MAExD;AAAA,IAAA;AAGG,QAAA,QAAQ,YAAY,MAAM;AACtB,aAAA;AAAA,QACN;AAAA,UACC,MAAMC,gBAAA;AAAA,UACN,UAAU,KAAK,QAAQ,YAAY,mBAAmB;AAAA,QAAA;AAAA,MAExD;AAAA,IAAA;AAGD,QAAI,QAAQ,YAAY,QAAQ,QAAQ,YAAY,MAAM;AAClD,aAAA;AAAA,QACN;AAAA,UACC,MAAMC,iBAAA;AAAA,UACN,UAAU,KAAK,QAAQ,YAAY,mBAAmB;AAAA,QAAA;AAAA,MAExD;AAAA,IAAA;AAGM,WAAA;AAAA,EAAA;AAET;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TableHtmlDeserializer.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableHtmlDeserializer.ts"],"sourcesContent":["import { HtmlDeserializerPlugin } from '../../../types'\nimport { tableCellElementType } from './TableCellElement'\nimport { tableElementType } from './TableElement'\nimport { tableRowElementType } from './TableRowElement'\n\nexport const tableHTMLDeserializer: HtmlDeserializerPlugin = {\n\tprocessBlockPaste: ({ element, next, cumulativeTextAttrs }) => {\n\t\tif (element.tagName === 'TABLE') {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: tableElementType,\n\t\t\t\t\tchildren: next(element.childNodes, cumulativeTextAttrs),\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\n\t\tif (element.tagName === 'TR') {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: tableRowElementType,\n\t\t\t\t\tchildren: next(element.childNodes, cumulativeTextAttrs),\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\n\t\tif (element.tagName === 'TD' || element.tagName === 'TH') {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: tableCellElementType,\n\t\t\t\t\tchildren: next(element.childNodes, cumulativeTextAttrs),\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\n\t\treturn null\n\t},\n}\n"],"names":[],"mappings":";;;AAKO,MAAM,wBAAgD;AAAA,EAC5D,mBAAmB,CAAC,EAAE,SAAS,MAAM,0BAA0B;AAC1D,QAAA,QAAQ,YAAY,SAAS;AACzB,aAAA;AAAA,QACN;AAAA,UACC,MAAM;AAAA,UACN,UAAU,KAAK,QAAQ,YAAY,mBAAmB;AAAA,QACvD;AAAA,MAAA;AAAA,IAEF;AAEI,QAAA,QAAQ,YAAY,MAAM;AACtB,aAAA;AAAA,QACN;AAAA,UACC,MAAM;AAAA,UACN,UAAU,KAAK,QAAQ,YAAY,mBAAmB;AAAA,QACvD;AAAA,MAAA;AAAA,IAEF;AAEA,QAAI,QAAQ,YAAY,QAAQ,QAAQ,YAAY,MAAM;AAClD,aAAA;AAAA,QACN;AAAA,UACC,MAAM;AAAA,UACN,UAAU,KAAK,QAAQ,YAAY,mBAAmB;AAAA,QACvD;AAAA,MAAA;AAAA,IAEF;AAEO,WAAA;AAAA,EACR;AACD;"}
1
+ {"version":3,"file":"TableHtmlDeserializer.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableHtmlDeserializer.ts"],"sourcesContent":["import { HtmlDeserializerPlugin } from '../../../types'\nimport { tableCellElementType } from './TableCellElement'\nimport { tableElementType } from './TableElement'\nimport { tableRowElementType } from './TableRowElement'\n\nexport const tableHTMLDeserializer: HtmlDeserializerPlugin = {\n\tprocessBlockPaste: ({ element, next, cumulativeTextAttrs }) => {\n\t\tif (element.tagName === 'TABLE') {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: tableElementType,\n\t\t\t\t\tchildren: next(element.childNodes, cumulativeTextAttrs),\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\n\t\tif (element.tagName === 'TR') {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: tableRowElementType,\n\t\t\t\t\tchildren: next(element.childNodes, cumulativeTextAttrs),\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\n\t\tif (element.tagName === 'TD' || element.tagName === 'TH') {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: tableCellElementType,\n\t\t\t\t\tchildren: next(element.childNodes, cumulativeTextAttrs),\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\n\t\treturn null\n\t},\n}\n"],"names":[],"mappings":";;;AAKO,MAAM,wBAAgD;AAAA,EAC5D,mBAAmB,CAAC,EAAE,SAAS,MAAM,0BAA0B;AAC1D,QAAA,QAAQ,YAAY,SAAS;AACzB,aAAA;AAAA,QACN;AAAA,UACC,MAAM;AAAA,UACN,UAAU,KAAK,QAAQ,YAAY,mBAAmB;AAAA,QAAA;AAAA,MAExD;AAAA,IAAA;AAGG,QAAA,QAAQ,YAAY,MAAM;AACtB,aAAA;AAAA,QACN;AAAA,UACC,MAAM;AAAA,UACN,UAAU,KAAK,QAAQ,YAAY,mBAAmB;AAAA,QAAA;AAAA,MAExD;AAAA,IAAA;AAGD,QAAI,QAAQ,YAAY,QAAQ,QAAQ,YAAY,MAAM;AAClD,aAAA;AAAA,QACN;AAAA,UACC,MAAM;AAAA,UACN,UAAU,KAAK,QAAQ,YAAY,mBAAmB;AAAA,QAAA;AAAA,MAExD;AAAA,IAAA;AAGM,WAAA;AAAA,EAAA;AAET;"}
@@ -1 +1 @@
1
- {"version":3,"file":"TableModifications.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableModifications.ts"],"sourcesContent":["import { Editor, NodeEntry, Transforms } from 'slate'\nimport { ReactEditor } from 'slate-react'\nimport { getTableElementColumnCount, getTableElementRowCount, TableElement } from './TableElement'\nimport { createEmptyTableRowElement, isTableRowElement, TableRowElement, tableRowElementType } from './TableRowElement'\nimport { ContemberEditor } from '../../../editor'\nimport {\n\tcreateEmptyTableCellElement,\n\tisTableCellElement,\n\tTableCellElement,\n\ttableCellElementType,\n} from './TableCellElement'\n\nexport class TableModifications {\n\tpublic static deleteTableColumn(editor: Editor, element: TableElement, index: number) {\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tconst rowCount = element.children.length\n\n\t\tEditor.withoutNormalizing(editor, () => {\n\t\t\tfor (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {\n\t\t\t\tTransforms.removeNodes(editor, {\n\t\t\t\t\tat: [...tablePath, rowIndex, index],\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic static addTableRow(editor: Editor, element: TableElement, index?: number) {\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tconst columnCount = getTableElementColumnCount(element)\n\t\tconst rowIndex = index ?? element.children.length\n\n\t\tlet tableRow: TableRowElement\n\t\tif (element.children.length === 0) {\n\t\t\ttableRow = createEmptyTableRowElement(columnCount)\n\t\t} else {\n\t\t\tconst blueprintRow = element.children[rowIndex === 0 ? 0 : rowIndex - 1] as TableRowElement\n\n\t\t\ttableRow = {\n\t\t\t\t...ContemberEditor.elementToSpecifics(blueprintRow),\n\t\t\t\ttype: tableRowElementType,\n\t\t\t\tchildren: Array.from(\n\t\t\t\t\t{ length: columnCount },\n\t\t\t\t\t(_, columnIndex): TableCellElement => copyTableCell(blueprintRow.children[columnIndex] as TableCellElement),\n\t\t\t\t),\n\t\t\t}\n\n\t\t\tif (rowIndex === 0) {\n\t\t\t\tconst firstRow = element.children[0] as TableRowElement\n\t\t\t\tif (firstRow.headerScope) {\n\t\t\t\t\tTransforms.setNodes(editor, { headerScope: null }, { at: [...tablePath, 0] })\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tTransforms.insertNodes(editor, tableRow, {\n\t\t\tat: [...tablePath, rowIndex],\n\t\t})\n\t}\n\n\tpublic static addTableColumn(editor: Editor, element: TableElement, index?: number) {\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tconst columnCount = getTableElementColumnCount(element)\n\t\tconst rowCount = getTableElementRowCount(element)\n\t\tconst columnIndex = index ?? columnCount ?? 0\n\n\t\tEditor.withoutNormalizing(editor, () => {\n\t\t\tfor (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {\n\t\t\t\tconst tableRow = element.children[rowIndex] as TableRowElement\n\n\t\t\t\tlet tableCell: TableCellElement\n\t\t\t\tif (tableRow.children.length === 0) {\n\t\t\t\t\ttableCell = createEmptyTableCellElement()\n\t\t\t\t} else {\n\t\t\t\t\ttableCell = copyTableCell(tableRow.children[columnIndex === 0 ? 0 : columnIndex - 1] as TableCellElement)\n\n\t\t\t\t\tif (columnIndex === 0) {\n\t\t\t\t\t\tconst firstCell = tableRow.children[0] as TableCellElement\n\t\t\t\t\t\tif (firstCell.headerScope) {\n\t\t\t\t\t\t\tTransforms.setNodes(editor, { headerScope: null }, { at: [...tablePath, rowIndex, 0] })\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tTransforms.insertNodes(editor, tableCell, {\n\t\t\t\t\tat: [...tablePath, rowIndex, columnIndex],\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic static justifyTableColumn(editor: Editor, element: TableElement, columnIndex: number, direction: TableCellElement['justify']) {\n\t\tforEachCellInColumn(editor, element, columnIndex, ([, cellPath]) => {\n\t\t\tTransforms.setNodes(\n\t\t\t\teditor,\n\t\t\t\t{ justify: direction ?? undefined },\n\t\t\t\t{ match: node => isTableCellElement(node), at: cellPath },\n\t\t\t)\n\t\t})\n\t}\n\n\tpublic static toggleTableRowHeaderScope(editor: Editor, element: TableElement, rowIndex: number, scope: TableRowElement['headerScope']) {\n\t\tconst rowCount = element.children.length\n\t\tif (rowIndex !== 0 || rowCount < 1) {\n\t\t\treturn\n\t\t}\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tconst firstRow = element.children[0] as TableRowElement\n\n\t\tTransforms.setNodes(\n\t\t\teditor,\n\t\t\t{ headerScope: firstRow.headerScope === scope ? undefined : scope },\n\t\t\t{ match: node => isTableRowElement(node), at: [...tablePath, 0] },\n\t\t)\n\t}\n\n\tpublic static toggleTableColumnHeaderScope(editor: Editor, element: TableElement, columnIndex: number, scope: TableCellElement['headerScope']) {\n\t\tlet currentStatusScore = 0\n\t\tconst rowCount = element.children.length\n\n\t\tforEachCellInColumn(editor, element, columnIndex, ([cell]) => {\n\t\t\tcurrentStatusScore += cell.headerScope === scope ? 1 : -1\n\t\t})\n\n\t\t// If none have it or the majority does but not all.\n\t\tconst shouldSetScope =\n\t\t\t-currentStatusScore === rowCount || (currentStatusScore > 0 && currentStatusScore !== rowCount)\n\n\t\tforEachCellInColumn(editor, element, columnIndex, ([, cellPath]) => {\n\t\t\tTransforms.setNodes(\n\t\t\t\teditor,\n\t\t\t\t{ headerScope: shouldSetScope ? scope : undefined },\n\t\t\t\t{ match: node => isTableCellElement(node), at: cellPath },\n\t\t\t)\n\t\t})\n\t}\n\n\tpublic static deleteTableRow(editor: Editor, element: TableElement, index: number) {\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tTransforms.removeNodes(editor, {\n\t\t\tat: [...tablePath, index],\n\t\t})\n\t}\n}\n\nconst forEachCellInColumn = (\n\teditor: Editor,\n\telement: TableElement,\n\tcolumnIndex: number,\n\tcallback: (cellEntry: NodeEntry<TableCellElement>) => void,\n) => {\n\tconst tablePath = ReactEditor.findPath(editor, element)\n\tconst rowCount = getTableElementRowCount(element)\n\n\tEditor.withoutNormalizing(editor, () => {\n\t\tfor (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {\n\t\t\tcallback(Editor.node(editor, [...tablePath, rowIndex, columnIndex]) as NodeEntry<TableCellElement>)\n\t\t}\n\t})\n}\nconst copyTableCell = (tableCellElement: TableCellElement): TableCellElement => ({\n\t...ContemberEditor.elementToSpecifics(tableCellElement),\n\ttype: tableCellElementType,\n\tchildren: [{ text: '' }],\n})\n\n"],"names":["index","ReactEditor","Editor","Transforms","getTableElementColumnCount","createEmptyTableRowElement","ContemberEditor","tableRowElementType","getTableElementRowCount","createEmptyTableCellElement","isTableCellElement","isTableRowElement","tableCellElementType"],"mappings":";;;;;;;;AAYO,MAAM,mBAAmB;AAAA,EAC/B,OAAc,kBAAkB,QAAgB,SAAuBA,QAAe;AACrF,UAAM,YAAYC,WAAA,YAAY,SAAS,QAAQ,OAAO;AAChD,UAAA,WAAW,QAAQ,SAAS;AAE3BC,iBAAA,mBAAmB,QAAQ,MAAM;AACvC,eAAS,WAAW,GAAG,WAAW,UAAU,YAAY;AACvDC,cAAA,WAAW,YAAY,QAAQ;AAAA,UAC9B,IAAI,CAAC,GAAG,WAAW,UAAUH,MAAK;AAAA,QAAA,CAClC;AAAA,MACF;AAAA,IAAA,CACA;AAAA,EACF;AAAA,EAEA,OAAc,YAAY,QAAgB,SAAuBA,SAAgB;AAChF,UAAM,YAAYC,WAAA,YAAY,SAAS,QAAQ,OAAO;AAChD,UAAA,cAAcG,wCAA2B,OAAO;AAChD,UAAA,WAAWJ,WAAS,QAAQ,SAAS;AAEvC,QAAA;AACA,QAAA,QAAQ,SAAS,WAAW,GAAG;AAClC,iBAAWK,gBAAAA,2BAA2B,WAAW;AAAA,IAAA,OAC3C;AACN,YAAM,eAAe,QAAQ,SAAS,aAAa,IAAI,IAAI,WAAW,CAAC;AAE5D,iBAAA;AAAA,QACV,GAAGC,MAAgB,gBAAA,mBAAmB,YAAY;AAAA,QAClD,MAAMC,gBAAA;AAAA,QACN,UAAU,MAAM;AAAA,UACf,EAAE,QAAQ,YAAY;AAAA,UACtB,CAAC,GAAG,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AAA,mBAAmB,IAAI,GAAG,IAAI,SAAS;AAAA,MAAA;AAAA,IACzD,CACA;AAAA,EACF;AAAA,EAEA,OAAc,eAAe,QAAgB,SAAuBV,QAAe;AAClF,UAAM,YAAYC,WAAA,YAAY,SAAS,QAAQ,OAAO;AACtDE,UAAA,WAAW,YAAY,QAAQ;AAAA,MAC9B,IAAI,CAAC,GAAG,WAAWH,MAAK;AAAA,IAAA,CACxB;AAAA,EACF;AACD;AAEA,MAAM,sBAAsB,CAC3B,QACA,SACA,aACA,aACI;AACJ,QAAM,YAAYC,WAAA,YAAY,SAAS,QAAQ,OAAO;AAChD,QAAA,WAAWO,qCAAwB,OAAO;AAEzCN,eAAA,mBAAmB,QAAQ,MAAM;AACvC,aAAS,WAAW,GAAG,WAAW,UAAU,YAAY;AAC9C,eAAAA,MAAAA,OAAO,KAAK,QAAQ,CAAC,GAAG,WAAW,UAAU,WAAW,CAAC,CAAgC;AAAA,IACnG;AAAA,EAAA,CACA;AACF;AACA,MAAM,gBAAgB,CAAC,sBAA0D;AAAA,EAChF,GAAGI,MAAgB,gBAAA,mBAAmB,gBAAgB;AAAA,EACtD,MAAMM,iBAAA;AAAA,EACN,UAAU,CAAC,EAAE,MAAM,IAAI;AACxB;;"}
1
+ {"version":3,"file":"TableModifications.cjs","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableModifications.ts"],"sourcesContent":["import { Editor, NodeEntry, Transforms } from 'slate'\nimport { ReactEditor } from 'slate-react'\nimport { getTableElementColumnCount, getTableElementRowCount, TableElement } from './TableElement'\nimport { createEmptyTableRowElement, isTableRowElement, TableRowElement, tableRowElementType } from './TableRowElement'\nimport { ContemberEditor } from '../../../editor'\nimport {\n\tcreateEmptyTableCellElement,\n\tisTableCellElement,\n\tTableCellElement,\n\ttableCellElementType,\n} from './TableCellElement'\n\nexport class TableModifications {\n\tpublic static deleteTableColumn(editor: Editor, element: TableElement, index: number) {\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tconst rowCount = element.children.length\n\n\t\tEditor.withoutNormalizing(editor, () => {\n\t\t\tfor (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {\n\t\t\t\tTransforms.removeNodes(editor, {\n\t\t\t\t\tat: [...tablePath, rowIndex, index],\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic static addTableRow(editor: Editor, element: TableElement, index?: number) {\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tconst columnCount = getTableElementColumnCount(element)\n\t\tconst rowIndex = index ?? element.children.length\n\n\t\tlet tableRow: TableRowElement\n\t\tif (element.children.length === 0) {\n\t\t\ttableRow = createEmptyTableRowElement(columnCount)\n\t\t} else {\n\t\t\tconst blueprintRow = element.children[rowIndex === 0 ? 0 : rowIndex - 1] as TableRowElement\n\n\t\t\ttableRow = {\n\t\t\t\t...ContemberEditor.elementToSpecifics(blueprintRow),\n\t\t\t\ttype: tableRowElementType,\n\t\t\t\tchildren: Array.from(\n\t\t\t\t\t{ length: columnCount },\n\t\t\t\t\t(_, columnIndex): TableCellElement => copyTableCell(blueprintRow.children[columnIndex] as TableCellElement),\n\t\t\t\t),\n\t\t\t}\n\n\t\t\tif (rowIndex === 0) {\n\t\t\t\tconst firstRow = element.children[0] as TableRowElement\n\t\t\t\tif (firstRow.headerScope) {\n\t\t\t\t\tTransforms.setNodes(editor, { headerScope: null }, { at: [...tablePath, 0] })\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tTransforms.insertNodes(editor, tableRow, {\n\t\t\tat: [...tablePath, rowIndex],\n\t\t})\n\t}\n\n\tpublic static addTableColumn(editor: Editor, element: TableElement, index?: number) {\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tconst columnCount = getTableElementColumnCount(element)\n\t\tconst rowCount = getTableElementRowCount(element)\n\t\tconst columnIndex = index ?? columnCount ?? 0\n\n\t\tEditor.withoutNormalizing(editor, () => {\n\t\t\tfor (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {\n\t\t\t\tconst tableRow = element.children[rowIndex] as TableRowElement\n\n\t\t\t\tlet tableCell: TableCellElement\n\t\t\t\tif (tableRow.children.length === 0) {\n\t\t\t\t\ttableCell = createEmptyTableCellElement()\n\t\t\t\t} else {\n\t\t\t\t\ttableCell = copyTableCell(tableRow.children[columnIndex === 0 ? 0 : columnIndex - 1] as TableCellElement)\n\n\t\t\t\t\tif (columnIndex === 0) {\n\t\t\t\t\t\tconst firstCell = tableRow.children[0] as TableCellElement\n\t\t\t\t\t\tif (firstCell.headerScope) {\n\t\t\t\t\t\t\tTransforms.setNodes(editor, { headerScope: null }, { at: [...tablePath, rowIndex, 0] })\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tTransforms.insertNodes(editor, tableCell, {\n\t\t\t\t\tat: [...tablePath, rowIndex, columnIndex],\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic static justifyTableColumn(editor: Editor, element: TableElement, columnIndex: number, direction: TableCellElement['justify']) {\n\t\tforEachCellInColumn(editor, element, columnIndex, ([, cellPath]) => {\n\t\t\tTransforms.setNodes(\n\t\t\t\teditor,\n\t\t\t\t{ justify: direction ?? undefined },\n\t\t\t\t{ match: node => isTableCellElement(node), at: cellPath },\n\t\t\t)\n\t\t})\n\t}\n\n\tpublic static toggleTableRowHeaderScope(editor: Editor, element: TableElement, rowIndex: number, scope: TableRowElement['headerScope']) {\n\t\tconst rowCount = element.children.length\n\t\tif (rowIndex !== 0 || rowCount < 1) {\n\t\t\treturn\n\t\t}\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tconst firstRow = element.children[0] as TableRowElement\n\n\t\tTransforms.setNodes(\n\t\t\teditor,\n\t\t\t{ headerScope: firstRow.headerScope === scope ? undefined : scope },\n\t\t\t{ match: node => isTableRowElement(node), at: [...tablePath, 0] },\n\t\t)\n\t}\n\n\tpublic static toggleTableColumnHeaderScope(editor: Editor, element: TableElement, columnIndex: number, scope: TableCellElement['headerScope']) {\n\t\tlet currentStatusScore = 0\n\t\tconst rowCount = element.children.length\n\n\t\tforEachCellInColumn(editor, element, columnIndex, ([cell]) => {\n\t\t\tcurrentStatusScore += cell.headerScope === scope ? 1 : -1\n\t\t})\n\n\t\t// If none have it or the majority does but not all.\n\t\tconst shouldSetScope =\n\t\t\t-currentStatusScore === rowCount || (currentStatusScore > 0 && currentStatusScore !== rowCount)\n\n\t\tforEachCellInColumn(editor, element, columnIndex, ([, cellPath]) => {\n\t\t\tTransforms.setNodes(\n\t\t\t\teditor,\n\t\t\t\t{ headerScope: shouldSetScope ? scope : undefined },\n\t\t\t\t{ match: node => isTableCellElement(node), at: cellPath },\n\t\t\t)\n\t\t})\n\t}\n\n\tpublic static deleteTableRow(editor: Editor, element: TableElement, index: number) {\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tTransforms.removeNodes(editor, {\n\t\t\tat: [...tablePath, index],\n\t\t})\n\t}\n}\n\nconst forEachCellInColumn = (\n\teditor: Editor,\n\telement: TableElement,\n\tcolumnIndex: number,\n\tcallback: (cellEntry: NodeEntry<TableCellElement>) => void,\n) => {\n\tconst tablePath = ReactEditor.findPath(editor, element)\n\tconst rowCount = getTableElementRowCount(element)\n\n\tEditor.withoutNormalizing(editor, () => {\n\t\tfor (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {\n\t\t\tcallback(Editor.node(editor, [...tablePath, rowIndex, columnIndex]) as NodeEntry<TableCellElement>)\n\t\t}\n\t})\n}\nconst copyTableCell = (tableCellElement: TableCellElement): TableCellElement => ({\n\t...ContemberEditor.elementToSpecifics(tableCellElement),\n\ttype: tableCellElementType,\n\tchildren: [{ text: '' }],\n})\n\n"],"names":["index","ReactEditor","Editor","Transforms","getTableElementColumnCount","createEmptyTableRowElement","ContemberEditor","tableRowElementType","getTableElementRowCount","createEmptyTableCellElement","isTableCellElement","isTableRowElement","tableCellElementType"],"mappings":";;;;;;;;AAYO,MAAM,mBAAmB;AAAA,EAC/B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AEzCN,eAAA,mBAAmB,QAAQ,MAAM;AACvC,aAAS,WAAW,GAAG,WAAW,UAAU,YAAY;AAC9C,eAAAA,MAAAA,OAAO,KAAK,QAAQ,CAAC,GAAG,WAAW,UAAU,WAAW,CAAC,CAAgC;AAAA,IAAA;AAAA,EACnG,CACA;AACF;AACA,MAAM,gBAAgB,CAAC,sBAA0D;AAAA,EAChF,GAAGI,MAAgB,gBAAA,mBAAmB,gBAAgB;AAAA,EACtD,MAAMM,iBAAA;AAAA,EACN,UAAU,CAAC,EAAE,MAAM,GAAI,CAAA;AACxB;;"}
@@ -3,7 +3,7 @@ import { ReactEditor } from "slate-react";
3
3
  import { getTableElementColumnCount, getTableElementRowCount } from "./TableElement.js";
4
4
  import { createEmptyTableRowElement, tableRowElementType, isTableRowElement } from "./TableRowElement.js";
5
5
  import { ContemberEditor } from "../../../editor/index.js";
6
- import { createEmptyTableCellElement, tableCellElementType, isTableCellElement } from "./TableCellElement.js";
6
+ import { tableCellElementType, createEmptyTableCellElement, isTableCellElement } from "./TableCellElement.js";
7
7
  class TableModifications {
8
8
  static deleteTableColumn(editor, element, index) {
9
9
  const tablePath = ReactEditor.findPath(editor, element);
@@ -1 +1 @@
1
- {"version":3,"file":"TableModifications.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableModifications.ts"],"sourcesContent":["import { Editor, NodeEntry, Transforms } from 'slate'\nimport { ReactEditor } from 'slate-react'\nimport { getTableElementColumnCount, getTableElementRowCount, TableElement } from './TableElement'\nimport { createEmptyTableRowElement, isTableRowElement, TableRowElement, tableRowElementType } from './TableRowElement'\nimport { ContemberEditor } from '../../../editor'\nimport {\n\tcreateEmptyTableCellElement,\n\tisTableCellElement,\n\tTableCellElement,\n\ttableCellElementType,\n} from './TableCellElement'\n\nexport class TableModifications {\n\tpublic static deleteTableColumn(editor: Editor, element: TableElement, index: number) {\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tconst rowCount = element.children.length\n\n\t\tEditor.withoutNormalizing(editor, () => {\n\t\t\tfor (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {\n\t\t\t\tTransforms.removeNodes(editor, {\n\t\t\t\t\tat: [...tablePath, rowIndex, index],\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic static addTableRow(editor: Editor, element: TableElement, index?: number) {\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tconst columnCount = getTableElementColumnCount(element)\n\t\tconst rowIndex = index ?? element.children.length\n\n\t\tlet tableRow: TableRowElement\n\t\tif (element.children.length === 0) {\n\t\t\ttableRow = createEmptyTableRowElement(columnCount)\n\t\t} else {\n\t\t\tconst blueprintRow = element.children[rowIndex === 0 ? 0 : rowIndex - 1] as TableRowElement\n\n\t\t\ttableRow = {\n\t\t\t\t...ContemberEditor.elementToSpecifics(blueprintRow),\n\t\t\t\ttype: tableRowElementType,\n\t\t\t\tchildren: Array.from(\n\t\t\t\t\t{ length: columnCount },\n\t\t\t\t\t(_, columnIndex): TableCellElement => copyTableCell(blueprintRow.children[columnIndex] as TableCellElement),\n\t\t\t\t),\n\t\t\t}\n\n\t\t\tif (rowIndex === 0) {\n\t\t\t\tconst firstRow = element.children[0] as TableRowElement\n\t\t\t\tif (firstRow.headerScope) {\n\t\t\t\t\tTransforms.setNodes(editor, { headerScope: null }, { at: [...tablePath, 0] })\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tTransforms.insertNodes(editor, tableRow, {\n\t\t\tat: [...tablePath, rowIndex],\n\t\t})\n\t}\n\n\tpublic static addTableColumn(editor: Editor, element: TableElement, index?: number) {\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tconst columnCount = getTableElementColumnCount(element)\n\t\tconst rowCount = getTableElementRowCount(element)\n\t\tconst columnIndex = index ?? columnCount ?? 0\n\n\t\tEditor.withoutNormalizing(editor, () => {\n\t\t\tfor (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {\n\t\t\t\tconst tableRow = element.children[rowIndex] as TableRowElement\n\n\t\t\t\tlet tableCell: TableCellElement\n\t\t\t\tif (tableRow.children.length === 0) {\n\t\t\t\t\ttableCell = createEmptyTableCellElement()\n\t\t\t\t} else {\n\t\t\t\t\ttableCell = copyTableCell(tableRow.children[columnIndex === 0 ? 0 : columnIndex - 1] as TableCellElement)\n\n\t\t\t\t\tif (columnIndex === 0) {\n\t\t\t\t\t\tconst firstCell = tableRow.children[0] as TableCellElement\n\t\t\t\t\t\tif (firstCell.headerScope) {\n\t\t\t\t\t\t\tTransforms.setNodes(editor, { headerScope: null }, { at: [...tablePath, rowIndex, 0] })\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tTransforms.insertNodes(editor, tableCell, {\n\t\t\t\t\tat: [...tablePath, rowIndex, columnIndex],\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic static justifyTableColumn(editor: Editor, element: TableElement, columnIndex: number, direction: TableCellElement['justify']) {\n\t\tforEachCellInColumn(editor, element, columnIndex, ([, cellPath]) => {\n\t\t\tTransforms.setNodes(\n\t\t\t\teditor,\n\t\t\t\t{ justify: direction ?? undefined },\n\t\t\t\t{ match: node => isTableCellElement(node), at: cellPath },\n\t\t\t)\n\t\t})\n\t}\n\n\tpublic static toggleTableRowHeaderScope(editor: Editor, element: TableElement, rowIndex: number, scope: TableRowElement['headerScope']) {\n\t\tconst rowCount = element.children.length\n\t\tif (rowIndex !== 0 || rowCount < 1) {\n\t\t\treturn\n\t\t}\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tconst firstRow = element.children[0] as TableRowElement\n\n\t\tTransforms.setNodes(\n\t\t\teditor,\n\t\t\t{ headerScope: firstRow.headerScope === scope ? undefined : scope },\n\t\t\t{ match: node => isTableRowElement(node), at: [...tablePath, 0] },\n\t\t)\n\t}\n\n\tpublic static toggleTableColumnHeaderScope(editor: Editor, element: TableElement, columnIndex: number, scope: TableCellElement['headerScope']) {\n\t\tlet currentStatusScore = 0\n\t\tconst rowCount = element.children.length\n\n\t\tforEachCellInColumn(editor, element, columnIndex, ([cell]) => {\n\t\t\tcurrentStatusScore += cell.headerScope === scope ? 1 : -1\n\t\t})\n\n\t\t// If none have it or the majority does but not all.\n\t\tconst shouldSetScope =\n\t\t\t-currentStatusScore === rowCount || (currentStatusScore > 0 && currentStatusScore !== rowCount)\n\n\t\tforEachCellInColumn(editor, element, columnIndex, ([, cellPath]) => {\n\t\t\tTransforms.setNodes(\n\t\t\t\teditor,\n\t\t\t\t{ headerScope: shouldSetScope ? scope : undefined },\n\t\t\t\t{ match: node => isTableCellElement(node), at: cellPath },\n\t\t\t)\n\t\t})\n\t}\n\n\tpublic static deleteTableRow(editor: Editor, element: TableElement, index: number) {\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tTransforms.removeNodes(editor, {\n\t\t\tat: [...tablePath, index],\n\t\t})\n\t}\n}\n\nconst forEachCellInColumn = (\n\teditor: Editor,\n\telement: TableElement,\n\tcolumnIndex: number,\n\tcallback: (cellEntry: NodeEntry<TableCellElement>) => void,\n) => {\n\tconst tablePath = ReactEditor.findPath(editor, element)\n\tconst rowCount = getTableElementRowCount(element)\n\n\tEditor.withoutNormalizing(editor, () => {\n\t\tfor (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {\n\t\t\tcallback(Editor.node(editor, [...tablePath, rowIndex, columnIndex]) as NodeEntry<TableCellElement>)\n\t\t}\n\t})\n}\nconst copyTableCell = (tableCellElement: TableCellElement): TableCellElement => ({\n\t...ContemberEditor.elementToSpecifics(tableCellElement),\n\ttype: tableCellElementType,\n\tchildren: [{ text: '' }],\n})\n\n"],"names":[],"mappings":";;;;;;AAYO,MAAM,mBAAmB;AAAA,EAC/B,OAAc,kBAAkB,QAAgB,SAAuB,OAAe;AACrF,UAAM,YAAY,YAAY,SAAS,QAAQ,OAAO;AAChD,UAAA,WAAW,QAAQ,SAAS;AAE3B,WAAA,mBAAmB,QAAQ,MAAM;AACvC,eAAS,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E,MAAM,IAAI;AACxB;"}
1
+ {"version":3,"file":"TableModifications.js","sources":["../../../../../../../packages/react-slate-editor-base/src/plugins/element/tables/TableModifications.ts"],"sourcesContent":["import { Editor, NodeEntry, Transforms } from 'slate'\nimport { ReactEditor } from 'slate-react'\nimport { getTableElementColumnCount, getTableElementRowCount, TableElement } from './TableElement'\nimport { createEmptyTableRowElement, isTableRowElement, TableRowElement, tableRowElementType } from './TableRowElement'\nimport { ContemberEditor } from '../../../editor'\nimport {\n\tcreateEmptyTableCellElement,\n\tisTableCellElement,\n\tTableCellElement,\n\ttableCellElementType,\n} from './TableCellElement'\n\nexport class TableModifications {\n\tpublic static deleteTableColumn(editor: Editor, element: TableElement, index: number) {\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tconst rowCount = element.children.length\n\n\t\tEditor.withoutNormalizing(editor, () => {\n\t\t\tfor (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {\n\t\t\t\tTransforms.removeNodes(editor, {\n\t\t\t\t\tat: [...tablePath, rowIndex, index],\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic static addTableRow(editor: Editor, element: TableElement, index?: number) {\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tconst columnCount = getTableElementColumnCount(element)\n\t\tconst rowIndex = index ?? element.children.length\n\n\t\tlet tableRow: TableRowElement\n\t\tif (element.children.length === 0) {\n\t\t\ttableRow = createEmptyTableRowElement(columnCount)\n\t\t} else {\n\t\t\tconst blueprintRow = element.children[rowIndex === 0 ? 0 : rowIndex - 1] as TableRowElement\n\n\t\t\ttableRow = {\n\t\t\t\t...ContemberEditor.elementToSpecifics(blueprintRow),\n\t\t\t\ttype: tableRowElementType,\n\t\t\t\tchildren: Array.from(\n\t\t\t\t\t{ length: columnCount },\n\t\t\t\t\t(_, columnIndex): TableCellElement => copyTableCell(blueprintRow.children[columnIndex] as TableCellElement),\n\t\t\t\t),\n\t\t\t}\n\n\t\t\tif (rowIndex === 0) {\n\t\t\t\tconst firstRow = element.children[0] as TableRowElement\n\t\t\t\tif (firstRow.headerScope) {\n\t\t\t\t\tTransforms.setNodes(editor, { headerScope: null }, { at: [...tablePath, 0] })\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tTransforms.insertNodes(editor, tableRow, {\n\t\t\tat: [...tablePath, rowIndex],\n\t\t})\n\t}\n\n\tpublic static addTableColumn(editor: Editor, element: TableElement, index?: number) {\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tconst columnCount = getTableElementColumnCount(element)\n\t\tconst rowCount = getTableElementRowCount(element)\n\t\tconst columnIndex = index ?? columnCount ?? 0\n\n\t\tEditor.withoutNormalizing(editor, () => {\n\t\t\tfor (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {\n\t\t\t\tconst tableRow = element.children[rowIndex] as TableRowElement\n\n\t\t\t\tlet tableCell: TableCellElement\n\t\t\t\tif (tableRow.children.length === 0) {\n\t\t\t\t\ttableCell = createEmptyTableCellElement()\n\t\t\t\t} else {\n\t\t\t\t\ttableCell = copyTableCell(tableRow.children[columnIndex === 0 ? 0 : columnIndex - 1] as TableCellElement)\n\n\t\t\t\t\tif (columnIndex === 0) {\n\t\t\t\t\t\tconst firstCell = tableRow.children[0] as TableCellElement\n\t\t\t\t\t\tif (firstCell.headerScope) {\n\t\t\t\t\t\t\tTransforms.setNodes(editor, { headerScope: null }, { at: [...tablePath, rowIndex, 0] })\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tTransforms.insertNodes(editor, tableCell, {\n\t\t\t\t\tat: [...tablePath, rowIndex, columnIndex],\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic static justifyTableColumn(editor: Editor, element: TableElement, columnIndex: number, direction: TableCellElement['justify']) {\n\t\tforEachCellInColumn(editor, element, columnIndex, ([, cellPath]) => {\n\t\t\tTransforms.setNodes(\n\t\t\t\teditor,\n\t\t\t\t{ justify: direction ?? undefined },\n\t\t\t\t{ match: node => isTableCellElement(node), at: cellPath },\n\t\t\t)\n\t\t})\n\t}\n\n\tpublic static toggleTableRowHeaderScope(editor: Editor, element: TableElement, rowIndex: number, scope: TableRowElement['headerScope']) {\n\t\tconst rowCount = element.children.length\n\t\tif (rowIndex !== 0 || rowCount < 1) {\n\t\t\treturn\n\t\t}\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tconst firstRow = element.children[0] as TableRowElement\n\n\t\tTransforms.setNodes(\n\t\t\teditor,\n\t\t\t{ headerScope: firstRow.headerScope === scope ? undefined : scope },\n\t\t\t{ match: node => isTableRowElement(node), at: [...tablePath, 0] },\n\t\t)\n\t}\n\n\tpublic static toggleTableColumnHeaderScope(editor: Editor, element: TableElement, columnIndex: number, scope: TableCellElement['headerScope']) {\n\t\tlet currentStatusScore = 0\n\t\tconst rowCount = element.children.length\n\n\t\tforEachCellInColumn(editor, element, columnIndex, ([cell]) => {\n\t\t\tcurrentStatusScore += cell.headerScope === scope ? 1 : -1\n\t\t})\n\n\t\t// If none have it or the majority does but not all.\n\t\tconst shouldSetScope =\n\t\t\t-currentStatusScore === rowCount || (currentStatusScore > 0 && currentStatusScore !== rowCount)\n\n\t\tforEachCellInColumn(editor, element, columnIndex, ([, cellPath]) => {\n\t\t\tTransforms.setNodes(\n\t\t\t\teditor,\n\t\t\t\t{ headerScope: shouldSetScope ? scope : undefined },\n\t\t\t\t{ match: node => isTableCellElement(node), at: cellPath },\n\t\t\t)\n\t\t})\n\t}\n\n\tpublic static deleteTableRow(editor: Editor, element: TableElement, index: number) {\n\t\tconst tablePath = ReactEditor.findPath(editor, element)\n\t\tTransforms.removeNodes(editor, {\n\t\t\tat: [...tablePath, index],\n\t\t})\n\t}\n}\n\nconst forEachCellInColumn = (\n\teditor: Editor,\n\telement: TableElement,\n\tcolumnIndex: number,\n\tcallback: (cellEntry: NodeEntry<TableCellElement>) => void,\n) => {\n\tconst tablePath = ReactEditor.findPath(editor, element)\n\tconst rowCount = getTableElementRowCount(element)\n\n\tEditor.withoutNormalizing(editor, () => {\n\t\tfor (let rowIndex = 0; rowIndex < rowCount; rowIndex++) {\n\t\t\tcallback(Editor.node(editor, [...tablePath, rowIndex, columnIndex]) as NodeEntry<TableCellElement>)\n\t\t}\n\t})\n}\nconst copyTableCell = (tableCellElement: TableCellElement): TableCellElement => ({\n\t...ContemberEditor.elementToSpecifics(tableCellElement),\n\ttype: tableCellElementType,\n\tchildren: [{ text: '' }],\n})\n\n"],"names":[],"mappings":";;;;;;AAYO,MAAM,mBAAmB;AAAA,EAC/B,OAAc,kBAAkB,QAAgB,SAAuB,OAAe;AACrF,UAAM,YAAY,YAAY,SAAS,QAAQ,OAAO;AAChD,UAAA,WAAW,QAAQ,SAAS;AAE3B,WAAA,mBAAmB,QAAQ,MAAM;AACvC,eAAS,WAAW,GAAG,WAAW,UAAU,YAAY;AACvD,mBAAW,YAAY,QAAQ;AAAA,UAC9B,IAAI,CAAC,GAAG,WAAW,UAAU,KAAK;AAAA,QAAA,CAClC;AAAA,MAAA;AAAA,IACF,CACA;AAAA,EAAA;AAAA,EAGF,OAAc,YAAY,QAAgB,SAAuB,OAAgB;AAChF,UAAM,YAAY,YAAY,SAAS,QAAQ,OAAO;AAChD,UAAA,cAAc,2BAA2B,OAAO;AAChD,UAAA,WAAW,SAAS,QAAQ,SAAS;AAEvC,QAAA;AACA,QAAA,QAAQ,SAAS,WAAW,GAAG;AAClC,iBAAW,2BAA2B,WAAW;AAAA,IAAA,OAC3C;AACN,YAAM,eAAe,QAAQ,SAAS,aAAa,IAAI,IAAI,WAAW,CAAC;AAE5D,iBAAA;AAAA,QACV,GAAG,gBAAgB,mBAAmB,YAAY;AAAA,QAClD,MAAM;AAAA,QACN,UAAU,MAAM;AAAA,UACf,EAAE,QAAQ,YAAY;AAAA,UACtB,CAAC,GAAG,gBAAkC,cAAc,aAAa,SAAS,WAAW,CAAqB;AAAA,QAAA;AAAA,MAE5G;AAEA,UAAI,aAAa,GAAG;AACb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;AAAA,MAC9B,IAAI,CAAC,GAAG,WAAW,KAAK;AAAA,IAAA,CACxB;AAAA,EAAA;AAEH;AAEA,MAAM,sBAAsB,CAC3B,QACA,SACA,aACA,aACI;AACJ,QAAM,YAAY,YAAY,SAAS,QAAQ,OAAO;AAChD,QAAA,WAAW,wBAAwB,OAAO;AAEzC,SAAA,mBAAmB,QAAQ,MAAM;AACvC,aAAS,WAAW,GAAG,WAAW,UAAU,YAAY;AAC9C,eAAA,OAAO,KAAK,QAAQ,CAAC,GAAG,WAAW,UAAU,WAAW,CAAC,CAAgC;AAAA,IAAA;AAAA,EACnG,CACA;AACF;AACA,MAAM,gBAAgB,CAAC,sBAA0D;AAAA,EAChF,GAAG,gBAAgB,mBAAmB,gBAAgB;AAAA,EACtD,MAAM;AAAA,EACN,UAAU,CAAC,EAAE,MAAM,GAAI,CAAA;AACxB;"}
@@ -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","getTableElementColumnC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A,OAAO,MAAM,QAAQ,CAAC,GAAG,WAAW,UAAU,cAAc,CAAC,CAAC;AAE3E,qBAAAC,iBAAW,OAAO,QAAQ,WAAW;AAAA,YAC7C;AAAA,UAAA,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,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,UA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