@qxs-bns/components 0.0.91 → 0.0.93

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 (415) hide show
  1. package/es/base/define.mjs +1 -1
  2. package/es/base/define.mjs.map +1 -1
  3. package/es/base/uid.mjs +1 -1
  4. package/es/base/uid.mjs.map +1 -1
  5. package/es/data-chart.mjs +15 -14
  6. package/es/data-chart.mjs.map +1 -1
  7. package/es/editor/blocksuite-editor.mjs +62 -51
  8. package/es/editor/blocksuite-editor.mjs.map +1 -1
  9. package/es/editor/content-format.mjs +8 -1
  10. package/es/editor/content-format.mjs.map +1 -1
  11. package/es/editor/index.mjs +1 -1
  12. package/es/editor/index.mjs.map +1 -1
  13. package/es/editor/toolbar.mjs +1 -1
  14. package/es/editor/toolbar.mjs.map +1 -1
  15. package/es/entry-data-chart.mjs +1 -1
  16. package/es/entry-editor.mjs +1 -1
  17. package/es/entry-file-upload.mjs +1 -1
  18. package/es/entry-fixed-action-bar.mjs +1 -1
  19. package/es/entry-icon.mjs +1 -1
  20. package/es/entry-image-upload.mjs +1 -1
  21. package/es/entry-photo-crop-tool.mjs +1 -1
  22. package/es/entry-subject.mjs +1 -1
  23. package/es/file-upload.mjs +25 -18
  24. package/es/file-upload.mjs.map +1 -1
  25. package/es/fixed-action-bar.mjs +5 -5
  26. package/es/fixed-action-bar.mjs.map +1 -1
  27. package/es/icon.mjs +7 -7
  28. package/es/icon.mjs.map +1 -1
  29. package/es/image-upload.mjs +26 -26
  30. package/es/image-upload.mjs.map +1 -1
  31. package/es/index.mjs +1 -1
  32. package/es/node_modules/.pnpm/marked@17.0.6/node_modules/marked/lib/marked.esm.mjs +59 -1
  33. package/es/node_modules/.pnpm/marked@17.0.6/node_modules/marked/lib/marked.esm.mjs.map +1 -1
  34. package/es/node_modules/.pnpm/turndown-plugin-gfm@1.0.2/node_modules/turndown-plugin-gfm/lib/turndown-plugin-gfm.es.mjs +16 -1
  35. package/es/node_modules/.pnpm/turndown-plugin-gfm@1.0.2/node_modules/turndown-plugin-gfm/lib/turndown-plugin-gfm.es.mjs.map +1 -1
  36. package/es/node_modules/.pnpm/turndown@7.2.4/node_modules/turndown/lib/turndown.browser.es.mjs +62 -0
  37. package/es/node_modules/.pnpm/turndown@7.2.4/node_modules/turndown/lib/turndown.browser.es.mjs.map +1 -0
  38. package/es/photo-crop-tool.mjs +12 -12
  39. package/es/photo-crop-tool.mjs.map +1 -1
  40. package/es/subject/action.mjs +58 -58
  41. package/es/subject/action.mjs.map +1 -1
  42. package/es/subject/blank-fill.mjs +80 -80
  43. package/es/subject/blank-fill.mjs.map +1 -1
  44. package/es/subject/draft.mjs +1 -1
  45. package/es/subject/draft.mjs.map +1 -1
  46. package/es/subject/layout.mjs +4 -4
  47. package/es/subject/layout.mjs.map +1 -1
  48. package/es/subject/page-end.mjs +5 -5
  49. package/es/subject/page-end.mjs.map +1 -1
  50. package/es/subject/pagination.mjs +1 -1
  51. package/es/subject/pagination.mjs.map +1 -1
  52. package/es/subject/runtime.mjs +1 -1
  53. package/es/subject/runtime.mjs.map +1 -1
  54. package/es/subject/scale.mjs +53 -50
  55. package/es/subject/scale.mjs.map +1 -1
  56. package/es/subject/shared-methods.mjs +1 -1
  57. package/es/subject/shared-methods.mjs.map +1 -1
  58. package/es/subject/shared-styles.mjs +53 -15
  59. package/es/subject/shared-styles.mjs.map +1 -1
  60. package/es/subject/single-interactions.mjs +2 -0
  61. package/es/subject/single-interactions.mjs.map +1 -0
  62. package/es/subject/single-model.mjs +2 -0
  63. package/es/subject/single-model.mjs.map +1 -0
  64. package/es/subject/single-state.mjs +2 -0
  65. package/es/subject/single-state.mjs.map +1 -0
  66. package/es/subject/single.mjs +177 -177
  67. package/es/subject/single.mjs.map +1 -1
  68. package/es/subject/sort-controller.mjs +1 -1
  69. package/es/subject/sort-controller.mjs.map +1 -1
  70. package/es/subject/sortable.mjs +13 -13
  71. package/es/subject/sortable.mjs.map +1 -1
  72. package/es/subject/sorting-card.mjs +12 -12
  73. package/es/subject/sorting-card.mjs.map +1 -1
  74. package/es/subject/subject-shared.mjs +2 -0
  75. package/es/subject/subject-shared.mjs.map +1 -0
  76. package/es/subject/text-fill.mjs +73 -73
  77. package/es/subject/text-fill.mjs.map +1 -1
  78. package/es/subject/title-prefix.mjs +1 -1
  79. package/es/subject/title-prefix.mjs.map +1 -1
  80. package/es/subject/types.mjs +1 -1
  81. package/es/subject/types.mjs.map +1 -1
  82. package/lib/base/define.cjs +1 -1
  83. package/lib/base/define.cjs.map +1 -1
  84. package/lib/base/uid.cjs +1 -1
  85. package/lib/base/uid.cjs.map +1 -1
  86. package/lib/data-chart.cjs +16 -15
  87. package/lib/data-chart.cjs.map +1 -1
  88. package/lib/editor/blocksuite-editor.cjs +62 -51
  89. package/lib/editor/blocksuite-editor.cjs.map +1 -1
  90. package/lib/editor/content-format.cjs +8 -1
  91. package/lib/editor/content-format.cjs.map +1 -1
  92. package/lib/editor/index.cjs +1 -1
  93. package/lib/editor/index.cjs.map +1 -1
  94. package/lib/editor/toolbar.cjs +1 -1
  95. package/lib/editor/toolbar.cjs.map +1 -1
  96. package/lib/entry-data-chart.cjs +1 -1
  97. package/lib/entry-editor.cjs +1 -1
  98. package/lib/entry-file-upload.cjs +1 -1
  99. package/lib/entry-fixed-action-bar.cjs +1 -1
  100. package/lib/entry-icon.cjs +1 -1
  101. package/lib/entry-image-upload.cjs +1 -1
  102. package/lib/entry-photo-crop-tool.cjs +1 -1
  103. package/lib/entry-subject.cjs +1 -1
  104. package/lib/file-upload.cjs +24 -17
  105. package/lib/file-upload.cjs.map +1 -1
  106. package/lib/fixed-action-bar.cjs +6 -6
  107. package/lib/fixed-action-bar.cjs.map +1 -1
  108. package/lib/icon.cjs +9 -9
  109. package/lib/icon.cjs.map +1 -1
  110. package/lib/image-upload.cjs +26 -26
  111. package/lib/image-upload.cjs.map +1 -1
  112. package/lib/index.cjs +1 -1
  113. package/lib/node_modules/.pnpm/marked@17.0.6/node_modules/marked/lib/marked.esm.cjs +59 -1
  114. package/lib/node_modules/.pnpm/marked@17.0.6/node_modules/marked/lib/marked.esm.cjs.map +1 -1
  115. package/lib/node_modules/.pnpm/turndown-plugin-gfm@1.0.2/node_modules/turndown-plugin-gfm/lib/turndown-plugin-gfm.es.cjs +16 -1
  116. package/lib/node_modules/.pnpm/turndown-plugin-gfm@1.0.2/node_modules/turndown-plugin-gfm/lib/turndown-plugin-gfm.es.cjs.map +1 -1
  117. package/lib/node_modules/.pnpm/turndown@7.2.4/node_modules/turndown/lib/turndown.browser.es.cjs +62 -0
  118. package/lib/node_modules/.pnpm/turndown@7.2.4/node_modules/turndown/lib/turndown.browser.es.cjs.map +1 -0
  119. package/lib/photo-crop-tool.cjs +11 -11
  120. package/lib/photo-crop-tool.cjs.map +1 -1
  121. package/lib/subject/action.cjs +42 -42
  122. package/lib/subject/action.cjs.map +1 -1
  123. package/lib/subject/blank-fill.cjs +80 -80
  124. package/lib/subject/blank-fill.cjs.map +1 -1
  125. package/lib/subject/draft.cjs +1 -1
  126. package/lib/subject/draft.cjs.map +1 -1
  127. package/lib/subject/layout.cjs +4 -4
  128. package/lib/subject/layout.cjs.map +1 -1
  129. package/lib/subject/page-end.cjs +4 -4
  130. package/lib/subject/page-end.cjs.map +1 -1
  131. package/lib/subject/pagination.cjs +1 -1
  132. package/lib/subject/pagination.cjs.map +1 -1
  133. package/lib/subject/runtime.cjs +1 -1
  134. package/lib/subject/runtime.cjs.map +1 -1
  135. package/lib/subject/scale.cjs +53 -50
  136. package/lib/subject/scale.cjs.map +1 -1
  137. package/lib/subject/shared-methods.cjs +1 -1
  138. package/lib/subject/shared-methods.cjs.map +1 -1
  139. package/lib/subject/shared-styles.cjs +54 -16
  140. package/lib/subject/shared-styles.cjs.map +1 -1
  141. package/lib/subject/single-interactions.cjs +2 -0
  142. package/lib/subject/single-interactions.cjs.map +1 -0
  143. package/lib/subject/single-model.cjs +2 -0
  144. package/lib/subject/single-model.cjs.map +1 -0
  145. package/lib/subject/single-state.cjs +2 -0
  146. package/lib/subject/single-state.cjs.map +1 -0
  147. package/lib/subject/single.cjs +177 -177
  148. package/lib/subject/single.cjs.map +1 -1
  149. package/lib/subject/sort-controller.cjs +1 -1
  150. package/lib/subject/sort-controller.cjs.map +1 -1
  151. package/lib/subject/sortable.cjs +15 -15
  152. package/lib/subject/sortable.cjs.map +1 -1
  153. package/lib/subject/sorting-card.cjs +12 -12
  154. package/lib/subject/sorting-card.cjs.map +1 -1
  155. package/lib/subject/subject-shared.cjs +2 -0
  156. package/lib/subject/subject-shared.cjs.map +1 -0
  157. package/lib/subject/text-fill.cjs +81 -81
  158. package/lib/subject/text-fill.cjs.map +1 -1
  159. package/lib/subject/title-prefix.cjs +1 -1
  160. package/lib/subject/title-prefix.cjs.map +1 -1
  161. package/lib/subject/types.cjs +1 -1
  162. package/lib/subject/types.cjs.map +1 -1
  163. package/package.json +5 -5
  164. package/types/editor/blocksuite-editor.d.ts +2 -0
  165. package/types/editor/toolbar.d.ts +1 -1
  166. package/types/file-upload.d.ts +2 -0
  167. package/types/subject/blank-fill.d.ts +1 -1
  168. package/types/subject/runtime.d.ts +1 -1
  169. package/types/subject/scale.d.ts +1 -1
  170. package/types/subject/single-interactions.d.ts +46 -0
  171. package/types/subject/single-model.d.ts +88 -0
  172. package/types/subject/single-state.d.ts +42 -0
  173. package/types/subject/single.d.ts +7 -85
  174. package/types/subject/sortable.d.ts +1 -1
  175. package/types/subject/subject-shared.d.ts +43 -0
  176. package/types/subject/text-fill.d.ts +1 -1
  177. package/README.md +0 -562
  178. package/es/node_modules/.pnpm/@iconify_vue@5.0.0_vue@3.5.18_typescript@5.9.2_/node_modules/@iconify/vue/dist/iconify.mjs +0 -2
  179. package/es/node_modules/.pnpm/@iconify_vue@5.0.0_vue@3.5.18_typescript@5.9.2_/node_modules/@iconify/vue/dist/iconify.mjs.map +0 -1
  180. package/es/node_modules/.pnpm/turndown@7.2.4/node_modules/turndown/lib/turndown.es.mjs +0 -2
  181. package/es/node_modules/.pnpm/turndown@7.2.4/node_modules/turndown/lib/turndown.es.mjs.map +0 -1
  182. package/es/package.json.mjs +0 -2
  183. package/es/package.json.mjs.map +0 -1
  184. package/es/src/alert/index.mjs +0 -2
  185. package/es/src/alert/index.mjs.map +0 -1
  186. package/es/src/alert/src/alert.mjs +0 -2
  187. package/es/src/alert/src/alert.mjs.map +0 -1
  188. package/es/src/components.mjs +0 -2
  189. package/es/src/components.mjs.map +0 -1
  190. package/es/src/data-chart/index.mjs +0 -2
  191. package/es/src/data-chart/index.mjs.map +0 -1
  192. package/es/src/defaults.mjs +0 -2
  193. package/es/src/defaults.mjs.map +0 -1
  194. package/es/src/dialog/src/dialog.mjs +0 -2
  195. package/es/src/dialog/src/dialog.mjs.map +0 -1
  196. package/es/src/feedback-plugin/index.mjs +0 -2
  197. package/es/src/feedback-plugin/index.mjs.map +0 -1
  198. package/es/src/file-upload/index.mjs +0 -2
  199. package/es/src/file-upload/index.mjs.map +0 -1
  200. package/es/src/icon/index.mjs +0 -2
  201. package/es/src/icon/index.mjs.map +0 -1
  202. package/es/src/icon/src/icon.mjs +0 -2
  203. package/es/src/icon/src/icon.mjs.map +0 -1
  204. package/es/src/image-upload/index.mjs +0 -2
  205. package/es/src/image-upload/index.mjs.map +0 -1
  206. package/es/src/make-installer.mjs +0 -2
  207. package/es/src/make-installer.mjs.map +0 -1
  208. package/es/src/message/src/message.mjs +0 -2
  209. package/es/src/message/src/message.mjs.map +0 -1
  210. package/es/src/photo-crop-tool/index.mjs +0 -2
  211. package/es/src/photo-crop-tool/index.mjs.map +0 -1
  212. package/es/src/tiny-mce-editor/index.mjs +0 -2
  213. package/es/src/tiny-mce-editor/index.mjs.map +0 -1
  214. package/es/src/tiny-mce-editor/src/tiny-mce-editor.vue.mjs +0 -2
  215. package/es/src/tiny-mce-editor/src/tiny-mce-editor.vue.mjs.map +0 -1
  216. package/es/src/tiny-mce-editor/src/tiny-mce-editor.vue2.mjs +0 -2
  217. package/es/src/tiny-mce-editor/src/tiny-mce-editor.vue2.mjs.map +0 -1
  218. package/es/src/ui/button/index.mjs +0 -2
  219. package/es/src/ui/button/index.mjs.map +0 -1
  220. package/es/src/ui/checkbox/index.mjs +0 -2
  221. package/es/src/ui/checkbox/index.mjs.map +0 -1
  222. package/es/src/ui/dialog/index.mjs +0 -2
  223. package/es/src/ui/dialog/index.mjs.map +0 -1
  224. package/es/src/ui/input/index.mjs +0 -2
  225. package/es/src/ui/input/index.mjs.map +0 -1
  226. package/es/src/ui/input-number/index.mjs +0 -2
  227. package/es/src/ui/input-number/index.mjs.map +0 -1
  228. package/es/src/ui/layout/index.mjs +0 -2
  229. package/es/src/ui/layout/index.mjs.map +0 -1
  230. package/es/src/ui/link/index.mjs +0 -2
  231. package/es/src/ui/link/index.mjs.map +0 -1
  232. package/es/src/ui/popover/index.mjs +0 -2
  233. package/es/src/ui/popover/index.mjs.map +0 -1
  234. package/es/src/ui/radio/index.mjs +0 -2
  235. package/es/src/ui/radio/index.mjs.map +0 -1
  236. package/es/src/ui/scrollbar/index.mjs +0 -2
  237. package/es/src/ui/scrollbar/index.mjs.map +0 -1
  238. package/es/src/ui/select/index.mjs +0 -2
  239. package/es/src/ui/select/index.mjs.map +0 -1
  240. package/es/src/ui/table/index.mjs +0 -2
  241. package/es/src/ui/table/index.mjs.map +0 -1
  242. package/es/src/ui/tag/index.mjs +0 -2
  243. package/es/src/ui/tag/index.mjs.map +0 -1
  244. package/es/src/wc-bridge.mjs +0 -2
  245. package/es/src/wc-bridge.mjs.map +0 -1
  246. package/es/src/withInstall.mjs +0 -2
  247. package/es/src/withInstall.mjs.map +0 -1
  248. package/lib/node_modules/.pnpm/@iconify_vue@5.0.0_vue@3.5.18_typescript@5.9.2_/node_modules/@iconify/vue/dist/iconify.cjs +0 -2
  249. package/lib/node_modules/.pnpm/@iconify_vue@5.0.0_vue@3.5.18_typescript@5.9.2_/node_modules/@iconify/vue/dist/iconify.cjs.map +0 -1
  250. package/lib/node_modules/.pnpm/turndown@7.2.4/node_modules/turndown/lib/turndown.es.cjs +0 -2
  251. package/lib/node_modules/.pnpm/turndown@7.2.4/node_modules/turndown/lib/turndown.es.cjs.map +0 -1
  252. package/lib/package.json.cjs +0 -2
  253. package/lib/package.json.cjs.map +0 -1
  254. package/lib/src/alert/index.cjs +0 -2
  255. package/lib/src/alert/index.cjs.map +0 -1
  256. package/lib/src/alert/src/alert.cjs +0 -2
  257. package/lib/src/alert/src/alert.cjs.map +0 -1
  258. package/lib/src/components.cjs +0 -2
  259. package/lib/src/components.cjs.map +0 -1
  260. package/lib/src/data-chart/index.cjs +0 -2
  261. package/lib/src/data-chart/index.cjs.map +0 -1
  262. package/lib/src/defaults.cjs +0 -2
  263. package/lib/src/defaults.cjs.map +0 -1
  264. package/lib/src/dialog/src/dialog.cjs +0 -2
  265. package/lib/src/dialog/src/dialog.cjs.map +0 -1
  266. package/lib/src/feedback-plugin/index.cjs +0 -2
  267. package/lib/src/feedback-plugin/index.cjs.map +0 -1
  268. package/lib/src/file-upload/index.cjs +0 -2
  269. package/lib/src/file-upload/index.cjs.map +0 -1
  270. package/lib/src/icon/index.cjs +0 -2
  271. package/lib/src/icon/index.cjs.map +0 -1
  272. package/lib/src/icon/src/icon.cjs +0 -2
  273. package/lib/src/icon/src/icon.cjs.map +0 -1
  274. package/lib/src/image-upload/index.cjs +0 -2
  275. package/lib/src/image-upload/index.cjs.map +0 -1
  276. package/lib/src/make-installer.cjs +0 -2
  277. package/lib/src/make-installer.cjs.map +0 -1
  278. package/lib/src/message/src/message.cjs +0 -2
  279. package/lib/src/message/src/message.cjs.map +0 -1
  280. package/lib/src/photo-crop-tool/index.cjs +0 -2
  281. package/lib/src/photo-crop-tool/index.cjs.map +0 -1
  282. package/lib/src/tiny-mce-editor/index.cjs +0 -2
  283. package/lib/src/tiny-mce-editor/index.cjs.map +0 -1
  284. package/lib/src/tiny-mce-editor/src/tiny-mce-editor.vue.cjs +0 -2
  285. package/lib/src/tiny-mce-editor/src/tiny-mce-editor.vue.cjs.map +0 -1
  286. package/lib/src/tiny-mce-editor/src/tiny-mce-editor.vue2.cjs +0 -2
  287. package/lib/src/tiny-mce-editor/src/tiny-mce-editor.vue2.cjs.map +0 -1
  288. package/lib/src/ui/button/index.cjs +0 -2
  289. package/lib/src/ui/button/index.cjs.map +0 -1
  290. package/lib/src/ui/checkbox/index.cjs +0 -2
  291. package/lib/src/ui/checkbox/index.cjs.map +0 -1
  292. package/lib/src/ui/dialog/index.cjs +0 -2
  293. package/lib/src/ui/dialog/index.cjs.map +0 -1
  294. package/lib/src/ui/input/index.cjs +0 -2
  295. package/lib/src/ui/input/index.cjs.map +0 -1
  296. package/lib/src/ui/input-number/index.cjs +0 -2
  297. package/lib/src/ui/input-number/index.cjs.map +0 -1
  298. package/lib/src/ui/layout/index.cjs +0 -2
  299. package/lib/src/ui/layout/index.cjs.map +0 -1
  300. package/lib/src/ui/link/index.cjs +0 -2
  301. package/lib/src/ui/link/index.cjs.map +0 -1
  302. package/lib/src/ui/popover/index.cjs +0 -2
  303. package/lib/src/ui/popover/index.cjs.map +0 -1
  304. package/lib/src/ui/radio/index.cjs +0 -2
  305. package/lib/src/ui/radio/index.cjs.map +0 -1
  306. package/lib/src/ui/scrollbar/index.cjs +0 -2
  307. package/lib/src/ui/scrollbar/index.cjs.map +0 -1
  308. package/lib/src/ui/select/index.cjs +0 -2
  309. package/lib/src/ui/select/index.cjs.map +0 -1
  310. package/lib/src/ui/table/index.cjs +0 -2
  311. package/lib/src/ui/table/index.cjs.map +0 -1
  312. package/lib/src/ui/tag/index.cjs +0 -2
  313. package/lib/src/ui/tag/index.cjs.map +0 -1
  314. package/lib/src/wc-bridge.cjs +0 -2
  315. package/lib/src/wc-bridge.cjs.map +0 -1
  316. package/lib/src/withInstall.cjs +0 -2
  317. package/lib/src/withInstall.cjs.map +0 -1
  318. package/types/index.d.ts.map +0 -1
  319. package/types/src/alert/index.d.ts +0 -66
  320. package/types/src/alert/index.d.ts.map +0 -1
  321. package/types/src/alert/src/alert.d.ts +0 -73
  322. package/types/src/alert/src/alert.d.ts.map +0 -1
  323. package/types/src/components.d.ts +0 -10
  324. package/types/src/components.d.ts.map +0 -1
  325. package/types/src/data-chart/index.d.ts +0 -13
  326. package/types/src/data-chart/index.d.ts.map +0 -1
  327. package/types/src/defaults.d.ts +0 -6
  328. package/types/src/defaults.d.ts.map +0 -1
  329. package/types/src/dialog/index.d.ts +0 -3
  330. package/types/src/dialog/index.d.ts.map +0 -1
  331. package/types/src/dialog/src/dialog.d.ts +0 -25
  332. package/types/src/dialog/src/dialog.d.ts.map +0 -1
  333. package/types/src/feedback-plugin/index.d.ts +0 -9
  334. package/types/src/feedback-plugin/index.d.ts.map +0 -1
  335. package/types/src/file-upload/index.d.ts +0 -12
  336. package/types/src/file-upload/index.d.ts.map +0 -1
  337. package/types/src/icon/index.d.ts +0 -56
  338. package/types/src/icon/index.d.ts.map +0 -1
  339. package/types/src/icon/src/icon.d.ts +0 -62
  340. package/types/src/icon/src/icon.d.ts.map +0 -1
  341. package/types/src/image-upload/index.d.ts +0 -12
  342. package/types/src/image-upload/index.d.ts.map +0 -1
  343. package/types/src/make-installer.d.ts +0 -6
  344. package/types/src/make-installer.d.ts.map +0 -1
  345. package/types/src/message/index.d.ts +0 -3
  346. package/types/src/message/index.d.ts.map +0 -1
  347. package/types/src/message/src/message.d.ts +0 -21
  348. package/types/src/message/src/message.d.ts.map +0 -1
  349. package/types/src/message/src/toaster.vue.d.ts +0 -3
  350. package/types/src/message/src/toaster.vue.d.ts.map +0 -1
  351. package/types/src/photo-crop-tool/index.d.ts +0 -12
  352. package/types/src/photo-crop-tool/index.d.ts.map +0 -1
  353. package/types/src/subject-action/index.d.ts +0 -93
  354. package/types/src/subject-action/index.d.ts.map +0 -1
  355. package/types/src/subject-action/src/subject-action.vue.d.ts +0 -92
  356. package/types/src/subject-action/src/subject-action.vue.d.ts.map +0 -1
  357. package/types/src/subject-layout/index.d.ts +0 -30
  358. package/types/src/subject-layout/index.d.ts.map +0 -1
  359. package/types/src/subject-layout/src/subject-layout.vue.d.ts +0 -20
  360. package/types/src/subject-layout/src/subject-layout.vue.d.ts.map +0 -1
  361. package/types/src/subject-list/index.d.ts +0 -20
  362. package/types/src/subject-list/index.d.ts.map +0 -1
  363. package/types/src/subject-list/src/components/SubjectPageEnd.vue.d.ts +0 -24
  364. package/types/src/subject-list/src/components/SubjectPageEnd.vue.d.ts.map +0 -1
  365. package/types/src/subject-list/src/components/subject-blank-fill.vue.d.ts +0 -32
  366. package/types/src/subject-list/src/components/subject-blank-fill.vue.d.ts.map +0 -1
  367. package/types/src/subject-list/src/components/subject-scale.vue.d.ts +0 -29
  368. package/types/src/subject-list/src/components/subject-scale.vue.d.ts.map +0 -1
  369. package/types/src/subject-list/src/components/subject-single.vue.d.ts +0 -37
  370. package/types/src/subject-list/src/components/subject-single.vue.d.ts.map +0 -1
  371. package/types/src/subject-list/src/components/subject-text-fill.vue.d.ts +0 -34
  372. package/types/src/subject-list/src/components/subject-text-fill.vue.d.ts.map +0 -1
  373. package/types/src/subject-list/src/subject-list.vue.d.ts +0 -21
  374. package/types/src/subject-list/src/subject-list.vue.d.ts.map +0 -1
  375. package/types/src/subject-type/index.d.ts +0 -8
  376. package/types/src/subject-type/index.d.ts.map +0 -1
  377. package/types/src/subject-type/src/subject-type.vue.d.ts +0 -7
  378. package/types/src/subject-type/src/subject-type.vue.d.ts.map +0 -1
  379. package/types/src/tiny-mce-editor/index.d.ts +0 -20
  380. package/types/src/tiny-mce-editor/index.d.ts.map +0 -1
  381. package/types/src/tiny-mce-editor/src/tiny-mce-editor.vue.d.ts +0 -32
  382. package/types/src/tiny-mce-editor/src/tiny-mce-editor.vue.d.ts.map +0 -1
  383. package/types/src/ui/button/index.d.ts +0 -96
  384. package/types/src/ui/button/index.d.ts.map +0 -1
  385. package/types/src/ui/checkbox/index.d.ts +0 -111
  386. package/types/src/ui/checkbox/index.d.ts.map +0 -1
  387. package/types/src/ui/dialog/index.d.ts +0 -134
  388. package/types/src/ui/dialog/index.d.ts.map +0 -1
  389. package/types/src/ui/index.d.ts +0 -16
  390. package/types/src/ui/index.d.ts.map +0 -1
  391. package/types/src/ui/input/index.d.ts +0 -132
  392. package/types/src/ui/input/index.d.ts.map +0 -1
  393. package/types/src/ui/input-number/index.d.ts +0 -106
  394. package/types/src/ui/input-number/index.d.ts.map +0 -1
  395. package/types/src/ui/layout/index.d.ts +0 -373
  396. package/types/src/ui/layout/index.d.ts.map +0 -1
  397. package/types/src/ui/link/index.d.ts +0 -57
  398. package/types/src/ui/link/index.d.ts.map +0 -1
  399. package/types/src/ui/popover/index.d.ts +0 -89
  400. package/types/src/ui/popover/index.d.ts.map +0 -1
  401. package/types/src/ui/radio/index.d.ts +0 -84
  402. package/types/src/ui/radio/index.d.ts.map +0 -1
  403. package/types/src/ui/scrollbar/index.d.ts +0 -35
  404. package/types/src/ui/scrollbar/index.d.ts.map +0 -1
  405. package/types/src/ui/select/index.d.ts +0 -113
  406. package/types/src/ui/select/index.d.ts.map +0 -1
  407. package/types/src/ui/table/index.d.ts +0 -152
  408. package/types/src/ui/table/index.d.ts.map +0 -1
  409. package/types/src/ui/tag/index.d.ts +0 -69
  410. package/types/src/ui/tag/index.d.ts.map +0 -1
  411. package/types/src/wc-bridge.d.ts +0 -23
  412. package/types/src/wc-bridge.d.ts.map +0 -1
  413. package/types/src/withInstall.d.ts +0 -4
  414. package/types/src/withInstall.d.ts.map +0 -1
  415. package/types/tsconfig.tsbuildinfo +0 -1
