@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
package/src/basic.tsx ADDED
@@ -0,0 +1,149 @@
1
+ import { Node } from "@tiptap/core";
2
+ import { colorCss, defineBlock, spacingValue, type BlockAttrSpec } from "@ecomcx/ecomweb-content";
3
+ import {
4
+ ChevronRight, Code2, Image as ImageIcon, LayoutPanelLeft, ListTree, MoveVertical, Plus, Quote, RectangleHorizontal, Share2, Trash2, Type, type LucideIcon,
5
+ } from "lucide-react";
6
+ import type { ComponentType } from "react";
7
+ import type { BlockEditProps } from "./blocks";
8
+ import { registerBlock } from "./blocks";
9
+ import { registerEditorExtension } from "./registry";
10
+
11
+ type Dict = Record<string, string>;
12
+ const vi: Dict = {
13
+ spacer: "Khoảng trống", buttons: "Nhóm nút", cover: "Ảnh bìa", mediaText: "Ảnh + chữ", pullquote: "Trích dẫn nổi bật", details: "Chi tiết (thu gọn)",
14
+ customHtml: "HTML tuỳ chỉnh", socialLinks: "Mạng xã hội", tableOfContents: "Mục lục", preformatted: "Văn bản định dạng sẵn",
15
+ height: "Chiều cao (preset hoặc 48px)", align: "Căn", left: "Trái", center: "Giữa", right: "Phải", "space-between": "Dàn đều", image: "Ảnh",
16
+ alt: "Mô tả ảnh (alt)", overlay: "Màu phủ", opacity: "Độ đậm lớp phủ (%)", minHeight: "Cao tối thiểu", contentAlign: "Vị trí nội dung",
17
+ top: "Trên", bottom: "Dưới", fixed: "Ảnh nền đứng yên khi cuộn", position: "Vị trí ảnh", width: "Độ rộng ảnh (%)", verticalAlign: "Căn dọc",
18
+ stack: "Xếp dọc trên điện thoại", citation: "Nguồn trích dẫn", summary: "Tiêu đề (bấm để mở)", open: "Mở sẵn", html: "Mã HTML",
19
+ size: "Cỡ", showLabels: "Hiện tên mạng cạnh biểu tượng", small: "Nhỏ", medium: "Vừa", large: "Lớn", title: "Tiêu đề", maxLevel: "Đến cấp tiêu đề",
20
+ pickImage: "Chọn ảnh", replaceImage: "Thay ảnh", removeImage: "Bỏ ảnh", addLink: "Thêm liên kết", service: "Mạng", url: "Đường dẫn",
21
+ htmlHint: "HTML chỉ chạy trên website; người không có quyền HTML không lọc sẽ bị lọc khi lưu.",
22
+ tocHint: "Tự tạo từ các tiêu đề trong bài", summaryPlaceholder: "Bấm để xem thêm",
23
+ };
24
+ const en: Dict = {
25
+ spacer: "Spacer", buttons: "Buttons", cover: "Cover", mediaText: "Media & text", pullquote: "Pullquote", details: "Details",
26
+ customHtml: "Custom HTML", socialLinks: "Social links", tableOfContents: "Table of contents", preformatted: "Preformatted",
27
+ height: "Height (preset or 48px)", align: "Alignment", left: "Left", center: "Center", right: "Right", "space-between": "Space between", image: "Image",
28
+ alt: "Alt text", overlay: "Overlay color", opacity: "Overlay opacity (%)", minHeight: "Min height", contentAlign: "Content position",
29
+ top: "Top", bottom: "Bottom", fixed: "Fixed background", position: "Media position", width: "Media width (%)", verticalAlign: "Vertical align",
30
+ stack: "Stack on mobile", citation: "Citation", summary: "Summary (click to open)", open: "Open by default", html: "HTML",
31
+ size: "Size", showLabels: "Show names next to icons", small: "Small", medium: "Medium", large: "Large", title: "Title", maxLevel: "Up to heading level",
32
+ pickImage: "Choose image", replaceImage: "Replace image", removeImage: "Remove image", addLink: "Add link", service: "Service", url: "URL",
33
+ htmlHint: "HTML runs only on the website; it is filtered on save for people without the unfiltered HTML permission.",
34
+ tocHint: "Built from the headings in the post", summaryPlaceholder: "Click to read more",
35
+ };
36
+
37
+ export const SOCIAL_SERVICES = ["facebook", "x", "instagram", "youtube", "tiktok", "linkedin", "zalo", "github", "threads", "pinterest", "telegram", "messenger", "email", "website"];
38
+
39
+ const s = (label: string, extra: Partial<BlockAttrSpec> = {}): BlockAttrSpec => ({ type: "string", label, ...extra });
40
+ const i = (label: string, extra: Partial<BlockAttrSpec> = {}): BlockAttrSpec => ({ type: "integer", label, ...extra });
41
+ const b = (label: string, extra: Partial<BlockAttrSpec> = {}): BlockAttrSpec => ({ type: "boolean", label, ...extra });
42
+ const enumOf = (label: string, values: string[], def?: string) => s(label, { enum: values, enumLabels: values, default: def });
43
+ const image = { src: { type: "url", label: "image", control: "media" } as BlockAttrSpec, mediaId: { type: "json", control: "hidden" } as BlockAttrSpec, alt: s("alt") };
44
+
45
+ function SpacerEdit({ attrs }: BlockEditProps) {
46
+ return <div className="cms-ed-spacer" style={{ height: spacingValue(attrs.height ?? "lg") ?? "1.5rem" }} contentEditable={false} />;
47
+ }
48
+ function CoverEdit({ attrs, children }: BlockEditProps) {
49
+ const overlay = colorCss(attrs.overlay) ?? (attrs.src ? "#000" : undefined);
50
+ return (
51
+ <div className="cms-ed-cover" style={{ minHeight: spacingValue(attrs.minHeight ?? "400px"), backgroundImage: attrs.src ? `url("${String(attrs.src).replace(/["\\()]/g, encodeURIComponent)}")` : undefined }}>
52
+ {overlay && <span className="cms-ed-cover-overlay" style={{ background: overlay, opacity: Math.min(100, Math.max(0, Number(attrs.opacity ?? 50))) / 100 }} contentEditable={false} />}
53
+ <div className="cms-ed-cover-inner">{children}</div>
54
+ </div>
55
+ );
56
+ }
57
+ function MediaTextEdit({ attrs, children }: BlockEditProps) {
58
+ const w = Math.min(80, Math.max(20, Number(attrs.width) || 50));
59
+ return (
60
+ <div className="cms-ed-media-text" style={{ gridTemplateColumns: attrs.position === "right" ? `1fr ${w}%` : `${w}% 1fr` }}>
61
+ <div className="cms-ed-media-text-media" style={{ order: attrs.position === "right" ? 2 : 0 }} contentEditable={false}>
62
+ {attrs.src ? <img src={attrs.src} alt={attrs.alt ?? ""} /> : <ImageIcon size={28} />}
63
+ </div>
64
+ <div>{children}</div>
65
+ </div>
66
+ );
67
+ }
68
+ const PullquoteEdit = ({ attrs, children }: BlockEditProps) => (
69
+ <figure className="cms-ed-pullquote"><div>{children}</div>{attrs.citation && <figcaption contentEditable={false}>{attrs.citation}</figcaption>}</figure>
70
+ );
71
+ const detailsEdit = (t: (k: string) => string) => function DetailsEdit({ attrs, children }: BlockEditProps) {
72
+ return <div className="cms-ed-details"><div className="cms-ed-details-summary" contentEditable={false}><ChevronRight size={14} /> {attrs.summary || t("summaryPlaceholder")}</div>{children}</div>;
73
+ };
74
+ const htmlEdit = (t: (k: string) => string) => function HtmlEdit({ attrs }: BlockEditProps) {
75
+ // Không chạy HTML trong trang quản trị (cùng tên miền với phiên đăng nhập) — chỉ hiện mã nguồn
76
+ return <div contentEditable={false}><pre className="cms-ed-html-src">{attrs.html || "<!-- HTML -->"}</pre><small className="cms-ed-hint-text">{t("htmlHint")}</small></div>;
77
+ };
78
+ const tocEdit = (t: (k: string) => string) => function TocEdit({ attrs }: BlockEditProps) {
79
+ return <div className="cms-ed-toc" contentEditable={false}><strong>{attrs.title || t("tableOfContents")}</strong> <small>{t("tocHint")} (H2–H{attrs.maxLevel ?? 3})</small></div>;
80
+ };
81
+ const socialEdit = (t: (k: string) => string) => function SocialEdit({ attrs, setAttrs }: BlockEditProps) {
82
+ const links: Array<{ service: string; url: string }> = Array.isArray(attrs.links) ? attrs.links : [];
83
+ const update = (next: typeof links) => setAttrs({ links: next });
84
+ return (
85
+ <div className="cms-ed-social" contentEditable={false}>
86
+ {links.map((l, idx) => (
87
+ <div key={idx} className="cms-ed-social-row">
88
+ <select aria-label={t("service")} value={l.service} onChange={(e) => update(links.map((x, j) => (j === idx ? { ...x, service: e.target.value } : x)))}>
89
+ {SOCIAL_SERVICES.map((sv) => <option key={sv} value={sv}>{sv}</option>)}
90
+ </select>
91
+ <input type="url" aria-label={t("url")} placeholder="https://" value={l.url} onChange={(e) => update(links.map((x, j) => (j === idx ? { ...x, url: e.target.value } : x)))} />
92
+ <button type="button" aria-label={t("removeImage").replace(/ảnh|image/i, "").trim() || "×"} title="×" onClick={() => update(links.filter((_, j) => j !== idx))}><Trash2 size={14} /></button>
93
+ </div>
94
+ ))}
95
+ <button type="button" className="cms-ed-text-btn" onClick={() => update([...links, { service: "facebook", url: "" }])}><Plus size={12} /> {t("addLink")}</button>
96
+ </div>
97
+ );
98
+ };
99
+
100
+ /** Văn bản định dạng sẵn: giữ nguyên khoảng trắng và xuống dòng (Enter = xuống dòng trong khối). */
101
+ export const Preformatted = Node.create({
102
+ name: "preformatted",
103
+ group: "block",
104
+ content: "inline*",
105
+ marks: "_",
106
+ whitespace: "pre",
107
+ defining: true,
108
+ parseHTML: () => [{ tag: "pre.ecx-pre" }],
109
+ renderHTML: () => ["pre", { class: "ecx-pre cms-ed-pre" }, 0],
110
+ addKeyboardShortcuts() {
111
+ return { Enter: () => (this.editor.isActive("preformatted") ? this.editor.commands.insertContent("\n") : false) };
112
+ },
113
+ });
114
+
115
+ let registered: string | null = null;
116
+
117
+ /** Bộ khối cơ bản (@ecomcx/ecomweb-content 1.9) cho mọi trình soạn — gọi lại với ngôn ngữ khác để đổi nhãn. */
118
+ export function registerBasicBlocks(locale: "vi" | "en" = "vi") {
119
+ if (registered === locale) return;
120
+ registered = locale;
121
+ const dict = locale === "en" ? en : vi;
122
+ const t = (k: string) => dict[k] ?? k;
123
+ type Spec = [string, LucideIcon, "none" | "blocks" | "inline", Record<string, BlockAttrSpec>, ComponentType<BlockEditProps> | undefined, (() => Array<Record<string, unknown>>) | undefined];
124
+ const specs: Spec[] = [
125
+ ["spacer", MoveVertical, "none", { height: s("height", { default: "lg" }) }, SpacerEdit, undefined],
126
+ ["buttons", RectangleHorizontal, "blocks", { align: enumOf("align", ["left", "center", "right", "space-between"]) }, undefined,
127
+ () => [{ type: "button", attrs: { text: locale === "en" ? "Button" : "Nút", variant: "primary" } }, { type: "button", attrs: { text: locale === "en" ? "Learn more" : "Tìm hiểu", variant: "outline" } }]],
128
+ ["cover", ImageIcon, "blocks", { ...image, overlay: s("overlay", { control: "color" }), opacity: i("opacity", { min: 0, max: 100, default: 50 }),
129
+ minHeight: s("minHeight", { default: "400px" }), contentAlign: enumOf("contentAlign", ["top", "center", "bottom"], "center"), fixed: b("fixed", { default: false }) }, CoverEdit,
130
+ () => [{ type: "heading", attrs: { level: 2, textAlign: "center" } }]],
131
+ ["mediaText", LayoutPanelLeft, "blocks", { ...image, position: enumOf("position", ["left", "right"], "left"), width: i("width", { min: 20, max: 80, default: 50 }),
132
+ verticalAlign: enumOf("verticalAlign", ["top", "center", "bottom"], "center"), stack: b("stack", { default: true }) }, MediaTextEdit, undefined],
133
+ ["pullquote", Quote, "inline", { citation: s("citation") }, PullquoteEdit, undefined],
134
+ ["details", ChevronRight, "blocks", { summary: s("summary"), open: b("open", { default: false }) }, detailsEdit(t), undefined],
135
+ ["customHtml", Code2, "none", { html: s("html", { control: "textarea" }) }, htmlEdit(t), undefined],
136
+ ["socialLinks", Share2, "none", { links: { type: "json", default: [], control: "hidden" }, size: enumOf("size", ["small", "medium", "large"], "medium"), align: enumOf("align", ["left", "center", "right"]), showLabels: b("showLabels", { default: false }) }, socialEdit(t), undefined],
137
+ ["tableOfContents", ListTree, "none", { title: s("title"), maxLevel: i("maxLevel", { min: 2, max: 4, default: 3 }) }, tocEdit(t), undefined],
138
+ ];
139
+ for (const [name, icon, content, attributes, edit, initialContent] of specs) {
140
+ const def = defineBlock({ name, title: name, keywords: `${vi[name]} ${en[name]}`, content, attributes });
141
+ registerBlock(def, { icon, translate: t, edit, initialContent });
142
+ }
143
+ registerEditorExtension({
144
+ name: "basic:preformatted",
145
+ extensions: [Preformatted],
146
+ insertItems: [{ key: "preformatted", title: t("preformatted"), hint: "pre", icon: Type, keywords: "dinh dang san preformatted pre van ban",
147
+ run: (editor, range) => { const c = range ? editor.chain().focus().deleteRange(range) : editor.chain().focus(); c.setNode("preformatted").run(); } }],
148
+ });
149
+ }
@@ -0,0 +1,42 @@
1
+ import {
2
+ Braces, CheckSquare, Columns2, Columns3, FileText, Globe, Heading, ImageIcon, Images, Info, List, ListOrdered, Minus, Music, Pilcrow, Quote,
3
+ RectangleHorizontal, SquareCode, SquareDashed, Table2, TriangleAlert, Video, type LucideIcon,
4
+ } from "lucide-react";
5
+ import { pluginBlockInfo } from "./blocks";
6
+ import type { EditorLabels } from "./labels";
7
+ import { UNKNOWN_BLOCK } from "./unknown";
8
+
9
+ export interface BlockInfo { title: string; icon: LucideIcon; description?: string }
10
+
11
+ /** Tên + biểu tượng của một loại khối (lõi hoặc plugin) — dùng chung cho trình chèn, cây khối, tab "Khối". */
12
+ export function blockInfo(type: string, t: EditorLabels): BlockInfo {
13
+ const core: Record<string, BlockInfo> = {
14
+ paragraph: { title: t.paragraph, icon: Pilcrow, description: t.paragraphHint },
15
+ heading: { title: t.heading, icon: Heading },
16
+ bulletList: { title: t.bulletList, icon: List },
17
+ orderedList: { title: t.orderedList, icon: ListOrdered },
18
+ taskList: { title: t.taskList, icon: CheckSquare },
19
+ blockquote: { title: t.quote, icon: Quote },
20
+ codeBlock: { title: t.codeBlock, icon: SquareCode },
21
+ horizontalRule: { title: t.hr, icon: Minus, description: t.hrHint },
22
+ image: { title: t.image, icon: ImageIcon },
23
+ gallery: { title: t.gallery, icon: Images, description: t.galleryHint },
24
+ video: { title: t.video, icon: Video },
25
+ audio: { title: t.audio, icon: Music },
26
+ file: { title: t.file, icon: FileText, description: t.fileHint },
27
+ table: { title: t.table, icon: Table2 },
28
+ youtube: { title: t.youtube, icon: Video },
29
+ columns: { title: t.columnsBlock, icon: Columns3, description: t.columnsHint },
30
+ column: { title: t.column, icon: Columns2 },
31
+ group: { title: t.group, icon: SquareDashed, description: t.groupHint },
32
+ callout: { title: t.callout, icon: Info, description: t.calloutHint },
33
+ button: { title: t.button, icon: RectangleHorizontal, description: t.buttonHint },
34
+ embed: { title: t.embed, icon: Globe, description: t.embedHint },
35
+ preformatted: { title: t.preformattedBlock, icon: SquareCode },
36
+ [UNKNOWN_BLOCK]: { title: t.unknownBlock, icon: TriangleAlert },
37
+ };
38
+ if (core[type]) return core[type];
39
+ const plugin = pluginBlockInfo(type);
40
+ if (plugin) return { title: plugin.title, icon: plugin.icon, description: plugin.description };
41
+ return { title: type, icon: Braces };
42
+ }
@@ -0,0 +1,179 @@
1
+ import { Fragment, type Node as PMNode } from "@tiptap/pm/model";
2
+ import { NodeSelection, Selection, TextSelection, type EditorState, type Transaction } from "@tiptap/pm/state";
3
+
4
+ /**
5
+ * Thao tác trên khối (tay kéo, menu khối, phím tắt) — hàm thuần trên trạng thái ProseMirror, test được không cần trình duyệt.
6
+ * "Khối" = nút nằm trực tiếp trong một vùng chứa khối: doc, cột, nhóm, hộp lưu ý, khối plugin có content "blocks".
7
+ * Mục danh sách, ô bảng… không phải khối riêng: thao tác áp lên cả danh sách / cả bảng.
8
+ */
9
+ const containers = new Set(["doc"]);
10
+
11
+ /** Đánh dấu một loại nút là vùng chứa khối (khối con bên trong có tay kéo + menu riêng). */
12
+ export function markContainer(name: string) { containers.add(name); }
13
+ export const isContainer = (node: PMNode) => containers.has(node.type.name);
14
+
15
+ export interface BlockRef { pos: number; node: PMNode; depth: number }
16
+
17
+ /** Khối chứa nút bắt đầu ở `pos` (chính nó nếu nằm trực tiếp trong vùng chứa, không thì tổ tiên gần nhất). */
18
+ export function blockFromPos(doc: PMNode, pos: number): BlockRef | null {
19
+ if (pos < 0 || pos >= doc.content.size) return null;
20
+ const $p = doc.resolve(pos);
21
+ const node = doc.nodeAt(pos);
22
+ if (node && isContainer($p.parent)) return { pos, node, depth: $p.depth + 1 };
23
+ for (let d = $p.depth; d >= 1; d--) if (isContainer($p.node(d - 1))) return { pos: $p.before(d), node: $p.node(d), depth: d };
24
+ return null;
25
+ }
26
+
27
+ /** Khối đang có con trỏ / đang được chọn. */
28
+ export function currentBlock(state: EditorState): BlockRef | null {
29
+ const sel = state.selection;
30
+ if (sel instanceof NodeSelection) return blockFromPos(state.doc, sel.from);
31
+ const $from = sel.$from;
32
+ if ($from.depth === 0) return null;
33
+ return blockFromPos(state.doc, $from.before($from.depth));
34
+ }
35
+
36
+ /** Khối cha (để chọn cả cột / nhóm chứa khối hiện tại). */
37
+ export function parentBlock(doc: PMNode, block: BlockRef): BlockRef | null {
38
+ const $p = doc.resolve(block.pos);
39
+ for (let d = $p.depth; d >= 1; d--) {
40
+ const before = $p.before(d);
41
+ const found = blockFromPos(doc, before);
42
+ if (found && found.pos !== block.pos) return found;
43
+ }
44
+ return null;
45
+ }
46
+
47
+ /** Sau khi chuyển khối: giữ con trỏ / vùng chọn ở đúng chỗ cũ bên trong khối (nếu nó nằm trong khối), không thì vào đầu khối. */
48
+ function keepSelection(state: EditorState, tr: Transaction, block: BlockRef, newPos: number) {
49
+ const sel = state.selection, end = block.pos + block.node.nodeSize;
50
+ if (sel instanceof NodeSelection && sel.from === block.pos) return tr.setSelection(NodeSelection.create(tr.doc, newPos));
51
+ if (sel.from >= block.pos && sel.to <= end) {
52
+ const shift = newPos - block.pos;
53
+ try { return tr.setSelection(TextSelection.create(tr.doc, sel.anchor + shift, sel.head + shift)); } catch { /* vị trí không còn hợp lệ */ }
54
+ }
55
+ return selectInside(tr, newPos);
56
+ }
57
+
58
+ function selectInside(tr: Transaction, pos: number) {
59
+ const node = tr.doc.nodeAt(pos);
60
+ if (!node) return tr;
61
+ // Khối có chữ → đặt con trỏ vào đầu khối; khối nguyên khối (ảnh, bộ sưu tập…) → chọn cả khối
62
+ if (node.isAtom || !node.inlineContent && !node.firstChild) return tr.setSelection(NodeSelection.create(tr.doc, pos));
63
+ const sel = Selection.findFrom(tr.doc.resolve(pos + 1), 1, true);
64
+ return sel ? tr.setSelection(sel) : tr.setSelection(NodeSelection.create(tr.doc, pos));
65
+ }
66
+
67
+ /** Đổi chỗ khối với khối liền trên (-1) / liền dưới (1) trong cùng vùng chứa. null = không di chuyển được. */
68
+ export function moveBlock(state: EditorState, block: BlockRef, dir: -1 | 1): Transaction | null {
69
+ const $p = state.doc.resolve(block.pos);
70
+ const parent = $p.parent, index = $p.index();
71
+ const target = index + dir;
72
+ if (target < 0 || target >= parent.childCount) return null;
73
+ const other = parent.child(target);
74
+ const tr = state.tr;
75
+ if (dir === -1) {
76
+ const start = block.pos - other.nodeSize;
77
+ tr.replaceWith(start, block.pos + block.node.nodeSize, Fragment.from([block.node, other]));
78
+ return keepSelection(state, tr, block, start).scrollIntoView();
79
+ }
80
+ tr.replaceWith(block.pos, block.pos + block.node.nodeSize + other.nodeSize, Fragment.from([other, block.node]));
81
+ return keepSelection(state, tr, block, block.pos + other.nodeSize).scrollIntoView();
82
+ }
83
+
84
+ /** Chèn bản sao ngay dưới khối. */
85
+ export function duplicateBlock(state: EditorState, block: BlockRef): Transaction {
86
+ const after = block.pos + block.node.nodeSize;
87
+ return selectInside(state.tr.insert(after, block.node), after).scrollIntoView();
88
+ }
89
+
90
+ /** Xoá khối. Vùng chứa chỉ còn khối này → thay bằng đoạn văn trống (vùng chứa không được rỗng). */
91
+ export function deleteBlock(state: EditorState, block: BlockRef): Transaction {
92
+ const $p = state.doc.resolve(block.pos);
93
+ const tr = state.tr;
94
+ const end = block.pos + block.node.nodeSize;
95
+ if ($p.parent.childCount === 1) {
96
+ const p = state.schema.nodes.paragraph.create();
97
+ tr.replaceWith(block.pos, end, p);
98
+ return tr.setSelection(TextSelection.create(tr.doc, block.pos + 1));
99
+ }
100
+ tr.delete(block.pos, end);
101
+ const sel = Selection.findFrom(tr.doc.resolve(Math.min(block.pos, tr.doc.content.size)), -1, true) ?? Selection.findFrom(tr.doc.resolve(Math.min(block.pos, tr.doc.content.size)), 1, true);
102
+ if (sel) tr.setSelection(sel);
103
+ return tr.scrollIntoView();
104
+ }
105
+
106
+ /** Chèn đoạn văn trống ngay dưới khối, đặt con trỏ vào đó. */
107
+ export function insertParagraphAfter(state: EditorState, block: BlockRef): Transaction {
108
+ const after = block.pos + block.node.nodeSize;
109
+ const tr = state.tr.insert(after, state.schema.nodes.paragraph.create());
110
+ return tr.setSelection(TextSelection.create(tr.doc, after + 1)).scrollIntoView();
111
+ }
112
+
113
+ export function insertParagraphBefore(state: EditorState, block: BlockRef): Transaction {
114
+ const tr = state.tr.insert(block.pos, state.schema.nodes.paragraph.create());
115
+ return tr.setSelection(TextSelection.create(tr.doc, block.pos + 1)).scrollIntoView();
116
+ }
117
+
118
+ /**
119
+ * Chuyển khối ở `from` tới vị trí `to` (vị trí giữa hai khối, theo tài liệu hiện tại) — dùng cho kéo thả trong cây khối.
120
+ * null khi không hợp lệ: thả vào chính nó / bên trong nó, hoặc chỗ đến không nhận loại khối này (vd cột chỉ nằm trong bộ cột).
121
+ */
122
+ export function moveBlockTo(state: EditorState, from: number, to: number): Transaction | null {
123
+ const node = state.doc.nodeAt(from);
124
+ if (!node) return null;
125
+ if (to > from && to < from + node.nodeSize) return null;
126
+ if (to === from || to === from + node.nodeSize) return null;
127
+ // Cột chỉ đổi chỗ trong chính bộ cột của nó (bộ cột cần 2–4 cột)
128
+ if (node.type.name === "column" && state.doc.resolve(from).start() !== state.doc.resolve(to).start()) return null;
129
+ const $from = state.doc.resolve(from), $to = state.doc.resolve(to);
130
+ const tr = state.tr;
131
+ let at: number;
132
+ if ($from.start() === $to.start()) {
133
+ // Cùng vùng chứa: sắp lại thứ tự cả vùng một lần (không qua trạng thái thiếu khối, vd bộ cột chỉ còn 1 cột)
134
+ const kids: PMNode[] = [];
135
+ $from.parent.forEach((c) => kids.push(c));
136
+ const fromIdx = $from.index();
137
+ let toIdx = $to.index();
138
+ kids.splice(fromIdx, 1);
139
+ if (toIdx > fromIdx) toIdx--;
140
+ kids.splice(toIdx, 0, node);
141
+ tr.replaceWith($from.start(), $from.end(), Fragment.from(kids));
142
+ at = $from.start() + kids.slice(0, toIdx).reduce((n, k) => n + k.nodeSize, 0);
143
+ } else {
144
+ if (!$to.parent.canReplaceWith($to.index(), $to.index(), node.type)) return null;
145
+ // Chèn trước rồi xoá bản gốc; vùng chứa mất khối cuối cùng được ProseMirror bù đoạn trống
146
+ tr.insert(to, node);
147
+ const start = tr.mapping.map(from);
148
+ tr.delete(start, start + node.nodeSize);
149
+ // Vị trí khối vừa chèn (bắt đầu ở `to` sau bước chèn) đi qua bước xoá
150
+ at = tr.mapping.slice(1).map(to, 1);
151
+ }
152
+ return selectInside(tr, at).scrollIntoView();
153
+ }
154
+
155
+ export interface BlockTreeItem { pos: number; node: PMNode; depth: number; children: BlockTreeItem[] }
156
+
157
+ /** Cây khối của tài liệu: khối trong vùng chứa (doc, cột trong bộ cột, nhóm…). */
158
+ export function blockTree(doc: PMNode): BlockTreeItem[] {
159
+ const walk = (parent: PMNode, start: number, depth: number): BlockTreeItem[] => {
160
+ const out: BlockTreeItem[] = [];
161
+ parent.forEach((child, offset) => {
162
+ const pos = start + offset;
163
+ // Bộ cột: từng cột là một mục (cột không phải vùng chứa trực tiếp của doc nhưng chứa khối)
164
+ const nested = isContainer(child) || child.type.name === "columns" ? walk(child, pos + 1, depth + 1) : [];
165
+ out.push({ pos, node: child, depth, children: nested });
166
+ });
167
+ return out;
168
+ };
169
+ return walk(doc, 0, 0);
170
+ }
171
+
172
+ /** Đổi thuộc tính của khối ở `pos`; khối đang được chọn cả khối thì vẫn giữ chọn (setNodeMarkup làm mất NodeSelection). */
173
+ export function setBlockAttrs(state: EditorState, pos: number, attrs: Record<string, unknown>): Transaction | null {
174
+ const node = state.doc.nodeAt(pos);
175
+ if (!node) return null;
176
+ const tr = state.tr.setNodeMarkup(pos, undefined, { ...node.attrs, ...attrs });
177
+ if (state.selection instanceof NodeSelection && state.selection.from === pos) tr.setSelection(NodeSelection.create(tr.doc, pos));
178
+ return tr;
179
+ }
package/src/blocks.tsx ADDED
@@ -0,0 +1,189 @@
1
+ import { Node, mergeAttributes } from "@tiptap/core";
2
+ import { NodeViewContent, NodeViewWrapper, ReactNodeViewRenderer, useEditorState, type ReactNodeViewProps } from "@tiptap/react";
3
+ import { BLOCK_VERSION_ATTR, blockDefaults, type BlockAttrSpec, type BlockDefinition } from "@ecomcx/ecomweb-content";
4
+ import { Blocks, type LucideIcon } from "lucide-react";
5
+ import type { ComponentType, ReactNode } from "react";
6
+ import { registerEditorExtension, unregisterEditorExtension } from "./registry";
7
+ import { cx } from "./util";
8
+ import { markContainer } from "./blockops";
9
+ import { insertBlock } from "./insert";
10
+
11
+ /** Props của phần xem trước tuỳ chỉnh trong trình soạn (tuỳ chọn — mặc định trình soạn tự hiển thị). */
12
+ export interface BlockEditProps {
13
+ attrs: Record<string, any>;
14
+ setAttrs(attrs: Record<string, unknown>): void;
15
+ selected: boolean;
16
+ /** Nội dung bên trong (khối có content "inline"/"blocks") — đặt vào chỗ muốn người dùng gõ. */
17
+ children?: ReactNode;
18
+ }
19
+
20
+ export interface RegisterBlockOptions {
21
+ /** Biểu tượng trong slash menu và khung khối. */
22
+ icon?: LucideIcon;
23
+ /** Xem trước tuỳ chỉnh trong trình soạn; không có → khung chung + form cài đặt sinh từ attributes. */
24
+ edit?: ComponentType<BlockEditProps>;
25
+ /** Dịch nhãn ("%khoá%" → chữ theo ngôn ngữ admin) — admin truyền vào. */
26
+ translate?(text: string): string;
27
+ /** Khối chứa khối khác: nội dung có sẵn khi chèn (mặc định một đoạn văn trống). */
28
+ initialContent?(): Array<Record<string, unknown>>;
29
+ }
30
+
31
+ /** Chọn một ảnh (điều khiển "media" trong form cài đặt) — Editor đặt bằng nguồn media của ứng dụng. */
32
+ let imagePicker: (() => Promise<{ url: string; id?: unknown; alt?: string } | null>) | null = null;
33
+ export function setImagePicker(fn: typeof imagePicker) { imagePicker = fn; }
34
+
35
+ const blocks = new Map<string, BlockDefinition>();
36
+ const options = new Map<string, RegisterBlockOptions>();
37
+
38
+ /** Tên (đã dịch) + biểu tượng của khối plugin — cho trình chèn, cây khối, tab "Khối". */
39
+ export function pluginBlockInfo(name: string): { title: string; description?: string; icon: LucideIcon; def: BlockDefinition; translate(s: string): string } | null {
40
+ const def = blocks.get(name);
41
+ if (!def) return null;
42
+ const o = options.get(name) ?? {};
43
+ const t = o.translate ?? ((x: string) => x);
44
+ return { title: t(def.title), description: def.description ? t(def.description) : undefined, icon: o.icon ?? Blocks, def, translate: t };
45
+ }
46
+
47
+ /** Khối đang đăng ký (để chuẩn hoá + nâng phiên bản khi mở bài: contentToEditor). */
48
+ export const registeredBlocks = (): BlockDefinition[] => [...blocks.values()];
49
+
50
+ function controlOf(spec: BlockAttrSpec): NonNullable<BlockAttrSpec["control"]> {
51
+ if (spec.control) return spec.control;
52
+ if (spec.enum) return "select";
53
+ switch (spec.type) {
54
+ case "number": case "integer": return "number";
55
+ case "boolean": return "checkbox";
56
+ case "url": return "url";
57
+ case "json": return "hidden";
58
+ default: return "text";
59
+ }
60
+ }
61
+
62
+ /** Form cài đặt sinh từ attributes của khối (trong khối, hoặc ở tab "Khối" khi ứng dụng có BlockInspector). */
63
+ export function BlockAttributesForm(props: { def: BlockDefinition; attrs: Record<string, any>; setAttrs(a: Record<string, unknown>): void; t(s: string): string; stacked?: boolean }) {
64
+ return <Settings {...props} />;
65
+ }
66
+
67
+ function Settings({ def, attrs, setAttrs, t, stacked }: { def: BlockDefinition; attrs: Record<string, any>; setAttrs(a: Record<string, unknown>): void; t(s: string): string; stacked?: boolean }) {
68
+ const fields = Object.entries(def.attributes).filter(([, spec]) => controlOf(spec) !== "hidden");
69
+ if (!fields.length) return null;
70
+ return (
71
+ <div className={cx("cms-ed-block-settings", stacked && "is-stacked")} contentEditable={false}>
72
+ {fields.map(([key, spec]) => {
73
+ const control = controlOf(spec);
74
+ const value = attrs[key] ?? spec.default ?? "";
75
+ const id = `blk-${def.name}-${key}`;
76
+ const label = t(spec.label ?? key);
77
+ const set = (v: unknown) => setAttrs({ [key]: v === "" ? null : v });
78
+ return (
79
+ <label key={key} htmlFor={id} className={cx("cms-ed-field", control === "checkbox" && "is-check")}>
80
+ {control !== "checkbox" && <span>{label}</span>}
81
+ {control === "media" ? (
82
+ <span className="cms-ed-media-field">
83
+ {value ? <img src={String(value)} alt="" /> : null}
84
+ <button type="button" id={id} className="cms-ed-text-btn" onClick={async () => {
85
+ const m = await imagePicker?.();
86
+ if (m) setAttrs({ [key]: m.url, ...(key === "src" ? { mediaId: m.id ?? null, ...(attrs.alt ? {} : { alt: m.alt || null }) } : {}) });
87
+ }}>{t(value ? "replaceImage" : "pickImage")}</button>
88
+ {value ? <button type="button" className="cms-ed-text-btn" onClick={() => setAttrs({ [key]: null, ...(key === "src" ? { mediaId: null } : {}) })}>{t("removeImage")}</button> : null}
89
+ </span>
90
+ ) : control === "select" ? (
91
+ <select id={id} value={String(value)} onChange={(e) => set(e.target.value)}>
92
+ {(spec.enum ?? []).map((v, i) => <option key={String(v)} value={String(v)}>{t(spec.enumLabels?.[i] ?? String(v))}</option>)}
93
+ </select>
94
+ ) : control === "textarea" ? (
95
+ <textarea id={id} value={String(value)} onChange={(e) => set(e.target.value)} rows={3} />
96
+ ) : control === "checkbox" ? (
97
+ <><input id={id} type="checkbox" checked={!!value} onChange={(e) => set(e.target.checked)} /><span>{label}</span></>
98
+ ) : (
99
+ <input id={id} type={control === "number" ? "number" : control === "color" ? "color" : control === "url" ? "url" : "text"} value={String(value)}
100
+ min={spec.min} max={spec.max} onChange={(e) => set(control === "number" ? (e.target.value === "" ? null : Number(e.target.value)) : e.target.value)} />
101
+ )}
102
+ {spec.help && <small>{t(spec.help)}</small>}
103
+ </label>
104
+ );
105
+ })}
106
+ </div>
107
+ );
108
+ }
109
+
110
+ /** Node TipTap sinh từ định nghĩa khối — plugin không cần biết TipTap. */
111
+ export function blockNode(def: BlockDefinition, opts: RegisterBlockOptions = {}) {
112
+ const t = opts.translate ?? ((s: string) => s);
113
+ // Khối chứa khối khác: khối con bên trong có tay kéo + menu riêng
114
+ if (def.content === "blocks") markContainer(def.name);
115
+ const Icon = opts.icon ?? Blocks;
116
+ const hasContent = def.content !== "none";
117
+ function View({ node, selected, updateAttributes, editor, getPos }: ReactNodeViewProps) {
118
+ const attrs = node.attrs as Record<string, any>;
119
+ // Form cài đặt hiện khi khối được chọn hoặc con trỏ đang ở bên trong khối
120
+ const { inside, inspector } = useEditorState({ editor, selector: ({ editor: e }) => {
121
+ const pos = getPos();
122
+ // Ứng dụng có tab "Khối" (BlockInspector đang hiện) → form cài đặt nằm ở đó, không lặp trong khối
123
+ const inspector = ((e.storage as any).cmsEditorContext?.inspector ?? 0) > 0;
124
+ if (typeof pos !== "number") return { inside: false, inspector };
125
+ const { from, to } = e.state.selection;
126
+ return { inside: from >= pos && to <= pos + node.nodeSize, inspector };
127
+ } });
128
+ const active = selected || inside;
129
+ const selectBlock = (e: { preventDefault(): void }) => { e.preventDefault(); const pos = getPos(); if (typeof pos === "number") editor.commands.setNodeSelection(pos); };
130
+ const setAttrs = (a: Record<string, unknown>) => updateAttributes(a);
131
+ const inner = hasContent ? <NodeViewContent className="cms-ed-block-content" /> : null;
132
+ return (
133
+ <NodeViewWrapper className={cx("cms-ed-block", "cms-ed-plugin-block", active && "is-selected")} data-block={def.name}>
134
+ <div className="cms-ed-block-label" contentEditable={false} data-drag-handle onMouseDown={selectBlock}><Icon size={12} /> {t(def.title)}</div>
135
+ {opts.edit ? <opts.edit attrs={attrs} setAttrs={setAttrs} selected={active}>{inner}</opts.edit> : inner}
136
+ {active && !inspector && <Settings def={def} attrs={attrs} setAttrs={setAttrs} t={t} />}
137
+ </NodeViewWrapper>
138
+ );
139
+ }
140
+ return Node.create({
141
+ name: def.name,
142
+ group: "block",
143
+ content: def.content === "blocks" ? "block+" : def.content === "inline" ? "inline*" : undefined,
144
+ atom: !hasContent,
145
+ draggable: true,
146
+ defining: hasContent,
147
+ addAttributes() {
148
+ // Thuộc tính chỉ nằm trong JSON (không render ra HTML của trình soạn)
149
+ const attr = (def_: unknown) => ({ default: def_ ?? null, renderHTML: () => ({}), parseHTML: () => def_ ?? null });
150
+ return {
151
+ ...Object.fromEntries(Object.entries(def.attributes).map(([k, spec]) => [k, attr(spec.default)])),
152
+ [BLOCK_VERSION_ATTR]: attr(def.version > 1 ? def.version : null),
153
+ };
154
+ },
155
+ parseHTML: () => [{ tag: `div[data-block="${def.name}"]` }],
156
+ renderHTML: ({ HTMLAttributes }) => hasContent ? ["div", mergeAttributes(HTMLAttributes, { "data-block": def.name }), 0] : ["div", mergeAttributes(HTMLAttributes, { "data-block": def.name })],
157
+ addNodeView: () => ReactNodeViewRenderer(View),
158
+ });
159
+ }
160
+
161
+ /**
162
+ * Đăng ký khối (từ defineBlock) cho mọi trình soạn trong ứng dụng: node + mục slash menu + form cài đặt.
163
+ * Trình soạn đang mở tự nạp lại. Gọi lại cùng tên → thay định nghĩa cũ.
164
+ */
165
+ export function registerBlock(def: BlockDefinition, opts: RegisterBlockOptions = {}) {
166
+ const t = opts.translate ?? ((s: string) => s);
167
+ blocks.set(def.name, def);
168
+ options.set(def.name, opts);
169
+ registerEditorExtension({
170
+ name: `block:${def.name}`,
171
+ extensions: [blockNode(def, opts)],
172
+ insertItems: [{
173
+ key: `block:${def.name}`, title: t(def.title), hint: def.description ? t(def.description) : def.name, icon: opts.icon ?? Blocks,
174
+ keywords: `${def.keywords} ${def.name.replace(/[/_-]/g, " ")}`.toLowerCase(),
175
+ run: (editor, range) => {
176
+ if (range) editor.chain().focus().deleteRange(range).run();
177
+ const node: Record<string, unknown> = { type: def.name, attrs: blockDefaults(def) };
178
+ if (def.content === "blocks") node.content = opts.initialContent?.() ?? [{ type: "paragraph" }];
179
+ insertBlock(editor, node);
180
+ },
181
+ }],
182
+ });
183
+ }
184
+
185
+ export function unregisterBlock(name: string) {
186
+ blocks.delete(name);
187
+ options.delete(name);
188
+ unregisterEditorExtension(`block:${name}`);
189
+ }
package/src/content.ts ADDED
@@ -0,0 +1,22 @@
1
+ import { normalizeContent } from "@ecomcx/ecomweb-content";
2
+ import { registeredBlocks } from "./blocks";
3
+ import type { ContentDoc } from "./types";
4
+
5
+ /** Nội dung đã lưu → nội dung cho trình soạn. Khối "html" (vd nội dung nhập từ hệ thống cũ) được TipTap tự chuyển thành rich text. */
6
+ export function contentToEditor(content?: ContentDoc | null): { main: any; others: ContentDoc["blocks"] } {
7
+ // Chuẩn hoá theo định dạng của CMS + nâng phiên bản khối của plugin (defineBlock) lưu bằng bản cũ
8
+ const blocks = content ? normalizeContent(content, { blocks: registeredBlocks() }).doc.blocks : [];
9
+ const editable = blocks.filter((b) => b.type === "richtext" || b.type === "html");
10
+ const others = blocks.filter((b) => b.type !== "richtext" && b.type !== "html");
11
+ if (editable.length === 1 && editable[0].type === "richtext") return { main: editable[0].data, others };
12
+ if (editable.length === 0) return { main: "", others };
13
+ const html = editable.map((b) => (b.type === "html" ? String(b.data?.html ?? "") : "")).join("");
14
+ const richtext = editable.find((b) => b.type === "richtext");
15
+ return { main: richtext && !html ? richtext.data : html, others };
16
+ }
17
+
18
+ /** Nội dung trình soạn → định dạng lưu trữ (giữ nguyên các khối không sửa được ở đây). */
19
+ export function editorToContent(json: any, others: ContentDoc["blocks"] = []): ContentDoc {
20
+ // Chuẩn hoá theo định dạng của CMS (bỏ thuộc tính null, ép kiểu) — máy chủ cũng chuẩn hoá lại khi lưu
21
+ return normalizeContent({ version: 1, blocks: [{ id: "main", type: "richtext", data: json }, ...others] }, { blocks: registeredBlocks() }).doc as ContentDoc;
22
+ }