@ecomcx/ecomweb-editor 0.0.0-stage → 1.17.0

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 (724) hide show
  1. package/README.md +107 -2
  2. package/node_modules/@floating-ui/core/LICENSE +20 -0
  3. package/node_modules/@floating-ui/core/README.md +4 -0
  4. package/node_modules/@floating-ui/core/dist/floating-ui.core.browser.min.mjs +1 -0
  5. package/node_modules/@floating-ui/core/dist/floating-ui.core.browser.mjs +1164 -0
  6. package/node_modules/@floating-ui/core/dist/floating-ui.core.d.mts +535 -0
  7. package/node_modules/@floating-ui/core/dist/floating-ui.core.d.ts +535 -0
  8. package/node_modules/@floating-ui/core/dist/floating-ui.core.esm.js +1038 -0
  9. package/node_modules/@floating-ui/core/dist/floating-ui.core.mjs +1038 -0
  10. package/node_modules/@floating-ui/core/dist/floating-ui.core.umd.js +1183 -0
  11. package/node_modules/@floating-ui/core/dist/floating-ui.core.umd.min.js +1 -0
  12. package/node_modules/@floating-ui/core/package.json +63 -0
  13. package/node_modules/@floating-ui/dom/LICENSE +20 -0
  14. package/node_modules/@floating-ui/dom/README.md +4 -0
  15. package/node_modules/@floating-ui/dom/dist/floating-ui.dom.browser.min.mjs +1 -0
  16. package/node_modules/@floating-ui/dom/dist/floating-ui.dom.browser.mjs +964 -0
  17. package/node_modules/@floating-ui/dom/dist/floating-ui.dom.d.mts +362 -0
  18. package/node_modules/@floating-ui/dom/dist/floating-ui.dom.d.ts +362 -0
  19. package/node_modules/@floating-ui/dom/dist/floating-ui.dom.esm.js +789 -0
  20. package/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs +789 -0
  21. package/node_modules/@floating-ui/dom/dist/floating-ui.dom.umd.js +983 -0
  22. package/node_modules/@floating-ui/dom/dist/floating-ui.dom.umd.min.js +1 -0
  23. package/node_modules/@floating-ui/dom/package.json +72 -0
  24. package/node_modules/@floating-ui/utils/LICENSE +20 -0
  25. package/node_modules/@floating-ui/utils/README.md +4 -0
  26. package/node_modules/@floating-ui/utils/dist/floating-ui.utils.d.mts +105 -0
  27. package/node_modules/@floating-ui/utils/dist/floating-ui.utils.d.ts +105 -0
  28. package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.d.mts +47 -0
  29. package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.d.ts +47 -0
  30. package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.esm.js +165 -0
  31. package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs +165 -0
  32. package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.umd.js +192 -0
  33. package/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.umd.min.js +1 -0
  34. package/node_modules/@floating-ui/utils/dist/floating-ui.utils.esm.js +136 -0
  35. package/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs +136 -0
  36. package/node_modules/@floating-ui/utils/dist/floating-ui.utils.umd.js +167 -0
  37. package/node_modules/@floating-ui/utils/dist/floating-ui.utils.umd.min.js +1 -0
  38. package/node_modules/@floating-ui/utils/dom/floating-ui.utils.dom.d.ts +47 -0
  39. package/node_modules/@floating-ui/utils/dom/floating-ui.utils.dom.esm.js +165 -0
  40. package/node_modules/@floating-ui/utils/dom/floating-ui.utils.dom.umd.js +192 -0
  41. package/node_modules/@floating-ui/utils/dom/package.json +6 -0
  42. package/node_modules/@floating-ui/utils/package.json +70 -0
  43. package/node_modules/@tiptap/core/LICENSE.md +21 -0
  44. package/node_modules/@tiptap/core/README.md +18 -0
  45. package/node_modules/@tiptap/core/dist/index.cjs +8463 -0
  46. package/node_modules/@tiptap/core/dist/index.d.cts +5798 -0
  47. package/node_modules/@tiptap/core/dist/index.d.ts +5797 -0
  48. package/node_modules/@tiptap/core/dist/index.js +8288 -0
  49. package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.cjs +70 -0
  50. package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.d.cts +28 -0
  51. package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.d.ts +28 -0
  52. package/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js +64 -0
  53. package/node_modules/@tiptap/core/dist/rolldown-runtime-D7D4PA-g.js +13 -0
  54. package/node_modules/@tiptap/core/jsx-dev-runtime/index.cjs +1 -0
  55. package/node_modules/@tiptap/core/jsx-dev-runtime/index.d.cts +1 -0
  56. package/node_modules/@tiptap/core/jsx-dev-runtime/index.d.ts +1 -0
  57. package/node_modules/@tiptap/core/jsx-dev-runtime/index.js +1 -0
  58. package/node_modules/@tiptap/core/jsx-runtime/index.cjs +1 -0
  59. package/node_modules/@tiptap/core/jsx-runtime/index.d.cts +1 -0
  60. package/node_modules/@tiptap/core/jsx-runtime/index.d.ts +1 -0
  61. package/node_modules/@tiptap/core/jsx-runtime/index.js +1 -0
  62. package/node_modules/@tiptap/core/package.json +74 -0
  63. package/node_modules/@tiptap/extension-blockquote/LICENSE.md +21 -0
  64. package/node_modules/@tiptap/extension-blockquote/README.md +18 -0
  65. package/node_modules/@tiptap/extension-blockquote/dist/index.cjs +132 -0
  66. package/node_modules/@tiptap/extension-blockquote/dist/index.d.cts +40 -0
  67. package/node_modules/@tiptap/extension-blockquote/dist/index.d.ts +40 -0
  68. package/node_modules/@tiptap/extension-blockquote/dist/index.js +126 -0
  69. package/node_modules/@tiptap/extension-blockquote/package.json +52 -0
  70. package/node_modules/@tiptap/extension-bold/LICENSE.md +21 -0
  71. package/node_modules/@tiptap/extension-bold/README.md +18 -0
  72. package/node_modules/@tiptap/extension-bold/dist/index.cjs +117 -0
  73. package/node_modules/@tiptap/extension-bold/dist/index.d.cts +52 -0
  74. package/node_modules/@tiptap/extension-bold/dist/index.d.ts +52 -0
  75. package/node_modules/@tiptap/extension-bold/dist/index.js +108 -0
  76. package/node_modules/@tiptap/extension-bold/package.json +50 -0
  77. package/node_modules/@tiptap/extension-bubble-menu/LICENSE.md +21 -0
  78. package/node_modules/@tiptap/extension-bubble-menu/README.md +18 -0
  79. package/node_modules/@tiptap/extension-bubble-menu/dist/index.cjs +333 -0
  80. package/node_modules/@tiptap/extension-bubble-menu/dist/index.d.cts +170 -0
  81. package/node_modules/@tiptap/extension-bubble-menu/dist/index.d.ts +170 -0
  82. package/node_modules/@tiptap/extension-bubble-menu/dist/index.js +326 -0
  83. package/node_modules/@tiptap/extension-bubble-menu/package.json +56 -0
  84. package/node_modules/@tiptap/extension-bullet-list/LICENSE.md +21 -0
  85. package/node_modules/@tiptap/extension-bullet-list/README.md +18 -0
  86. package/node_modules/@tiptap/extension-bullet-list/dist/index.cjs +17 -0
  87. package/node_modules/@tiptap/extension-bullet-list/dist/index.d.cts +2 -0
  88. package/node_modules/@tiptap/extension-bullet-list/dist/index.d.ts +2 -0
  89. package/node_modules/@tiptap/extension-bullet-list/dist/index.js +7 -0
  90. package/node_modules/@tiptap/extension-bullet-list/package.json +50 -0
  91. package/node_modules/@tiptap/extension-code/LICENSE.md +21 -0
  92. package/node_modules/@tiptap/extension-code/README.md +18 -0
  93. package/node_modules/@tiptap/extension-code/dist/index.cjs +136 -0
  94. package/node_modules/@tiptap/extension-code/dist/index.d.cts +60 -0
  95. package/node_modules/@tiptap/extension-code/dist/index.d.ts +60 -0
  96. package/node_modules/@tiptap/extension-code/dist/index.js +127 -0
  97. package/node_modules/@tiptap/extension-code/package.json +50 -0
  98. package/node_modules/@tiptap/extension-code-block/LICENSE.md +21 -0
  99. package/node_modules/@tiptap/extension-code-block/README.md +18 -0
  100. package/node_modules/@tiptap/extension-code-block/dist/index.cjs +255 -0
  101. package/node_modules/@tiptap/extension-code-block/dist/index.d.cts +84 -0
  102. package/node_modules/@tiptap/extension-code-block/dist/index.d.ts +84 -0
  103. package/node_modules/@tiptap/extension-code-block/dist/index.js +248 -0
  104. package/node_modules/@tiptap/extension-code-block/package.json +52 -0
  105. package/node_modules/@tiptap/extension-document/LICENSE.md +21 -0
  106. package/node_modules/@tiptap/extension-document/README.md +18 -0
  107. package/node_modules/@tiptap/extension-document/dist/index.cjs +26 -0
  108. package/node_modules/@tiptap/extension-document/dist/index.d.cts +10 -0
  109. package/node_modules/@tiptap/extension-document/dist/index.d.ts +10 -0
  110. package/node_modules/@tiptap/extension-document/dist/index.js +22 -0
  111. package/node_modules/@tiptap/extension-document/package.json +50 -0
  112. package/node_modules/@tiptap/extension-dropcursor/LICENSE.md +21 -0
  113. package/node_modules/@tiptap/extension-dropcursor/README.md +18 -0
  114. package/node_modules/@tiptap/extension-dropcursor/dist/index.cjs +17 -0
  115. package/node_modules/@tiptap/extension-dropcursor/dist/index.d.cts +2 -0
  116. package/node_modules/@tiptap/extension-dropcursor/dist/index.d.ts +2 -0
  117. package/node_modules/@tiptap/extension-dropcursor/dist/index.js +7 -0
  118. package/node_modules/@tiptap/extension-dropcursor/package.json +50 -0
  119. package/node_modules/@tiptap/extension-floating-menu/LICENSE.md +21 -0
  120. package/node_modules/@tiptap/extension-floating-menu/README.md +18 -0
  121. package/node_modules/@tiptap/extension-floating-menu/dist/index.cjs +272 -0
  122. package/node_modules/@tiptap/extension-floating-menu/dist/index.d.cts +180 -0
  123. package/node_modules/@tiptap/extension-floating-menu/dist/index.d.ts +180 -0
  124. package/node_modules/@tiptap/extension-floating-menu/dist/index.js +265 -0
  125. package/node_modules/@tiptap/extension-floating-menu/package.json +55 -0
  126. package/node_modules/@tiptap/extension-gapcursor/LICENSE.md +21 -0
  127. package/node_modules/@tiptap/extension-gapcursor/README.md +18 -0
  128. package/node_modules/@tiptap/extension-gapcursor/dist/index.cjs +17 -0
  129. package/node_modules/@tiptap/extension-gapcursor/dist/index.d.cts +2 -0
  130. package/node_modules/@tiptap/extension-gapcursor/dist/index.d.ts +2 -0
  131. package/node_modules/@tiptap/extension-gapcursor/dist/index.js +7 -0
  132. package/node_modules/@tiptap/extension-gapcursor/package.json +50 -0
  133. package/node_modules/@tiptap/extension-hard-break/LICENSE.md +21 -0
  134. package/node_modules/@tiptap/extension-hard-break/README.md +18 -0
  135. package/node_modules/@tiptap/extension-hard-break/dist/index.cjs +69 -0
  136. package/node_modules/@tiptap/extension-hard-break/dist/index.d.cts +35 -0
  137. package/node_modules/@tiptap/extension-hard-break/dist/index.d.ts +35 -0
  138. package/node_modules/@tiptap/extension-hard-break/dist/index.js +64 -0
  139. package/node_modules/@tiptap/extension-hard-break/package.json +50 -0
  140. package/node_modules/@tiptap/extension-heading/LICENSE.md +21 -0
  141. package/node_modules/@tiptap/extension-heading/README.md +18 -0
  142. package/node_modules/@tiptap/extension-heading/dist/index.cjs +93 -0
  143. package/node_modules/@tiptap/extension-heading/dist/index.d.cts +50 -0
  144. package/node_modules/@tiptap/extension-heading/dist/index.d.ts +50 -0
  145. package/node_modules/@tiptap/extension-heading/dist/index.js +88 -0
  146. package/node_modules/@tiptap/extension-heading/package.json +50 -0
  147. package/node_modules/@tiptap/extension-highlight/LICENSE.md +21 -0
  148. package/node_modules/@tiptap/extension-highlight/README.md +18 -0
  149. package/node_modules/@tiptap/extension-highlight/dist/index.cjs +113 -0
  150. package/node_modules/@tiptap/extension-highlight/dist/index.d.cts +59 -0
  151. package/node_modules/@tiptap/extension-highlight/dist/index.d.ts +59 -0
  152. package/node_modules/@tiptap/extension-highlight/dist/index.js +106 -0
  153. package/node_modules/@tiptap/extension-highlight/package.json +50 -0
  154. package/node_modules/@tiptap/extension-horizontal-rule/LICENSE.md +21 -0
  155. package/node_modules/@tiptap/extension-horizontal-rule/README.md +18 -0
  156. package/node_modules/@tiptap/extension-horizontal-rule/dist/index.cjs +78 -0
  157. package/node_modules/@tiptap/extension-horizontal-rule/dist/index.d.cts +35 -0
  158. package/node_modules/@tiptap/extension-horizontal-rule/dist/index.d.ts +35 -0
  159. package/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +73 -0
  160. package/node_modules/@tiptap/extension-horizontal-rule/package.json +52 -0
  161. package/node_modules/@tiptap/extension-image/LICENSE.md +21 -0
  162. package/node_modules/@tiptap/extension-image/README.md +18 -0
  163. package/node_modules/@tiptap/extension-image/dist/index.cjs +181 -0
  164. package/node_modules/@tiptap/extension-image/dist/index.d.cts +69 -0
  165. package/node_modules/@tiptap/extension-image/dist/index.d.ts +69 -0
  166. package/node_modules/@tiptap/extension-image/dist/index.js +175 -0
  167. package/node_modules/@tiptap/extension-image/package.json +50 -0
  168. package/node_modules/@tiptap/extension-italic/LICENSE.md +21 -0
  169. package/node_modules/@tiptap/extension-italic/README.md +18 -0
  170. package/node_modules/@tiptap/extension-italic/dist/index.cjs +113 -0
  171. package/node_modules/@tiptap/extension-italic/dist/index.d.cts +55 -0
  172. package/node_modules/@tiptap/extension-italic/dist/index.d.ts +55 -0
  173. package/node_modules/@tiptap/extension-italic/dist/index.js +104 -0
  174. package/node_modules/@tiptap/extension-italic/package.json +50 -0
  175. package/node_modules/@tiptap/extension-link/LICENSE.md +21 -0
  176. package/node_modules/@tiptap/extension-link/README.md +18 -0
  177. package/node_modules/@tiptap/extension-link/dist/index.cjs +560 -0
  178. package/node_modules/@tiptap/extension-link/dist/index.d.cts +159 -0
  179. package/node_modules/@tiptap/extension-link/dist/index.d.ts +159 -0
  180. package/node_modules/@tiptap/extension-link/dist/index.js +553 -0
  181. package/node_modules/@tiptap/extension-link/package.json +56 -0
  182. package/node_modules/@tiptap/extension-list/LICENSE.md +21 -0
  183. package/node_modules/@tiptap/extension-list/README.md +18 -0
  184. package/node_modules/@tiptap/extension-list/dist/bullet-list/index.cjs +84 -0
  185. package/node_modules/@tiptap/extension-list/dist/bullet-list/index.d.cts +52 -0
  186. package/node_modules/@tiptap/extension-list/dist/bullet-list/index.d.ts +52 -0
  187. package/node_modules/@tiptap/extension-list/dist/bullet-list/index.js +82 -0
  188. package/node_modules/@tiptap/extension-list/dist/index.cjs +1570 -0
  189. package/node_modules/@tiptap/extension-list/dist/index.d.cts +391 -0
  190. package/node_modules/@tiptap/extension-list/dist/index.d.ts +390 -0
  191. package/node_modules/@tiptap/extension-list/dist/index.js +1533 -0
  192. package/node_modules/@tiptap/extension-list/dist/item/index.cjs +308 -0
  193. package/node_modules/@tiptap/extension-list/dist/item/index.d.cts +30 -0
  194. package/node_modules/@tiptap/extension-list/dist/item/index.d.ts +30 -0
  195. package/node_modules/@tiptap/extension-list/dist/item/index.js +307 -0
  196. package/node_modules/@tiptap/extension-list/dist/keymap/index.cjs +263 -0
  197. package/node_modules/@tiptap/extension-list/dist/keymap/index.d.cts +66 -0
  198. package/node_modules/@tiptap/extension-list/dist/keymap/index.d.ts +65 -0
  199. package/node_modules/@tiptap/extension-list/dist/keymap/index.js +245 -0
  200. package/node_modules/@tiptap/extension-list/dist/keymap/rolldown-runtime-D7D4PA-g.js +13 -0
  201. package/node_modules/@tiptap/extension-list/dist/kit/index.cjs +1487 -0
  202. package/node_modules/@tiptap/extension-list/dist/kit/index.d.cts +235 -0
  203. package/node_modules/@tiptap/extension-list/dist/kit/index.d.ts +235 -0
  204. package/node_modules/@tiptap/extension-list/dist/kit/index.js +1486 -0
  205. package/node_modules/@tiptap/extension-list/dist/ordered-list/index.cjs +671 -0
  206. package/node_modules/@tiptap/extension-list/dist/ordered-list/index.d.cts +120 -0
  207. package/node_modules/@tiptap/extension-list/dist/ordered-list/index.d.ts +120 -0
  208. package/node_modules/@tiptap/extension-list/dist/ordered-list/index.js +659 -0
  209. package/node_modules/@tiptap/extension-list/dist/rolldown-runtime-D7D4PA-g.js +13 -0
  210. package/node_modules/@tiptap/extension-list/dist/task-item/index.cjs +327 -0
  211. package/node_modules/@tiptap/extension-list/dist/task-item/index.d.cts +69 -0
  212. package/node_modules/@tiptap/extension-list/dist/task-item/index.d.ts +69 -0
  213. package/node_modules/@tiptap/extension-list/dist/task-item/index.js +325 -0
  214. package/node_modules/@tiptap/extension-list/dist/task-list/index.cjs +121 -0
  215. package/node_modules/@tiptap/extension-list/dist/task-list/index.d.cts +35 -0
  216. package/node_modules/@tiptap/extension-list/dist/task-list/index.d.ts +35 -0
  217. package/node_modules/@tiptap/extension-list/dist/task-list/index.js +120 -0
  218. package/node_modules/@tiptap/extension-list/package.json +108 -0
  219. package/node_modules/@tiptap/extension-list-item/LICENSE.md +21 -0
  220. package/node_modules/@tiptap/extension-list-item/README.md +18 -0
  221. package/node_modules/@tiptap/extension-list-item/dist/index.cjs +17 -0
  222. package/node_modules/@tiptap/extension-list-item/dist/index.d.cts +2 -0
  223. package/node_modules/@tiptap/extension-list-item/dist/index.d.ts +2 -0
  224. package/node_modules/@tiptap/extension-list-item/dist/index.js +7 -0
  225. package/node_modules/@tiptap/extension-list-item/package.json +50 -0
  226. package/node_modules/@tiptap/extension-list-keymap/LICENSE.md +21 -0
  227. package/node_modules/@tiptap/extension-list-keymap/README.md +18 -0
  228. package/node_modules/@tiptap/extension-list-keymap/dist/index.cjs +23 -0
  229. package/node_modules/@tiptap/extension-list-keymap/dist/index.d.cts +2 -0
  230. package/node_modules/@tiptap/extension-list-keymap/dist/index.d.ts +2 -0
  231. package/node_modules/@tiptap/extension-list-keymap/dist/index.js +7 -0
  232. package/node_modules/@tiptap/extension-list-keymap/package.json +50 -0
  233. package/node_modules/@tiptap/extension-ordered-list/LICENSE.md +21 -0
  234. package/node_modules/@tiptap/extension-ordered-list/README.md +18 -0
  235. package/node_modules/@tiptap/extension-ordered-list/dist/index.cjs +17 -0
  236. package/node_modules/@tiptap/extension-ordered-list/dist/index.d.cts +2 -0
  237. package/node_modules/@tiptap/extension-ordered-list/dist/index.d.ts +2 -0
  238. package/node_modules/@tiptap/extension-ordered-list/dist/index.js +7 -0
  239. package/node_modules/@tiptap/extension-ordered-list/package.json +50 -0
  240. package/node_modules/@tiptap/extension-paragraph/LICENSE.md +21 -0
  241. package/node_modules/@tiptap/extension-paragraph/README.md +18 -0
  242. package/node_modules/@tiptap/extension-paragraph/dist/index.cjs +73 -0
  243. package/node_modules/@tiptap/extension-paragraph/dist/index.d.cts +29 -0
  244. package/node_modules/@tiptap/extension-paragraph/dist/index.d.ts +29 -0
  245. package/node_modules/@tiptap/extension-paragraph/dist/index.js +68 -0
  246. package/node_modules/@tiptap/extension-paragraph/package.json +50 -0
  247. package/node_modules/@tiptap/extension-strike/LICENSE.md +21 -0
  248. package/node_modules/@tiptap/extension-strike/README.md +18 -0
  249. package/node_modules/@tiptap/extension-strike/dist/index.cjs +88 -0
  250. package/node_modules/@tiptap/extension-strike/dist/index.d.cts +47 -0
  251. package/node_modules/@tiptap/extension-strike/dist/index.d.ts +47 -0
  252. package/node_modules/@tiptap/extension-strike/dist/index.js +81 -0
  253. package/node_modules/@tiptap/extension-strike/package.json +50 -0
  254. package/node_modules/@tiptap/extension-subscript/LICENSE.md +21 -0
  255. package/node_modules/@tiptap/extension-subscript/README.md +18 -0
  256. package/node_modules/@tiptap/extension-subscript/dist/index.cjs +56 -0
  257. package/node_modules/@tiptap/extension-subscript/dist/index.d.cts +39 -0
  258. package/node_modules/@tiptap/extension-subscript/dist/index.d.ts +39 -0
  259. package/node_modules/@tiptap/extension-subscript/dist/index.js +51 -0
  260. package/node_modules/@tiptap/extension-subscript/package.json +52 -0
  261. package/node_modules/@tiptap/extension-superscript/LICENSE.md +21 -0
  262. package/node_modules/@tiptap/extension-superscript/README.md +18 -0
  263. package/node_modules/@tiptap/extension-superscript/dist/index.cjs +56 -0
  264. package/node_modules/@tiptap/extension-superscript/dist/index.d.cts +39 -0
  265. package/node_modules/@tiptap/extension-superscript/dist/index.d.ts +39 -0
  266. package/node_modules/@tiptap/extension-superscript/dist/index.js +51 -0
  267. package/node_modules/@tiptap/extension-superscript/package.json +52 -0
  268. package/node_modules/@tiptap/extension-table/LICENSE.md +21 -0
  269. package/node_modules/@tiptap/extension-table/README.md +18 -0
  270. package/node_modules/@tiptap/extension-table/dist/cell/index.cjs +142 -0
  271. package/node_modules/@tiptap/extension-table/dist/cell/index.d.cts +35 -0
  272. package/node_modules/@tiptap/extension-table/dist/cell/index.d.ts +35 -0
  273. package/node_modules/@tiptap/extension-table/dist/cell/index.js +141 -0
  274. package/node_modules/@tiptap/extension-table/dist/header/index.cjs +142 -0
  275. package/node_modules/@tiptap/extension-table/dist/header/index.d.cts +35 -0
  276. package/node_modules/@tiptap/extension-table/dist/header/index.d.ts +35 -0
  277. package/node_modules/@tiptap/extension-table/dist/header/index.js +141 -0
  278. package/node_modules/@tiptap/extension-table/dist/index.cjs +832 -0
  279. package/node_modules/@tiptap/extension-table/dist/index.d.cts +344 -0
  280. package/node_modules/@tiptap/extension-table/dist/index.d.ts +344 -0
  281. package/node_modules/@tiptap/extension-table/dist/index.js +819 -0
  282. package/node_modules/@tiptap/extension-table/dist/kit/index.cjs +817 -0
  283. package/node_modules/@tiptap/extension-table/dist/kit/index.d.cts +265 -0
  284. package/node_modules/@tiptap/extension-table/dist/kit/index.d.ts +265 -0
  285. package/node_modules/@tiptap/extension-table/dist/kit/index.js +816 -0
  286. package/node_modules/@tiptap/extension-table/dist/row/index.cjs +29 -0
  287. package/node_modules/@tiptap/extension-table/dist/row/index.d.cts +35 -0
  288. package/node_modules/@tiptap/extension-table/dist/row/index.d.ts +35 -0
  289. package/node_modules/@tiptap/extension-table/dist/row/index.js +28 -0
  290. package/node_modules/@tiptap/extension-table/dist/table/index.cjs +616 -0
  291. package/node_modules/@tiptap/extension-table/dist/table/index.d.cts +254 -0
  292. package/node_modules/@tiptap/extension-table/dist/table/index.d.ts +254 -0
  293. package/node_modules/@tiptap/extension-table/dist/table/index.js +609 -0
  294. package/node_modules/@tiptap/extension-table/package.json +92 -0
  295. package/node_modules/@tiptap/extension-text/LICENSE.md +21 -0
  296. package/node_modules/@tiptap/extension-text/README.md +18 -0
  297. package/node_modules/@tiptap/extension-text/dist/index.cjs +28 -0
  298. package/node_modules/@tiptap/extension-text/dist/index.d.cts +10 -0
  299. package/node_modules/@tiptap/extension-text/dist/index.d.ts +10 -0
  300. package/node_modules/@tiptap/extension-text/dist/index.js +24 -0
  301. package/node_modules/@tiptap/extension-text/package.json +50 -0
  302. package/node_modules/@tiptap/extension-text-align/LICENSE.md +21 -0
  303. package/node_modules/@tiptap/extension-text-align/README.md +18 -0
  304. package/node_modules/@tiptap/extension-text-align/dist/index.cjs +73 -0
  305. package/node_modules/@tiptap/extension-text-align/dist/index.d.cts +53 -0
  306. package/node_modules/@tiptap/extension-text-align/dist/index.d.ts +53 -0
  307. package/node_modules/@tiptap/extension-text-align/dist/index.js +68 -0
  308. package/node_modules/@tiptap/extension-text-align/package.json +50 -0
  309. package/node_modules/@tiptap/extension-text-style/LICENSE.md +21 -0
  310. package/node_modules/@tiptap/extension-text-style/README.md +18 -0
  311. package/node_modules/@tiptap/extension-text-style/dist/background-color/index.cjs +121 -0
  312. package/node_modules/@tiptap/extension-text-style/dist/background-color/index.d.cts +161 -0
  313. package/node_modules/@tiptap/extension-text-style/dist/background-color/index.d.ts +161 -0
  314. package/node_modules/@tiptap/extension-text-style/dist/background-color/index.js +116 -0
  315. package/node_modules/@tiptap/extension-text-style/dist/color/index.cjs +121 -0
  316. package/node_modules/@tiptap/extension-text-style/dist/color/index.d.cts +161 -0
  317. package/node_modules/@tiptap/extension-text-style/dist/color/index.d.ts +161 -0
  318. package/node_modules/@tiptap/extension-text-style/dist/color/index.js +116 -0
  319. package/node_modules/@tiptap/extension-text-style/dist/font-family/index.cjs +120 -0
  320. package/node_modules/@tiptap/extension-text-style/dist/font-family/index.d.cts +161 -0
  321. package/node_modules/@tiptap/extension-text-style/dist/font-family/index.d.ts +161 -0
  322. package/node_modules/@tiptap/extension-text-style/dist/font-family/index.js +115 -0
  323. package/node_modules/@tiptap/extension-text-style/dist/font-size/index.cjs +120 -0
  324. package/node_modules/@tiptap/extension-text-style/dist/font-size/index.d.cts +161 -0
  325. package/node_modules/@tiptap/extension-text-style/dist/font-size/index.d.ts +161 -0
  326. package/node_modules/@tiptap/extension-text-style/dist/font-size/index.js +115 -0
  327. package/node_modules/@tiptap/extension-text-style/dist/index.cjs +298 -0
  328. package/node_modules/@tiptap/extension-text-style/dist/index.d.cts +275 -0
  329. package/node_modules/@tiptap/extension-text-style/dist/index.d.ts +275 -0
  330. package/node_modules/@tiptap/extension-text-style/dist/index.js +291 -0
  331. package/node_modules/@tiptap/extension-text-style/dist/line-height/index.cjs +120 -0
  332. package/node_modules/@tiptap/extension-text-style/dist/line-height/index.d.cts +161 -0
  333. package/node_modules/@tiptap/extension-text-style/dist/line-height/index.d.ts +161 -0
  334. package/node_modules/@tiptap/extension-text-style/dist/line-height/index.js +115 -0
  335. package/node_modules/@tiptap/extension-text-style/dist/text-style/index.cjs +80 -0
  336. package/node_modules/@tiptap/extension-text-style/dist/text-style/index.d.cts +170 -0
  337. package/node_modules/@tiptap/extension-text-style/dist/text-style/index.d.ts +170 -0
  338. package/node_modules/@tiptap/extension-text-style/dist/text-style/index.js +79 -0
  339. package/node_modules/@tiptap/extension-text-style/dist/text-style-kit/index.cjs +292 -0
  340. package/node_modules/@tiptap/extension-text-style/dist/text-style-kit/index.d.cts +244 -0
  341. package/node_modules/@tiptap/extension-text-style/dist/text-style-kit/index.d.ts +244 -0
  342. package/node_modules/@tiptap/extension-text-style/dist/text-style-kit/index.js +291 -0
  343. package/node_modules/@tiptap/extension-text-style/package.json +106 -0
  344. package/node_modules/@tiptap/extension-underline/LICENSE.md +21 -0
  345. package/node_modules/@tiptap/extension-underline/README.md +18 -0
  346. package/node_modules/@tiptap/extension-underline/dist/index.cjs +81 -0
  347. package/node_modules/@tiptap/extension-underline/dist/index.d.cts +39 -0
  348. package/node_modules/@tiptap/extension-underline/dist/index.d.ts +39 -0
  349. package/node_modules/@tiptap/extension-underline/dist/index.js +76 -0
  350. package/node_modules/@tiptap/extension-underline/package.json +50 -0
  351. package/node_modules/@tiptap/extension-youtube/LICENSE.md +21 -0
  352. package/node_modules/@tiptap/extension-youtube/README.md +18 -0
  353. package/node_modules/@tiptap/extension-youtube/dist/index.cjs +254 -0
  354. package/node_modules/@tiptap/extension-youtube/dist/index.d.cts +204 -0
  355. package/node_modules/@tiptap/extension-youtube/dist/index.d.ts +204 -0
  356. package/node_modules/@tiptap/extension-youtube/dist/index.js +246 -0
  357. package/node_modules/@tiptap/extension-youtube/package.json +50 -0
  358. package/node_modules/@tiptap/extensions/LICENSE.md +21 -0
  359. package/node_modules/@tiptap/extensions/README.md +18 -0
  360. package/node_modules/@tiptap/extensions/dist/character-count/index.cjs +87 -0
  361. package/node_modules/@tiptap/extensions/dist/character-count/index.d.cts +70 -0
  362. package/node_modules/@tiptap/extensions/dist/character-count/index.d.ts +70 -0
  363. package/node_modules/@tiptap/extensions/dist/character-count/index.js +86 -0
  364. package/node_modules/@tiptap/extensions/dist/drop-cursor/index.cjs +27 -0
  365. package/node_modules/@tiptap/extensions/dist/drop-cursor/index.d.cts +32 -0
  366. package/node_modules/@tiptap/extensions/dist/drop-cursor/index.d.ts +32 -0
  367. package/node_modules/@tiptap/extensions/dist/drop-cursor/index.js +26 -0
  368. package/node_modules/@tiptap/extensions/dist/focus/index.cjs +48 -0
  369. package/node_modules/@tiptap/extensions/dist/focus/index.d.cts +29 -0
  370. package/node_modules/@tiptap/extensions/dist/focus/index.d.ts +29 -0
  371. package/node_modules/@tiptap/extensions/dist/focus/index.js +47 -0
  372. package/node_modules/@tiptap/extensions/dist/gap-cursor/index.cjs +29 -0
  373. package/node_modules/@tiptap/extensions/dist/gap-cursor/index.d.cts +26 -0
  374. package/node_modules/@tiptap/extensions/dist/gap-cursor/index.d.ts +26 -0
  375. package/node_modules/@tiptap/extensions/dist/gap-cursor/index.js +28 -0
  376. package/node_modules/@tiptap/extensions/dist/index.cjs +711 -0
  377. package/node_modules/@tiptap/extensions/dist/index.d.cts +321 -0
  378. package/node_modules/@tiptap/extensions/dist/index.d.ts +321 -0
  379. package/node_modules/@tiptap/extensions/dist/index.js +699 -0
  380. package/node_modules/@tiptap/extensions/dist/placeholder/index.cjs +372 -0
  381. package/node_modules/@tiptap/extensions/dist/placeholder/index.d.cts +91 -0
  382. package/node_modules/@tiptap/extensions/dist/placeholder/index.d.ts +91 -0
  383. package/node_modules/@tiptap/extensions/dist/placeholder/index.js +368 -0
  384. package/node_modules/@tiptap/extensions/dist/selection/index.cjs +72 -0
  385. package/node_modules/@tiptap/extensions/dist/selection/index.d.cts +20 -0
  386. package/node_modules/@tiptap/extensions/dist/selection/index.d.ts +20 -0
  387. package/node_modules/@tiptap/extensions/dist/selection/index.js +71 -0
  388. package/node_modules/@tiptap/extensions/dist/trailing-node/index.cjs +62 -0
  389. package/node_modules/@tiptap/extensions/dist/trailing-node/index.d.cts +30 -0
  390. package/node_modules/@tiptap/extensions/dist/trailing-node/index.d.ts +30 -0
  391. package/node_modules/@tiptap/extensions/dist/trailing-node/index.js +60 -0
  392. package/node_modules/@tiptap/extensions/dist/undo-redo/index.cjs +48 -0
  393. package/node_modules/@tiptap/extensions/dist/undo-redo/index.d.cts +45 -0
  394. package/node_modules/@tiptap/extensions/dist/undo-redo/index.d.ts +45 -0
  395. package/node_modules/@tiptap/extensions/dist/undo-redo/index.js +47 -0
  396. package/node_modules/@tiptap/extensions/package.json +116 -0
  397. package/node_modules/@tiptap/pm/LICENSE +21 -0
  398. package/node_modules/@tiptap/pm/README.md +22 -0
  399. package/node_modules/@tiptap/pm/THIRD_PARTY_LICENSES.md +47 -0
  400. package/node_modules/@tiptap/pm/changeset/index.ts +1 -0
  401. package/node_modules/@tiptap/pm/commands/index.ts +1 -0
  402. package/node_modules/@tiptap/pm/dist/changeset/index.cjs +9 -0
  403. package/node_modules/@tiptap/pm/dist/changeset/index.d.cts +1 -0
  404. package/node_modules/@tiptap/pm/dist/changeset/index.d.ts +1 -0
  405. package/node_modules/@tiptap/pm/dist/changeset/index.js +2 -0
  406. package/node_modules/@tiptap/pm/dist/commands/index.cjs +9 -0
  407. package/node_modules/@tiptap/pm/dist/commands/index.d.cts +1 -0
  408. package/node_modules/@tiptap/pm/dist/commands/index.d.ts +1 -0
  409. package/node_modules/@tiptap/pm/dist/commands/index.js +2 -0
  410. package/node_modules/@tiptap/pm/dist/dropcursor/index.cjs +9 -0
  411. package/node_modules/@tiptap/pm/dist/dropcursor/index.d.cts +1 -0
  412. package/node_modules/@tiptap/pm/dist/dropcursor/index.d.ts +1 -0
  413. package/node_modules/@tiptap/pm/dist/dropcursor/index.js +2 -0
  414. package/node_modules/@tiptap/pm/dist/gapcursor/index.cjs +9 -0
  415. package/node_modules/@tiptap/pm/dist/gapcursor/index.d.cts +1 -0
  416. package/node_modules/@tiptap/pm/dist/gapcursor/index.d.ts +1 -0
  417. package/node_modules/@tiptap/pm/dist/gapcursor/index.js +2 -0
  418. package/node_modules/@tiptap/pm/dist/history/index.cjs +9 -0
  419. package/node_modules/@tiptap/pm/dist/history/index.d.cts +1 -0
  420. package/node_modules/@tiptap/pm/dist/history/index.d.ts +1 -0
  421. package/node_modules/@tiptap/pm/dist/history/index.js +2 -0
  422. package/node_modules/@tiptap/pm/dist/inputrules/index.cjs +9 -0
  423. package/node_modules/@tiptap/pm/dist/inputrules/index.d.cts +1 -0
  424. package/node_modules/@tiptap/pm/dist/inputrules/index.d.ts +1 -0
  425. package/node_modules/@tiptap/pm/dist/inputrules/index.js +2 -0
  426. package/node_modules/@tiptap/pm/dist/keymap/index.cjs +9 -0
  427. package/node_modules/@tiptap/pm/dist/keymap/index.d.cts +1 -0
  428. package/node_modules/@tiptap/pm/dist/keymap/index.d.ts +1 -0
  429. package/node_modules/@tiptap/pm/dist/keymap/index.js +2 -0
  430. package/node_modules/@tiptap/pm/dist/model/index.cjs +9 -0
  431. package/node_modules/@tiptap/pm/dist/model/index.d.cts +1 -0
  432. package/node_modules/@tiptap/pm/dist/model/index.d.ts +1 -0
  433. package/node_modules/@tiptap/pm/dist/model/index.js +2 -0
  434. package/node_modules/@tiptap/pm/dist/schema-list/index.cjs +9 -0
  435. package/node_modules/@tiptap/pm/dist/schema-list/index.d.cts +1 -0
  436. package/node_modules/@tiptap/pm/dist/schema-list/index.d.ts +1 -0
  437. package/node_modules/@tiptap/pm/dist/schema-list/index.js +2 -0
  438. package/node_modules/@tiptap/pm/dist/state/index.cjs +9 -0
  439. package/node_modules/@tiptap/pm/dist/state/index.d.cts +1 -0
  440. package/node_modules/@tiptap/pm/dist/state/index.d.ts +1 -0
  441. package/node_modules/@tiptap/pm/dist/state/index.js +2 -0
  442. package/node_modules/@tiptap/pm/dist/tables/index.cjs +9 -0
  443. package/node_modules/@tiptap/pm/dist/tables/index.d.cts +1 -0
  444. package/node_modules/@tiptap/pm/dist/tables/index.d.ts +1 -0
  445. package/node_modules/@tiptap/pm/dist/tables/index.js +2 -0
  446. package/node_modules/@tiptap/pm/dist/transform/index.cjs +9 -0
  447. package/node_modules/@tiptap/pm/dist/transform/index.d.cts +1 -0
  448. package/node_modules/@tiptap/pm/dist/transform/index.d.ts +1 -0
  449. package/node_modules/@tiptap/pm/dist/transform/index.js +2 -0
  450. package/node_modules/@tiptap/pm/dist/view/index.cjs +9 -0
  451. package/node_modules/@tiptap/pm/dist/view/index.d.cts +1 -0
  452. package/node_modules/@tiptap/pm/dist/view/index.d.ts +1 -0
  453. package/node_modules/@tiptap/pm/dist/view/index.js +2 -0
  454. package/node_modules/@tiptap/pm/dropcursor/index.ts +1 -0
  455. package/node_modules/@tiptap/pm/gapcursor/index.ts +1 -0
  456. package/node_modules/@tiptap/pm/history/index.ts +1 -0
  457. package/node_modules/@tiptap/pm/inputrules/index.ts +1 -0
  458. package/node_modules/@tiptap/pm/keymap/index.ts +1 -0
  459. package/node_modules/@tiptap/pm/model/index.ts +1 -0
  460. package/node_modules/@tiptap/pm/package.json +166 -0
  461. package/node_modules/@tiptap/pm/schema-list/index.ts +1 -0
  462. package/node_modules/@tiptap/pm/state/index.ts +1 -0
  463. package/node_modules/@tiptap/pm/tables/index.ts +1 -0
  464. package/node_modules/@tiptap/pm/transform/index.ts +1 -0
  465. package/node_modules/@tiptap/pm/view/index.ts +1 -0
  466. package/node_modules/@tiptap/react/LICENSE.md +21 -0
  467. package/node_modules/@tiptap/react/README.md +18 -0
  468. package/node_modules/@tiptap/react/dist/index.cjs +1396 -0
  469. package/node_modules/@tiptap/react/dist/index.d.cts +632 -0
  470. package/node_modules/@tiptap/react/dist/index.d.ts +632 -0
  471. package/node_modules/@tiptap/react/dist/index.js +1337 -0
  472. package/node_modules/@tiptap/react/dist/menus/index.cjs +469 -0
  473. package/node_modules/@tiptap/react/dist/menus/index.d.cts +21 -0
  474. package/node_modules/@tiptap/react/dist/menus/index.d.ts +21 -0
  475. package/node_modules/@tiptap/react/dist/menus/index.js +444 -0
  476. package/node_modules/@tiptap/react/package.json +80 -0
  477. package/node_modules/@tiptap/starter-kit/LICENSE.md +21 -0
  478. package/node_modules/@tiptap/starter-kit/README.md +18 -0
  479. package/node_modules/@tiptap/starter-kit/dist/index.cjs +76 -0
  480. package/node_modules/@tiptap/starter-kit/dist/index.d.cts +137 -0
  481. package/node_modules/@tiptap/starter-kit/dist/index.d.ts +137 -0
  482. package/node_modules/@tiptap/starter-kit/dist/index.js +71 -0
  483. package/node_modules/@tiptap/starter-kit/package.json +70 -0
  484. package/node_modules/@tiptap/suggestion/LICENSE.md +21 -0
  485. package/node_modules/@tiptap/suggestion/README.md +18 -0
  486. package/node_modules/@tiptap/suggestion/dist/index.cjs +665 -0
  487. package/node_modules/@tiptap/suggestion/dist/index.d.cts +419 -0
  488. package/node_modules/@tiptap/suggestion/dist/index.d.ts +419 -0
  489. package/node_modules/@tiptap/suggestion/dist/index.js +657 -0
  490. package/node_modules/@tiptap/suggestion/package.json +54 -0
  491. package/node_modules/@types/use-sync-external-store/LICENSE +21 -0
  492. package/node_modules/@types/use-sync-external-store/README.md +15 -0
  493. package/node_modules/@types/use-sync-external-store/index.d.ts +5 -0
  494. package/node_modules/@types/use-sync-external-store/package.json +30 -0
  495. package/node_modules/@types/use-sync-external-store/shim/index.d.ts +1 -0
  496. package/node_modules/@types/use-sync-external-store/shim/with-selector.d.ts +1 -0
  497. package/node_modules/@types/use-sync-external-store/with-selector.d.ts +7 -0
  498. package/node_modules/fast-equals/LICENSE +21 -0
  499. package/node_modules/fast-equals/README.md +479 -0
  500. package/node_modules/fast-equals/dist/cjs/index.cjs +796 -0
  501. package/node_modules/fast-equals/dist/cjs/index.d.cts +211 -0
  502. package/node_modules/fast-equals/dist/es/index.d.mts +211 -0
  503. package/node_modules/fast-equals/dist/es/index.mjs +785 -0
  504. package/node_modules/fast-equals/dist/umd/index.d.ts +211 -0
  505. package/node_modules/fast-equals/dist/umd/index.js +802 -0
  506. package/node_modules/fast-equals/index.d.ts +211 -0
  507. package/node_modules/fast-equals/package.json +120 -0
  508. package/node_modules/linkifyjs/LICENSE +19 -0
  509. package/node_modules/linkifyjs/README.md +47 -0
  510. package/node_modules/linkifyjs/dist/linkify.cjs +1854 -0
  511. package/node_modules/linkifyjs/dist/linkify.d.cts +637 -0
  512. package/node_modules/linkifyjs/dist/linkify.d.mts +637 -0
  513. package/node_modules/linkifyjs/dist/linkify.js +1859 -0
  514. package/node_modules/linkifyjs/dist/linkify.min.js +1 -0
  515. package/node_modules/linkifyjs/dist/linkify.mjs +1836 -0
  516. package/node_modules/linkifyjs/package.json +38 -0
  517. package/node_modules/orderedmap/LICENSE +19 -0
  518. package/node_modules/orderedmap/README.md +69 -0
  519. package/node_modules/orderedmap/dist/index.cjs +139 -0
  520. package/node_modules/orderedmap/dist/index.d.cts +33 -0
  521. package/node_modules/orderedmap/dist/index.d.ts +33 -0
  522. package/node_modules/orderedmap/dist/index.js +137 -0
  523. package/node_modules/orderedmap/package.json +39 -0
  524. package/node_modules/prosemirror-changeset/CHANGELOG.md +171 -0
  525. package/node_modules/prosemirror-changeset/LICENSE +19 -0
  526. package/node_modules/prosemirror-changeset/README.md +175 -0
  527. package/node_modules/prosemirror-changeset/dist/index.cjs +588 -0
  528. package/node_modules/prosemirror-changeset/dist/index.d.cts +187 -0
  529. package/node_modules/prosemirror-changeset/dist/index.d.ts +187 -0
  530. package/node_modules/prosemirror-changeset/dist/index.js +722 -0
  531. package/node_modules/prosemirror-changeset/package.json +40 -0
  532. package/node_modules/prosemirror-changeset/test/test-changed-range.ts +48 -0
  533. package/node_modules/prosemirror-changeset/test/test-changes.ts +211 -0
  534. package/node_modules/prosemirror-changeset/test/test-diff.ts +77 -0
  535. package/node_modules/prosemirror-changeset/test/test-merge.ts +56 -0
  536. package/node_modules/prosemirror-changeset/test/test-simplify.ts +74 -0
  537. package/node_modules/prosemirror-commands/.tern-project +8 -0
  538. package/node_modules/prosemirror-commands/CHANGELOG.md +328 -0
  539. package/node_modules/prosemirror-commands/CONTRIBUTING.md +104 -0
  540. package/node_modules/prosemirror-commands/LICENSE +19 -0
  541. package/node_modules/prosemirror-commands/README.md +28 -0
  542. package/node_modules/prosemirror-commands/dist/index.cjs +688 -0
  543. package/node_modules/prosemirror-commands/dist/index.d.cts +215 -0
  544. package/node_modules/prosemirror-commands/dist/index.d.ts +215 -0
  545. package/node_modules/prosemirror-commands/dist/index.js +852 -0
  546. package/node_modules/prosemirror-commands/package.json +39 -0
  547. package/node_modules/prosemirror-dropcursor/CHANGELOG.md +149 -0
  548. package/node_modules/prosemirror-dropcursor/CONTRIBUTING.md +104 -0
  549. package/node_modules/prosemirror-dropcursor/LICENSE +19 -0
  550. package/node_modules/prosemirror-dropcursor/README.md +50 -0
  551. package/node_modules/prosemirror-dropcursor/dist/index.cjs +200 -0
  552. package/node_modules/prosemirror-dropcursor/dist/index.d.cts +38 -0
  553. package/node_modules/prosemirror-dropcursor/dist/index.d.ts +38 -0
  554. package/node_modules/prosemirror-dropcursor/dist/index.js +163 -0
  555. package/node_modules/prosemirror-dropcursor/package.json +38 -0
  556. package/node_modules/prosemirror-gapcursor/CHANGELOG.md +122 -0
  557. package/node_modules/prosemirror-gapcursor/CONTRIBUTING.md +104 -0
  558. package/node_modules/prosemirror-gapcursor/LICENSE +19 -0
  559. package/node_modules/prosemirror-gapcursor/README.md +31 -0
  560. package/node_modules/prosemirror-gapcursor/dist/index.cjs +239 -0
  561. package/node_modules/prosemirror-gapcursor/dist/index.d.cts +31 -0
  562. package/node_modules/prosemirror-gapcursor/dist/index.d.ts +31 -0
  563. package/node_modules/prosemirror-gapcursor/dist/index.js +239 -0
  564. package/node_modules/prosemirror-gapcursor/package.json +43 -0
  565. package/node_modules/prosemirror-gapcursor/style/gapcursor.css +25 -0
  566. package/node_modules/prosemirror-history/.tern-project +8 -0
  567. package/node_modules/prosemirror-history/CHANGELOG.md +176 -0
  568. package/node_modules/prosemirror-history/CONTRIBUTING.md +104 -0
  569. package/node_modules/prosemirror-history/LICENSE +19 -0
  570. package/node_modules/prosemirror-history/README.md +27 -0
  571. package/node_modules/prosemirror-history/dist/index.cjs +383 -0
  572. package/node_modules/prosemirror-history/dist/index.d.cts +64 -0
  573. package/node_modules/prosemirror-history/dist/index.d.ts +64 -0
  574. package/node_modules/prosemirror-history/dist/index.js +454 -0
  575. package/node_modules/prosemirror-history/package.json +40 -0
  576. package/node_modules/prosemirror-inputrules/.tern-project +8 -0
  577. package/node_modules/prosemirror-inputrules/CHANGELOG.md +127 -0
  578. package/node_modules/prosemirror-inputrules/CONTRIBUTING.md +104 -0
  579. package/node_modules/prosemirror-inputrules/LICENSE +19 -0
  580. package/node_modules/prosemirror-inputrules/README.md +29 -0
  581. package/node_modules/prosemirror-inputrules/dist/index.cjs +194 -0
  582. package/node_modules/prosemirror-inputrules/dist/index.d.cts +131 -0
  583. package/node_modules/prosemirror-inputrules/dist/index.d.ts +131 -0
  584. package/node_modules/prosemirror-inputrules/dist/index.js +239 -0
  585. package/node_modules/prosemirror-inputrules/package.json +36 -0
  586. package/node_modules/prosemirror-keymap/.tern-project +8 -0
  587. package/node_modules/prosemirror-keymap/CHANGELOG.md +104 -0
  588. package/node_modules/prosemirror-keymap/CONTRIBUTING.md +104 -0
  589. package/node_modules/prosemirror-keymap/LICENSE +19 -0
  590. package/node_modules/prosemirror-keymap/README.md +27 -0
  591. package/node_modules/prosemirror-keymap/dist/index.cjs +65 -0
  592. package/node_modules/prosemirror-keymap/dist/index.d.cts +47 -0
  593. package/node_modules/prosemirror-keymap/dist/index.d.ts +47 -0
  594. package/node_modules/prosemirror-keymap/dist/index.js +128 -0
  595. package/node_modules/prosemirror-keymap/package.json +38 -0
  596. package/node_modules/prosemirror-model/.tern-project +8 -0
  597. package/node_modules/prosemirror-model/CHANGELOG.md +782 -0
  598. package/node_modules/prosemirror-model/CONTRIBUTING.md +104 -0
  599. package/node_modules/prosemirror-model/LICENSE +19 -0
  600. package/node_modules/prosemirror-model/README.md +29 -0
  601. package/node_modules/prosemirror-model/dist/index.cjs +2911 -0
  602. package/node_modules/prosemirror-model/dist/index.d.cts +1683 -0
  603. package/node_modules/prosemirror-model/dist/index.d.ts +1683 -0
  604. package/node_modules/prosemirror-model/dist/index.js +3463 -0
  605. package/node_modules/prosemirror-model/package.json +38 -0
  606. package/node_modules/prosemirror-schema-list/.tern-project +8 -0
  607. package/node_modules/prosemirror-schema-list/CHANGELOG.md +140 -0
  608. package/node_modules/prosemirror-schema-list/CONTRIBUTING.md +100 -0
  609. package/node_modules/prosemirror-schema-list/LICENSE +19 -0
  610. package/node_modules/prosemirror-schema-list/README.md +28 -0
  611. package/node_modules/prosemirror-schema-list/dist/index.cjs +253 -0
  612. package/node_modules/prosemirror-schema-list/dist/index.d.cts +71 -0
  613. package/node_modules/prosemirror-schema-list/dist/index.d.ts +71 -0
  614. package/node_modules/prosemirror-schema-list/dist/index.js +289 -0
  615. package/node_modules/prosemirror-schema-list/package.json +40 -0
  616. package/node_modules/prosemirror-state/.tern-project +8 -0
  617. package/node_modules/prosemirror-state/CHANGELOG.md +296 -0
  618. package/node_modules/prosemirror-state/CONTRIBUTING.md +104 -0
  619. package/node_modules/prosemirror-state/LICENSE +19 -0
  620. package/node_modules/prosemirror-state/README.md +28 -0
  621. package/node_modules/prosemirror-state/dist/index.cjs +884 -0
  622. package/node_modules/prosemirror-state/dist/index.d.cts +709 -0
  623. package/node_modules/prosemirror-state/dist/index.d.ts +709 -0
  624. package/node_modules/prosemirror-state/dist/index.js +1002 -0
  625. package/node_modules/prosemirror-state/package.json +39 -0
  626. package/node_modules/prosemirror-tables/LICENSE +19 -0
  627. package/node_modules/prosemirror-tables/README.md +254 -0
  628. package/node_modules/prosemirror-tables/dist/index.cjs +2683 -0
  629. package/node_modules/prosemirror-tables/dist/index.d.cts +751 -0
  630. package/node_modules/prosemirror-tables/dist/index.d.ts +751 -0
  631. package/node_modules/prosemirror-tables/dist/index.js +2626 -0
  632. package/node_modules/prosemirror-tables/package.json +80 -0
  633. package/node_modules/prosemirror-tables/style/tables.css +48 -0
  634. package/node_modules/prosemirror-transform/.tern-project +8 -0
  635. package/node_modules/prosemirror-transform/CHANGELOG.md +530 -0
  636. package/node_modules/prosemirror-transform/CONTRIBUTING.md +104 -0
  637. package/node_modules/prosemirror-transform/LICENSE +19 -0
  638. package/node_modules/prosemirror-transform/README.md +29 -0
  639. package/node_modules/prosemirror-transform/dist/index.cjs +2014 -0
  640. package/node_modules/prosemirror-transform/dist/index.d.cts +857 -0
  641. package/node_modules/prosemirror-transform/dist/index.d.ts +857 -0
  642. package/node_modules/prosemirror-transform/dist/index.js +2272 -0
  643. package/node_modules/prosemirror-transform/package.json +37 -0
  644. package/node_modules/prosemirror-view/.tern-project +8 -0
  645. package/node_modules/prosemirror-view/CHANGELOG.md +2543 -0
  646. package/node_modules/prosemirror-view/CONTRIBUTING.md +104 -0
  647. package/node_modules/prosemirror-view/LICENSE +19 -0
  648. package/node_modules/prosemirror-view/README.md +28 -0
  649. package/node_modules/prosemirror-view/dist/index.cjs +5549 -0
  650. package/node_modules/prosemirror-view/dist/index.d.cts +913 -0
  651. package/node_modules/prosemirror-view/dist/index.d.ts +913 -0
  652. package/node_modules/prosemirror-view/dist/index.js +6053 -0
  653. package/node_modules/prosemirror-view/package.json +43 -0
  654. package/node_modules/prosemirror-view/style/prosemirror.css +54 -0
  655. package/node_modules/rope-sequence/LICENSE +19 -0
  656. package/node_modules/rope-sequence/README.md +63 -0
  657. package/node_modules/rope-sequence/dist/index.cjs +209 -0
  658. package/node_modules/rope-sequence/dist/index.d.cts +11 -0
  659. package/node_modules/rope-sequence/dist/index.d.ts +11 -0
  660. package/node_modules/rope-sequence/dist/index.js +207 -0
  661. package/node_modules/rope-sequence/index.js +190 -0
  662. package/node_modules/rope-sequence/package.json +34 -0
  663. package/node_modules/rope-sequence/test.js +78 -0
  664. package/node_modules/use-sync-external-store/LICENSE +21 -0
  665. package/node_modules/use-sync-external-store/README.md +5 -0
  666. package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js +97 -0
  667. package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js +85 -0
  668. package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +95 -0
  669. package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.native.development.js +88 -0
  670. package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.native.production.js +59 -0
  671. package/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +66 -0
  672. package/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js +96 -0
  673. package/node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.js +84 -0
  674. package/node_modules/use-sync-external-store/cjs/use-sync-external-store.development.js +27 -0
  675. package/node_modules/use-sync-external-store/cjs/use-sync-external-store.production.js +13 -0
  676. package/node_modules/use-sync-external-store/index.js +7 -0
  677. package/node_modules/use-sync-external-store/package.json +43 -0
  678. package/node_modules/use-sync-external-store/shim/index.js +7 -0
  679. package/node_modules/use-sync-external-store/shim/index.native.js +7 -0
  680. package/node_modules/use-sync-external-store/shim/with-selector.js +7 -0
  681. package/node_modules/use-sync-external-store/with-selector.js +7 -0
  682. package/node_modules/w3c-keyname/.tern-port +1 -0
  683. package/node_modules/w3c-keyname/LICENSE +19 -0
  684. package/node_modules/w3c-keyname/README.md +18 -0
  685. package/node_modules/w3c-keyname/index.cjs +127 -0
  686. package/node_modules/w3c-keyname/index.d.cts +5 -0
  687. package/node_modules/w3c-keyname/index.d.ts +5 -0
  688. package/node_modules/w3c-keyname/index.js +119 -0
  689. package/node_modules/w3c-keyname/package.json +37 -0
  690. package/package.json +79 -4
  691. package/src/Editor.tsx +424 -0
  692. package/src/ask.tsx +154 -0
  693. package/src/basic.tsx +149 -0
  694. package/src/blockMeta.ts +42 -0
  695. package/src/blockops.ts +179 -0
  696. package/src/blocks.tsx +189 -0
  697. package/src/content.ts +22 -0
  698. package/src/dynamic.tsx +105 -0
  699. package/src/editor.css +345 -0
  700. package/src/extensions.ts +78 -0
  701. package/src/handle.tsx +186 -0
  702. package/src/handles.tsx +149 -0
  703. package/src/index.ts +29 -0
  704. package/src/insert.ts +9 -0
  705. package/src/inserter.tsx +163 -0
  706. package/src/inspector.tsx +237 -0
  707. package/src/labels.ts +135 -0
  708. package/src/layout.tsx +174 -0
  709. package/src/layoutUi.tsx +226 -0
  710. package/src/media.ts +31 -0
  711. package/src/nodes.tsx +107 -0
  712. package/src/outline.tsx +124 -0
  713. package/src/panels.ts +59 -0
  714. package/src/paste.ts +100 -0
  715. package/src/patterns.ts +129 -0
  716. package/src/rank.ts +22 -0
  717. package/src/registry.ts +20 -0
  718. package/src/styleattr.ts +55 -0
  719. package/src/stylepanel.tsx +275 -0
  720. package/src/synced.tsx +128 -0
  721. package/src/toolbar.tsx +238 -0
  722. package/src/types.ts +55 -0
  723. package/src/unknown.tsx +74 -0
  724. package/src/util.ts +3 -0