@@ -1,9 +1,11 @@
1
- import{Node as e,mergeAttributes as t,Editor as i}from"@tiptap/core";import o from"@tiptap/extension-blockquote";import r from"@tiptap/extension-bold";import n from"@tiptap/extension-bullet-list";import s from"@tiptap/extension-code";import l from"@tiptap/extension-document";import a from"@tiptap/extension-heading";import d from"@tiptap/extension-history";import h from"@tiptap/extension-horizontal-rule";import c from"@tiptap/extension-image";import p from"@tiptap/extension-italic";import u from"@tiptap/extension-link";import b from"@tiptap/extension-list-item";import g from"@tiptap/extension-ordered-list";import m from"@tiptap/extension-paragraph";import _ from"@tiptap/extension-placeholder";import x from"@tiptap/extension-strike";import{Table as f}from"@tiptap/extension-table";import{TableCell as v}from"@tiptap/extension-table-cell";import{TableHeader as y}from"@tiptap/extension-table-header";import{TableRow as k}from"@tiptap/extension-table-row";import w from"@tiptap/extension-text";import C from"@tiptap/extension-text-align";import T from"@tiptap/extension-underline";import{css as M,LitElement as I,html as S}from"lit";import{property as L,state as $}from"lit/decorators.js";import{transformIncomingContentByFormat as A,EMPTY_EDITOR_HTML as B,transformOutgoingContentByFormat as E}from"./content-format.mjs";import{parseEditorToolbarItems as P,SIMPLE_EDITOR_TOOLBAR as R,DEFAULT_EDITOR_TOOLBAR as V}from"./toolbar.mjs";import{safeCustomElement as q}from"../base/define.mjs";var z=Object.defineProperty,F=Object.getOwnPropertyDescriptor,H=(e,t,i,o)=>{for(var r,n=o>1?void 0:o?F(t,i):t,s=e.length-1;s>=0;s--)(r=e[s])&&(n=(o?r(t,i,n):r(n))||n);return o&&n&&z(t,i,n),n};const D="输入内容",O="输入 / 唤出快捷命令",j="80px",U=new Set(["bold","italic","underline","strike","code","link","image","bulletList","orderedList","taskList","blockquote","table"]),N=e.create({name:"taskList",group:"block list",content:"taskItem+",defining:!0,parseHTML:()=>[{tag:'ul[data-type="taskList"]'}],renderHTML(e){let{HTMLAttributes:i}=e;return["ul",t(i,{"data-type":"taskList"}),0]},addCommands(){return{toggleTaskList:()=>e=>{let{commands:t}=e;return t.toggleList(this.name,"taskItem")}}}}),W=e.create({name:"taskItem",defining:!0,content:"paragraph block*",addAttributes:()=>({checked:{default:!1,parseHTML:e=>"true"===e.getAttribute("data-checked"),renderHTML:e=>({"data-checked":String(Boolean(e.checked))})}}),parseHTML:()=>[{tag:'li[data-type="taskItem"]'}],renderHTML(e){let{HTMLAttributes:i}=e;const o=Boolean(i.checked);return["li",t(i,{"data-type":"taskItem"}),["label",{contenteditable:"false"},["input",{type:"checkbox",checked:o?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),G=c.extend({addAttributes(){return{...this.parent?.(),width:{default:null,parseHTML:e=>{const t=e.getAttribute("width"),i=Number(t);return Number.isFinite(i)&&i>0?i:null},renderHTML:e=>e.width?{width:String(e.width)}:{}},align:{default:"left",parseHTML:e=>e.getAttribute("data-align")||"left",renderHTML:e=>e.align?{"data-align":String(e.align)}:{}}}},renderHTML(e){let{HTMLAttributes:i}=e;const o=Number(i.width),r=["max-width:100%","height:auto",Number.isFinite(o)&&o>0?`width:${o}px`:"",i.style||""].filter(Boolean).join(";");return["img",t(this.options.HTMLAttributes,i,{style:r})]}});let K=class extends I{constructor(){super(...arguments),this.content="",this["model-value"]="",this.placeholder=D,this["toolbar-mode"]="header",this.toolbar="",this["toolbar-preset"]="full",this["header-toolbar-labels"]="",this["header-always-visible"]="false",this["use-model"]="false",this.readonly="false",this.preview="false",this.editable=null,this["min-height"]=j,this["max-height"]="",this["show-character-count"]="false",this["toolbar-position"]="top",this["custom-styles"]="",this["content-format"]="html",this["deserialize-content"]=null,this["serialize-content"]=null,this._injectedStyleEl=null,this["upload-image"]=async e=>new Promise((t,i)=>{const o=new FileReader;o.onload=e=>t(e.target?.result),o.onerror=i,o.readAsDataURL(e)}),this._editor=null,this._pendingContent=null,this._tableRows=3,this._tableCols=3,this._hoverRow=0,this._hoverCol=0,this._tableDropdownOpen=!1,this._tableCellToolbar={x:0,y:0,visible:!1,cellRow:0,cellCol:0},this._imageToolbar={x:0,y:0,visible:!1},this._linkEditor={x:0,y:0,visible:!1,url:"",label:""},this._isEditorFocused=!1,this._selectedImage=null,this._hasSlashCommand=!1,this._slashCommandRange=null,this._slashInlineMarkState=null,this._isComposingText=!1,this._isUpdating=!1,this._pendingImageInsertPos=null,this._linkSelection=null,this._preserveFocusOnInternalClick=!1,this._tableEdgeDetectionSetup=!1,this._handleCompositionStart=()=>{this._isComposingText=!0},this._handleCompositionEnd=()=>{this._isComposingText=!1,requestAnimationFrame(()=>{this._syncSlashInlineMarkState(),this._restoreSlashInlineMarkIfNeeded()})}}_injectCustomStyles(){const e=this.shadowRoot;if(!e)return;if(this._injectedStyleEl&&(this._injectedStyleEl.remove(),this._injectedStyleEl=null),!this["custom-styles"])return;const t=document.createElement("style");t.textContent=this["custom-styles"],e.appendChild(t),this._injectedStyleEl=t}get _useModelValue(){return!0===this["use-model"]||"true"===this["use-model"]||""===this["use-model"]||this.hasAttribute("use-model")}get _readonlyValue(){return!1!==this.readonly&&"false"!==this.readonly}get _previewValue(){return!1!==this.preview&&"false"!==this.preview}get _editableValue(){return null===this.editable||void 0===this.editable?null:!1!==this.editable&&"false"!==this.editable}get _isEditable(){return!this._previewValue&&(null!==this._editableValue?this._editableValue:!this._readonlyValue)}get _toolbarModeValue(){return"header"===this["toolbar-mode"]?"header":"slash"}get _headerAlwaysVisibleValue(){return!0===this["header-always-visible"]||"true"===this["header-always-visible"]||""===this["header-always-visible"]||this.hasAttribute("header-always-visible")}get _toolbarPositionValue(){return"bottom"===this["toolbar-position"]?"bottom":"top"}get _toolbarPresetValue(){return"simple"===this["toolbar-preset"]?"simple":"none"===this["toolbar-preset"]?"none":"full"}get _contentFormatValue(){return"markdown"===this["content-format"]?"markdown":"custom"===this["content-format"]?"custom":"html"}get _showCharacterCountValue(){return!0===this["show-character-count"]||"true"===this["show-character-count"]||""===this["show-character-count"]||this.hasAttribute("show-character-count")}get _resolvedMinHeight(){return this["min-height"]?.trim()||j}get _resolvedMaxHeight(){return this["max-height"]?.trim()||"none"}get _wrapperStyleValue(){const e=this["max-height"]?.trim()?"auto":"visible";return[`--qxs-editor-min-height: ${this._resolvedMinHeight}`,`--qxs-editor-max-height: ${this._resolvedMaxHeight}`,`--qxs-editor-overflow-y: ${e}`].join("; ")}get _resolvedPlaceholder(){return this.placeholder&&this.placeholder!==D&&this.placeholder!==O?this.placeholder:"header"===this._toolbarModeValue?D:O}get _toolbarItemsValue(){return Array.isArray(this.toolbar)||"string"==typeof this.toolbar&&this.toolbar.trim()?P(this.toolbar):"simple"===this._toolbarPresetValue?[...R]:"none"===this._toolbarPresetValue?[]:[...V]}_hasToolbarItem(e){return this._toolbarItemsValue.includes(e)}get _headerToolbarLabelsValue(){const e=this["header-toolbar-labels"];if(!e)return{};let t=e;if("string"==typeof e)try{t=JSON.parse(e)}catch(e){return{}}if(!t||"object"!=typeof t||Array.isArray(t))return{};const i={};for(const[e,o]of Object.entries(t))U.has(e)&&"string"==typeof o&&o.trim()&&(i[e]=o.trim());return i}_getHeaderToolbarLabel(e){return"header"!==this._toolbarModeValue?"":this._headerToolbarLabelsValue[e]||""}_renderToolbarButton(e,t){const i=this._getHeaderToolbarLabel(e),o=["bubble-btn",t.active?"is-active":"",t.danger?"danger":"",i?"has-label":""].filter(Boolean).join(" ");return S`
1
+ import{Node as E,mergeAttributes as w,Editor as P}from"@tiptap/core";import V from"@tiptap/extension-blockquote";import F from"@tiptap/extension-bold";import H from"@tiptap/extension-bullet-list";import q from"@tiptap/extension-code";import z from"@tiptap/extension-document";import D from"@tiptap/extension-heading";import O from"@tiptap/extension-history";import j from"@tiptap/extension-horizontal-rule";import U from"@tiptap/extension-image";import W from"@tiptap/extension-italic";import N from"@tiptap/extension-link";import G from"@tiptap/extension-list-item";import K from"@tiptap/extension-ordered-list";import Y from"@tiptap/extension-paragraph";import X from"@tiptap/extension-placeholder";import J from"@tiptap/extension-strike";import{Table as Q}from"@tiptap/extension-table";import{TableCell as Z}from"@tiptap/extension-table-cell";import{TableHeader as ee}from"@tiptap/extension-table-header";import{TableRow as te}from"@tiptap/extension-table-row";import ie from"@tiptap/extension-text";import oe from"@tiptap/extension-text-align";import re from"@tiptap/extension-underline";import{css as ne,LitElement as se,html as l}from"lit";import{property as h,state as b}from"lit/decorators.js";import{transformIncomingContentByFormat as C,EMPTY_EDITOR_HTML as le,transformOutgoingContentByFormat as I}from"./content-format.mjs";import{parseEditorToolbarItems as M,SIMPLE_EDITOR_TOOLBAR as ae,DEFAULT_EDITOR_TOOLBAR as de}from"./toolbar.mjs";import{safeCustomElement as he}from"../base/define.mjs";var ce=Object.defineProperty,ue=Object.getOwnPropertyDescriptor,d=(e,t,i,o)=>{for(var r=o>1?void 0:o?ue(t,i):t,n=e.length-1,s;n>=0;n--)(s=e[n])&&(r=(o?s(t,i,r):s(r))||r);return o&&r&&ce(t,i,r),r};const S=560,v=24,k="输入内容",L="输入 / 唤出快捷命令",A="80px",pe={image:"插入图片",link:"插入链接"},be=new Set(["bold","italic","underline","strike","code","link","image","bulletList","orderedList","taskList","blockquote","table"]),ge=E.create({name:"taskList",group:"block list",content:"taskItem+",defining:!0,parseHTML(){return[{tag:'ul[data-type="taskList"]'}]},renderHTML({HTMLAttributes:e}){return["ul",w(e,{"data-type":"taskList"}),0]},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,"taskItem")}}}),me=E.create({name:"taskItem",defining:!0,content:"paragraph block*",addAttributes(){return{checked:{default:!1,parseHTML:e=>e.getAttribute("data-checked")==="true",renderHTML:e=>({"data-checked":String(!!e.checked)})}}},parseHTML(){return[{tag:'li[data-type="taskItem"]'}]},renderHTML({HTMLAttributes:e}){const t=!!e.checked;return["li",w(e,{"data-type":"taskItem"}),["label",{contenteditable:"false"},["input",{type:"checkbox",checked:t?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),fe=G.extend({addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),_e=U.extend({addAttributes(){return{...this.parent?.(),width:{default:null,parseHTML:e=>{const t=e.getAttribute("width"),i=Number(t);return Number.isFinite(i)&&i>0?i:null},renderHTML:e=>e.width?{width:String(e.width)}:{}},align:{default:"left",parseHTML:e=>e.getAttribute("data-align")||"left",renderHTML:e=>e.align?{"data-align":String(e.align)}:{}}}},renderHTML({HTMLAttributes:e}){const t=Number(e.width),i=["max-width:100%","height:auto",Number.isFinite(t)&&t>0?`width:${t}px`:"",e.style||""].filter(Boolean).join(";");return["img",w(this.options.HTMLAttributes,e,{style:i})]}});let a=class extends se{constructor(){super(...arguments),this.content="",this["model-value"]="",this.placeholder=k,this["toolbar-mode"]="header",this.toolbar="",this["toolbar-preset"]="full",this["header-toolbar-labels"]=pe,this._lastInvalidHeaderToolbarLabelsSource=void 0,this["header-always-visible"]="true",this["use-model"]="false",this.readonly="false",this.preview="false",this.editable=null,this["min-height"]=A,this["max-height"]="",this["show-character-count"]="false",this["toolbar-position"]="top",this["custom-styles"]="",this["content-format"]="html",this["deserialize-content"]=null,this["serialize-content"]=null,this._injectedStyleEl=null,this["upload-image"]=async e=>new Promise((t,i)=>{const o=new FileReader;o.onload=r=>t(r.target?.result),o.onerror=i,o.readAsDataURL(e)}),this._editor=null,this._pendingContent=null,this._tableRows=3,this._tableCols=3,this._hoverRow=0,this._hoverCol=0,this._tableDropdownOpen=!1,this._tableCellToolbar={x:0,y:0,visible:!1,cellRow:0,cellCol:0},this._imageToolbar={x:0,y:0,visible:!1},this._linkEditor={x:0,y:0,visible:!1,url:"",label:""},this._isEditorFocused=!1,this._selectedImage=null,this._hasSlashCommand=!1,this._slashCommandRange=null,this._slashInlineMarkState=null,this._isComposingText=!1,this._isUpdating=!1,this._pendingImageInsertPos=null,this._linkSelection=null,this._preserveFocusOnInternalClick=!1,this._tableEdgeDetectionSetup=!1,this._handleCompositionStart=()=>{this._isComposingText=!0},this._handleCompositionEnd=()=>{this._isComposingText=!1,requestAnimationFrame(()=>{this._syncSlashInlineMarkState(),this._restoreSlashInlineMarkIfNeeded()})}}_injectCustomStyles(){const e=this.shadowRoot;if(!e||(this._injectedStyleEl&&(this._injectedStyleEl.remove(),this._injectedStyleEl=null),!this["custom-styles"]))return;const t=document.createElement("style");t.textContent=this["custom-styles"],e.appendChild(t),this._injectedStyleEl=t}get _useModelValue(){return this["use-model"]===!0||this["use-model"]==="true"||this["use-model"]===""||this.hasAttribute("use-model")}get _readonlyValue(){return this.readonly!==!1&&this.readonly!=="false"}get _previewValue(){return this.preview!==!1&&this.preview!=="false"}get _editableValue(){return this.editable===null||this.editable===void 0?null:this.editable!==!1&&this.editable!=="false"}get _isEditable(){return this._previewValue?!1:this._editableValue!==null?this._editableValue:!this._readonlyValue}get _toolbarModeValue(){return this["toolbar-mode"]==="header"?"header":"slash"}get _headerAlwaysVisibleValue(){return this["header-always-visible"]===!0||this["header-always-visible"]==="true"||this["header-always-visible"]===""||this.hasAttribute("header-always-visible")}get _toolbarPositionValue(){return this["toolbar-position"]==="bottom"?"bottom":"top"}get _toolbarPresetValue(){return this["toolbar-preset"]==="simple"?"simple":this["toolbar-preset"]==="none"?"none":"full"}get _contentFormatValue(){return this["content-format"]==="markdown"?"markdown":this["content-format"]==="custom"?"custom":"html"}get _showCharacterCountValue(){return this["show-character-count"]===!0||this["show-character-count"]==="true"||this["show-character-count"]===""||this.hasAttribute("show-character-count")}get _resolvedMinHeight(){return this["min-height"]?.trim()||A}get _resolvedMaxHeight(){return this["max-height"]?.trim()||"none"}get _wrapperStyleValue(){const e=this["max-height"]?.trim()?"auto":"visible";return[`--qxs-editor-min-height: ${this._resolvedMinHeight}`,`--qxs-editor-max-height: ${this._resolvedMaxHeight}`,`--qxs-editor-overflow-y: ${e}`].join("; ")}get _resolvedPlaceholder(){return this.placeholder&&this.placeholder!==k&&this.placeholder!==L?this.placeholder:this._toolbarModeValue==="header"?k:L}get _toolbarItemsValue(){return Array.isArray(this.toolbar)?M(this.toolbar):typeof this.toolbar=="string"&&this.toolbar.trim()?M(this.toolbar):this._toolbarPresetValue==="simple"?[...ae]:this._toolbarPresetValue==="none"?[]:[...de]}_hasToolbarItem(e){return this._toolbarItemsValue.includes(e)}get _headerToolbarLabelsValue(){const e=this["header-toolbar-labels"];if(!e)return{};let t=e;if(typeof e=="string"){if(e==="[object Object]")return this._warnInvalidHeaderToolbarLabels(e,'received "[object Object]"; Vue hosts should pass object values with `.prop`, for example `:header-toolbar-labels.prop="headerToolbarLabels"`'),{};try{t=JSON.parse(e)}catch(o){return this._warnInvalidHeaderToolbarLabels(e,"parse failed, fallback to empty map",o),{}}}if(!t||typeof t!="object"||Array.isArray(t))return{};const i={};for(const[o,r]of Object.entries(t))be.has(o)&&typeof r=="string"&&r.trim()&&(i[o]=r.trim());return i}_warnInvalidHeaderToolbarLabels(e,t,i){this._lastInvalidHeaderToolbarLabelsSource!==e&&(this._lastInvalidHeaderToolbarLabelsSource=e)}_getHeaderToolbarLabel(e){return this._toolbarModeValue!=="header"?"":this._headerToolbarLabelsValue[e]||""}_renderToolbarButton(e,t){const i=this._getHeaderToolbarLabel(e),o=["bubble-btn",t.active?"is-active":"",t.danger?"danger":"",i?"has-label":""].filter(Boolean).join(" ");return l`
2
2
  <button class=${o} @click=${t.onClick} title=${t.title}>
3
3
  ${t.icon}
4
- ${i?S`<span class="bubble-btn__label">${i}</span>`:null}
4
+ ${i?l`<span class="bubble-btn__label">${i}</span>`:null}
5
5
  </button>
6
- `}_transformIncomingContent(e){const t=e||"",i=this["deserialize-content"];if(!i)return A(t,this._contentFormatValue);try{return i(t)||B}catch(e){return A(t,this._contentFormatValue)}}_transformOutgoingContent(e){const t=this["serialize-content"];if(!t)return E(e,this._contentFormatValue);try{return t(e)}catch(t){return E(e,this._contentFormatValue)}}_getEditorCharacterCount(){return this._editor?.getText().length??0}_initEditor(){if(this._editor)return;const e=this.shadowRoot?.querySelector(".editor-content");if(!e)return void requestAnimationFrame(()=>this._initEditor());for(;e.firstChild;)e.removeChild(e.firstChild);const t=this._useModelValue,c=this.getAttribute("model-value")??this["model-value"],M=this.content,I=t?this._transformIncomingContent(this._pendingContent??c):this._transformIncomingContent(this._pendingContent??M),S=[l,m,w,r,p,T,x,s,a.configure({levels:[1,2,3]}),n,g,N,W,b,o,h,d,G.configure({inline:!1,allowBase64:!0}),u.extend({inclusive:!1}).configure({openOnClick:!1,HTMLAttributes:{rel:"noopener noreferrer"}}),C.configure({types:["heading","paragraph"]}),f.configure({resizable:!0}),k,v,y,_.configure({placeholder:this._resolvedPlaceholder})];this._editor=new i({element:e,extensions:S,editable:this._isEditable,content:I}),this._editor.view.dom.addEventListener("compositionstart",this._handleCompositionStart),this._editor.view.dom.addEventListener("compositionend",this._handleCompositionEnd),this._pendingContent=null,this._editor.on("selectionUpdate",()=>{this._syncSlashInlineMarkState(),this._restoreSlashInlineMarkIfNeeded(),"slash"===this._toolbarModeValue&&this._updateBubbleMenuPosition(),this._editor?.isActive("table")?this._showTableCellToolbar():this._hideTableCellToolbar(),this._syncImageSelectionState()}),this._editor.on("transaction",()=>{this._editor?.isActive("table")?this._showTableCellToolbar():this._hideTableCellToolbar(),this._checkSlashCommand(),this._syncSlashInlineMarkState(),this._restoreSlashInlineMarkIfNeeded(),this._setupTableEdgeDetection(),this._syncImageSelectionState()}),this._editor.on("update",()=>{this._emitContentChange()})}_toggleTaskItemChecked(e){const t=e.target,i=this._editor;if(!(t instanceof HTMLInputElement&&"checkbox"===t.type&&i))return;const o=t.closest('li[data-type="taskItem"]');if(!o)return;e.preventDefault(),e.stopPropagation();const r=i.view.posAtDOM(o,0),n=Math.max(0,r-2),s=Math.min(i.state.doc.content.size,r+2);let l=null;if(i.state.doc.nodesBetween(n,s,(e,t)=>{if("taskItem"===e.type.name)return l=t,!1}),null===l)return;const a=i.state.doc.nodeAt(l);a&&"taskItem"===a.type.name&&i.view.dispatch(i.state.tr.setNodeMarkup(l,void 0,{...a.attrs,checked:!a.attrs.checked}))}_emitContentChange(){if(!this._editor)return;const e=this.getContentSnapshot();this._showCharacterCountValue&&this.requestUpdate(),this.dispatchEvent(new CustomEvent("content-update",{detail:e,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("content-change",{detail:e.value,bubbles:!0,composed:!0}))}_setupTableEdgeDetection(){const e=this.shadowRoot?.querySelector(".editor-content"),t=this.shadowRoot?.querySelector(".editor-wrapper");if(!e||this._tableEdgeDetectionSetup)return;this._tableEdgeDetectionSetup=!0;const i=e=>{this._toggleTaskItemChecked(e);const t=e.target;t instanceof Element&&t.closest(".editor-header, .bubble-menu, .table-cell-toolbar, .image-toolbar, .link-editor")||this._isEditable&&this._editor?.chain().focus().run()};e.addEventListener("click",i),t?.addEventListener("click",i)}_handleWrapperFocusIn(){this._preserveFocusOnInternalClick=!1,this._isEditorFocused=!0}_handleHeaderToolbarMouseDown(e){if(!this._isEditable)return;const t=e.target;t instanceof Element&&t.closest("button, .bubble-dropdown, .table-cell")&&(e.preventDefault(),this._preserveFocusOnInternalClick=!0,requestAnimationFrame(()=>{this._preserveFocusOnInternalClick=!1}))}_handleWrapperMouseDown(e){const t=e.target;this._isEditable&&t instanceof Element&&!t.closest(".editor-header, .bubble-menu, .table-cell-toolbar, .image-toolbar, .link-editor")&&(this._preserveFocusOnInternalClick=!0,requestAnimationFrame(()=>{this._preserveFocusOnInternalClick=!1}))}_handleWrapperFocusOut(e){const t=e.relatedTarget,i=this.shadowRoot?.querySelector(".editor-wrapper");this._preserveFocusOnInternalClick||t&&i?.contains(t)||(this._isEditorFocused=!1,this._tableDropdownOpen=!1,this._closeLinkEditor())}_isHeaderVisible(){return"header"===this._toolbarModeValue&&!this._previewValue&&(this._headerAlwaysVisibleValue||this._isEditorFocused||this._tableDropdownOpen||Boolean(this._selectedImage))}_getImageSelection(){const e=this._editor,t=e?.state.selection;return e&&t?.node&&"image"===t.node.type?.name?{pos:t.from,attrs:t.node.attrs??{}}:null}_getImageMaxWidth(){const e=this.shadowRoot?.querySelector(".editor-content"),t=(e?.clientWidth??560)-32;return Math.max(24,Math.min(560,t))}async _getImageNaturalWidth(e){return await new Promise(t=>{const i=URL.createObjectURL(e),o=new window.Image;o.onload=()=>{const e=o.naturalWidth;URL.revokeObjectURL(i),t(Number.isFinite(e)&&e>0?e:null)},o.onerror=()=>{URL.revokeObjectURL(i),t(null)},o.src=i})}_syncImageSelectionState(){const e=this._getImageSelection();if(!e)return this._selectedImage=null,void("slash"===this._toolbarModeValue&&this._hideImageToolbar());const t=Number(e.attrs.width),i=String(e.attrs.align||"left");if(this._selectedImage={pos:e.pos,width:Number.isFinite(t)&&t>0?t:this._getImageMaxWidth(),align:i},"slash"!==this._toolbarModeValue)return void this._hideImageToolbar();const o=this._editor,r=this.shadowRoot?.querySelector(".editor-wrapper")?.getBoundingClientRect();if(!o||!r)return;const n=o.view.coordsAtPos(e.pos),s=n.left-r.left+(n.right-n.left)/2,l=n.top-r.top-40;this._showImageToolbar({x:s,y:l})}_clearSlashCommandText(){if(!this._editor||!this._slashCommandRange)return;const{from:e,to:t}=this._slashCommandRange;this._editor.chain().focus().deleteRange({from:e,to:t}).run(),this._hasSlashCommand=!1,this._slashCommandRange=null}_checkSlashCommand(){if(!this._editor)return;const{selection:e}=this._editor.state;if(!e.empty)return this._hasSlashCommand=!1,void(this._slashCommandRange=null);const{$from:t}=e,i=t.parent.textBetween(0,t.parentOffset," "," "),o=/(?:^|\s)(\/\S*)$/.exec(i);if(!o)return this._hasSlashCommand=!1,void(this._slashCommandRange=null);const r=o[1];this._hasSlashCommand=!0,this._slashCommandRange={from:e.from-r.length,to:e.from}}firstUpdated(){this._injectCustomStyles(),queueMicrotask(()=>{this.isConnected&&this._initEditor()})}updated(e){if(e.has("custom-styles")&&this._injectCustomStyles(),this._editor){if(e.has("content")||e.has("model-value")&&this._useModelValue||e.has("deserialize-content")||e.has("content-format")){const e=this._transformIncomingContent(this._useModelValue?this["model-value"]:this.content);e!==this._editor.getHTML()&&this._editor.commands.setContent(e)}(e.has("readonly")||e.has("preview")||e.has("editable"))&&this._editor.setEditable(this._isEditable)}else e.has("content")&&(this._pendingContent=this.content),e.has("model-value")&&this._useModelValue&&(this._pendingContent=this["model-value"])}disconnectedCallback(){super.disconnectedCallback();const e=this._editor?.view?.dom;e?.removeEventListener("compositionstart",this._handleCompositionStart),e?.removeEventListener("compositionend",this._handleCompositionEnd),this._editor?.destroy(),this._editor=null}getContent(){return this.getContentSnapshot().value}getContentSnapshot(){const e=this._editor?.getHTML()??"",t=this._editor?.getText().trim()??"";return{value:e?this._transformOutgoingContent(e):"",html:e,text:t,format:this._contentFormatValue}}forceUpdate(){if(this.requestUpdate(),this._editor){const e=this._transformIncomingContent(this._useModelValue?this["model-value"]:this.content);e!==this._editor.getHTML()&&this._editor.commands.setContent(e)}}_applyFormat(e){this._clearSlashCommandText(),this._clearSlashInlineMarkState(!0),e()}_getCurrentLineStart(e){const{selection:t}=e.state;return t.empty?t.$from.start():null}_getSlashCommandContext(){const e=this._editor,t=this._slashCommandRange;if(!e||!t)return null;return{lineFrom:e.state.doc.resolve(t.from).start(),lineTo:t.from}}_clearSlashInlineMarkState(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=this._editor,i=this._slashInlineMarkState;if(!t||!i)return;const{selection:o}=t.state,r=this._getCurrentLineStart(t);if(!e&&r===i.lineStart&&o.empty&&o.to>=i.startPos)return;this._slashInlineMarkState=null;const n=t.state.selection.to;let s=t.chain().focus().setTextSelection({from:n,to:n});switch(i.type){case"bold":s=s.unsetBold();break;case"italic":s=s.unsetItalic();break;case"underline":s=s.unsetUnderline();break;case"strike":s=s.unsetStrike();break;case"code":s=s.unsetCode()}s.run()}_runInlineMarkAction(e,t,i){switch(e){case"bold":return"set"===i?t.setBold():t.unsetBold();case"italic":return"set"===i?t.setItalic():t.unsetItalic();case"underline":return"set"===i?t.setUnderline():t.unsetUnderline();case"strike":return"set"===i?t.setStrike():t.unsetStrike();case"code":return"set"===i?t.setCode():t.unsetCode()}}_syncSlashInlineMarkState(){this._slashInlineMarkState&&this._editor&&(this._isComposingText||(this._shouldEndSlashInlineMarkAtCursor()?this._clearSlashInlineMarkState(!0):this._clearSlashInlineMarkState()))}_shouldEndSlashInlineMarkAtCursor(){const e=this._editor,t=this._slashInlineMarkState;if(!e||!t)return!1;const{selection:i}=e.state,o=this._getCurrentLineStart(e);if(!i.empty||o!==t.lineStart||i.to<=t.startPos)return!1;const r=e.state.doc.textBetween(i.to-1,i.to,"\n","\n");return/\s/.test(r)}_hasInlineMarkAtCursor(e){const t=this._editor;if(!t)return!1;const i=t.schema.marks[e];if(!i)return!1;const{selection:o,storedMarks:r}=t.state;if(!o.empty)return!1;return(r??o.$from.marks()).some(e=>e.type===i)}_restoreSlashInlineMarkIfNeeded(){const e=this._editor,t=this._slashInlineMarkState;if(!e||!t)return;const{selection:i}=e.state,o=this._getCurrentLineStart(e);if(!i.empty||o!==t.lineStart||i.to<t.startPos)return;if(this._hasInlineMarkAtCursor(t.type))return;const r=e.state.selection.to;this._runInlineMarkAction(t.type,e.chain().focus().setTextSelection({from:r,to:r}),"set").run()}_setInlineMarkState(e,t){const i=this._getCurrentLineStart(this._editor);this._slashInlineMarkState=null===i?null:{type:e,lineStart:i,startPos:t}}_applyInlineMarkToCurrentLine(e,t){const i=this._editor;if(!i)return!1;const{selection:o}=i.state;if(!o.empty)return this._runInlineMarkAction(e,i.chain().focus().setTextSelection({from:o.from,to:o.to}),t).run(),"unset"===t&&this._clearSlashInlineMarkState(!0),!0;const r=o.from,n=i.state.doc.resolve(r),s={from:n.start(),to:n.end()};return this._clearSlashInlineMarkState(!0),s.from<s.to&&this._runInlineMarkAction(e,i.chain().focus().setTextSelection(s),t).run(),this._runInlineMarkAction(e,i.chain().focus().setTextSelection({from:r,to:r}),t).run(),"set"===t&&this._setInlineMarkState(e,r),!0}_toggleToolbarInlineMark(e){return this._applyInlineMarkToCurrentLine(e,this._hasInlineMarkAtCursor(e)?"unset":"set")}_applySlashInlineMark(e){const t=this._editor,i=this._getSlashCommandContext();if(!t||!i)return!1;this._clearSlashCommandText(),this._clearSlashInlineMarkState(!0);const o=t.state.selection.to,r={from:i.lineFrom,to:t.state.doc.resolve(o).end()};return r.from<r.to&&this._runInlineMarkAction(e,t.chain().focus().setTextSelection(r),"set").run(),this._runInlineMarkAction(e,t.chain().focus().setTextSelection({from:o,to:o}),"set").run(),this._setInlineMarkState(e,o),!0}_applySlashLineBlock(e){const t=this._editor,i=this._getSlashCommandContext();return!(!t||!i)&&(this._clearSlashCommandText(),e(t.chain().focus().setTextSelection({from:i.lineFrom,to:i.lineTo})).run(),!0)}_toggleBold(){this._applySlashInlineMark("bold")||this._toggleToolbarInlineMark("bold")}_toggleItalic(){this._applySlashInlineMark("italic")||this._toggleToolbarInlineMark("italic")}_toggleUnderline(){this._applySlashInlineMark("underline")||this._toggleToolbarInlineMark("underline")}_toggleStrike(){this._applySlashInlineMark("strike")||this._toggleToolbarInlineMark("strike")}_toggleCode(){this._applySlashInlineMark("code")||this._toggleToolbarInlineMark("code")}_setHeading(e){this._applySlashLineBlock(t=>t.setHeading({level:e}))||this._applyFormat(()=>this._editor?.chain().focus().toggleHeading({level:e}).run())}_setParagraph(){this._applySlashLineBlock(e=>e.setParagraph())||this._applyFormat(()=>this._editor?.chain().focus().setParagraph().run())}_toggleBulletList(){this._applySlashLineBlock(e=>e.toggleBulletList())||this._applyFormat(()=>this._editor?.chain().focus().toggleBulletList().run())}_toggleOrderedList(){this._applySlashLineBlock(e=>e.toggleOrderedList())||this._applyFormat(()=>this._editor?.chain().focus().toggleOrderedList().run())}_toggleTaskList(){this._applySlashLineBlock(e=>e.toggleTaskList())||this._applyFormat(()=>this._editor?.chain().focus().toggleTaskList().run())}_toggleBlockquote(){this._applySlashLineBlock(e=>e.toggleBlockquote())||this._applyFormat(()=>this._editor?.chain().focus().toggleBlockquote().run())}_setTextAlign(e){this._applySlashLineBlock(t=>t.setTextAlign(e))||this._applyFormat(()=>this._editor?.chain().focus().setTextAlign(e).run())}_normalizeLinkUrl(e){const t=e.trim();return t?/^(https?:\/\/|mailto:|tel:|#|\/)/i.test(t)?t:`https://${t}`:""}_getLinkLabelFromRange(e){const t=this._editor;return!t||!e||e.from>=e.to?"":t.state.doc.textBetween(e.from,e.to,"")}_getLinkTargetRange(){const e=this._editor;if(!e)return null;const{selection:t}=e.state;if(!t.empty)return{from:t.from,to:t.to};if(e.isActive("link"))return e.chain().focus().extendMarkRange("link").run(),{from:e.state.selection.from,to:e.state.selection.to};const i=e.state.doc.resolve(t.from);return{from:i.start(),to:i.end()}}_setLink(e){const t=this._editor,i=this.shadowRoot?.querySelector(".editor-wrapper"),o=e.currentTarget instanceof HTMLElement?e.currentTarget:null;if(!t||!i||!o)return;const r=this._getLinkTargetRange();this._linkSelection=r;const n=i.getBoundingClientRect(),s=o.getBoundingClientRect(),l=Math.max(12,n.width-332),a=Math.min(Math.max(12,s.left-n.left),l),d=s.bottom-n.top+8,h=String(t.getAttributes("link").href||""),c=this._getLinkLabelFromRange(r);this._linkEditor={x:a,y:d,visible:!0,url:h,label:c},this.updateComplete.then(()=>{const e=this.shadowRoot?.querySelector('.link-editor__input[data-field="url"]');e?.focus(),e?.select()})}_closeLinkEditor(){this._linkEditor={...this._linkEditor,visible:!1}}_handleLinkEditorInput(e){const t=e.target,i="label"===t.dataset.field?"label":"url";this._linkEditor={...this._linkEditor,[i]:t.value}}_applyLink(){const e=this._editor,t=this._normalizeLinkUrl(this._linkEditor.url),i=this._linkEditor.label.trim()||t;if(!e||!t)return;this._clearSlashCommandText();const o=this._linkSelection??this._getLinkTargetRange()??e.state.selection,r=o.from+i.length;e.chain().focus().insertContentAt({from:o.from,to:o.to},{type:"text",text:i,marks:[{type:"link",attrs:{href:t}}]}).setTextSelection({from:r,to:r}).run(),this._closeLinkEditor()}_removeLink(){const e=this._editor;if(!e)return;const t=this._linkSelection??e.state.selection;let i=e.chain().focus();t.from!==t.to&&(i=i.setTextSelection(t)),i.extendMarkRange("link").unsetLink().run(),this._closeLinkEditor()}_handleLinkEditorKeydown(e){if("Enter"===e.key)return e.preventDefault(),void this._applyLink();"Escape"===e.key&&(e.preventDefault(),this._closeLinkEditor())}_insertTable(e,t){this._editor?.chain().focus().insertTable({rows:e??this._tableRows,cols:t??this._tableCols,withHeaderRow:!0}).run()}async _handleImageUpload(e){const t=e.target,i=t.files?.[0];if(i)try{const e=await this._getImageNaturalWidth(i),t=await this["upload-image"](i),o=e?Math.min(e,this._getImageMaxWidth()):this._getImageMaxWidth();this._clearSlashCommandText();const r=this._pendingImageInsertPos;this._pendingImageInsertPos=null,null!==r?this._insertImageAt(r,{src:t,width:o,align:"left"}):this._editor?.chain().focus().setImage({src:t,width:o,align:"left"}).run()}catch(e){const t=e instanceof Error?e:new Error("图片上传失败");this.dispatchEvent(new CustomEvent("image-upload-error",{detail:{file:i,error:t},bubbles:!0,composed:!0}))}t.value=""}_triggerImageUpload(){this._clearSlashCommandText();const e=this.shadowRoot?.querySelector(".image-input");e?.click()}_insertTableByClick(e,t){this._clearSlashCommandText(),this._tableRows=e,this._tableCols=t,this._insertTable(e,t)}_showTableCellToolbar(){if(!this._editor?.isActive("table"))return;const{state:e}=this._editor,{selection:t}=e,i=this._editor.view.coordsAtPos(t.from),o=this.shadowRoot?.querySelector(".editor-wrapper");if(!o)return;const r=o.getBoundingClientRect(),n=this._getTableCellRow(),s=this._getTableCellCol();(0===n||0===s)&&requestAnimationFrame(()=>{this._tableCellToolbar={x:i.left-r.left,y:i.bottom-r.top+8,visible:!0,cellRow:n,cellCol:s}})}_getTableCellRow(){if(!this._editor)return 0;const{selection:e}=this._editor.state,t=this._editor.state.doc.resolve(e.from);for(let e=t.depth;e>0;e--){if("tableCell"===t.node(e).type.name)return t.index(e-1)}return 0}_getTableCellCol(){if(!this._editor)return 0;const{selection:e}=this._editor.state,t=this._editor.state.doc.resolve(e.from);for(let e=t.depth;e>0;e--){if("tableCell"===t.node(e).type.name)return t.index(e)}return 0}_hideTableCellToolbar(){requestAnimationFrame(()=>{this._tableCellToolbar={...this._tableCellToolbar,visible:!1}})}_addTableRowAbove(){this._editor?.chain().focus().addRowBefore().run(),this._hideTableCellToolbar()}_addTableRowBelow(){this._editor?.chain().focus().addRowAfter().run(),this._hideTableCellToolbar()}_addTableColumnLeft(){this._editor?.chain().focus().addColumnBefore().run(),this._hideTableCellToolbar()}_addTableColumnRight(){this._editor?.chain().focus().addColumnAfter().run(),this._hideTableCellToolbar()}_deleteTableRow(){this._editor?.chain().focus().deleteRow().run(),this._hideTableCellToolbar()}_deleteTableColumn(){this._editor?.chain().focus().deleteColumn().run(),this._hideTableCellToolbar()}_deleteTable(){this._editor?.chain().focus().deleteTable().run(),this._hideTableCellToolbar()}_showImageToolbar(e){requestAnimationFrame(()=>{this._imageToolbar={x:e.x,y:e.y,visible:!0}})}_hideImageToolbar(){requestAnimationFrame(()=>{this._imageToolbar={...this._imageToolbar,visible:!1}})}_deleteImage(){const e=this._getSelectedImageNode();if(!e)return;const{editor:t,pos:i,node:o}=e;t.view.dispatch(t.state.tr.delete(i,i+o.nodeSize)),this._selectedImage=null,this._pendingImageInsertPos=null,this._hideImageToolbar()}_insertImageAfter(){const e=this._getSelectedImageNode();e?(this._pendingImageInsertPos=e.pos+e.node.nodeSize,this._triggerImageUpload()):this._triggerImageUpload()}_getSelectedImageNode(){const e=this._editor,t=this._selectedImage?.pos;if(!e||void 0===t)return null;const i=e.state.doc.nodeAt(t);return i&&"image"===i.type.name?{editor:e,pos:t,node:i}:null}_insertImageAt(e,t){const i=this._editor;if(!i)return;const o=Math.max(0,Math.min(e,i.state.doc.content.size));i.chain().insertContentAt(o,{type:"image",attrs:t}).setNodeSelection(o).run()}_updateSelectedImageAttributes(e){const t=this._getSelectedImageNode();if(!t)return;const{editor:i,pos:o,node:r}=t;i.view.dispatch(i.state.tr.setNodeMarkup(o,void 0,{...r.attrs,...e}))}_setImageWidth(e){const t=Math.max(24,Math.min(this._getImageMaxWidth(),Math.round(e)));this._updateSelectedImageAttributes({width:t})}_handleImageWidthInput(e){const t=e.target.value.trim();if(!t)return;const i=Number(t);Number.isFinite(i)&&this._setImageWidth(i)}_setImageAlignLeft(){this._updateSelectedImageAttributes({align:"left"})}_setImageAlignCenter(){this._updateSelectedImageAttributes({align:"center"})}_setImageAlignRight(){this._updateSelectedImageAttributes({align:"right"})}_getTextLabel(){const e=this._editor;return e?e.isActive("heading",{level:1})?"标题 1":e.isActive("heading",{level:2})?"标题 2":e.isActive("heading",{level:3})?"标题 3":"正文":"正文"}_getAlignLabel(){const e=this._editor;return e?e.isActive({textAlign:"center"})?"居中":e.isActive({textAlign:"right"})?"右对齐":"左对齐":"对齐"}_renderImageControls(){const e=this._selectedImage;return e?S`
6
+ `}_transformIncomingContent(e){const t=e||"",i=this["deserialize-content"];if(!i)return C(t,this._contentFormatValue);try{return i(t)||le}catch{return C(t,this._contentFormatValue)}}_transformOutgoingContent(e){const t=this["serialize-content"];if(!t)return I(e,this._contentFormatValue);try{return t(e)}catch{return I(e,this._contentFormatValue)}}_getEditorCharacterCount(){return this._editor?.getText().length??0}_initEditor(){if(this._editor)return;const e=this.shadowRoot?.querySelector(".editor-content");if(!e){requestAnimationFrame(()=>this._initEditor());return}for(;e.firstChild;)e.removeChild(e.firstChild);const t=this._useModelValue,i=this.getAttribute("model-value")??this["model-value"],o=this.content,r=t?this._transformIncomingContent(this._pendingContent??i):this._transformIncomingContent(this._pendingContent??o),n=[z,Y,ie,F,W,re,J,q,D.configure({levels:[1,2,3]}),H,K,ge,me,fe,V,j,O,_e.configure({inline:!1,allowBase64:!0}),N.extend({inclusive:!1}).configure({openOnClick:!1,HTMLAttributes:{rel:"noopener noreferrer"}}),oe.configure({types:["heading","paragraph"]}),Q.configure({resizable:!0}),te,Z,ee,X.configure({placeholder:this._resolvedPlaceholder})];this._editor=new P({element:e,extensions:n,editable:this._isEditable,content:r}),this._editor.view.dom.addEventListener("compositionstart",this._handleCompositionStart),this._editor.view.dom.addEventListener("compositionend",this._handleCompositionEnd),this._pendingContent=null,this._editor.on("selectionUpdate",()=>{this._syncSlashInlineMarkState(),this._restoreSlashInlineMarkIfNeeded(),this._toolbarModeValue==="slash"&&this._updateBubbleMenuPosition(),this._editor?.isActive("table")?this._showTableCellToolbar():this._hideTableCellToolbar(),this._syncImageSelectionState()}),this._editor.on("transaction",()=>{this._editor?.isActive("table")?this._showTableCellToolbar():this._hideTableCellToolbar(),this._checkSlashCommand(),this._syncSlashInlineMarkState(),this._restoreSlashInlineMarkIfNeeded(),this._setupTableEdgeDetection(),this._syncImageSelectionState()}),this._editor.on("update",()=>{this._emitContentChange()})}_toggleTaskItemChecked(e){const t=e.target,i=this._editor;if(!(t instanceof HTMLInputElement)||t.type!=="checkbox"||!i)return;const o=t.closest('li[data-type="taskItem"]');if(!o)return;e.preventDefault(),e.stopPropagation();const r=i.view.posAtDOM(o,0),n=Math.max(0,r-2),s=Math.min(i.state.doc.content.size,r+2);let c=null;if(i.state.doc.nodesBetween(n,s,(g,p)=>{if(g.type.name==="taskItem")return c=p,!1}),c===null)return;const u=i.state.doc.nodeAt(c);!u||u.type.name!=="taskItem"||i.view.dispatch(i.state.tr.setNodeMarkup(c,void 0,{...u.attrs,checked:!u.attrs.checked}))}_emitContentChange(){if(!this._editor)return;const e=this.getContentSnapshot();this._showCharacterCountValue&&this.requestUpdate(),this.dispatchEvent(new CustomEvent("content-update",{detail:e,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("content-change",{detail:e.value,bubbles:!0,composed:!0}))}_setupTableEdgeDetection(){const e=this.shadowRoot?.querySelector(".editor-content"),t=this.shadowRoot?.querySelector(".editor-wrapper");if(!e||this._tableEdgeDetectionSetup)return;this._tableEdgeDetectionSetup=!0;const i=o=>{this._toggleTaskItemChecked(o);const r=o.target;r instanceof Element&&r.closest(".editor-header, .bubble-menu, .table-cell-toolbar, .image-toolbar, .link-editor")||this._isEditable&&this._editor?.chain().focus().run()};e.addEventListener("click",i),t?.addEventListener("click",i)}_handleWrapperFocusIn(){this._preserveFocusOnInternalClick=!1,this._isEditorFocused=!0}_handleHeaderToolbarMouseDown(e){if(!this._isEditable)return;const t=e.target;!(t instanceof Element)||!t.closest("button, .bubble-dropdown, .table-cell")||(e.preventDefault(),this._preserveFocusOnInternalClick=!0,requestAnimationFrame(()=>{this._preserveFocusOnInternalClick=!1}))}_handleWrapperMouseDown(e){const t=e.target;!this._isEditable||!(t instanceof Element)||t.closest(".editor-header, .bubble-menu, .table-cell-toolbar, .image-toolbar, .link-editor")||(this._preserveFocusOnInternalClick=!0,requestAnimationFrame(()=>{this._preserveFocusOnInternalClick=!1}))}_handleWrapperFocusOut(e){const t=e.relatedTarget,i=this.shadowRoot?.querySelector(".editor-wrapper");this._preserveFocusOnInternalClick||t&&i?.contains(t)||(this._isEditorFocused=!1,this._tableDropdownOpen=!1,this._selectedImage=null,this._hideImageToolbar(),this._closeLinkEditor())}_isHeaderVisible(){return this._toolbarModeValue==="header"&&!this._previewValue&&(this._headerAlwaysVisibleValue||this._isEditorFocused||this._tableDropdownOpen||!!this._selectedImage)}_getImageSelection(){const e=this._editor,t=e?.state.selection;return!e||!t?.node||t.node.type?.name!=="image"?null:{pos:t.from,attrs:t.node.attrs??{}}}_getImageMaxWidth(){const t=(this.shadowRoot?.querySelector(".editor-content")?.clientWidth??S)-32;return Math.max(v,Math.min(S,t))}async _getImageNaturalWidth(e){return await new Promise(t=>{const i=URL.createObjectURL(e),o=new window.Image;o.onload=()=>{const r=o.naturalWidth;URL.revokeObjectURL(i),t(Number.isFinite(r)&&r>0?r:null)},o.onerror=()=>{URL.revokeObjectURL(i),t(null)},o.src=i})}_syncImageSelectionState(){const e=this._getImageSelection();if(!e){this._selectedImage=null,this._toolbarModeValue==="slash"&&this._hideImageToolbar();return}const t=Number(e.attrs.width),i=String(e.attrs.align||"left");if(this._selectedImage={pos:e.pos,width:Number.isFinite(t)&&t>0?t:this._getImageMaxWidth(),align:i},this._toolbarModeValue!=="slash"){this._hideImageToolbar();return}const o=this._editor,r=this.shadowRoot?.querySelector(".editor-wrapper")?.getBoundingClientRect();if(!o||!r)return;const n=o.view.coordsAtPos(e.pos),s=n.left-r.left+(n.right-n.left)/2,c=n.top-r.top-40;this._showImageToolbar({x:s,y:c})}_clearSlashCommandText(){if(!this._editor||!this._slashCommandRange)return;const{from:e,to:t}=this._slashCommandRange;this._editor.chain().focus().deleteRange({from:e,to:t}).run(),this._hasSlashCommand=!1,this._slashCommandRange=null}_checkSlashCommand(){if(!this._editor)return;const{selection:e}=this._editor.state;if(!e.empty){this._hasSlashCommand=!1,this._slashCommandRange=null;return}const{$from:t}=e,i=t.parent.textBetween(0,t.parentOffset," "," "),o=/(?:^|\s)(\/\S*)$/.exec(i);if(!o){this._hasSlashCommand=!1,this._slashCommandRange=null;return}const r=o[1];this._hasSlashCommand=!0,this._slashCommandRange={from:e.from-r.length,to:e.from}}firstUpdated(){this._injectCustomStyles(),queueMicrotask(()=>{this.isConnected&&this._initEditor()})}updated(e){if(e.has("custom-styles")&&this._injectCustomStyles(),this._editor){if(e.has("content")||e.has("model-value")&&this._useModelValue||e.has("deserialize-content")||e.has("content-format")){const t=this._useModelValue?this["model-value"]:this.content,i=this._transformIncomingContent(t);!(!(e.has("deserialize-content")||e.has("content-format"))&&(t??"")===this.getContent())&&i!==this._editor.getHTML()&&this._editor.commands.setContent(i)}(e.has("readonly")||e.has("preview")||e.has("editable"))&&this._editor.setEditable(this._isEditable);return}e.has("content")&&(this._pendingContent=this.content),e.has("model-value")&&this._useModelValue&&(this._pendingContent=this["model-value"])}disconnectedCallback(){super.disconnectedCallback();const e=this._editor?.view?.dom;e?.removeEventListener("compositionstart",this._handleCompositionStart),e?.removeEventListener("compositionend",this._handleCompositionEnd),this._editor?.destroy(),this._editor=null}getContent(){return this.getContentSnapshot().value}getContentSnapshot(){const e=this._editor?.getHTML()??"",t=this._editor?.getText().trim()??"";return{value:e?this._transformOutgoingContent(e):"",html:e,text:t,format:this._contentFormatValue}}forceUpdate(){if(this.requestUpdate(),this._editor){const e=this._transformIncomingContent(this._useModelValue?this["model-value"]:this.content);e!==this._editor.getHTML()&&this._editor.commands.setContent(e)}}_applyFormat(e){this._clearSlashCommandText(),this._clearSlashInlineMarkState(!0),e()}_getCurrentLineStart(e){const{selection:t}=e.state;return t.empty?t.$from.start():null}_getSlashCommandContext(){const e=this._editor,t=this._slashCommandRange;return!e||!t?null:{lineFrom:e.state.doc.resolve(t.from).start(),lineTo:t.from}}_clearSlashInlineMarkState(e=!1){const t=this._editor,i=this._slashInlineMarkState;if(!t||!i)return;const{selection:o}=t.state,r=this._getCurrentLineStart(t);if(!e&&r===i.lineStart&&o.empty&&o.to>=i.startPos)return;this._slashInlineMarkState=null;const n=t.state.selection.to;let s=t.chain().focus().setTextSelection({from:n,to:n});switch(i.type){case"bold":s=s.unsetBold();break;case"italic":s=s.unsetItalic();break;case"underline":s=s.unsetUnderline();break;case"strike":s=s.unsetStrike();break;case"code":s=s.unsetCode();break}s.run()}_runInlineMarkAction(e,t,i){switch(e){case"bold":return i==="set"?t.setBold():t.unsetBold();case"italic":return i==="set"?t.setItalic():t.unsetItalic();case"underline":return i==="set"?t.setUnderline():t.unsetUnderline();case"strike":return i==="set"?t.setStrike():t.unsetStrike();case"code":return i==="set"?t.setCode():t.unsetCode()}}_syncSlashInlineMarkState(){if(!(!this._slashInlineMarkState||!this._editor)&&!this._isComposingText){if(this._shouldEndSlashInlineMarkAtCursor()){this._clearSlashInlineMarkState(!0);return}this._clearSlashInlineMarkState()}}_shouldEndSlashInlineMarkAtCursor(){const e=this._editor,t=this._slashInlineMarkState;if(!e||!t)return!1;const{selection:i}=e.state,o=this._getCurrentLineStart(e);if(!i.empty||o!==t.lineStart||i.to<=t.startPos)return!1;const r=e.state.doc.textBetween(i.to-1,i.to,`
7
+ `,`
8
+ `);return/\s/.test(r)}_hasInlineMarkAtCursor(e){const t=this._editor;if(!t)return!1;const i=t.schema.marks[e];if(!i)return!1;const{selection:o,storedMarks:r}=t.state;return o.empty?(r??o.$from.marks()).some(s=>s.type===i):!1}_restoreSlashInlineMarkIfNeeded(){const e=this._editor,t=this._slashInlineMarkState;if(!e||!t)return;const{selection:i}=e.state,o=this._getCurrentLineStart(e);if(!i.empty||o!==t.lineStart||i.to<t.startPos||this._hasInlineMarkAtCursor(t.type))return;const r=e.state.selection.to;this._runInlineMarkAction(t.type,e.chain().focus().setTextSelection({from:r,to:r}),"set").run()}_setInlineMarkState(e,t){const i=this._getCurrentLineStart(this._editor);this._slashInlineMarkState=i===null?null:{type:e,lineStart:i,startPos:t}}_applyInlineMarkToCurrentLine(e,t){const i=this._editor;if(!i)return!1;const{selection:o}=i.state;if(!o.empty)return this._runInlineMarkAction(e,i.chain().focus().setTextSelection({from:o.from,to:o.to}),t).run(),t==="unset"&&this._clearSlashInlineMarkState(!0),!0;const r=o.from,n=i.state.doc.resolve(r),s={from:n.start(),to:n.end()};return this._clearSlashInlineMarkState(!0),s.from<s.to&&this._runInlineMarkAction(e,i.chain().focus().setTextSelection(s),t).run(),this._runInlineMarkAction(e,i.chain().focus().setTextSelection({from:r,to:r}),t).run(),t==="set"&&this._setInlineMarkState(e,r),!0}_toggleToolbarInlineMark(e){return this._applyInlineMarkToCurrentLine(e,this._hasInlineMarkAtCursor(e)?"unset":"set")}_applySlashInlineMark(e){const t=this._editor,i=this._getSlashCommandContext();if(!t||!i)return!1;this._clearSlashCommandText(),this._clearSlashInlineMarkState(!0);const o=t.state.selection.to,r={from:i.lineFrom,to:t.state.doc.resolve(o).end()};return r.from<r.to&&this._runInlineMarkAction(e,t.chain().focus().setTextSelection(r),"set").run(),this._runInlineMarkAction(e,t.chain().focus().setTextSelection({from:o,to:o}),"set").run(),this._setInlineMarkState(e,o),!0}_applySlashLineBlock(e){const t=this._editor,i=this._getSlashCommandContext();return!t||!i?!1:(this._clearSlashCommandText(),e(t.chain().focus().setTextSelection({from:i.lineFrom,to:i.lineTo})).run(),!0)}_toggleBold(){this._applySlashInlineMark("bold")||this._toggleToolbarInlineMark("bold")}_toggleItalic(){this._applySlashInlineMark("italic")||this._toggleToolbarInlineMark("italic")}_toggleUnderline(){this._applySlashInlineMark("underline")||this._toggleToolbarInlineMark("underline")}_toggleStrike(){this._applySlashInlineMark("strike")||this._toggleToolbarInlineMark("strike")}_toggleCode(){this._applySlashInlineMark("code")||this._toggleToolbarInlineMark("code")}_setHeading(e){this._applySlashLineBlock(t=>t.setHeading({level:e}))||this._applyFormat(()=>this._editor?.chain().focus().toggleHeading({level:e}).run())}_setParagraph(){this._applySlashLineBlock(e=>e.setParagraph())||this._applyFormat(()=>this._editor?.chain().focus().setParagraph().run())}_toggleBulletList(){this._applySlashLineBlock(e=>e.toggleBulletList())||this._applyFormat(()=>this._editor?.chain().focus().toggleBulletList().run())}_toggleOrderedList(){this._applySlashLineBlock(e=>e.toggleOrderedList())||this._applyFormat(()=>this._editor?.chain().focus().toggleOrderedList().run())}_toggleTaskList(){this._applySlashLineBlock(e=>e.toggleTaskList())||this._applyFormat(()=>this._editor?.chain().focus().toggleTaskList().run())}_toggleBlockquote(){this._applySlashLineBlock(e=>e.toggleBlockquote())||this._applyFormat(()=>this._editor?.chain().focus().toggleBlockquote().run())}_setTextAlign(e){this._applySlashLineBlock(t=>t.setTextAlign(e))||this._applyFormat(()=>this._editor?.chain().focus().setTextAlign(e).run())}_normalizeLinkUrl(e){const t=e.trim();return t?/^(https?:\/\/|mailto:|tel:|#|\/)/i.test(t)?t:`https://${t}`:""}_getLinkLabelFromRange(e){const t=this._editor;return!t||!e||e.from>=e.to?"":t.state.doc.textBetween(e.from,e.to,"")}_getLinkTargetRange(){const e=this._editor;if(!e)return null;const{selection:t}=e.state;if(!t.empty)return{from:t.from,to:t.to};if(e.isActive("link"))return e.chain().focus().extendMarkRange("link").run(),{from:e.state.selection.from,to:e.state.selection.to};const i=e.state.doc.resolve(t.from);return{from:i.start(),to:i.end()}}_setLink(e){const t=this._editor,i=this.shadowRoot?.querySelector(".editor-wrapper"),o=e.currentTarget instanceof HTMLElement?e.currentTarget:null;if(!t||!i||!o)return;const r=this._getLinkTargetRange();this._linkSelection=r;const n=i.getBoundingClientRect(),s=o.getBoundingClientRect(),c=Math.max(12,n.width-332),u=Math.min(Math.max(12,s.left-n.left),c),g=s.bottom-n.top+8,p=String(t.getAttributes("link").href||""),m=this._getLinkLabelFromRange(r);this._linkEditor={x:u,y:g,visible:!0,url:p,label:m},this.updateComplete.then(()=>{const f=this.shadowRoot?.querySelector('.link-editor__input[data-field="url"]');f?.focus(),f?.select()})}_closeLinkEditor(){this._linkEditor={...this._linkEditor,visible:!1}}_handleLinkEditorInput(e){const t=e.target,i=t.dataset.field==="label"?"label":"url";this._linkEditor={...this._linkEditor,[i]:t.value}}_applyLink(){const e=this._editor,t=this._normalizeLinkUrl(this._linkEditor.url),i=this._linkEditor.label.trim()||t;if(!e||!t)return;this._clearSlashCommandText();const o=this._linkSelection??this._getLinkTargetRange()??e.state.selection,r=o.from+i.length;e.chain().focus().insertContentAt({from:o.from,to:o.to},{type:"text",text:i,marks:[{type:"link",attrs:{href:t}}]}).setTextSelection({from:r,to:r}).run(),this._closeLinkEditor()}_removeLink(){const e=this._editor;if(!e)return;const t=this._linkSelection??e.state.selection;let i=e.chain().focus();t.from!==t.to&&(i=i.setTextSelection(t)),i.extendMarkRange("link").unsetLink().run(),this._closeLinkEditor()}_handleLinkEditorKeydown(e){if(e.key==="Enter"){e.preventDefault(),this._applyLink();return}e.key==="Escape"&&(e.preventDefault(),this._closeLinkEditor())}_insertTable(e,t){this._editor?.chain().focus().insertTable({rows:e??this._tableRows,cols:t??this._tableCols,withHeaderRow:!0}).run()}async _handleImageUpload(e){const t=e.target,i=Array.from(t.files??[]);if(!i.length){t.value="";return}this._clearSlashCommandText();let o=this._pendingImageInsertPos!==null?{from:this._pendingImageInsertPos,to:this._pendingImageInsertPos}:this._editor?{from:this._editor.state.selection.from,to:this._editor.state.selection.to}:null;this._pendingImageInsertPos=null;for(const r of i)try{const n=await this._getImageNaturalWidth(r),s=await this["upload-image"](r),c=n?Math.min(n,this._getImageMaxWidth()):this._getImageMaxWidth();if(!o&&this._editor&&(o={from:this._editor.state.selection.from,to:this._editor.state.selection.to}),!o)continue;const u=this._insertImageAt(o,{src:s,width:c,align:"left"});o={from:u,to:u}}catch(n){const s=n instanceof Error?n:new Error("图片上传失败");this.dispatchEvent(new CustomEvent("image-upload-error",{detail:{file:r,error:s},bubbles:!0,composed:!0}))}t.value=""}_triggerImageUpload(){this._clearSlashCommandText();const e=this.shadowRoot?.querySelector(".image-input");if(!e)return;e.value="";const t=e;if(typeof t.showPicker=="function")try{t.showPicker();return}catch{}e.click()}_insertTableByClick(e,t){this._clearSlashCommandText(),this._tableRows=e,this._tableCols=t,this._insertTable(e,t)}_showTableCellToolbar(){if(!this._editor?.isActive("table"))return;const{state:e}=this._editor,{selection:t}=e,i=this._editor.view.coordsAtPos(t.from),o=this.shadowRoot?.querySelector(".editor-wrapper");if(!o)return;const r=o.getBoundingClientRect(),n=this._getTableCellRow(),s=this._getTableCellCol();!(n===0)&&!(s===0)||requestAnimationFrame(()=>{this._tableCellToolbar={x:i.left-r.left,y:i.bottom-r.top+8,visible:!0,cellRow:n,cellCol:s}})}_getTableCellRow(){if(!this._editor)return 0;const{selection:e}=this._editor.state,t=this._editor.state.doc.resolve(e.from);for(let i=t.depth;i>0;i--)if(t.node(i).type.name==="tableCell")return t.index(i-1);return 0}_getTableCellCol(){if(!this._editor)return 0;const{selection:e}=this._editor.state,t=this._editor.state.doc.resolve(e.from);for(let i=t.depth;i>0;i--)if(t.node(i).type.name==="tableCell")return t.index(i);return 0}_hideTableCellToolbar(){requestAnimationFrame(()=>{this._tableCellToolbar={...this._tableCellToolbar,visible:!1}})}_addTableRowAbove(){this._editor?.chain().focus().addRowBefore().run(),this._hideTableCellToolbar()}_addTableRowBelow(){this._editor?.chain().focus().addRowAfter().run(),this._hideTableCellToolbar()}_addTableColumnLeft(){this._editor?.chain().focus().addColumnBefore().run(),this._hideTableCellToolbar()}_addTableColumnRight(){this._editor?.chain().focus().addColumnAfter().run(),this._hideTableCellToolbar()}_deleteTableRow(){this._editor?.chain().focus().deleteRow().run(),this._hideTableCellToolbar()}_deleteTableColumn(){this._editor?.chain().focus().deleteColumn().run(),this._hideTableCellToolbar()}_deleteTable(){this._editor?.chain().focus().deleteTable().run(),this._hideTableCellToolbar()}_showImageToolbar(e){requestAnimationFrame(()=>{this._imageToolbar={x:e.x,y:e.y,visible:!0}})}_hideImageToolbar(){requestAnimationFrame(()=>{this._imageToolbar={...this._imageToolbar,visible:!1}})}_deleteImage(){const e=this._getSelectedImageNode();if(!e)return;const{editor:t,pos:i,node:o}=e;t.view.dispatch(t.state.tr.delete(i,i+o.nodeSize)),this._selectedImage=null,this._pendingImageInsertPos=null,this._hideImageToolbar()}_insertImageAfter(){const e=this._getSelectedImageNode();if(!e){this._triggerImageUpload();return}this._pendingImageInsertPos=e.pos+e.node.nodeSize,this._triggerImageUpload()}_getSelectedImageNode(){const e=this._editor,t=this._selectedImage?.pos;if(!e||t===void 0)return null;const i=e.state.doc.nodeAt(t);return!i||i.type.name!=="image"?null:{editor:e,pos:t,node:i}}_insertImageAt(e,t){const i=this._editor;if(!i)return 0;const o=typeof e=="number"?{from:Math.max(0,Math.min(e,i.state.doc.content.size)),to:Math.max(0,Math.min(e,i.state.doc.content.size))}:{from:Math.max(0,Math.min(e.from,i.state.doc.content.size)),to:Math.max(0,Math.min(e.to,i.state.doc.content.size))},r=o.from,n=i.chain().focus();if(typeof n.insertContentAt=="function"){let s=n.insertContentAt(o,{type:"image",attrs:t});typeof s?.setNodeSelection=="function"&&(s=s.setNodeSelection(r)),s.run();const c=i.state.doc.nodeAt(r)?.nodeSize??1;return r+c}return typeof n.setImage=="function"?(n.setImage(t).run(),r+1):r}_updateSelectedImageAttributes(e){const t=this._getSelectedImageNode();if(!t)return;const{editor:i,pos:o,node:r}=t;i.view.dispatch(i.state.tr.setNodeMarkup(o,void 0,{...r.attrs,...e}))}_setImageWidth(e){const t=Math.max(v,Math.min(this._getImageMaxWidth(),Math.round(e)));this._updateSelectedImageAttributes({width:t})}_handleImageWidthInput(e){const t=e.target.value.trim();if(!t)return;const i=Number(t);Number.isFinite(i)&&this._setImageWidth(i)}_setImageAlignLeft(){this._updateSelectedImageAttributes({align:"left"})}_setImageAlignCenter(){this._updateSelectedImageAttributes({align:"center"})}_setImageAlignRight(){this._updateSelectedImageAttributes({align:"right"})}_getTextLabel(){const e=this._editor;return e?e.isActive("heading",{level:1})?"标题 1":e.isActive("heading",{level:2})?"标题 2":e.isActive("heading",{level:3})?"标题 3":"正文":"正文"}_getAlignLabel(){const e=this._editor;return e?e.isActive({textAlign:"center"})?"居中":e.isActive({textAlign:"right"})?"右对齐":"左对齐":"对齐"}_renderImageControls(){const e=this._selectedImage;return e?l`
7
9
  <button class="bubble-btn danger" title="删除图片" @click=${this._deleteImage}>
8
10
  <svg viewBox="0 0 24 24"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg>
9
11
  </button>
@@ -12,13 +14,13 @@ import{Node as e,mergeAttributes as t,Editor as i}from"@tiptap/core";import o fr
12
14
  </button>
13
15
  <div class="bubble-divider"></div>
14
16
  <span class="image-control-label">对齐</span>
15
- <button class="bubble-btn ${"left"===e.align?"is-active":""}" title="左对齐" @click=${this._setImageAlignLeft}>
17
+ <button class="bubble-btn ${e.align==="left"?"is-active":""}" title="左对齐" @click=${this._setImageAlignLeft}>
16
18
  <svg viewBox="0 0 24 24"><line x1="3" y1="6" x2="21" y2="6"/><line x1="3" y1="12" x2="15" y2="12"/><line x1="3" y1="18" x2="18" y2="18"/></svg>
17
19
  </button>
18
- <button class="bubble-btn ${"center"===e.align?"is-active":""}" title="居中" @click=${this._setImageAlignCenter}>
20
+ <button class="bubble-btn ${e.align==="center"?"is-active":""}" title="居中" @click=${this._setImageAlignCenter}>
19
21
  <svg viewBox="0 0 24 24"><line x1="3" y1="6" x2="21" y2="6"/><line x1="6" y1="12" x2="18" y2="12"/><line x1="4" y1="18" x2="20" y2="18"/></svg>
20
22
  </button>
21
- <button class="bubble-btn ${"right"===e.align?"is-active":""}" title="右对齐" @click=${this._setImageAlignRight}>
23
+ <button class="bubble-btn ${e.align==="right"?"is-active":""}" title="右对齐" @click=${this._setImageAlignRight}>
22
24
  <svg viewBox="0 0 24 24"><line x1="3" y1="6" x2="21" y2="6"/><line x1="9" y1="12" x2="21" y2="12"/><line x1="6" y1="18" x2="21" y2="18"/></svg>
23
25
  </button>
24
26
  <div class="image-size-control">
@@ -26,18 +28,18 @@ import{Node as e,mergeAttributes as t,Editor as i}from"@tiptap/core";import o fr
26
28
  <input
27
29
  class="image-size-range"
28
30
  type="number"
29
- min="${24}"
31
+ min="${v}"
30
32
  max="${this._getImageMaxWidth()}"
31
33
  .value=${String(e.width)}
32
34
  @input=${this._handleImageWidthInput}
33
35
  />
34
36
  </div>
35
- `:""}_joinToolbarGroups(e){return e.flatMap((e,t)=>0===t?[e]:[S`<div class="bubble-divider"></div>`,e])}_renderFormatToolbarGroup(e){return S`
36
- ${this._renderToolbarButton("bold",{title:"加粗",active:e?.isActive("bold"),onClick:this._toggleBold,icon:S`<svg viewBox="0 0 24 24"><path d="M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"/><path d="M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"/></svg>`})}
37
- ${this._renderToolbarButton("italic",{title:"斜体",active:e?.isActive("italic"),onClick:this._toggleItalic,icon:S`<svg viewBox="0 0 24 24"><line x1="19" y1="4" x2="10" y2="4"/><line x1="14" y1="20" x2="5" y2="20"/><line x1="15" y1="4" x2="9" y2="20"/></svg>`})}
38
- ${this._renderToolbarButton("underline",{title:"下划线",active:e?.isActive("underline"),onClick:this._toggleUnderline,icon:S`<svg viewBox="0 0 24 24"><path d="M6 3v7a6 6 0 0 0 6 6 6 6 0 0 0 6-6V3"/><line x1="4" y1="21" x2="20" y2="21"/></svg>`})}
39
- ${this._renderToolbarButton("strike",{title:"删除线",active:e?.isActive("strike"),onClick:this._toggleStrike,icon:S`<svg viewBox="0 0 24 24"><path d="M17.3 4.9c-2.3-.6-4.4-1-6.2-.9-2.7 0-5.3.7-5.3 3.6 0 1.5 1.8 3.3 5.3 3.9h.2m8.2 3.2c.3.4.4.8.4 1.3 0 2.9-2.7 3.6-6.2 3.6-2.3 0-4.4-.3-6.2-.9M4 12h16"/></svg>`})}
40
- `}_renderHeadingToolbarGroup(e){return S`
37
+ `:""}_joinToolbarGroups(e){return e.flatMap((t,i)=>i===0?[t]:[l`<div class="bubble-divider"></div>`,t])}_renderFormatToolbarGroup(e){return l`
38
+ ${this._renderToolbarButton("bold",{title:"加粗",active:e?.isActive("bold"),onClick:this._toggleBold,icon:l`<svg viewBox="0 0 24 24"><path d="M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"/><path d="M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z"/></svg>`})}
39
+ ${this._renderToolbarButton("italic",{title:"斜体",active:e?.isActive("italic"),onClick:this._toggleItalic,icon:l`<svg viewBox="0 0 24 24"><line x1="19" y1="4" x2="10" y2="4"/><line x1="14" y1="20" x2="5" y2="20"/><line x1="15" y1="4" x2="9" y2="20"/></svg>`})}
40
+ ${this._renderToolbarButton("underline",{title:"下划线",active:e?.isActive("underline"),onClick:this._toggleUnderline,icon:l`<svg viewBox="0 0 24 24"><path d="M6 3v7a6 6 0 0 0 6 6 6 6 0 0 0 6-6V3"/><line x1="4" y1="21" x2="20" y2="21"/></svg>`})}
41
+ ${this._renderToolbarButton("strike",{title:"删除线",active:e?.isActive("strike"),onClick:this._toggleStrike,icon:l`<svg viewBox="0 0 24 24"><path d="M17.3 4.9c-2.3-.6-4.4-1-6.2-.9-2.7 0-5.3.7-5.3 3.6 0 1.5 1.8 3.3 5.3 3.9h.2m8.2 3.2c.3.4.4.8.4 1.3 0 2.9-2.7 3.6-6.2 3.6-2.3 0-4.4-.3-6.2-.9M4 12h16"/></svg>`})}
42
+ `}_renderHeadingToolbarGroup(e){return l`
41
43
  <div class="bubble-dropdown">
42
44
  <button class="bubble-dropdown-btn">
43
45
  ${this._getTextLabel()}
@@ -50,7 +52,7 @@ import{Node as e,mergeAttributes as t,Editor as i}from"@tiptap/core";import o fr
50
52
  <button class="bubble-dropdown-item ${e?.isActive("heading",{level:3})?"is-active":""}" @click=${()=>this._setHeading(3)}>标题 3</button>
51
53
  </div>
52
54
  </div>
53
- `}_renderAlignToolbarGroup(e){return S`
55
+ `}_renderAlignToolbarGroup(e){return l`
54
56
  <div class="bubble-dropdown">
55
57
  <button class="bubble-dropdown-btn">
56
58
  ${this._getAlignLabel()}
@@ -71,12 +73,12 @@ import{Node as e,mergeAttributes as t,Editor as i}from"@tiptap/core";import o fr
71
73
  </button>
72
74
  </div>
73
75
  </div>
74
- `}_renderCodeLinkImageToolbarGroup(e){return S`
75
- ${this._hasToolbarItem("code")?this._renderToolbarButton("code",{title:"行内代码",active:e?.isActive("code"),onClick:this._toggleCode,icon:S`<svg viewBox="0 0 24 24"><polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/></svg>`}):""}
76
- ${this._hasToolbarItem("link")?this._renderToolbarButton("link",{title:"链接",active:e?.isActive("link"),onClick:this._setLink,icon:S`<svg viewBox="0 0 24 24"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>`}):""}
77
- ${this._hasToolbarItem("image")?this._renderToolbarButton("image",{title:"图片",onClick:this._triggerImageUpload,icon:S`<svg viewBox="0 0 24 24"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>`}):""}
78
- `}_renderCodeToolbarButton(e){return this._renderToolbarButton("code",{title:"行内代码",active:e?.isActive("code"),onClick:this._toggleCode,icon:S`<svg viewBox="0 0 24 24"><polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/></svg>`})}_renderLinkToolbarButton(e){return this._renderToolbarButton("link",{title:"链接",active:e?.isActive("link"),onClick:this._setLink,icon:S`<svg viewBox="0 0 24 24"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>`})}_renderImageToolbarButton(){return this._renderToolbarButton("image",{title:"图片",onClick:this._triggerImageUpload,icon:S`<svg viewBox="0 0 24 24"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>`})}_renderListToolbarGroup(e){return S`
79
- ${this._renderToolbarButton("bulletList",{title:"无序列表",active:e?.isActive("bulletList"),onClick:this._toggleBulletList,icon:S`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
76
+ `}_renderCodeLinkImageToolbarGroup(e){return l`
77
+ ${this._hasToolbarItem("code")?this._renderToolbarButton("code",{title:"行内代码",active:e?.isActive("code"),onClick:this._toggleCode,icon:l`<svg viewBox="0 0 24 24"><polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/></svg>`}):""}
78
+ ${this._hasToolbarItem("link")?this._renderToolbarButton("link",{title:"链接",active:e?.isActive("link"),onClick:this._setLink,icon:l`<svg viewBox="0 0 24 24"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>`}):""}
79
+ ${this._hasToolbarItem("image")?this._renderToolbarButton("image",{title:"图片",onClick:this._triggerImageUpload,icon:l`<svg viewBox="0 0 24 24"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>`}):""}
80
+ `}_renderCodeToolbarButton(e){return this._renderToolbarButton("code",{title:"行内代码",active:e?.isActive("code"),onClick:this._toggleCode,icon:l`<svg viewBox="0 0 24 24"><polyline points="16 18 22 12 16 6"/><polyline points="8 6 2 12 8 18"/></svg>`})}_renderLinkToolbarButton(e){return this._renderToolbarButton("link",{title:"链接",active:e?.isActive("link"),onClick:this._setLink,icon:l`<svg viewBox="0 0 24 24"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/></svg>`})}_renderImageToolbarButton(){return this._renderToolbarButton("image",{title:"图片",onClick:this._triggerImageUpload,icon:l`<svg viewBox="0 0 24 24"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><circle cx="8.5" cy="8.5" r="1.5"/><polyline points="21 15 16 10 5 21"/></svg>`})}_renderListToolbarGroup(e){return l`
81
+ ${this._renderToolbarButton("bulletList",{title:"无序列表",active:e?.isActive("bulletList"),onClick:this._toggleBulletList,icon:l`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
80
82
  <line x1="9" y1="6" x2="20" y2="6"/>
81
83
  <line x1="9" y1="12" x2="20" y2="12"/>
82
84
  <line x1="9" y1="18" x2="20" y2="18"/>
@@ -84,7 +86,7 @@ import{Node as e,mergeAttributes as t,Editor as i}from"@tiptap/core";import o fr
84
86
  <circle cx="4" cy="12" r="0.5" fill="currentColor" stroke="none"/>
85
87
  <circle cx="4" cy="18" r="0.5" fill="currentColor" stroke="none"/>
86
88
  </svg>`})}
87
- ${this._renderToolbarButton("orderedList",{title:"有序列表",active:e?.isActive("orderedList"),onClick:this._toggleOrderedList,icon:S`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
89
+ ${this._renderToolbarButton("orderedList",{title:"有序列表",active:e?.isActive("orderedList"),onClick:this._toggleOrderedList,icon:l`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
88
90
  <line x1="10" y1="6" x2="21" y2="6"/>
89
91
  <line x1="10" y1="12" x2="21" y2="12"/>
90
92
  <line x1="10" y1="18" x2="21" y2="18"/>
@@ -92,16 +94,16 @@ import{Node as e,mergeAttributes as t,Editor as i}from"@tiptap/core";import o fr
92
94
  <path d="M4 10h2"/>
93
95
  <path d="M6 18H4c0-1 2-2 2-3s-1-1.5-2-1.5"/>
94
96
  </svg>`})}
95
- ${this._renderToolbarButton("taskList",{title:"待办列表",active:e?.isActive("taskList"),onClick:this._toggleTaskList,icon:S`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
97
+ ${this._renderToolbarButton("taskList",{title:"待办列表",active:e?.isActive("taskList"),onClick:this._toggleTaskList,icon:l`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
96
98
  <rect x="3" y="5" width="4" height="4" rx="1"/>
97
99
  <polyline points="4 7 5 8 6.5 6.5"/>
98
100
  <line x1="10" y1="7" x2="21" y2="7"/>
99
101
  <rect x="3" y="15" width="4" height="4" rx="1"/>
100
102
  <line x1="10" y1="17" x2="21" y2="17"/>
101
103
  </svg>`})}
102
- `}_renderBlockquoteToolbarGroup(e){return S`
103
- ${this._renderToolbarButton("blockquote",{title:"引用",active:e?.isActive("blockquote"),onClick:this._toggleBlockquote,icon:S`<svg viewBox="0 0 24 24"><path d="M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V21z"/><path d="M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z"/></svg>`})}
104
- `}_renderTableToolbarGroup(){const e=this._getHeaderToolbarLabel("table");return S`
104
+ `}_renderBlockquoteToolbarGroup(e){return l`
105
+ ${this._renderToolbarButton("blockquote",{title:"引用",active:e?.isActive("blockquote"),onClick:this._toggleBlockquote,icon:l`<svg viewBox="0 0 24 24"><path d="M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V21z"/><path d="M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z"/></svg>`})}
106
+ `}_renderTableToolbarGroup(){const e=this._getHeaderToolbarLabel("table");return l`
105
107
  <div
106
108
  class="bubble-dropdown ${this._tableDropdownOpen?"is-open":""}"
107
109
  @mouseenter=${()=>{this._tableDropdownOpen=!0,this._hoverRow=0,this._hoverCol=0}}
@@ -109,7 +111,7 @@ import{Node as e,mergeAttributes as t,Editor as i}from"@tiptap/core";import o fr
109
111
  >
110
112
  <button class="bubble-dropdown-btn ${e?"has-label":""}" title="表格">
111
113
  <svg viewBox="0 0 24 24" style="width:18px;height:18px;stroke:currentColor;stroke-width:2;fill:none;"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"/><line x1="3" y1="9" x2="21" y2="9"/><line x1="3" y1="15" x2="21" y2="15"/><line x1="9" y1="3" x2="9" y2="21"/><line x1="15" y1="3" x2="15" y2="21"/></svg>
112
- ${e?S`<span class="bubble-dropdown-btn__label">${e}</span>`:null}
114
+ ${e?l`<span class="bubble-dropdown-btn__label">${e}</span>`:null}
113
115
  </button>
114
116
  <div class="bubble-dropdown-menu">
115
117
  <div class="table-grid-preview">
@@ -120,21 +122,21 @@ import{Node as e,mergeAttributes as t,Editor as i}from"@tiptap/core";import o fr
120
122
  </div>
121
123
  </div>
122
124
  </div>
123
- `}_getToolbarMergeKey(e){return"code"===e||"link"===e||"image"===e?"code-link-image":e}_renderToolbarItemByKey(e,t){switch(t){case"format":return this._renderFormatToolbarGroup(e);case"heading":return this._renderHeadingToolbarGroup(e);case"align":return this._renderAlignToolbarGroup(e);case"code":return this._renderCodeToolbarButton(e);case"link":return this._renderLinkToolbarButton(e);case"image":return this._renderImageToolbarButton();case"list":return this._renderListToolbarGroup(e);case"blockquote":return this._renderBlockquoteToolbarGroup(e);case"table":return this._renderTableToolbarGroup();default:return null}}_renderTextToolbar(e){const t=[];let i="",o=[];const r=()=>{o.length&&(t.push([...o]),o=[])};for(const t of this._toolbarItemsValue){const n=this._renderToolbarItemByKey(e,t);if(!n)continue;const s=this._getToolbarMergeKey(t);o.length&&s!==i&&r(),i=s,o.push(n)}return r(),this._joinToolbarGroups(t)}_updateBubbleMenuPosition(){"slash"===this._toolbarModeValue&&requestAnimationFrame(()=>{const e=this.shadowRoot?.querySelector(".bubble-menu"),t=this.shadowRoot?.querySelector(".ProseMirror"),i=this.shadowRoot?.querySelector(".editor-wrapper");if(!e||!t||!i)return;const o=this._editor,r=o?.isActive("table")??!1,{selection:n}=o?.state??{selection:null};if(r&&n&&!n.empty&&o){const{from:t,to:i}=n,r=o.state.doc.resolve(t),s=o.state.doc.resolve(i);let l=!1;for(let e=r.depth;e>=0;e--)if("table"===r.node(e).type.name){l=!0;break}const a=r.node(r.depth),d=s.node(s.depth);if("table"!==a.type.name&&"table"!==d.type.name||(l=!0),l)return e.style.opacity="0",void(e.style.visibility="hidden")}if(n&&!n.empty);else if(!n||n.empty&&!this._hasSlashCommand)return e.style.opacity="0",void(e.style.visibility="hidden");const s=i.getBoundingClientRect(),l=e.getBoundingClientRect(),{from:a}=n,d=this._editor?.view.coordsAtPos(a);if(!d)return;let h=d.left-s.left,c=d.top-s.top-40;h+l.width>s.width&&(h=s.width-l.width-8),h<0&&(h=8),c<0&&(c=d.bottom-s.top+8),e.style.left=`${h}px`,e.style.top=`${c}px`,e.style.opacity="1",e.style.visibility="visible"})}render(){const e=this._editor,t=this._previewValue||"header"!==this._toolbarModeValue?null:S`
125
+ `}_getToolbarMergeKey(e){return e==="code"||e==="link"||e==="image"?"code-link-image":e}_renderToolbarItemByKey(e,t){switch(t){case"format":return this._renderFormatToolbarGroup(e);case"heading":return this._renderHeadingToolbarGroup(e);case"align":return this._renderAlignToolbarGroup(e);case"code":return this._renderCodeToolbarButton(e);case"link":return this._renderLinkToolbarButton(e);case"image":return this._renderImageToolbarButton();case"list":return this._renderListToolbarGroup(e);case"blockquote":return this._renderBlockquoteToolbarGroup(e);case"table":return this._renderTableToolbarGroup();default:return null}}_renderTextToolbar(e){const t=[];let i="",o=[];const r=()=>{o.length&&(t.push([...o]),o=[])};for(const n of this._toolbarItemsValue){const s=this._renderToolbarItemByKey(e,n);if(!s)continue;const c=this._getToolbarMergeKey(n);o.length&&c!==i&&r(),i=c,o.push(s)}return r(),this._joinToolbarGroups(t)}_updateBubbleMenuPosition(){this._toolbarModeValue==="slash"&&requestAnimationFrame(()=>{const e=this.shadowRoot?.querySelector(".bubble-menu"),t=this.shadowRoot?.querySelector(".ProseMirror"),i=this.shadowRoot?.querySelector(".editor-wrapper");if(!e||!t||!i)return;const o=this._editor,r=o?.isActive("table")??!1,{selection:n}=o?.state??{selection:null};if(r&&n&&!n.empty&&o){const{from:f,to:$}=n,_=o.state.doc.resolve(f),T=o.state.doc.resolve($);let x=!1;for(let y=_.depth;y>=0;y--)if(_.node(y).type.name==="table"){x=!0;break}const B=_.node(_.depth),R=T.node(T.depth);if((B.type.name==="table"||R.type.name==="table")&&(x=!0),x){e.style.opacity="0",e.style.visibility="hidden";return}}if(!(n&&!n.empty)){if(!n||n.empty&&!this._hasSlashCommand){e.style.opacity="0",e.style.visibility="hidden";return}}const s=i.getBoundingClientRect(),c=e.getBoundingClientRect(),{from:u}=n,g=this._editor?.view.coordsAtPos(u);if(!g)return;let p=g.left-s.left,m=g.top-s.top-40;p+c.width>s.width&&(p=s.width-c.width-8),p<0&&(p=8),m<0&&(m=g.bottom-s.top+8),e.style.left=`${p}px`,e.style.top=`${m}px`,e.style.opacity="1",e.style.visibility="visible"})}render(){const e=this._editor,t=!this._previewValue&&this._toolbarModeValue==="header"?l`
124
126
  <div class="editor-header ${this._isHeaderVisible()?"is-visible":""}">
125
127
  <div class="editor-header__inner" @mousedown=${this._handleHeaderToolbarMouseDown}>
126
128
  ${this._selectedImage?this._renderImageControls():this._renderTextToolbar(e)}
127
129
  </div>
128
130
  </div>
129
- `,i=this._showCharacterCountValue&&!this._previewValue;return S`
131
+ `:null,i=this._showCharacterCountValue&&!this._previewValue;return l`
130
132
  <div
131
- class="editor-wrapper ${e?"":"loading"} ${this._previewValue?"preview":""} ${"bottom"===this._toolbarPositionValue?"toolbar-bottom":""}"
133
+ class="editor-wrapper ${e?"":"loading"} ${this._previewValue?"preview":""} ${this._toolbarPositionValue==="bottom"?"toolbar-bottom":""}"
132
134
  style=${this._wrapperStyleValue}
133
135
  @mousedown=${this._handleWrapperMouseDown}
134
136
  @focusin=${this._handleWrapperFocusIn}
135
137
  @focusout=${this._handleWrapperFocusOut}
136
138
  >
137
- ${e?"":S`
139
+ ${e?"":l`
138
140
  <div class="loading-placeholder">
139
141
  <div class="loading-spinner"></div>
140
142
  <span>编辑器加载中...</span>
@@ -143,31 +145,32 @@ import{Node as e,mergeAttributes as t,Editor as i}from"@tiptap/core";import o fr
143
145
  <input
144
146
  type="file"
145
147
  accept="image/*"
148
+ multiple
146
149
  class="image-input"
147
150
  @change=${this._handleImageUpload}
148
151
  />
149
152
 
150
- ${"top"===this._toolbarPositionValue?t:null}
153
+ ${this._toolbarPositionValue==="top"?t:null}
151
154
 
152
155
  <!-- Bubble Menu (悬浮操作栏) -->
153
- ${this._previewValue||"slash"!==this._toolbarModeValue?"":S`
156
+ ${!this._previewValue&&this._toolbarModeValue==="slash"?l`
154
157
  <div class="bubble-menu">
155
158
  ${this._renderTextToolbar(e)}
156
159
  </div>
157
- `}
160
+ `:""}
158
161
 
159
162
  <div class="editor-content" data-empty-hint=${this._resolvedPlaceholder}></div>
160
163
 
161
- ${"bottom"===this._toolbarPositionValue?t:null}
164
+ ${this._toolbarPositionValue==="bottom"?t:null}
162
165
 
163
- ${i?S`<div class="editor-footer">${this._getEditorCharacterCount()} 字符</div>`:null}
166
+ ${i?l`<div class="editor-footer">${this._getEditorCharacterCount()} 字符</div>`:null}
164
167
 
165
- ${this._linkEditor.visible?S`
168
+ ${this._linkEditor.visible?l`
166
169
  <div
167
170
  class="link-editor"
168
171
  style="left: ${this._linkEditor.x}px; top: ${this._linkEditor.y}px;"
169
- @mousedown=${e=>e.stopPropagation()}
170
- @click=${e=>e.stopPropagation()}
172
+ @mousedown=${o=>o.stopPropagation()}
173
+ @click=${o=>o.stopPropagation()}
171
174
  >
172
175
  <div class="link-editor__field">
173
176
  <span class="link-editor__label">链接地址</span>
@@ -196,19 +199,19 @@ import{Node as e,mergeAttributes as t,Editor as i}from"@tiptap/core";import o fr
196
199
  <div class="link-editor__actions">
197
200
  <button class="link-editor__action primary" title="应用链接" @click=${this._applyLink}>应用</button>
198
201
  <button class="link-editor__action" title="取消链接编辑" @click=${this._closeLinkEditor}>取消</button>
199
- ${e?.isActive("link")||this._linkEditor.url?S`<button class="link-editor__action danger" title="移除链接" @click=${this._removeLink}>移除</button>`:""}
202
+ ${e?.isActive("link")||this._linkEditor.url?l`<button class="link-editor__action danger" title="移除链接" @click=${this._removeLink}>移除</button>`:""}
200
203
  </div>
201
204
  </div>
202
205
  `:""}
203
206
 
204
207
  <!-- Table Cell Toolbar -->
205
- ${this._tableCellToolbar.visible&&e?.isActive("table")?S`
208
+ ${this._tableCellToolbar.visible&&e?.isActive("table")?l`
206
209
  <div
207
210
  class="table-cell-toolbar"
208
211
  style="left: ${this._tableCellToolbar.x}px; top: ${this._tableCellToolbar.y}px;"
209
- @mousedown=${e=>e.preventDefault()}
212
+ @mousedown=${o=>o.preventDefault()}
210
213
  >
211
- ${0===this._tableCellToolbar.cellRow?S`
214
+ ${this._tableCellToolbar.cellRow===0?l`
212
215
  <button class="table-cell-toolbar-btn" title="上方添加行" @click=${this._addTableRowAbove}>
213
216
  <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" stroke-width="2" fill="none"><rect x="4" y="8" width="16" height="8" rx="1"/><line x1="12" y1="3" x2="12" y2="7"/><line x1="10" y1="5" x2="14" y2="5"/></svg>
214
217
  </button>
@@ -219,8 +222,8 @@ import{Node as e,mergeAttributes as t,Editor as i}from"@tiptap/core";import o fr
219
222
  <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" stroke-width="2" fill="none"><rect x="4" y="8" width="16" height="8" rx="1"/><line x1="9" y1="10" x2="9" y2="14"/><line x1="15" y1="10" x2="15" y2="14"/></svg>
220
223
  </button>
221
224
  `:""}
222
- ${0===this._tableCellToolbar.cellCol?S`
223
- ${0!==this._tableCellToolbar.cellRow?S`<div style="width:1px;height:20px;background:#e3e3e3;margin:0 4px;"></div>`:""}
225
+ ${this._tableCellToolbar.cellCol===0?l`
226
+ ${this._tableCellToolbar.cellRow!==0?l`<div style="width:1px;height:20px;background:#e3e3e3;margin:0 4px;"></div>`:""}
224
227
  <button class="table-cell-toolbar-btn" title="左侧添加列" @click=${this._addTableColumnLeft}>
225
228
  <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" stroke-width="2" fill="none"><rect x="8" y="4" width="8" height="16" rx="1"/><line x1="3" y1="12" x2="7" y2="12"/><line x1="5" y1="10" x2="5" y2="14"/></svg>
226
229
  </button>
@@ -231,7 +234,7 @@ import{Node as e,mergeAttributes as t,Editor as i}from"@tiptap/core";import o fr
231
234
  <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" stroke-width="2" fill="none"><rect x="8" y="4" width="8" height="16" rx="1"/><line x1="10" y1="9" x2="14" y2="9"/><line x1="10" y1="15" x2="14" y2="15"/></svg>
232
235
  </button>
233
236
  `:""}
234
- ${0===this._tableCellToolbar.cellRow&&0===this._tableCellToolbar.cellCol?S`
237
+ ${this._tableCellToolbar.cellRow===0&&this._tableCellToolbar.cellCol===0?l`
235
238
  <div style="width:1px;height:20px;background:#e3e3e3;margin:0 4px;"></div>
236
239
  <button class="table-cell-toolbar-btn danger" title="删除表格" @click=${this._deleteTable}>
237
240
  <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" stroke-width="2" fill="none"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg>
@@ -241,24 +244,24 @@ import{Node as e,mergeAttributes as t,Editor as i}from"@tiptap/core";import o fr
241
244
  `:""}
242
245
 
243
246
  <!-- Image Toolbar -->
244
- ${"slash"===this._toolbarModeValue&&this._imageToolbar.visible?S`
247
+ ${this._toolbarModeValue==="slash"&&this._imageToolbar.visible?l`
245
248
  <div
246
249
  class="image-toolbar"
247
250
  style="left: ${this._imageToolbar.x}px; top: ${this._imageToolbar.y}px;"
248
- @mousedown=${e=>e.preventDefault()}
251
+ @mousedown=${o=>o.preventDefault()}
249
252
  >
250
253
  ${this._renderImageControls()}
251
254
  </div>
252
255
  `:""}
253
256
  </div>
254
- `}_renderTableGrid(){const e=[];for(let t=0;t<100;t++){const i=Math.floor(t/10)+1,o=t%10+1,r=this._hoverRow>0&&i<=this._hoverRow&&o<=this._hoverCol;e.push(S`
257
+ `}_renderTableGrid(){const e=[];for(let t=0;t<100;t++){const i=Math.floor(t/10)+1,o=t%10+1,r=this._hoverRow>0&&i<=this._hoverRow&&o<=this._hoverCol;e.push(l`
255
258
  <div
256
259
  class="table-cell ${r?"selected":""}"
257
260
  @click=${()=>{this._insertTableByClick(i,o),this._tableDropdownOpen=!1}}
258
261
  @mouseenter=${()=>{this._hoverRow=i,this._hoverCol=o}}
259
262
  @mouseleave=${()=>{this._hoverRow=0,this._hoverCol=0}}
260
263
  ></div>
261
- `)}return e}};K.styles=M`
264
+ `)}return e}};a.styles=ne`
262
265
  :host {
263
266
  display: block;
264
267
  font-family: inherit;
@@ -854,8 +857,16 @@ import{Node as e,mergeAttributes as t,Editor as i}from"@tiptap/core";import o fr
854
857
  fill: none;
855
858
  }
856
859
 
860
+ /* Keep the file input programmatically clickable inside shadow hosts. */
857
861
  .image-input {
858
- display: none;
862
+ position: absolute;
863
+ inset: 0 auto auto 0;
864
+ width: 1px;
865
+ height: 1px;
866
+ padding: 0;
867
+ margin: 0;
868
+ opacity: 0;
869
+ pointer-events: none;
859
870
  }
860
871
 
861
872
  .table-grid-preview {
@@ -1111,5 +1122,5 @@ import{Node as e,mergeAttributes as t,Editor as i}from"@tiptap/core";import o fr
1111
1122
  outline: 2px solid var(--qxs-color-primary, #3D61E3);
1112
1123
  outline-offset: 2px;
1113
1124
  }
1114
- `,H([L({type:String,attribute:"content"})],K.prototype,"content",2),H([L({type:String,attribute:"model-value"})],K.prototype,"model-value",2),H([L({type:String,attribute:"placeholder"})],K.prototype,"placeholder",2),H([L({type:String,attribute:"toolbar-mode"})],K.prototype,"toolbar-mode",2),H([L({attribute:"toolbar"})],K.prototype,"toolbar",2),H([L({type:String,attribute:"toolbar-preset"})],K.prototype,"toolbar-preset",2),H([L({attribute:"header-toolbar-labels"})],K.prototype,"header-toolbar-labels",2),H([L({type:String,attribute:"header-always-visible"})],K.prototype,"header-always-visible",2),H([L({type:String,attribute:"use-model"})],K.prototype,"use-model",2),H([L({type:String,attribute:"readonly"})],K.prototype,"readonly",2),H([L({type:String,attribute:"preview"})],K.prototype,"preview",2),H([L({attribute:"editable"})],K.prototype,"editable",2),H([L({type:String,attribute:"min-height"})],K.prototype,"min-height",2),H([L({type:String,attribute:"max-height"})],K.prototype,"max-height",2),H([L({type:String,attribute:"show-character-count"})],K.prototype,"show-character-count",2),H([L({type:String,attribute:"toolbar-position"})],K.prototype,"toolbar-position",2),H([L({type:String,attribute:"custom-styles"})],K.prototype,"custom-styles",2),H([L({type:String,attribute:"content-format"})],K.prototype,"content-format",2),H([L({type:Object,attribute:"deserialize-content"})],K.prototype,"deserialize-content",2),H([L({type:Object,attribute:"serialize-content"})],K.prototype,"serialize-content",2),H([L({type:Object,attribute:"upload-image"})],K.prototype,"upload-image",2),H([$()],K.prototype,"_editor",2),H([$()],K.prototype,"_hoverRow",2),H([$()],K.prototype,"_hoverCol",2),H([$()],K.prototype,"_tableDropdownOpen",2),H([$()],K.prototype,"_tableCellToolbar",2),H([$()],K.prototype,"_imageToolbar",2),H([$()],K.prototype,"_linkEditor",2),H([$()],K.prototype,"_isEditorFocused",2),H([$()],K.prototype,"_selectedImage",2),K=H([q("qxs-blocksuite-editor")],K);export{K as QxsBlocksuiteEditor};
1125
+ `;d([h({type:String,attribute:"content"})],a.prototype,"content",2);d([h({type:String,attribute:"model-value"})],a.prototype,"model-value",2);d([h({type:String,attribute:"placeholder"})],a.prototype,"placeholder",2);d([h({type:String,attribute:"toolbar-mode"})],a.prototype,"toolbar-mode",2);d([h({attribute:"toolbar"})],a.prototype,"toolbar",2);d([h({type:String,attribute:"toolbar-preset"})],a.prototype,"toolbar-preset",2);d([h({attribute:"header-toolbar-labels"})],a.prototype,"header-toolbar-labels",2);d([h({type:String,attribute:"header-always-visible"})],a.prototype,"header-always-visible",2);d([h({type:String,attribute:"use-model"})],a.prototype,"use-model",2);d([h({type:String,attribute:"readonly"})],a.prototype,"readonly",2);d([h({type:String,attribute:"preview"})],a.prototype,"preview",2);d([h({attribute:"editable"})],a.prototype,"editable",2);d([h({type:String,attribute:"min-height"})],a.prototype,"min-height",2);d([h({type:String,attribute:"max-height"})],a.prototype,"max-height",2);d([h({type:String,attribute:"show-character-count"})],a.prototype,"show-character-count",2);d([h({type:String,attribute:"toolbar-position"})],a.prototype,"toolbar-position",2);d([h({type:String,attribute:"custom-styles"})],a.prototype,"custom-styles",2);d([h({type:String,attribute:"content-format"})],a.prototype,"content-format",2);d([h({type:Object,attribute:"deserialize-content"})],a.prototype,"deserialize-content",2);d([h({type:Object,attribute:"serialize-content"})],a.prototype,"serialize-content",2);d([h({type:Object,attribute:"upload-image"})],a.prototype,"upload-image",2);d([b()],a.prototype,"_editor",2);d([b()],a.prototype,"_hoverRow",2);d([b()],a.prototype,"_hoverCol",2);d([b()],a.prototype,"_tableDropdownOpen",2);d([b()],a.prototype,"_tableCellToolbar",2);d([b()],a.prototype,"_imageToolbar",2);d([b()],a.prototype,"_linkEditor",2);d([b()],a.prototype,"_isEditorFocused",2);d([b()],a.prototype,"_selectedImage",2);a=d([he("qxs-blocksuite-editor")],a);export{a as QxsBlocksuiteEditor};
1115
1126
  //# sourceMappingURL=blocksuite-editor.mjs.map