@@ -0,0 +1,2014 @@
1
+ 'use strict';
2
+
3
+ function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
4
+ function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
5
+ function _isNativeFunction(fn) { try { return Function.toString.call(fn).indexOf("[native code]") !== -1; } catch (e) { return typeof fn === "function"; } }
6
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
7
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
10
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
11
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
13
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
14
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
15
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
16
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
17
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
19
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
20
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
21
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
22
+ var prosemirrorModel = require('prosemirror-model');
23
+ var lower16 = 0xffff;
24
+ var factor16 = Math.pow(2, 16);
25
+ function makeRecover(index, offset) {
26
+ return index + offset * factor16;
27
+ }
28
+ function recoverIndex(value) {
29
+ return value & lower16;
30
+ }
31
+ function recoverOffset(value) {
32
+ return (value - (value & lower16)) / factor16;
33
+ }
34
+ var DEL_BEFORE = 1,
35
+ DEL_AFTER = 2,
36
+ DEL_ACROSS = 4,
37
+ DEL_SIDE = 8;
38
+ var MapResult = function () {
39
+ function MapResult(pos, delInfo, recover) {
40
+ _classCallCheck(this, MapResult);
41
+ this.pos = pos;
42
+ this.delInfo = delInfo;
43
+ this.recover = recover;
44
+ }
45
+ _createClass(MapResult, [{
46
+ key: "deleted",
47
+ get: function get() {
48
+ return (this.delInfo & DEL_SIDE) > 0;
49
+ }
50
+ }, {
51
+ key: "deletedBefore",
52
+ get: function get() {
53
+ return (this.delInfo & (DEL_BEFORE | DEL_ACROSS)) > 0;
54
+ }
55
+ }, {
56
+ key: "deletedAfter",
57
+ get: function get() {
58
+ return (this.delInfo & (DEL_AFTER | DEL_ACROSS)) > 0;
59
+ }
60
+ }, {
61
+ key: "deletedAcross",
62
+ get: function get() {
63
+ return (this.delInfo & DEL_ACROSS) > 0;
64
+ }
65
+ }]);
66
+ return MapResult;
67
+ }();
68
+ var StepMap = function () {
69
+ function StepMap(ranges) {
70
+ var inverted = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
71
+ _classCallCheck(this, StepMap);
72
+ this.ranges = ranges;
73
+ this.inverted = inverted;
74
+ if (!ranges.length && StepMap.empty) return StepMap.empty;
75
+ }
76
+ _createClass(StepMap, [{
77
+ key: "recover",
78
+ value: function recover(value) {
79
+ var diff = 0,
80
+ index = recoverIndex(value);
81
+ if (!this.inverted) for (var i = 0; i < index; i++) diff += this.ranges[i * 3 + 2] - this.ranges[i * 3 + 1];
82
+ return this.ranges[index * 3] + diff + recoverOffset(value);
83
+ }
84
+ }, {
85
+ key: "mapResult",
86
+ value: function mapResult(pos) {
87
+ var assoc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
88
+ return this._map(pos, assoc, false);
89
+ }
90
+ }, {
91
+ key: "map",
92
+ value: function map(pos) {
93
+ var assoc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
94
+ return this._map(pos, assoc, true);
95
+ }
96
+ }, {
97
+ key: "_map",
98
+ value: function _map(pos, assoc, simple) {
99
+ var diff = 0,
100
+ oldIndex = this.inverted ? 2 : 1,
101
+ newIndex = this.inverted ? 1 : 2;
102
+ for (var i = 0; i < this.ranges.length; i += 3) {
103
+ var start = this.ranges[i] - (this.inverted ? diff : 0);
104
+ if (start > pos) break;
105
+ var oldSize = this.ranges[i + oldIndex],
106
+ newSize = this.ranges[i + newIndex],
107
+ end = start + oldSize;
108
+ if (pos <= end) {
109
+ var side = !oldSize ? assoc : pos == start ? -1 : pos == end ? 1 : assoc;
110
+ var result = start + diff + (side < 0 ? 0 : newSize);
111
+ if (simple) return result;
112
+ var recover = pos == (assoc < 0 ? start : end) ? null : makeRecover(i / 3, pos - start);
113
+ var del = 0;
114
+ if (oldSize) {
115
+ del |= pos == start ? DEL_AFTER : pos == end ? DEL_BEFORE : DEL_ACROSS;
116
+ if (assoc < 0 ? pos != start : pos != end) del |= DEL_SIDE;
117
+ }
118
+ return new MapResult(result, del, recover);
119
+ }
120
+ diff += newSize - oldSize;
121
+ }
122
+ return simple ? pos + diff : new MapResult(pos + diff, 0, null);
123
+ }
124
+ }, {
125
+ key: "touches",
126
+ value: function touches(pos, recover) {
127
+ var diff = 0,
128
+ index = recoverIndex(recover);
129
+ var oldIndex = this.inverted ? 2 : 1,
130
+ newIndex = this.inverted ? 1 : 2;
131
+ for (var i = 0; i < this.ranges.length; i += 3) {
132
+ var start = this.ranges[i] - (this.inverted ? diff : 0);
133
+ if (start > pos) break;
134
+ var oldSize = this.ranges[i + oldIndex],
135
+ end = start + oldSize;
136
+ if (pos <= end && i == index * 3) return true;
137
+ diff += this.ranges[i + newIndex] - oldSize;
138
+ }
139
+ return false;
140
+ }
141
+ }, {
142
+ key: "forEach",
143
+ value: function forEach(f) {
144
+ var oldIndex = this.inverted ? 2 : 1,
145
+ newIndex = this.inverted ? 1 : 2;
146
+ for (var i = 0, diff = 0; i < this.ranges.length; i += 3) {
147
+ var start = this.ranges[i],
148
+ oldStart = start - (this.inverted ? diff : 0),
149
+ newStart = start + (this.inverted ? 0 : diff);
150
+ var oldSize = this.ranges[i + oldIndex],
151
+ newSize = this.ranges[i + newIndex];
152
+ f(oldStart, oldStart + oldSize, newStart, newStart + newSize);
153
+ diff += newSize - oldSize;
154
+ }
155
+ }
156
+ }, {
157
+ key: "invert",
158
+ value: function invert() {
159
+ return new StepMap(this.ranges, !this.inverted);
160
+ }
161
+ }, {
162
+ key: "toString",
163
+ value: function toString() {
164
+ return (this.inverted ? "-" : "") + JSON.stringify(this.ranges);
165
+ }
166
+ }], [{
167
+ key: "offset",
168
+ value: function offset(n) {
169
+ return n == 0 ? StepMap.empty : new StepMap(n < 0 ? [0, -n, 0] : [0, 0, n]);
170
+ }
171
+ }]);
172
+ return StepMap;
173
+ }();
174
+ StepMap.empty = new StepMap([]);
175
+ var Mapping = function () {
176
+ function Mapping(maps, mirror) {
177
+ var from = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
178
+ var to = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : maps ? maps.length : 0;
179
+ _classCallCheck(this, Mapping);
180
+ this.mirror = mirror;
181
+ this.from = from;
182
+ this.to = to;
183
+ this._maps = maps || [];
184
+ this.ownData = !(maps || mirror);
185
+ }
186
+ _createClass(Mapping, [{
187
+ key: "maps",
188
+ get: function get() {
189
+ return this._maps;
190
+ }
191
+ }, {
192
+ key: "slice",
193
+ value: function slice() {
194
+ var from = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
195
+ var to = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.maps.length;
196
+ return new Mapping(this._maps, this.mirror, from, to);
197
+ }
198
+ }, {
199
+ key: "appendMap",
200
+ value: function appendMap(map, mirrors) {
201
+ if (!this.ownData) {
202
+ this._maps = this._maps.slice();
203
+ this.mirror = this.mirror && this.mirror.slice();
204
+ this.ownData = true;
205
+ }
206
+ this.to = this._maps.push(map);
207
+ if (mirrors != null) this.setMirror(this._maps.length - 1, mirrors);
208
+ }
209
+ }, {
210
+ key: "appendMapping",
211
+ value: function appendMapping(mapping) {
212
+ for (var i = 0, startSize = this._maps.length; i < mapping._maps.length; i++) {
213
+ var mirr = mapping.getMirror(i);
214
+ this.appendMap(mapping._maps[i], mirr != null && mirr < i ? startSize + mirr : undefined);
215
+ }
216
+ }
217
+ }, {
218
+ key: "getMirror",
219
+ value: function getMirror(n) {
220
+ if (this.mirror) for (var i = 0; i < this.mirror.length; i++) if (this.mirror[i] == n) return this.mirror[i + (i % 2 ? -1 : 1)];
221
+ }
222
+ }, {
223
+ key: "setMirror",
224
+ value: function setMirror(n, m) {
225
+ if (!this.mirror) this.mirror = [];
226
+ this.mirror.push(n, m);
227
+ }
228
+ }, {
229
+ key: "appendMappingInverted",
230
+ value: function appendMappingInverted(mapping) {
231
+ for (var i = mapping.maps.length - 1, totalSize = this._maps.length + mapping._maps.length; i >= 0; i--) {
232
+ var mirr = mapping.getMirror(i);
233
+ this.appendMap(mapping._maps[i].invert(), mirr != null && mirr > i ? totalSize - mirr - 1 : undefined);
234
+ }
235
+ }
236
+ }, {
237
+ key: "invert",
238
+ value: function invert() {
239
+ var inverse = new Mapping();
240
+ inverse.appendMappingInverted(this);
241
+ return inverse;
242
+ }
243
+ }, {
244
+ key: "map",
245
+ value: function map(pos) {
246
+ var assoc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
247
+ if (this.mirror) return this._map(pos, assoc, true);
248
+ for (var i = this.from; i < this.to; i++) pos = this._maps[i].map(pos, assoc);
249
+ return pos;
250
+ }
251
+ }, {
252
+ key: "mapResult",
253
+ value: function mapResult(pos) {
254
+ var assoc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
255
+ return this._map(pos, assoc, false);
256
+ }
257
+ }, {
258
+ key: "_map",
259
+ value: function _map(pos, assoc, simple) {
260
+ var delInfo = 0;
261
+ for (var i = this.from; i < this.to; i++) {
262
+ var map = this._maps[i],
263
+ result = map.mapResult(pos, assoc);
264
+ if (result.recover != null) {
265
+ var corr = this.getMirror(i);
266
+ if (corr != null && corr > i && corr < this.to) {
267
+ i = corr;
268
+ pos = this._maps[corr].recover(result.recover);
269
+ continue;
270
+ }
271
+ }
272
+ delInfo |= result.delInfo;
273
+ pos = result.pos;
274
+ }
275
+ return simple ? pos : new MapResult(pos, delInfo, null);
276
+ }
277
+ }]);
278
+ return Mapping;
279
+ }();
280
+ var stepsByID = Object.create(null);
281
+ var Step = function () {
282
+ function Step() {
283
+ _classCallCheck(this, Step);
284
+ }
285
+ _createClass(Step, [{
286
+ key: "getMap",
287
+ value: function getMap() {
288
+ return StepMap.empty;
289
+ }
290
+ }, {
291
+ key: "merge",
292
+ value: function merge(other) {
293
+ return null;
294
+ }
295
+ }], [{
296
+ key: "fromJSON",
297
+ value: function fromJSON(schema, json) {
298
+ if (!json || !json.stepType) throw new RangeError("Invalid input for Step.fromJSON");
299
+ var type = stepsByID[json.stepType];
300
+ if (!type) throw new RangeError("No step type ".concat(json.stepType, " defined"));
301
+ return type.fromJSON(schema, json);
302
+ }
303
+ }, {
304
+ key: "jsonID",
305
+ value: function jsonID(id, stepClass) {
306
+ if (id in stepsByID) throw new RangeError("Duplicate use of step JSON ID " + id);
307
+ stepsByID[id] = stepClass;
308
+ stepClass.prototype.jsonID = id;
309
+ return stepClass;
310
+ }
311
+ }]);
312
+ return Step;
313
+ }();
314
+ var StepResult = function () {
315
+ function StepResult(doc, failed) {
316
+ _classCallCheck(this, StepResult);
317
+ this.doc = doc;
318
+ this.failed = failed;
319
+ }
320
+ _createClass(StepResult, null, [{
321
+ key: "ok",
322
+ value: function ok(doc) {
323
+ return new StepResult(doc, null);
324
+ }
325
+ }, {
326
+ key: "fail",
327
+ value: function fail(message) {
328
+ return new StepResult(null, message);
329
+ }
330
+ }, {
331
+ key: "fromReplace",
332
+ value: function fromReplace(doc, from, to, slice) {
333
+ try {
334
+ return StepResult.ok(doc.replace(from, to, slice));
335
+ } catch (e) {
336
+ if (e instanceof prosemirrorModel.ReplaceError) return StepResult.fail(e.message);
337
+ throw e;
338
+ }
339
+ }
340
+ }]);
341
+ return StepResult;
342
+ }();
343
+ function mapFragment(fragment, f, parent) {
344
+ var mapped = [];
345
+ for (var i = 0; i < fragment.childCount; i++) {
346
+ var child = fragment.child(i);
347
+ if (child.content.size) child = child.copy(mapFragment(child.content, f, child));
348
+ if (child.isInline) child = f(child, parent, i);
349
+ mapped.push(child);
350
+ }
351
+ return prosemirrorModel.Fragment.fromArray(mapped);
352
+ }
353
+ var AddMarkStep = function (_Step) {
354
+ _inherits(AddMarkStep, _Step);
355
+ var _super = _createSuper(AddMarkStep);
356
+ function AddMarkStep(from, to, mark) {
357
+ var _this;
358
+ _classCallCheck(this, AddMarkStep);
359
+ _this = _super.call(this);
360
+ _this.from = from;
361
+ _this.to = to;
362
+ _this.mark = mark;
363
+ return _this;
364
+ }
365
+ _createClass(AddMarkStep, [{
366
+ key: "apply",
367
+ value: function apply(doc) {
368
+ var _this2 = this;
369
+ if (this.from == this.to) return new StepResult(doc, null);
370
+ var oldSlice = doc.slice(this.from, this.to),
371
+ $from = doc.resolve(this.from);
372
+ var parent = $from.node($from.sharedDepth(this.to));
373
+ var slice = new prosemirrorModel.Slice(mapFragment(oldSlice.content, function (node, parent) {
374
+ if (!node.isAtom || !parent.type.allowsMarkType(_this2.mark.type)) return node;
375
+ return node.mark(_this2.mark.addToSet(node.marks));
376
+ }, parent), oldSlice.openStart, oldSlice.openEnd);
377
+ return StepResult.fromReplace(doc, this.from, this.to, slice);
378
+ }
379
+ }, {
380
+ key: "invert",
381
+ value: function invert(doc) {
382
+ var _this3 = this;
383
+ var steps = [];
384
+ doc.nodesBetween(this.from, this.to, function (node, pos) {
385
+ if (node.isInline && node.isAtom) {
386
+ var added = _this3.mark.addToSet(node.marks);
387
+ if (!prosemirrorModel.Mark.sameSet(added, node.marks)) {
388
+ var from = Math.max(_this3.from, pos),
389
+ to = Math.min(_this3.to, pos + node.nodeSize);
390
+ steps.push(new RemoveMarkStep(from, to, _this3.mark));
391
+ var _iterator = _createForOfIteratorHelper(node.marks),
392
+ _step;
393
+ try {
394
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
395
+ var mark = _step.value;
396
+ if (!mark.isInSet(added)) steps.push(new AddMarkStep(from, to, mark));
397
+ }
398
+ } catch (err) {
399
+ _iterator.e(err);
400
+ } finally {
401
+ _iterator.f();
402
+ }
403
+ }
404
+ }
405
+ });
406
+ return steps.length == 0 ? new RemoveMarkStep(this.from, this.from, this.mark) : steps.length == 1 ? steps[0] : new MarkSetStep(steps);
407
+ }
408
+ }, {
409
+ key: "map",
410
+ value: function map(mapping) {
411
+ var from = mapping.map(this.from, 1),
412
+ to = mapping.map(this.to, -1);
413
+ if (from >= to) return null;
414
+ return new AddMarkStep(from, to, this.mark);
415
+ }
416
+ }, {
417
+ key: "merge",
418
+ value: function merge(other) {
419
+ if (other instanceof AddMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from) return new AddMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);
420
+ return null;
421
+ }
422
+ }, {
423
+ key: "toJSON",
424
+ value: function toJSON() {
425
+ return {
426
+ stepType: "addMark",
427
+ mark: this.mark.toJSON(),
428
+ from: this.from,
429
+ to: this.to
430
+ };
431
+ }
432
+ }], [{
433
+ key: "fromJSON",
434
+ value: function fromJSON(schema, json) {
435
+ if (typeof json.from != "number" || typeof json.to != "number") throw new RangeError("Invalid input for AddMarkStep.fromJSON");
436
+ return new AddMarkStep(json.from, json.to, schema.markFromJSON(json.mark));
437
+ }
438
+ }]);
439
+ return AddMarkStep;
440
+ }(Step);
441
+ Step.jsonID("addMark", AddMarkStep);
442
+ var RemoveMarkStep = function (_Step2) {
443
+ _inherits(RemoveMarkStep, _Step2);
444
+ var _super2 = _createSuper(RemoveMarkStep);
445
+ function RemoveMarkStep(from, to, mark) {
446
+ var _this4;
447
+ _classCallCheck(this, RemoveMarkStep);
448
+ _this4 = _super2.call(this);
449
+ _this4.from = from;
450
+ _this4.to = to;
451
+ _this4.mark = mark;
452
+ return _this4;
453
+ }
454
+ _createClass(RemoveMarkStep, [{
455
+ key: "apply",
456
+ value: function apply(doc) {
457
+ var _this5 = this;
458
+ if (this.from == this.to) return new StepResult(doc, null);
459
+ var oldSlice = doc.slice(this.from, this.to);
460
+ var slice = new prosemirrorModel.Slice(mapFragment(oldSlice.content, function (node) {
461
+ return node.mark(_this5.mark.removeFromSet(node.marks));
462
+ }, doc), oldSlice.openStart, oldSlice.openEnd);
463
+ return StepResult.fromReplace(doc, this.from, this.to, slice);
464
+ }
465
+ }, {
466
+ key: "invert",
467
+ value: function invert(doc) {
468
+ var _this6 = this;
469
+ var steps = [];
470
+ doc.nodesBetween(this.from, this.to, function (node, pos) {
471
+ if (node.isInline && node.isAtom && _this6.mark.isInSet(node.marks)) steps.push(new AddMarkStep(Math.max(_this6.from, pos), Math.min(_this6.to, pos + node.nodeSize), _this6.mark));
472
+ });
473
+ return steps.length == 0 ? new AddMarkStep(this.from, this.from, this.mark) : steps.length == 1 ? steps[0] : new MarkSetStep(steps);
474
+ }
475
+ }, {
476
+ key: "map",
477
+ value: function map(mapping) {
478
+ var from = mapping.map(this.from, 1),
479
+ to = mapping.map(this.to, -1);
480
+ if (from >= to) return null;
481
+ return new RemoveMarkStep(from, to, this.mark);
482
+ }
483
+ }, {
484
+ key: "merge",
485
+ value: function merge(other) {
486
+ if (other instanceof RemoveMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from) return new RemoveMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);
487
+ return null;
488
+ }
489
+ }, {
490
+ key: "toJSON",
491
+ value: function toJSON() {
492
+ return {
493
+ stepType: "removeMark",
494
+ mark: this.mark.toJSON(),
495
+ from: this.from,
496
+ to: this.to
497
+ };
498
+ }
499
+ }], [{
500
+ key: "fromJSON",
501
+ value: function fromJSON(schema, json) {
502
+ if (typeof json.from != "number" || typeof json.to != "number") throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");
503
+ return new RemoveMarkStep(json.from, json.to, schema.markFromJSON(json.mark));
504
+ }
505
+ }]);
506
+ return RemoveMarkStep;
507
+ }(Step);
508
+ Step.jsonID("removeMark", RemoveMarkStep);
509
+ var MarkSetStep = function (_Step3) {
510
+ _inherits(MarkSetStep, _Step3);
511
+ var _super3 = _createSuper(MarkSetStep);
512
+ function MarkSetStep(steps) {
513
+ var _this7;
514
+ _classCallCheck(this, MarkSetStep);
515
+ _this7 = _super3.call(this);
516
+ _this7.steps = steps;
517
+ return _this7;
518
+ }
519
+ _createClass(MarkSetStep, [{
520
+ key: "apply",
521
+ value: function apply(doc) {
522
+ var _iterator2 = _createForOfIteratorHelper(this.steps),
523
+ _step2;
524
+ try {
525
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
526
+ var step = _step2.value;
527
+ var result = step.apply(doc);
528
+ if (!result.doc) return result;
529
+ doc = result.doc;
530
+ }
531
+ } catch (err) {
532
+ _iterator2.e(err);
533
+ } finally {
534
+ _iterator2.f();
535
+ }
536
+ return new StepResult(doc, null);
537
+ }
538
+ }, {
539
+ key: "invert",
540
+ value: function invert(doc) {
541
+ return new MarkSetStep(this.steps.map(function (s) {
542
+ return s.invert(doc);
543
+ }));
544
+ }
545
+ }, {
546
+ key: "map",
547
+ value: function map(mapping) {
548
+ var result = [];
549
+ var _iterator3 = _createForOfIteratorHelper(this.steps),
550
+ _step3;
551
+ try {
552
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
553
+ var step = _step3.value;
554
+ var mapped = step.map(mapping);
555
+ if (mapped) result.push(mapped);
556
+ }
557
+ } catch (err) {
558
+ _iterator3.e(err);
559
+ } finally {
560
+ _iterator3.f();
561
+ }
562
+ return result.length ? new MarkSetStep(result) : null;
563
+ }
564
+ }, {
565
+ key: "toJSON",
566
+ value: function toJSON() {
567
+ return {
568
+ stepType: "markSet",
569
+ steps: this.steps.map(function (s) {
570
+ return s.toJSON();
571
+ })
572
+ };
573
+ }
574
+ }, {
575
+ key: "fromJSON",
576
+ value: function fromJSON(schema, json) {
577
+ if (!Array.isArray(json.steps) || !json.steps.every(function (s) {
578
+ return s.stepType == "addMark" || s.stepType == "removeMark";
579
+ })) throw new RangeError("Invalid JSON for MarkSetStep");
580
+ return new MarkSetStep(json.steps.map(function (s) {
581
+ return Step.fromJSON(schema, s);
582
+ }));
583
+ }
584
+ }]);
585
+ return MarkSetStep;
586
+ }(Step);
587
+ Step.jsonID("markSet", MarkSetStep);
588
+ var AddNodeMarkStep = function (_Step4) {
589
+ _inherits(AddNodeMarkStep, _Step4);
590
+ var _super4 = _createSuper(AddNodeMarkStep);
591
+ function AddNodeMarkStep(pos, mark) {
592
+ var _this8;
593
+ _classCallCheck(this, AddNodeMarkStep);
594
+ _this8 = _super4.call(this);
595
+ _this8.pos = pos;
596
+ _this8.mark = mark;
597
+ return _this8;
598
+ }
599
+ _createClass(AddNodeMarkStep, [{
600
+ key: "apply",
601
+ value: function apply(doc) {
602
+ var node = doc.nodeAt(this.pos);
603
+ if (!node) return StepResult.fail("No node at mark step's position");
604
+ var updated = node.type.create(node.attrs, null, this.mark.addToSet(node.marks));
605
+ return StepResult.fromReplace(doc, this.pos, this.pos + 1, new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(updated), 0, node.isLeaf ? 0 : 1));
606
+ }
607
+ }, {
608
+ key: "invert",
609
+ value: function invert(doc) {
610
+ var node = doc.nodeAt(this.pos);
611
+ if (node) {
612
+ var newSet = this.mark.addToSet(node.marks);
613
+ if (newSet.length == node.marks.length) {
614
+ for (var i = 0; i < node.marks.length; i++) if (!node.marks[i].isInSet(newSet)) return new AddNodeMarkStep(this.pos, node.marks[i]);
615
+ return new AddNodeMarkStep(this.pos, this.mark);
616
+ }
617
+ }
618
+ return new RemoveNodeMarkStep(this.pos, this.mark);
619
+ }
620
+ }, {
621
+ key: "map",
622
+ value: function map(mapping) {
623
+ var pos = mapping.mapResult(this.pos, 1);
624
+ return pos.deletedAfter ? null : new AddNodeMarkStep(pos.pos, this.mark);
625
+ }
626
+ }, {
627
+ key: "toJSON",
628
+ value: function toJSON() {
629
+ return {
630
+ stepType: "addNodeMark",
631
+ pos: this.pos,
632
+ mark: this.mark.toJSON()
633
+ };
634
+ }
635
+ }], [{
636
+ key: "fromJSON",
637
+ value: function fromJSON(schema, json) {
638
+ if (typeof json.pos != "number") throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");
639
+ return new AddNodeMarkStep(json.pos, schema.markFromJSON(json.mark));
640
+ }
641
+ }]);
642
+ return AddNodeMarkStep;
643
+ }(Step);
644
+ Step.jsonID("addNodeMark", AddNodeMarkStep);
645
+ var RemoveNodeMarkStep = function (_Step5) {
646
+ _inherits(RemoveNodeMarkStep, _Step5);
647
+ var _super5 = _createSuper(RemoveNodeMarkStep);
648
+ function RemoveNodeMarkStep(pos, mark) {
649
+ var _this9;
650
+ _classCallCheck(this, RemoveNodeMarkStep);
651
+ _this9 = _super5.call(this);
652
+ _this9.pos = pos;
653
+ _this9.mark = mark;
654
+ return _this9;
655
+ }
656
+ _createClass(RemoveNodeMarkStep, [{
657
+ key: "apply",
658
+ value: function apply(doc) {
659
+ var node = doc.nodeAt(this.pos);
660
+ if (!node) return StepResult.fail("No node at mark step's position");
661
+ var updated = node.type.create(node.attrs, null, this.mark.removeFromSet(node.marks));
662
+ return StepResult.fromReplace(doc, this.pos, this.pos + 1, new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(updated), 0, node.isLeaf ? 0 : 1));
663
+ }
664
+ }, {
665
+ key: "invert",
666
+ value: function invert(doc) {
667
+ var node = doc.nodeAt(this.pos);
668
+ if (!node || !this.mark.isInSet(node.marks)) return this;
669
+ return new AddNodeMarkStep(this.pos, this.mark);
670
+ }
671
+ }, {
672
+ key: "map",
673
+ value: function map(mapping) {
674
+ var pos = mapping.mapResult(this.pos, 1);
675
+ return pos.deletedAfter ? null : new RemoveNodeMarkStep(pos.pos, this.mark);
676
+ }
677
+ }, {
678
+ key: "toJSON",
679
+ value: function toJSON() {
680
+ return {
681
+ stepType: "removeNodeMark",
682
+ pos: this.pos,
683
+ mark: this.mark.toJSON()
684
+ };
685
+ }
686
+ }], [{
687
+ key: "fromJSON",
688
+ value: function fromJSON(schema, json) {
689
+ if (typeof json.pos != "number") throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");
690
+ return new RemoveNodeMarkStep(json.pos, schema.markFromJSON(json.mark));
691
+ }
692
+ }]);
693
+ return RemoveNodeMarkStep;
694
+ }(Step);
695
+ Step.jsonID("removeNodeMark", RemoveNodeMarkStep);
696
+ var ReplaceStep = function (_Step6) {
697
+ _inherits(ReplaceStep, _Step6);
698
+ var _super6 = _createSuper(ReplaceStep);
699
+ function ReplaceStep(from, to, slice) {
700
+ var _this10;
701
+ var structure = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
702
+ _classCallCheck(this, ReplaceStep);
703
+ _this10 = _super6.call(this);
704
+ _this10.from = from;
705
+ _this10.to = to;
706
+ _this10.slice = slice;
707
+ _this10.structure = structure;
708
+ return _this10;
709
+ }
710
+ _createClass(ReplaceStep, [{
711
+ key: "apply",
712
+ value: function apply(doc) {
713
+ if (this.structure && contentBetween(doc, this.from, this.to)) return StepResult.fail("Structure replace would overwrite content");
714
+ return StepResult.fromReplace(doc, this.from, this.to, this.slice);
715
+ }
716
+ }, {
717
+ key: "getMap",
718
+ value: function getMap() {
719
+ return new StepMap([this.from, this.to - this.from, this.slice.size]);
720
+ }
721
+ }, {
722
+ key: "invert",
723
+ value: function invert(doc) {
724
+ return new ReplaceStep(this.from, this.from + this.slice.size, doc.slice(this.from, this.to));
725
+ }
726
+ }, {
727
+ key: "map",
728
+ value: function map(mapping) {
729
+ var to = mapping.mapResult(this.to, -1);
730
+ var from = this.from == this.to && ReplaceStep.MAP_BIAS < 0 ? to : mapping.mapResult(this.from, 1);
731
+ if (from.deletedAcross && to.deletedAcross) return null;
732
+ return new ReplaceStep(from.pos, Math.max(from.pos, to.pos), this.slice, this.structure);
733
+ }
734
+ }, {
735
+ key: "merge",
736
+ value: function merge(other) {
737
+ if (!(other instanceof ReplaceStep) || other.structure || this.structure) return null;
738
+ if (this.from + this.slice.size == other.from && !this.slice.openEnd && !other.slice.openStart) {
739
+ var slice = this.slice.size + other.slice.size == 0 ? prosemirrorModel.Slice.empty : new prosemirrorModel.Slice(this.slice.content.append(other.slice.content), this.slice.openStart, other.slice.openEnd);
740
+ return new ReplaceStep(this.from, this.to + (other.to - other.from), slice, this.structure);
741
+ } else if (other.to == this.from && !this.slice.openStart && !other.slice.openEnd) {
742
+ var _slice = this.slice.size + other.slice.size == 0 ? prosemirrorModel.Slice.empty : new prosemirrorModel.Slice(other.slice.content.append(this.slice.content), other.slice.openStart, this.slice.openEnd);
743
+ return new ReplaceStep(other.from, this.to, _slice, this.structure);
744
+ } else {
745
+ return null;
746
+ }
747
+ }
748
+ }, {
749
+ key: "toJSON",
750
+ value: function toJSON() {
751
+ var json = {
752
+ stepType: "replace",
753
+ from: this.from,
754
+ to: this.to
755
+ };
756
+ if (this.slice.size) json.slice = this.slice.toJSON();
757
+ if (this.structure) json.structure = true;
758
+ return json;
759
+ }
760
+ }], [{
761
+ key: "fromJSON",
762
+ value: function fromJSON(schema, json) {
763
+ if (typeof json.from != "number" || typeof json.to != "number") throw new RangeError("Invalid input for ReplaceStep.fromJSON");
764
+ return new ReplaceStep(json.from, json.to, prosemirrorModel.Slice.fromJSON(schema, json.slice), !!json.structure);
765
+ }
766
+ }]);
767
+ return ReplaceStep;
768
+ }(Step);
769
+ ReplaceStep.MAP_BIAS = 1;
770
+ Step.jsonID("replace", ReplaceStep);
771
+ var ReplaceAroundStep = function (_Step7) {
772
+ _inherits(ReplaceAroundStep, _Step7);
773
+ var _super7 = _createSuper(ReplaceAroundStep);
774
+ function ReplaceAroundStep(from, to, gapFrom, gapTo, slice, insert) {
775
+ var _this11;
776
+ var structure = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
777
+ _classCallCheck(this, ReplaceAroundStep);
778
+ _this11 = _super7.call(this);
779
+ _this11.from = from;
780
+ _this11.to = to;
781
+ _this11.gapFrom = gapFrom;
782
+ _this11.gapTo = gapTo;
783
+ _this11.slice = slice;
784
+ _this11.insert = insert;
785
+ _this11.structure = structure;
786
+ return _this11;
787
+ }
788
+ _createClass(ReplaceAroundStep, [{
789
+ key: "apply",
790
+ value: function apply(doc) {
791
+ if (this.structure && (contentBetween(doc, this.from, this.gapFrom) || contentBetween(doc, this.gapTo, this.to))) return StepResult.fail("Structure gap-replace would overwrite content");
792
+ var gap = doc.slice(this.gapFrom, this.gapTo);
793
+ if (gap.openStart || gap.openEnd) return StepResult.fail("Gap is not a flat range");
794
+ var inserted = this.slice.insertAt(this.insert, gap.content);
795
+ if (!inserted) return StepResult.fail("Content does not fit in gap");
796
+ return StepResult.fromReplace(doc, this.from, this.to, inserted);
797
+ }
798
+ }, {
799
+ key: "getMap",
800
+ value: function getMap() {
801
+ return new StepMap([this.from, this.gapFrom - this.from, this.insert, this.gapTo, this.to - this.gapTo, this.slice.size - this.insert]);
802
+ }
803
+ }, {
804
+ key: "invert",
805
+ value: function invert(doc) {
806
+ var gap = this.gapTo - this.gapFrom;
807
+ return new ReplaceAroundStep(this.from, this.from + this.slice.size + gap, this.from + this.insert, this.from + this.insert + gap, doc.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);
808
+ }
809
+ }, {
810
+ key: "map",
811
+ value: function map(mapping) {
812
+ var from = mapping.mapResult(this.from, 1),
813
+ to = mapping.mapResult(this.to, -1);
814
+ var gapFrom = this.from == this.gapFrom ? from.pos : mapping.map(this.gapFrom, -1);
815
+ var gapTo = this.to == this.gapTo ? to.pos : mapping.map(this.gapTo, 1);
816
+ if (from.deletedAcross && to.deletedAcross || gapFrom < from.pos || gapTo > to.pos) return null;
817
+ return new ReplaceAroundStep(from.pos, to.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);
818
+ }
819
+ }, {
820
+ key: "toJSON",
821
+ value: function toJSON() {
822
+ var json = {
823
+ stepType: "replaceAround",
824
+ from: this.from,
825
+ to: this.to,
826
+ gapFrom: this.gapFrom,
827
+ gapTo: this.gapTo,
828
+ insert: this.insert
829
+ };
830
+ if (this.slice.size) json.slice = this.slice.toJSON();
831
+ if (this.structure) json.structure = true;
832
+ return json;
833
+ }
834
+ }], [{
835
+ key: "fromJSON",
836
+ value: function fromJSON(schema, json) {
837
+ if (typeof json.from != "number" || typeof json.to != "number" || typeof json.gapFrom != "number" || typeof json.gapTo != "number" || typeof json.insert != "number") throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");
838
+ return new ReplaceAroundStep(json.from, json.to, json.gapFrom, json.gapTo, prosemirrorModel.Slice.fromJSON(schema, json.slice), json.insert, !!json.structure);
839
+ }
840
+ }]);
841
+ return ReplaceAroundStep;
842
+ }(Step);
843
+ Step.jsonID("replaceAround", ReplaceAroundStep);
844
+ function contentBetween(doc, from, to) {
845
+ var $from = doc.resolve(from),
846
+ dist = to - from,
847
+ depth = $from.depth;
848
+ while (dist > 0 && depth > 0 && $from.indexAfter(depth) == $from.node(depth).childCount) {
849
+ depth--;
850
+ dist--;
851
+ }
852
+ if (dist > 0) {
853
+ var next = $from.node(depth).maybeChild($from.indexAfter(depth));
854
+ while (dist > 0) {
855
+ if (!next || next.isLeaf) return true;
856
+ next = next.firstChild;
857
+ dist--;
858
+ }
859
+ }
860
+ return false;
861
+ }
862
+ function _addMark(tr, from, to, mark) {
863
+ var added = [],
864
+ adding;
865
+ tr.doc.nodesBetween(from, to, function (node, pos, parent) {
866
+ if (!node.isInline) return;
867
+ var marks = node.marks;
868
+ if (!mark.isInSet(marks) && parent.type.allowsMarkType(mark.type)) {
869
+ var start = Math.max(pos, from),
870
+ end = Math.min(pos + node.nodeSize, to);
871
+ if (adding && adding.to == start) adding.to = end;else added.push(adding = new AddMarkStep(start, end, mark));
872
+ }
873
+ });
874
+ added.forEach(function (s) {
875
+ return tr.step(s);
876
+ });
877
+ }
878
+ function _removeMark(tr, from, to, mark) {
879
+ var matched = [],
880
+ step = 0;
881
+ tr.doc.nodesBetween(from, to, function (node, pos) {
882
+ if (!node.isInline || !node.isAtom) return;
883
+ step++;
884
+ var toRemove = null;
885
+ if (mark instanceof prosemirrorModel.MarkType) {
886
+ var set = node.marks,
887
+ found;
888
+ while (found = mark.isInSet(set)) {
889
+ (toRemove || (toRemove = [])).push(found);
890
+ set = found.removeFromSet(set);
891
+ }
892
+ } else if (mark) {
893
+ if (mark.isInSet(node.marks)) toRemove = [mark];
894
+ } else {
895
+ toRemove = node.marks;
896
+ }
897
+ if (toRemove && toRemove.length) {
898
+ var end = Math.min(pos + node.nodeSize, to);
899
+ for (var i = 0; i < toRemove.length; i++) {
900
+ var style = toRemove[i],
901
+ _found = void 0;
902
+ for (var j = 0; j < matched.length; j++) {
903
+ var m = matched[j];
904
+ if (m.step == step - 1 && style.eq(matched[j].style)) _found = m;
905
+ }
906
+ if (_found) {
907
+ _found.to = end;
908
+ _found.step = step;
909
+ } else {
910
+ matched.push({
911
+ style: style,
912
+ from: Math.max(pos, from),
913
+ to: end,
914
+ step: step
915
+ });
916
+ }
917
+ }
918
+ }
919
+ });
920
+ matched.forEach(function (m) {
921
+ return tr.step(new RemoveMarkStep(m.from, m.to, m.style));
922
+ });
923
+ }
924
+ function _clearIncompatible(tr, pos, parentType) {
925
+ var match = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : parentType.contentMatch;
926
+ var clearNewlines = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
927
+ var node = tr.doc.nodeAt(pos);
928
+ var replSteps = [],
929
+ cur = pos + 1;
930
+ for (var i = 0; i < node.childCount; i++) {
931
+ var child = node.child(i),
932
+ end = cur + child.nodeSize;
933
+ var allowed = match.matchType(child.type);
934
+ if (!allowed) {
935
+ replSteps.push(new ReplaceStep(cur, end, prosemirrorModel.Slice.empty));
936
+ } else {
937
+ match = allowed;
938
+ for (var j = 0; j < child.marks.length; j++) if (!parentType.allowsMarkType(child.marks[j].type)) tr.step(new RemoveMarkStep(cur, end, child.marks[j]));
939
+ if (clearNewlines && child.isText && parentType.whitespace != "pre") {
940
+ var m = void 0,
941
+ newline = /\r?\n|\r/g,
942
+ slice = void 0;
943
+ while (m = newline.exec(child.text)) {
944
+ if (!slice) slice = new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(parentType.schema.text(" ", parentType.allowedMarks(child.marks))), 0, 0);
945
+ replSteps.push(new ReplaceStep(cur + m.index, cur + m.index + m[0].length, slice));
946
+ }
947
+ }
948
+ }
949
+ cur = end;
950
+ }
951
+ if (!match.validEnd) {
952
+ var fill = match.fillBefore(prosemirrorModel.Fragment.empty, true);
953
+ tr.replace(cur, cur, new prosemirrorModel.Slice(fill, 0, 0));
954
+ }
955
+ for (var _i = replSteps.length - 1; _i >= 0; _i--) tr.step(replSteps[_i]);
956
+ }
957
+ function canCut(node, start, end) {
958
+ return (start == 0 || node.canReplace(start, node.childCount)) && (end == node.childCount || node.canReplace(0, end));
959
+ }
960
+ function liftTarget(range) {
961
+ var parent = range.parent;
962
+ var content = parent.content.cutByIndex(range.startIndex, range.endIndex);
963
+ for (var depth = range.depth, contentBefore = 0, contentAfter = 0;; --depth) {
964
+ var node = range.$from.node(depth);
965
+ var index = range.$from.index(depth) + contentBefore,
966
+ endIndex = range.$to.indexAfter(depth) - contentAfter;
967
+ if (depth < range.depth && node.canReplace(index, endIndex, content)) return depth;
968
+ if (depth == 0 || node.type.spec.isolating || !canCut(node, index, endIndex)) break;
969
+ if (index) contentBefore = 1;
970
+ if (endIndex < node.childCount) contentAfter = 1;
971
+ }
972
+ return null;
973
+ }
974
+ function _lift(tr, range, target) {
975
+ var $from = range.$from,
976
+ $to = range.$to,
977
+ depth = range.depth;
978
+ var gapStart = $from.before(depth + 1),
979
+ gapEnd = $to.after(depth + 1);
980
+ var start = gapStart,
981
+ end = gapEnd;
982
+ var before = prosemirrorModel.Fragment.empty,
983
+ openStart = 0;
984
+ for (var d = depth, splitting = false; d > target; d--) if (splitting || $from.index(d) > 0) {
985
+ splitting = true;
986
+ before = prosemirrorModel.Fragment.from($from.node(d).copy(before));
987
+ openStart++;
988
+ } else {
989
+ start--;
990
+ }
991
+ var after = prosemirrorModel.Fragment.empty,
992
+ openEnd = 0;
993
+ for (var _d = depth, _splitting = false; _d > target; _d--) if (_splitting || $to.after(_d + 1) < $to.end(_d)) {
994
+ _splitting = true;
995
+ after = prosemirrorModel.Fragment.from($to.node(_d).copy(after));
996
+ openEnd++;
997
+ } else {
998
+ end++;
999
+ }
1000
+ tr.step(new ReplaceAroundStep(start, end, gapStart, gapEnd, new prosemirrorModel.Slice(before.append(after), openStart, openEnd), before.size - openStart, true));
1001
+ }
1002
+ function findWrapping(range, nodeType) {
1003
+ var attrs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
1004
+ var innerRange = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : range;
1005
+ var around = findWrappingOutside(range, nodeType);
1006
+ var inner = around && findWrappingInside(innerRange, nodeType);
1007
+ if (!inner) return null;
1008
+ return around.map(withAttrs).concat({
1009
+ type: nodeType,
1010
+ attrs: attrs
1011
+ }).concat(inner.map(withAttrs));
1012
+ }
1013
+ function withAttrs(type) {
1014
+ return {
1015
+ type: type,
1016
+ attrs: null
1017
+ };
1018
+ }
1019
+ function findWrappingOutside(range, type) {
1020
+ var parent = range.parent,
1021
+ startIndex = range.startIndex,
1022
+ endIndex = range.endIndex;
1023
+ var around = parent.contentMatchAt(startIndex).findWrapping(type);
1024
+ if (!around) return null;
1025
+ var outer = around.length ? around[0] : type;
1026
+ return parent.canReplaceWith(startIndex, endIndex, outer) ? around : null;
1027
+ }
1028
+ function findWrappingInside(range, type) {
1029
+ var parent = range.parent,
1030
+ startIndex = range.startIndex,
1031
+ endIndex = range.endIndex;
1032
+ var inner = parent.child(startIndex);
1033
+ var inside = type.contentMatch.findWrapping(inner.type);
1034
+ if (!inside) return null;
1035
+ var lastType = inside.length ? inside[inside.length - 1] : type;
1036
+ var innerMatch = lastType.contentMatch;
1037
+ for (var i = startIndex; innerMatch && i < endIndex; i++) innerMatch = innerMatch.matchType(parent.child(i).type);
1038
+ if (!innerMatch || !innerMatch.validEnd) return null;
1039
+ return inside;
1040
+ }
1041
+ function _wrap2(tr, range, wrappers) {
1042
+ var content = prosemirrorModel.Fragment.empty;
1043
+ for (var i = wrappers.length - 1; i >= 0; i--) {
1044
+ if (content.size) {
1045
+ var match = wrappers[i].type.contentMatch.matchFragment(content);
1046
+ if (!match || !match.validEnd) throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper");
1047
+ }
1048
+ content = prosemirrorModel.Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));
1049
+ }
1050
+ var start = range.start,
1051
+ end = range.end;
1052
+ tr.step(new ReplaceAroundStep(start, end, start, end, new prosemirrorModel.Slice(content, 0, 0), wrappers.length, true));
1053
+ }
1054
+ function _setBlockType(tr, from, to, type, attrs) {
1055
+ if (!type.isTextblock) throw new RangeError("Type given to setBlockType should be a textblock");
1056
+ var mapFrom = tr.steps.length;
1057
+ tr.doc.nodesBetween(from, to, function (node, pos) {
1058
+ var attrsHere = typeof attrs == "function" ? attrs(node) : attrs;
1059
+ if (node.isTextblock && !node.hasMarkup(type, attrsHere) && canChangeType(tr.doc, tr.mapping.slice(mapFrom).map(pos), type)) {
1060
+ var convertNewlines = null;
1061
+ if (type.schema.linebreakReplacement) {
1062
+ var pre = type.whitespace == "pre",
1063
+ supportLinebreak = !!type.contentMatch.matchType(type.schema.linebreakReplacement);
1064
+ if (pre && !supportLinebreak) convertNewlines = false;else if (!pre && supportLinebreak) convertNewlines = true;
1065
+ }
1066
+ if (convertNewlines === false) replaceLinebreaks(tr, node, pos, mapFrom);
1067
+ _clearIncompatible(tr, tr.mapping.slice(mapFrom).map(pos, 1), type, undefined, convertNewlines === null);
1068
+ var mapping = tr.mapping.slice(mapFrom);
1069
+ var startM = mapping.map(pos, 1),
1070
+ endM = mapping.map(pos + node.nodeSize, 1);
1071
+ tr.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(type.create(attrsHere, null, node.marks)), 0, 0), 1, true));
1072
+ if (convertNewlines === true) replaceNewlines(tr, node, pos, mapFrom);
1073
+ return false;
1074
+ }
1075
+ });
1076
+ }
1077
+ function replaceNewlines(tr, node, pos, mapFrom) {
1078
+ node.forEach(function (child, offset) {
1079
+ if (child.isText) {
1080
+ var m,
1081
+ newline = /\r?\n|\r/g;
1082
+ while (m = newline.exec(child.text)) {
1083
+ var start = tr.mapping.slice(mapFrom).map(pos + 1 + offset + m.index);
1084
+ tr.replaceWith(start, start + 1, node.type.schema.linebreakReplacement.create());
1085
+ }
1086
+ }
1087
+ });
1088
+ }
1089
+ function replaceLinebreaks(tr, node, pos, mapFrom) {
1090
+ node.forEach(function (child, offset) {
1091
+ if (child.type == child.type.schema.linebreakReplacement) {
1092
+ var start = tr.mapping.slice(mapFrom).map(pos + 1 + offset);
1093
+ tr.replaceWith(start, start + 1, node.type.schema.text("\n"));
1094
+ }
1095
+ });
1096
+ }
1097
+ function canChangeType(doc, pos, type) {
1098
+ var $pos = doc.resolve(pos),
1099
+ index = $pos.index();
1100
+ return $pos.parent.canReplaceWith(index, index + 1, type);
1101
+ }
1102
+ function _setNodeMarkup(tr, pos, type, attrs, marks) {
1103
+ var node = tr.doc.nodeAt(pos);
1104
+ if (!node) throw new RangeError("No node at given position");
1105
+ if (!type) type = node.type;
1106
+ var newNode = type.create(attrs, null, marks || node.marks);
1107
+ if (node.isLeaf) return tr.replaceWith(pos, pos + node.nodeSize, newNode);
1108
+ if (!type.validContent(node.content)) throw new RangeError("Invalid content for node type " + type.name);
1109
+ tr.step(new ReplaceAroundStep(pos, pos + node.nodeSize, pos + 1, pos + node.nodeSize - 1, new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(newNode), 0, 0), 1, true));
1110
+ }
1111
+ function canSplit(doc, pos) {
1112
+ var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
1113
+ var typesAfter = arguments.length > 3 ? arguments[3] : undefined;
1114
+ var $pos = doc.resolve(pos),
1115
+ base = $pos.depth - depth;
1116
+ var innerType = typesAfter && typesAfter[typesAfter.length - 1] || $pos.parent;
1117
+ if (base < 0 || $pos.parent.type.spec.isolating || !$pos.parent.canReplace($pos.index(), $pos.parent.childCount) || !innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(), $pos.parent.childCount))) return false;
1118
+ for (var d = $pos.depth - 1, i = depth - 2; d > base; d--, i--) {
1119
+ var node = $pos.node(d),
1120
+ _index = $pos.index(d);
1121
+ if (node.type.spec.isolating) return false;
1122
+ var rest = node.content.cutByIndex(_index, node.childCount);
1123
+ var overrideChild = typesAfter && typesAfter[i + 1];
1124
+ if (overrideChild) rest = rest.replaceChild(0, overrideChild.type.create(overrideChild.attrs));
1125
+ var after = typesAfter && typesAfter[i] || node;
1126
+ if (!node.canReplace(_index + 1, node.childCount) || !after.type.validContent(rest)) return false;
1127
+ }
1128
+ var index = $pos.indexAfter(base);
1129
+ var baseType = typesAfter && typesAfter[0];
1130
+ return $pos.node(base).canReplaceWith(index, index, baseType ? baseType.type : $pos.node(base + 1).type);
1131
+ }
1132
+ function _split(tr, pos) {
1133
+ var depth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
1134
+ var typesAfter = arguments.length > 3 ? arguments[3] : undefined;
1135
+ var $pos = tr.doc.resolve(pos),
1136
+ before = prosemirrorModel.Fragment.empty,
1137
+ after = prosemirrorModel.Fragment.empty;
1138
+ for (var d = $pos.depth, e = $pos.depth - depth, i = depth - 1; d > e; d--, i--) {
1139
+ before = prosemirrorModel.Fragment.from($pos.node(d).copy(before));
1140
+ var typeAfter = typesAfter && typesAfter[i];
1141
+ after = prosemirrorModel.Fragment.from(typeAfter ? typeAfter.type.create(typeAfter.attrs, after) : $pos.node(d).copy(after));
1142
+ }
1143
+ tr.step(new ReplaceStep(pos, pos, new prosemirrorModel.Slice(before.append(after), depth, depth), true));
1144
+ }
1145
+ function canJoin(doc, pos) {
1146
+ var $pos = doc.resolve(pos),
1147
+ index = $pos.index();
1148
+ return joinable($pos.nodeBefore, $pos.nodeAfter) && $pos.parent.canReplace(index, index + 1);
1149
+ }
1150
+ function canAppendWithSubstitutedLinebreaks(a, b) {
1151
+ if (!b.content.size) a.type.compatibleContent(b.type);
1152
+ var match = a.contentMatchAt(a.childCount);
1153
+ var linebreakReplacement = a.type.schema.linebreakReplacement;
1154
+ for (var i = 0; i < b.childCount; i++) {
1155
+ var child = b.child(i);
1156
+ var type = child.type == linebreakReplacement ? a.type.schema.nodes.text : child.type;
1157
+ match = match.matchType(type);
1158
+ if (!match) return false;
1159
+ if (!a.type.allowsMarks(child.marks)) return false;
1160
+ }
1161
+ return match.validEnd;
1162
+ }
1163
+ function joinable(a, b) {
1164
+ return !!(a && b && !a.isLeaf && canAppendWithSubstitutedLinebreaks(a, b));
1165
+ }
1166
+ function joinPoint(doc, pos) {
1167
+ var dir = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1;
1168
+ var $pos = doc.resolve(pos);
1169
+ for (var d = $pos.depth;; d--) {
1170
+ var before = void 0,
1171
+ after = void 0,
1172
+ index = $pos.index(d);
1173
+ if (d == $pos.depth) {
1174
+ before = $pos.nodeBefore;
1175
+ after = $pos.nodeAfter;
1176
+ } else if (dir > 0) {
1177
+ before = $pos.node(d + 1);
1178
+ index++;
1179
+ after = $pos.node(d).maybeChild(index);
1180
+ } else {
1181
+ before = $pos.node(d).maybeChild(index - 1);
1182
+ after = $pos.node(d + 1);
1183
+ }
1184
+ if (before && !before.isTextblock && joinable(before, after) && $pos.node(d).canReplace(index, index + 1)) return pos;
1185
+ if (d == 0) break;
1186
+ pos = dir < 0 ? $pos.before(d) : $pos.after(d);
1187
+ }
1188
+ }
1189
+ function _join(tr, pos, depth) {
1190
+ var convertNewlines = null;
1191
+ var linebreakReplacement = tr.doc.type.schema.linebreakReplacement;
1192
+ var $before = tr.doc.resolve(pos - depth),
1193
+ beforeType = $before.node().type;
1194
+ if (linebreakReplacement && beforeType.inlineContent) {
1195
+ var pre = beforeType.whitespace == "pre";
1196
+ var supportLinebreak = !!beforeType.contentMatch.matchType(linebreakReplacement);
1197
+ if (pre && !supportLinebreak) convertNewlines = false;else if (!pre && supportLinebreak) convertNewlines = true;
1198
+ }
1199
+ var mapFrom = tr.steps.length;
1200
+ if (convertNewlines === false) {
1201
+ var $after = tr.doc.resolve(pos + depth);
1202
+ replaceLinebreaks(tr, $after.node(), $after.before(), mapFrom);
1203
+ }
1204
+ if (beforeType.inlineContent) _clearIncompatible(tr, pos + depth - 1, beforeType, $before.node().contentMatchAt($before.index()), convertNewlines == null);
1205
+ var mapping = tr.mapping.slice(mapFrom),
1206
+ start = mapping.map(pos - depth);
1207
+ tr.step(new ReplaceStep(start, mapping.map(pos + depth, -1), prosemirrorModel.Slice.empty, true));
1208
+ if (convertNewlines === true) {
1209
+ var $full = tr.doc.resolve(start);
1210
+ replaceNewlines(tr, $full.node(), $full.before(), tr.steps.length);
1211
+ }
1212
+ return tr;
1213
+ }
1214
+ function insertPoint(doc, pos, nodeType) {
1215
+ var $pos = doc.resolve(pos);
1216
+ if ($pos.parent.canReplaceWith($pos.index(), $pos.index(), nodeType)) return pos;
1217
+ if ($pos.parentOffset == 0) for (var d = $pos.depth - 1; d >= 0; d--) {
1218
+ var index = $pos.index(d);
1219
+ if ($pos.node(d).canReplaceWith(index, index, nodeType)) return $pos.before(d + 1);
1220
+ if (index > 0) return null;
1221
+ }
1222
+ if ($pos.parentOffset == $pos.parent.content.size) for (var _d2 = $pos.depth - 1; _d2 >= 0; _d2--) {
1223
+ var _index2 = $pos.indexAfter(_d2);
1224
+ if ($pos.node(_d2).canReplaceWith(_index2, _index2, nodeType)) return $pos.after(_d2 + 1);
1225
+ if (_index2 < $pos.node(_d2).childCount) return null;
1226
+ }
1227
+ return null;
1228
+ }
1229
+ function dropPoint(doc, pos, slice) {
1230
+ var $pos = doc.resolve(pos);
1231
+ if (!slice.content.size) return pos;
1232
+ var content = slice.content;
1233
+ for (var i = 0; i < slice.openStart; i++) content = content.firstChild.content;
1234
+ for (var pass = 1; pass <= (slice.openStart == 0 && slice.size ? 2 : 1); pass++) {
1235
+ for (var d = $pos.depth; d >= 0; d--) {
1236
+ var bias = d == $pos.depth ? 0 : $pos.pos <= ($pos.start(d + 1) + $pos.end(d + 1)) / 2 ? -1 : 1;
1237
+ var insertPos = $pos.index(d) + (bias > 0 ? 1 : 0);
1238
+ var parent = $pos.node(d),
1239
+ fits = false;
1240
+ if (pass == 1) {
1241
+ fits = parent.canReplace(insertPos, insertPos, content);
1242
+ } else {
1243
+ var wrapping = parent.contentMatchAt(insertPos).findWrapping(content.firstChild.type);
1244
+ fits = wrapping && parent.canReplaceWith(insertPos, insertPos, wrapping[0]);
1245
+ }
1246
+ if (fits) return bias == 0 ? $pos.pos : bias < 0 ? $pos.before(d + 1) : $pos.after(d + 1);
1247
+ }
1248
+ }
1249
+ return null;
1250
+ }
1251
+ function replaceStep(doc, from) {
1252
+ var to = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : from;
1253
+ var slice = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : prosemirrorModel.Slice.empty;
1254
+ if (from == to && !slice.size) return null;
1255
+ var $from = doc.resolve(from),
1256
+ $to = doc.resolve(to);
1257
+ if (fitsTrivially($from, $to, slice)) return new ReplaceStep(from, to, slice);
1258
+ return new Fitter($from, $to, slice).fit();
1259
+ }
1260
+ function fitsTrivially($from, $to, slice) {
1261
+ return !slice.openStart && !slice.openEnd && $from.start() == $to.start() && $from.parent.canReplace($from.index(), $to.index(), slice.content);
1262
+ }
1263
+ var Fitter = function () {
1264
+ function Fitter($from, $to, unplaced) {
1265
+ _classCallCheck(this, Fitter);
1266
+ this.$from = $from;
1267
+ this.$to = $to;
1268
+ this.unplaced = unplaced;
1269
+ this.frontier = [];
1270
+ this.placed = prosemirrorModel.Fragment.empty;
1271
+ for (var i = 0; i <= $from.depth; i++) {
1272
+ var node = $from.node(i);
1273
+ this.frontier.push({
1274
+ type: node.type,
1275
+ match: node.contentMatchAt($from.indexAfter(i))
1276
+ });
1277
+ }
1278
+ for (var _i2 = $from.depth; _i2 > 0; _i2--) this.placed = prosemirrorModel.Fragment.from($from.node(_i2).copy(this.placed));
1279
+ }
1280
+ _createClass(Fitter, [{
1281
+ key: "depth",
1282
+ get: function get() {
1283
+ return this.frontier.length - 1;
1284
+ }
1285
+ }, {
1286
+ key: "fit",
1287
+ value: function fit() {
1288
+ while (this.unplaced.size) {
1289
+ var fit = this.findFittable();
1290
+ if (fit) this.placeNodes(fit);else this.openMore() || this.dropNode();
1291
+ }
1292
+ var moveInline = this.mustMoveInline(),
1293
+ placedSize = this.placed.size - this.depth - this.$from.depth;
1294
+ var $from = this.$from,
1295
+ $to = this.close(moveInline < 0 ? this.$to : $from.doc.resolve(moveInline));
1296
+ if (!$to) return null;
1297
+ var content = this.placed,
1298
+ openStart = $from.depth,
1299
+ openEnd = $to.depth;
1300
+ while (openStart && openEnd && content.childCount == 1) {
1301
+ content = content.firstChild.content;
1302
+ openStart--;
1303
+ openEnd--;
1304
+ }
1305
+ var slice = new prosemirrorModel.Slice(content, openStart, openEnd);
1306
+ if (moveInline > -1) return new ReplaceAroundStep($from.pos, moveInline, this.$to.pos, this.$to.end(), slice, placedSize);
1307
+ if (slice.size || $from.pos != this.$to.pos) return new ReplaceStep($from.pos, $to.pos, slice);
1308
+ return null;
1309
+ }
1310
+ }, {
1311
+ key: "findFittable",
1312
+ value: function findFittable() {
1313
+ var startDepth = this.unplaced.openStart;
1314
+ for (var cur = this.unplaced.content, d = 0, openEnd = this.unplaced.openEnd; d < startDepth; d++) {
1315
+ var node = cur.firstChild;
1316
+ if (cur.childCount > 1) openEnd = 0;
1317
+ if (node.type.spec.isolating && openEnd <= d) {
1318
+ startDepth = d;
1319
+ break;
1320
+ }
1321
+ cur = node.content;
1322
+ }
1323
+ for (var pass = 1; pass <= 2; pass++) {
1324
+ for (var sliceDepth = pass == 1 ? startDepth : this.unplaced.openStart; sliceDepth >= 0; sliceDepth--) {
1325
+ var fragment = void 0,
1326
+ parent = null;
1327
+ if (sliceDepth) {
1328
+ parent = contentAt(this.unplaced.content, sliceDepth - 1).firstChild;
1329
+ fragment = parent.content;
1330
+ } else {
1331
+ fragment = this.unplaced.content;
1332
+ }
1333
+ var first = fragment.firstChild;
1334
+ for (var frontierDepth = this.depth; frontierDepth >= 0; frontierDepth--) {
1335
+ var _this$frontier$fronti = this.frontier[frontierDepth],
1336
+ type = _this$frontier$fronti.type,
1337
+ match = _this$frontier$fronti.match,
1338
+ _wrap = void 0,
1339
+ inject = null;
1340
+ if (pass == 1 && (first ? match.matchType(first.type) || (inject = match.fillBefore(prosemirrorModel.Fragment.from(first), false)) : parent && type.compatibleContent(parent.type))) return {
1341
+ sliceDepth: sliceDepth,
1342
+ frontierDepth: frontierDepth,
1343
+ parent: parent,
1344
+ inject: inject
1345
+ };else if (pass == 2 && first && (_wrap = match.findWrapping(first.type))) return {
1346
+ sliceDepth: sliceDepth,
1347
+ frontierDepth: frontierDepth,
1348
+ parent: parent,
1349
+ wrap: _wrap
1350
+ };
1351
+ if (parent && match.matchType(parent.type)) break;
1352
+ }
1353
+ }
1354
+ }
1355
+ }
1356
+ }, {
1357
+ key: "openMore",
1358
+ value: function openMore() {
1359
+ var _this$unplaced = this.unplaced,
1360
+ content = _this$unplaced.content,
1361
+ openStart = _this$unplaced.openStart,
1362
+ openEnd = _this$unplaced.openEnd;
1363
+ if (maxOpen(content, -1) <= openStart) return false;
1364
+ if (this.unplaced.size > 1 && maxOpen(content, 1) > openEnd) openEnd++;
1365
+ this.unplaced = new prosemirrorModel.Slice(content, openStart + 1, openEnd);
1366
+ return true;
1367
+ }
1368
+ }, {
1369
+ key: "dropNode",
1370
+ value: function dropNode() {
1371
+ var _this$unplaced2 = this.unplaced,
1372
+ content = _this$unplaced2.content,
1373
+ openStart = _this$unplaced2.openStart,
1374
+ openEnd = _this$unplaced2.openEnd;
1375
+ var inner = contentAt(content, openStart);
1376
+ if (inner.childCount <= 1 && openStart > 0) {
1377
+ var openAtEnd = content.size - openStart <= openStart + inner.size;
1378
+ this.unplaced = new prosemirrorModel.Slice(dropFromFragment(content, openStart - 1, 1), openStart - 1, openAtEnd ? openStart - 1 : openEnd);
1379
+ } else {
1380
+ this.unplaced = new prosemirrorModel.Slice(dropFromFragment(content, openStart, 1), openStart, openEnd);
1381
+ }
1382
+ }
1383
+ }, {
1384
+ key: "placeNodes",
1385
+ value: function placeNodes(_ref) {
1386
+ var sliceDepth = _ref.sliceDepth,
1387
+ frontierDepth = _ref.frontierDepth,
1388
+ parent = _ref.parent,
1389
+ inject = _ref.inject,
1390
+ wrap = _ref.wrap;
1391
+ while (this.depth > frontierDepth) this.closeFrontierNode();
1392
+ if (wrap) for (var i = 0; i < wrap.length; i++) this.openFrontierNode(wrap[i]);
1393
+ var slice = this.unplaced,
1394
+ fragment = parent ? parent.content : slice.content;
1395
+ var openStart = slice.openStart - sliceDepth;
1396
+ var taken = 0,
1397
+ add = [];
1398
+ var _this$frontier$fronti2 = this.frontier[frontierDepth],
1399
+ match = _this$frontier$fronti2.match,
1400
+ type = _this$frontier$fronti2.type;
1401
+ if (inject) {
1402
+ for (var _i3 = 0; _i3 < inject.childCount; _i3++) add.push(inject.child(_i3));
1403
+ match = match.matchFragment(inject);
1404
+ }
1405
+ var openEndCount = fragment.size + sliceDepth - (slice.content.size - slice.openEnd);
1406
+ while (taken < fragment.childCount) {
1407
+ var next = fragment.child(taken),
1408
+ matches = match.matchType(next.type);
1409
+ if (!matches) break;
1410
+ taken++;
1411
+ if (taken > 1 || openStart == 0 || next.content.size) {
1412
+ match = matches;
1413
+ add.push(closeNodeStart(next.mark(type.allowedMarks(next.marks)), taken == 1 ? openStart : 0, taken == fragment.childCount ? openEndCount : -1));
1414
+ }
1415
+ }
1416
+ var toEnd = taken == fragment.childCount;
1417
+ if (!toEnd) openEndCount = -1;
1418
+ this.placed = addToFragment(this.placed, frontierDepth, prosemirrorModel.Fragment.from(add));
1419
+ this.frontier[frontierDepth].match = match;
1420
+ if (toEnd && openEndCount < 0 && parent && parent.type == this.frontier[this.depth].type && this.frontier.length > 1) this.closeFrontierNode();
1421
+ for (var _i4 = 0, cur = fragment; _i4 < openEndCount; _i4++) {
1422
+ var node = cur.lastChild;
1423
+ this.frontier.push({
1424
+ type: node.type,
1425
+ match: node.contentMatchAt(node.childCount)
1426
+ });
1427
+ cur = node.content;
1428
+ }
1429
+ this.unplaced = !toEnd ? new prosemirrorModel.Slice(dropFromFragment(slice.content, sliceDepth, taken), slice.openStart, slice.openEnd) : sliceDepth == 0 ? prosemirrorModel.Slice.empty : new prosemirrorModel.Slice(dropFromFragment(slice.content, sliceDepth - 1, 1), sliceDepth - 1, openEndCount < 0 ? slice.openEnd : sliceDepth - 1);
1430
+ }
1431
+ }, {
1432
+ key: "mustMoveInline",
1433
+ value: function mustMoveInline() {
1434
+ if (!this.$to.parent.isTextblock) return -1;
1435
+ var top = this.frontier[this.depth],
1436
+ level;
1437
+ if (!top.type.isTextblock || !contentAfterFits(this.$to, this.$to.depth, top.type, top.match, false) || this.$to.depth == this.depth && (level = this.findCloseLevel(this.$to)) && level.depth == this.depth) return -1;
1438
+ var depth = this.$to.depth,
1439
+ after = this.$to.after(depth);
1440
+ while (depth > 1 && after == this.$to.end(--depth)) ++after;
1441
+ return after;
1442
+ }
1443
+ }, {
1444
+ key: "findCloseLevel",
1445
+ value: function findCloseLevel($to) {
1446
+ scan: for (var i = Math.min(this.depth, $to.depth); i >= 0; i--) {
1447
+ var _this$frontier$i = this.frontier[i],
1448
+ match = _this$frontier$i.match,
1449
+ type = _this$frontier$i.type;
1450
+ var dropInner = i < $to.depth && $to.end(i + 1) == $to.pos + ($to.depth - (i + 1));
1451
+ var fit = contentAfterFits($to, i, type, match, dropInner);
1452
+ if (!fit) continue;
1453
+ for (var d = i - 1; d >= 0; d--) {
1454
+ var _this$frontier$d = this.frontier[d],
1455
+ _match = _this$frontier$d.match,
1456
+ _type = _this$frontier$d.type;
1457
+ var matches = contentAfterFits($to, d, _type, _match, true);
1458
+ if (!matches || matches.childCount) continue scan;
1459
+ }
1460
+ return {
1461
+ depth: i,
1462
+ fit: fit,
1463
+ move: dropInner ? $to.doc.resolve($to.after(i + 1)) : $to
1464
+ };
1465
+ }
1466
+ }
1467
+ }, {
1468
+ key: "close",
1469
+ value: function close($to) {
1470
+ var close = this.findCloseLevel($to);
1471
+ if (!close) return null;
1472
+ while (this.depth > close.depth) this.closeFrontierNode();
1473
+ if (close.fit.childCount) this.placed = addToFragment(this.placed, close.depth, close.fit);
1474
+ $to = close.move;
1475
+ for (var d = close.depth + 1; d <= $to.depth; d++) {
1476
+ var node = $to.node(d),
1477
+ add = node.type.contentMatch.fillBefore(node.content, true, $to.index(d));
1478
+ this.openFrontierNode(node.type, node.attrs, add);
1479
+ }
1480
+ return $to;
1481
+ }
1482
+ }, {
1483
+ key: "openFrontierNode",
1484
+ value: function openFrontierNode(type) {
1485
+ var attrs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1486
+ var content = arguments.length > 2 ? arguments[2] : undefined;
1487
+ var top = this.frontier[this.depth];
1488
+ top.match = top.match.matchType(type);
1489
+ this.placed = addToFragment(this.placed, this.depth, prosemirrorModel.Fragment.from(type.create(attrs, content)));
1490
+ this.frontier.push({
1491
+ type: type,
1492
+ match: type.contentMatch
1493
+ });
1494
+ }
1495
+ }, {
1496
+ key: "closeFrontierNode",
1497
+ value: function closeFrontierNode() {
1498
+ var open = this.frontier.pop();
1499
+ var add = open.match.fillBefore(prosemirrorModel.Fragment.empty, true);
1500
+ if (add.childCount) this.placed = addToFragment(this.placed, this.frontier.length, add);
1501
+ }
1502
+ }]);
1503
+ return Fitter;
1504
+ }();
1505
+ function dropFromFragment(fragment, depth, count) {
1506
+ if (depth == 0) return fragment.cutByIndex(count, fragment.childCount);
1507
+ return fragment.replaceChild(0, fragment.firstChild.copy(dropFromFragment(fragment.firstChild.content, depth - 1, count)));
1508
+ }
1509
+ function addToFragment(fragment, depth, content) {
1510
+ if (depth == 0) return fragment.append(content);
1511
+ return fragment.replaceChild(fragment.childCount - 1, fragment.lastChild.copy(addToFragment(fragment.lastChild.content, depth - 1, content)));
1512
+ }
1513
+ function contentAt(fragment, depth) {
1514
+ for (var i = 0; i < depth; i++) fragment = fragment.firstChild.content;
1515
+ return fragment;
1516
+ }
1517
+ function closeNodeStart(node, openStart, openEnd) {
1518
+ if (openStart <= 0) return node;
1519
+ var frag = node.content;
1520
+ if (openStart > 1) frag = frag.replaceChild(0, closeNodeStart(frag.firstChild, openStart - 1, frag.childCount == 1 ? openEnd - 1 : 0));
1521
+ if (openStart > 0) {
1522
+ frag = node.type.contentMatch.fillBefore(frag).append(frag);
1523
+ if (openEnd <= 0) frag = frag.append(node.type.contentMatch.matchFragment(frag).fillBefore(prosemirrorModel.Fragment.empty, true));
1524
+ }
1525
+ return node.copy(frag);
1526
+ }
1527
+ function contentAfterFits($to, depth, type, match, open) {
1528
+ var node = $to.node(depth),
1529
+ index = open ? $to.indexAfter(depth) : $to.index(depth);
1530
+ if (index == node.childCount && !type.compatibleContent(node.type)) return null;
1531
+ var fit = match.fillBefore(node.content, true, index);
1532
+ return fit && !invalidMarks(type, node.content, index) ? fit : null;
1533
+ }
1534
+ function invalidMarks(type, fragment, start) {
1535
+ for (var i = start; i < fragment.childCount; i++) if (!type.allowsMarks(fragment.child(i).marks)) return true;
1536
+ return false;
1537
+ }
1538
+ function definesContent(type) {
1539
+ return type.spec.defining || type.spec.definingForContent;
1540
+ }
1541
+ function maxOpen(frag, side) {
1542
+ for (var count = 0;; count++) {
1543
+ var ch = side < 0 ? frag.firstChild : frag.lastChild;
1544
+ if (!ch || ch.isAtom) return count;
1545
+ frag = ch.content;
1546
+ }
1547
+ }
1548
+ function _replaceRange(tr, from, to, slice) {
1549
+ if (!slice.size) return tr.deleteRange(from, to);
1550
+ var $from = tr.doc.resolve(from),
1551
+ $to = tr.doc.resolve(to);
1552
+ if (fitsTrivially($from, $to, slice)) return tr.step(new ReplaceStep(from, to, slice));
1553
+ var targetDepths = coveredDepths($from, $to);
1554
+ if (targetDepths[targetDepths.length - 1] == 0) targetDepths.pop();
1555
+ var preferredTarget = -($from.depth + 1);
1556
+ targetDepths.unshift(preferredTarget);
1557
+ for (var d = $from.depth, pos = $from.pos - 1; d > 0; d--, pos--) {
1558
+ var spec = $from.node(d).type.spec;
1559
+ if (spec.defining || spec.definingAsContext || spec.isolating) break;
1560
+ if (targetDepths.indexOf(d) > -1) preferredTarget = d;else if ($from.before(d) == pos) targetDepths.splice(1, 0, -d);
1561
+ }
1562
+ var preferredTargetIndex = targetDepths.indexOf(preferredTarget);
1563
+ var leftNodes = [],
1564
+ preferredDepth = slice.openStart;
1565
+ for (var content = slice.content, i = 0;; i++) {
1566
+ var node = content.firstChild;
1567
+ leftNodes.push(node);
1568
+ if (i == slice.openStart) break;
1569
+ content = node.content;
1570
+ }
1571
+ for (var _d3 = preferredDepth - 1; _d3 >= 0; _d3--) {
1572
+ var leftNode = leftNodes[_d3],
1573
+ def = definesContent(leftNode.type);
1574
+ if (def && !leftNode.sameMarkup($from.node(Math.abs(preferredTarget) - 1))) preferredDepth = _d3;else if (def || !leftNode.type.isTextblock) break;
1575
+ }
1576
+ for (var j = slice.openStart; j >= 0; j--) {
1577
+ var openDepth = (j + preferredDepth + 1) % (slice.openStart + 1);
1578
+ var insert = leftNodes[openDepth];
1579
+ if (!insert) continue;
1580
+ for (var _i5 = 0; _i5 < targetDepths.length; _i5++) {
1581
+ var targetDepth = targetDepths[(_i5 + preferredTargetIndex) % targetDepths.length],
1582
+ expand = true;
1583
+ if (targetDepth < 0) {
1584
+ expand = false;
1585
+ targetDepth = -targetDepth;
1586
+ }
1587
+ var parent = $from.node(targetDepth - 1),
1588
+ index = $from.index(targetDepth - 1);
1589
+ if (parent.canReplaceWith(index, index, insert.type, insert.marks)) return tr.replace($from.before(targetDepth), expand ? $to.after(targetDepth) : to, new prosemirrorModel.Slice(closeFragment(slice.content, 0, slice.openStart, openDepth), openDepth, slice.openEnd));
1590
+ }
1591
+ }
1592
+ var startSteps = tr.steps.length;
1593
+ for (var _i6 = targetDepths.length - 1; _i6 >= 0; _i6--) {
1594
+ tr.replace(from, to, slice);
1595
+ if (tr.steps.length > startSteps) break;
1596
+ var depth = targetDepths[_i6];
1597
+ if (depth < 0) continue;
1598
+ from = $from.before(depth);
1599
+ to = $to.after(depth);
1600
+ }
1601
+ }
1602
+ function closeFragment(fragment, depth, oldOpen, newOpen, parent) {
1603
+ if (depth < oldOpen) {
1604
+ var first = fragment.firstChild;
1605
+ fragment = fragment.replaceChild(0, first.copy(closeFragment(first.content, depth + 1, oldOpen, newOpen, first)));
1606
+ }
1607
+ if (depth > newOpen) {
1608
+ var match = parent.contentMatchAt(0);
1609
+ var start = match.fillBefore(fragment).append(fragment);
1610
+ fragment = start.append(match.matchFragment(start).fillBefore(prosemirrorModel.Fragment.empty, true));
1611
+ }
1612
+ return fragment;
1613
+ }
1614
+ function _replaceRangeWith(tr, from, to, node) {
1615
+ if (!node.isInline && from == to && tr.doc.resolve(from).parent.content.size) {
1616
+ var point = insertPoint(tr.doc, from, node.type);
1617
+ if (point != null) from = to = point;
1618
+ }
1619
+ tr.replaceRange(from, to, new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(node), 0, 0));
1620
+ }
1621
+ function _deleteRange(tr, from, to) {
1622
+ var $from = tr.doc.resolve(from),
1623
+ $to = tr.doc.resolve(to);
1624
+ if ($from.parent.isTextblock && $to.parent.isTextblock && $from.start() != $to.start() && $from.parentOffset == 0 && $to.parentOffset == 0) {
1625
+ var shared = $from.sharedDepth(to),
1626
+ isolated = false;
1627
+ for (var d = $from.depth; d > shared; d--) if ($from.node(d).type.spec.isolating) isolated = true;
1628
+ for (var _d4 = $to.depth; _d4 > shared; _d4--) if ($to.node(_d4).type.spec.isolating) isolated = true;
1629
+ if (!isolated) {
1630
+ for (var _d5 = $from.depth; _d5 > 0 && from == $from.start(_d5); _d5--) from = $from.before(_d5);
1631
+ for (var _d6 = $to.depth; _d6 > 0 && to == $to.start(_d6); _d6--) to = $to.before(_d6);
1632
+ $from = tr.doc.resolve(from);
1633
+ $to = tr.doc.resolve(to);
1634
+ }
1635
+ }
1636
+ var covered = coveredDepths($from, $to);
1637
+ for (var i = 0; i < covered.length; i++) {
1638
+ var depth = covered[i],
1639
+ last = i == covered.length - 1;
1640
+ if (last && depth == 0 || $from.node(depth).type.contentMatch.validEnd) return tr["delete"]($from.start(depth), $to.end(depth));
1641
+ if (depth > 0 && (last || $from.node(depth - 1).canReplace($from.index(depth - 1), $to.indexAfter(depth - 1)))) return tr["delete"]($from.before(depth), $to.after(depth));
1642
+ }
1643
+ for (var _d7 = 1; _d7 <= $from.depth && _d7 <= $to.depth; _d7++) {
1644
+ if (from - $from.start(_d7) == $from.depth - _d7 && to > $from.end(_d7) && $to.end(_d7) - to != $to.depth - _d7 && $from.start(_d7 - 1) == $to.start(_d7 - 1) && $from.node(_d7 - 1).canReplace($from.index(_d7 - 1), $to.index(_d7 - 1))) return tr["delete"]($from.before(_d7), to);
1645
+ }
1646
+ tr["delete"](from, to);
1647
+ }
1648
+ function coveredDepths($from, $to) {
1649
+ var result = [],
1650
+ minDepth = Math.min($from.depth, $to.depth);
1651
+ for (var d = minDepth; d >= 0; d--) {
1652
+ var start = $from.start(d);
1653
+ if (start < $from.pos - ($from.depth - d) || $to.end(d) > $to.pos + ($to.depth - d) || $from.node(d).type.spec.isolating || $to.node(d).type.spec.isolating) break;
1654
+ if (start == $to.start(d) || d == $from.depth && d == $to.depth && $from.parent.inlineContent && $to.parent.inlineContent && d && $to.start(d - 1) == start - 1) result.push(d);
1655
+ }
1656
+ return result;
1657
+ }
1658
+ var AttrStep = function (_Step8) {
1659
+ _inherits(AttrStep, _Step8);
1660
+ var _super8 = _createSuper(AttrStep);
1661
+ function AttrStep(pos, attr, value) {
1662
+ var _this12;
1663
+ _classCallCheck(this, AttrStep);
1664
+ _this12 = _super8.call(this);
1665
+ _this12.pos = pos;
1666
+ _this12.attr = attr;
1667
+ _this12.value = value;
1668
+ return _this12;
1669
+ }
1670
+ _createClass(AttrStep, [{
1671
+ key: "apply",
1672
+ value: function apply(doc) {
1673
+ var node = doc.nodeAt(this.pos);
1674
+ if (!node) return StepResult.fail("No node at attribute step's position");
1675
+ var attrs = Object.create(null);
1676
+ for (var name in node.attrs) attrs[name] = node.attrs[name];
1677
+ attrs[this.attr] = this.value;
1678
+ var updated = node.type.create(attrs, null, node.marks);
1679
+ return StepResult.fromReplace(doc, this.pos, this.pos + 1, new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(updated), 0, node.isLeaf ? 0 : 1));
1680
+ }
1681
+ }, {
1682
+ key: "getMap",
1683
+ value: function getMap() {
1684
+ return StepMap.empty;
1685
+ }
1686
+ }, {
1687
+ key: "invert",
1688
+ value: function invert(doc) {
1689
+ return new AttrStep(this.pos, this.attr, doc.nodeAt(this.pos).attrs[this.attr]);
1690
+ }
1691
+ }, {
1692
+ key: "map",
1693
+ value: function map(mapping) {
1694
+ var pos = mapping.mapResult(this.pos, 1);
1695
+ return pos.deletedAfter ? null : new AttrStep(pos.pos, this.attr, this.value);
1696
+ }
1697
+ }, {
1698
+ key: "toJSON",
1699
+ value: function toJSON() {
1700
+ return {
1701
+ stepType: "attr",
1702
+ pos: this.pos,
1703
+ attr: this.attr,
1704
+ value: this.value
1705
+ };
1706
+ }
1707
+ }], [{
1708
+ key: "fromJSON",
1709
+ value: function fromJSON(schema, json) {
1710
+ if (typeof json.pos != "number" || typeof json.attr != "string") throw new RangeError("Invalid input for AttrStep.fromJSON");
1711
+ return new AttrStep(json.pos, json.attr, json.value);
1712
+ }
1713
+ }]);
1714
+ return AttrStep;
1715
+ }(Step);
1716
+ Step.jsonID("attr", AttrStep);
1717
+ var DocAttrStep = function (_Step9) {
1718
+ _inherits(DocAttrStep, _Step9);
1719
+ var _super9 = _createSuper(DocAttrStep);
1720
+ function DocAttrStep(attr, value) {
1721
+ var _this13;
1722
+ _classCallCheck(this, DocAttrStep);
1723
+ _this13 = _super9.call(this);
1724
+ _this13.attr = attr;
1725
+ _this13.value = value;
1726
+ return _this13;
1727
+ }
1728
+ _createClass(DocAttrStep, [{
1729
+ key: "apply",
1730
+ value: function apply(doc) {
1731
+ var attrs = Object.create(null);
1732
+ for (var name in doc.attrs) attrs[name] = doc.attrs[name];
1733
+ attrs[this.attr] = this.value;
1734
+ var updated = doc.type.create(attrs, doc.content, doc.marks);
1735
+ return StepResult.ok(updated);
1736
+ }
1737
+ }, {
1738
+ key: "getMap",
1739
+ value: function getMap() {
1740
+ return StepMap.empty;
1741
+ }
1742
+ }, {
1743
+ key: "invert",
1744
+ value: function invert(doc) {
1745
+ return new DocAttrStep(this.attr, doc.attrs[this.attr]);
1746
+ }
1747
+ }, {
1748
+ key: "map",
1749
+ value: function map(mapping) {
1750
+ return this;
1751
+ }
1752
+ }, {
1753
+ key: "toJSON",
1754
+ value: function toJSON() {
1755
+ return {
1756
+ stepType: "docAttr",
1757
+ attr: this.attr,
1758
+ value: this.value
1759
+ };
1760
+ }
1761
+ }], [{
1762
+ key: "fromJSON",
1763
+ value: function fromJSON(schema, json) {
1764
+ if (typeof json.attr != "string") throw new RangeError("Invalid input for DocAttrStep.fromJSON");
1765
+ return new DocAttrStep(json.attr, json.value);
1766
+ }
1767
+ }]);
1768
+ return DocAttrStep;
1769
+ }(Step);
1770
+ Step.jsonID("docAttr", DocAttrStep);
1771
+ exports.TransformError = function (_Error) {
1772
+ _inherits(TransformError, _Error);
1773
+ var _super10 = _createSuper(TransformError);
1774
+ function TransformError() {
1775
+ _classCallCheck(this, TransformError);
1776
+ return _super10.apply(this, arguments);
1777
+ }
1778
+ return _createClass(TransformError);
1779
+ }(_wrapNativeSuper(Error));
1780
+ exports.TransformError = function TransformError(message) {
1781
+ var err = Error.call(this, message);
1782
+ err.__proto__ = TransformError.prototype;
1783
+ return err;
1784
+ };
1785
+ exports.TransformError.prototype = Object.create(Error.prototype);
1786
+ exports.TransformError.prototype.constructor = exports.TransformError;
1787
+ exports.TransformError.prototype.name = "TransformError";
1788
+ var Transform = function () {
1789
+ function Transform(doc) {
1790
+ _classCallCheck(this, Transform);
1791
+ this.doc = doc;
1792
+ this.steps = [];
1793
+ this.docs = [];
1794
+ this.mapping = new Mapping();
1795
+ }
1796
+ _createClass(Transform, [{
1797
+ key: "before",
1798
+ get: function get() {
1799
+ return this.docs.length ? this.docs[0] : this.doc;
1800
+ }
1801
+ }, {
1802
+ key: "step",
1803
+ value: function step(_step4) {
1804
+ var result = this.maybeStep(_step4);
1805
+ if (result.failed) throw new exports.TransformError(result.failed);
1806
+ return this;
1807
+ }
1808
+ }, {
1809
+ key: "maybeStep",
1810
+ value: function maybeStep(step) {
1811
+ var result = step.apply(this.doc);
1812
+ if (!result.failed) this.addStep(step, result.doc);
1813
+ return result;
1814
+ }
1815
+ }, {
1816
+ key: "docChanged",
1817
+ get: function get() {
1818
+ return this.steps.length > 0;
1819
+ }
1820
+ }, {
1821
+ key: "changedRange",
1822
+ value: function changedRange() {
1823
+ var from = 1e9,
1824
+ to = -1e9;
1825
+ for (var i = 0; i < this.mapping.maps.length; i++) {
1826
+ var map = this.mapping.maps[i];
1827
+ if (i) {
1828
+ from = map.map(from, 1);
1829
+ to = map.map(to, -1);
1830
+ }
1831
+ map.forEach(function (_f, _t, fromB, toB) {
1832
+ from = Math.min(from, fromB);
1833
+ to = Math.max(to, toB);
1834
+ });
1835
+ }
1836
+ return from == 1e9 ? null : {
1837
+ from: from,
1838
+ to: to
1839
+ };
1840
+ }
1841
+ }, {
1842
+ key: "addStep",
1843
+ value: function addStep(step, doc) {
1844
+ this.docs.push(this.doc);
1845
+ this.steps.push(step);
1846
+ this.mapping.appendMap(step.getMap());
1847
+ this.doc = doc;
1848
+ }
1849
+ }, {
1850
+ key: "replace",
1851
+ value: function replace(from) {
1852
+ var to = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : from;
1853
+ var slice = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : prosemirrorModel.Slice.empty;
1854
+ var step = replaceStep(this.doc, from, to, slice);
1855
+ if (step) this.step(step);
1856
+ return this;
1857
+ }
1858
+ }, {
1859
+ key: "replaceWith",
1860
+ value: function replaceWith(from, to, content) {
1861
+ return this.replace(from, to, new prosemirrorModel.Slice(prosemirrorModel.Fragment.from(content), 0, 0));
1862
+ }
1863
+ }, {
1864
+ key: "delete",
1865
+ value: function _delete(from, to) {
1866
+ return this.replace(from, to, prosemirrorModel.Slice.empty);
1867
+ }
1868
+ }, {
1869
+ key: "insert",
1870
+ value: function insert(pos, content) {
1871
+ return this.replaceWith(pos, pos, content);
1872
+ }
1873
+ }, {
1874
+ key: "replaceRange",
1875
+ value: function replaceRange(from, to, slice) {
1876
+ _replaceRange(this, from, to, slice);
1877
+ return this;
1878
+ }
1879
+ }, {
1880
+ key: "replaceRangeWith",
1881
+ value: function replaceRangeWith(from, to, node) {
1882
+ _replaceRangeWith(this, from, to, node);
1883
+ return this;
1884
+ }
1885
+ }, {
1886
+ key: "deleteRange",
1887
+ value: function deleteRange(from, to) {
1888
+ _deleteRange(this, from, to);
1889
+ return this;
1890
+ }
1891
+ }, {
1892
+ key: "lift",
1893
+ value: function lift(range, target) {
1894
+ _lift(this, range, target);
1895
+ return this;
1896
+ }
1897
+ }, {
1898
+ key: "join",
1899
+ value: function join(pos) {
1900
+ var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
1901
+ _join(this, pos, depth);
1902
+ return this;
1903
+ }
1904
+ }, {
1905
+ key: "wrap",
1906
+ value: function wrap(range, wrappers) {
1907
+ _wrap2(this, range, wrappers);
1908
+ return this;
1909
+ }
1910
+ }, {
1911
+ key: "setBlockType",
1912
+ value: function setBlockType(from) {
1913
+ var to = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : from;
1914
+ var type = arguments.length > 2 ? arguments[2] : undefined;
1915
+ var attrs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
1916
+ _setBlockType(this, from, to, type, attrs);
1917
+ return this;
1918
+ }
1919
+ }, {
1920
+ key: "setNodeMarkup",
1921
+ value: function setNodeMarkup(pos, type) {
1922
+ var attrs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
1923
+ var marks = arguments.length > 3 ? arguments[3] : undefined;
1924
+ _setNodeMarkup(this, pos, type, attrs, marks);
1925
+ return this;
1926
+ }
1927
+ }, {
1928
+ key: "setNodeAttribute",
1929
+ value: function setNodeAttribute(pos, attr, value) {
1930
+ this.step(new AttrStep(pos, attr, value));
1931
+ return this;
1932
+ }
1933
+ }, {
1934
+ key: "setDocAttribute",
1935
+ value: function setDocAttribute(attr, value) {
1936
+ this.step(new DocAttrStep(attr, value));
1937
+ return this;
1938
+ }
1939
+ }, {
1940
+ key: "addNodeMark",
1941
+ value: function addNodeMark(pos, mark) {
1942
+ this.step(new AddNodeMarkStep(pos, mark));
1943
+ return this;
1944
+ }
1945
+ }, {
1946
+ key: "removeNodeMark",
1947
+ value: function removeNodeMark(pos, mark) {
1948
+ var node = this.doc.nodeAt(pos);
1949
+ if (!node) throw new RangeError("No node at position " + pos);
1950
+ if (mark instanceof prosemirrorModel.Mark) {
1951
+ if (mark.isInSet(node.marks)) this.step(new RemoveNodeMarkStep(pos, mark));
1952
+ } else {
1953
+ var set = node.marks,
1954
+ found,
1955
+ steps = [];
1956
+ while (found = mark.isInSet(set)) {
1957
+ steps.push(new RemoveNodeMarkStep(pos, found));
1958
+ set = found.removeFromSet(set);
1959
+ }
1960
+ for (var i = steps.length - 1; i >= 0; i--) this.step(steps[i]);
1961
+ }
1962
+ return this;
1963
+ }
1964
+ }, {
1965
+ key: "split",
1966
+ value: function split(pos) {
1967
+ var depth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
1968
+ var typesAfter = arguments.length > 2 ? arguments[2] : undefined;
1969
+ _split(this, pos, depth, typesAfter);
1970
+ return this;
1971
+ }
1972
+ }, {
1973
+ key: "addMark",
1974
+ value: function addMark(from, to, mark) {
1975
+ _addMark(this, from, to, mark);
1976
+ return this;
1977
+ }
1978
+ }, {
1979
+ key: "removeMark",
1980
+ value: function removeMark(from, to, mark) {
1981
+ _removeMark(this, from, to, mark);
1982
+ return this;
1983
+ }
1984
+ }, {
1985
+ key: "clearIncompatible",
1986
+ value: function clearIncompatible(pos, parentType, match) {
1987
+ _clearIncompatible(this, pos, parentType, match);
1988
+ return this;
1989
+ }
1990
+ }]);
1991
+ return Transform;
1992
+ }();
1993
+ exports.AddMarkStep = AddMarkStep;
1994
+ exports.AddNodeMarkStep = AddNodeMarkStep;
1995
+ exports.AttrStep = AttrStep;
1996
+ exports.DocAttrStep = DocAttrStep;
1997
+ exports.MapResult = MapResult;
1998
+ exports.Mapping = Mapping;
1999
+ exports.RemoveMarkStep = RemoveMarkStep;
2000
+ exports.RemoveNodeMarkStep = RemoveNodeMarkStep;
2001
+ exports.ReplaceAroundStep = ReplaceAroundStep;
2002
+ exports.ReplaceStep = ReplaceStep;
2003
+ exports.Step = Step;
2004
+ exports.StepMap = StepMap;
2005
+ exports.StepResult = StepResult;
2006
+ exports.Transform = Transform;
2007
+ exports.canJoin = canJoin;
2008
+ exports.canSplit = canSplit;
2009
+ exports.dropPoint = dropPoint;
2010
+ exports.findWrapping = findWrapping;
2011
+ exports.insertPoint = insertPoint;
2012
+ exports.joinPoint = joinPoint;
2013
+ exports.liftTarget = liftTarget;
2014
+ exports.replaceStep = replaceStep;