@opentiny/fluent-editor 4.0.0-alpha.15 → 4.0.0-alpha.16

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 (330) hide show
  1. package/README.md +88 -88
  2. package/es/attributors/line-height.es.js.map +1 -1
  3. package/es/config/base64-image.es.js.map +1 -1
  4. package/es/config/editor.config.es.js.map +1 -1
  5. package/es/config/editor.utils.es.js.map +1 -1
  6. package/es/config/i18n/en-us.es.js.map +1 -1
  7. package/es/config/i18n/zh-cn.es.js.map +1 -1
  8. package/es/config/index.es.js.map +1 -1
  9. package/es/core/fluent-editor.es.js.map +1 -1
  10. package/es/fluent-editor.es.js.map +1 -1
  11. package/es/formats/emoji.es.js.map +1 -1
  12. package/es/formats/soft-break.es.js.map +1 -1
  13. package/es/formats/strike.es.js.map +1 -1
  14. package/es/formats/video.es.js.map +1 -1
  15. package/es/modules/ai/constants.es.js.map +1 -1
  16. package/es/modules/ai/icons.es.js.map +1 -1
  17. package/es/modules/ai/index.es.js.map +1 -1
  18. package/es/modules/collaborative-editing/awareness/awareness.es.js.map +1 -1
  19. package/es/modules/collaborative-editing/awareness/y-indexeddb.es.js.map +1 -1
  20. package/es/modules/collaborative-editing/collaborative-editing.es.js.map +1 -1
  21. package/es/modules/collaborative-editing/module.es.js.map +1 -1
  22. package/es/modules/collaborative-editing/provider/providerRegistry.es.js.map +1 -1
  23. package/es/modules/collaborative-editing/provider/webrtc.es.js.map +1 -1
  24. package/es/modules/collaborative-editing/provider/websocket.es.js.map +1 -1
  25. package/es/modules/counter.es.js.map +1 -1
  26. package/es/modules/custom-clipboard.es.js.map +1 -1
  27. package/es/modules/custom-image/actions/action.es.js.map +1 -1
  28. package/es/modules/custom-image/actions/custom-resize-action.es.js.map +1 -1
  29. package/es/modules/custom-image/actions/delete-action.es.js.map +1 -1
  30. package/es/modules/custom-image/blot-formatter.es.js.map +1 -1
  31. package/es/modules/custom-image/image.es.js.map +1 -1
  32. package/es/modules/custom-image/options.es.js.map +1 -1
  33. package/es/modules/custom-image/specs/blot-spec.es.js.map +1 -1
  34. package/es/modules/custom-image/specs/custom-image-spec.es.js.map +1 -1
  35. package/es/modules/custom-image/specs/image-spec.es.js.map +1 -1
  36. package/es/modules/divider.es.js.map +1 -1
  37. package/es/modules/emoji.es.js.map +1 -1
  38. package/es/modules/file/formats/file.es.js.map +1 -1
  39. package/es/modules/file/modules/file-bar.es.js.map +1 -1
  40. package/es/modules/file/modules/file-module.es.js.map +1 -1
  41. package/es/modules/flow-chart/config-utils.es.js.map +1 -1
  42. package/es/modules/flow-chart/formats/flow-chart-blot.es.js.map +1 -1
  43. package/es/modules/flow-chart/i18n/en-us.es.js.map +1 -1
  44. package/es/modules/flow-chart/i18n/index.es.js.map +1 -1
  45. package/es/modules/flow-chart/i18n/zh-cn.es.js.map +1 -1
  46. package/es/modules/flow-chart/icons.es.js.map +1 -1
  47. package/es/modules/flow-chart/index.es.js.map +1 -1
  48. package/es/modules/flow-chart/modules/context-menu.es.js.map +1 -1
  49. package/es/modules/flow-chart/modules/control-panel.es.js.map +1 -1
  50. package/es/modules/flow-chart/modules/custom-resize-action.es.js.map +1 -1
  51. package/es/modules/link/formats/link.es.js.map +1 -1
  52. package/es/modules/link/modules/tooltip.es.js.map +1 -1
  53. package/es/modules/mathlive/formats.es.js.map +1 -1
  54. package/es/modules/mathlive/tooltip.es.js.map +1 -1
  55. package/es/modules/mention/constants.es.js.map +1 -1
  56. package/es/modules/mention/mention-link.es.js.map +1 -1
  57. package/es/modules/mention/mention.es.js.map +1 -1
  58. package/es/modules/mind-map/config-utils.es.js.map +1 -1
  59. package/es/modules/mind-map/formats/mind-map-blot.es.js.map +1 -1
  60. package/es/modules/mind-map/i18n/en-us.es.js.map +1 -1
  61. package/es/modules/mind-map/i18n/index.es.js.map +1 -1
  62. package/es/modules/mind-map/i18n/zh-cn.es.js.map +1 -1
  63. package/es/modules/mind-map/icons.es.js.map +1 -1
  64. package/es/modules/mind-map/index.es.js.map +1 -1
  65. package/es/modules/mind-map/modules/context-menu.es.js.map +1 -1
  66. package/es/modules/mind-map/modules/control-panel.es.js.map +1 -1
  67. package/es/modules/mind-map/modules/custom-resize-action.es.js.map +1 -1
  68. package/es/modules/syntax.es.js.map +1 -1
  69. package/es/modules/toolbar/better-picker.es.js.map +1 -1
  70. package/es/themes/snow.es.js.map +1 -1
  71. package/es/tools/screenshot.es.js.map +1 -1
  72. package/es/ui/icons.config.es.js.map +1 -1
  73. package/es/ui/icons.es.js.map +1 -1
  74. package/es/utils/debounce.es.js.map +1 -1
  75. package/es/utils/merge.es.js.map +1 -1
  76. package/es/utils/method.es.js.map +1 -1
  77. package/lib/attributors/line-height.cjs.js.map +1 -1
  78. package/lib/config/base64-image.cjs.js.map +1 -1
  79. package/lib/config/editor.config.cjs.js.map +1 -1
  80. package/lib/config/editor.utils.cjs.js.map +1 -1
  81. package/lib/config/i18n/en-us.cjs.js.map +1 -1
  82. package/lib/config/i18n/zh-cn.cjs.js.map +1 -1
  83. package/lib/config/index.cjs.js.map +1 -1
  84. package/lib/core/fluent-editor.cjs.js.map +1 -1
  85. package/lib/fluent-editor.cjs.js.map +1 -1
  86. package/lib/formats/emoji.cjs.js.map +1 -1
  87. package/lib/formats/soft-break.cjs.js.map +1 -1
  88. package/lib/formats/strike.cjs.js.map +1 -1
  89. package/lib/formats/video.cjs.js.map +1 -1
  90. package/lib/modules/ai/constants.cjs.js.map +1 -1
  91. package/lib/modules/ai/icons.cjs.js.map +1 -1
  92. package/lib/modules/ai/index.cjs.js.map +1 -1
  93. package/lib/modules/collaborative-editing/awareness/awareness.cjs.js.map +1 -1
  94. package/lib/modules/collaborative-editing/awareness/y-indexeddb.cjs.js.map +1 -1
  95. package/lib/modules/collaborative-editing/collaborative-editing.cjs.js.map +1 -1
  96. package/lib/modules/collaborative-editing/module.cjs.js.map +1 -1
  97. package/lib/modules/collaborative-editing/provider/providerRegistry.cjs.js.map +1 -1
  98. package/lib/modules/collaborative-editing/provider/webrtc.cjs.js.map +1 -1
  99. package/lib/modules/collaborative-editing/provider/websocket.cjs.js.map +1 -1
  100. package/lib/modules/counter.cjs.js.map +1 -1
  101. package/lib/modules/custom-clipboard.cjs.js.map +1 -1
  102. package/lib/modules/custom-image/actions/action.cjs.js.map +1 -1
  103. package/lib/modules/custom-image/actions/custom-resize-action.cjs.js.map +1 -1
  104. package/lib/modules/custom-image/actions/delete-action.cjs.js.map +1 -1
  105. package/lib/modules/custom-image/blot-formatter.cjs.js.map +1 -1
  106. package/lib/modules/custom-image/image.cjs.js.map +1 -1
  107. package/lib/modules/custom-image/options.cjs.js.map +1 -1
  108. package/lib/modules/custom-image/specs/blot-spec.cjs.js.map +1 -1
  109. package/lib/modules/custom-image/specs/custom-image-spec.cjs.js.map +1 -1
  110. package/lib/modules/custom-image/specs/image-spec.cjs.js.map +1 -1
  111. package/lib/modules/divider.cjs.js.map +1 -1
  112. package/lib/modules/emoji.cjs.js.map +1 -1
  113. package/lib/modules/file/formats/file.cjs.js.map +1 -1
  114. package/lib/modules/file/modules/file-bar.cjs.js.map +1 -1
  115. package/lib/modules/file/modules/file-module.cjs.js.map +1 -1
  116. package/lib/modules/flow-chart/config-utils.cjs.js.map +1 -1
  117. package/lib/modules/flow-chart/formats/flow-chart-blot.cjs.js.map +1 -1
  118. package/lib/modules/flow-chart/i18n/en-us.cjs.js.map +1 -1
  119. package/lib/modules/flow-chart/i18n/index.cjs.js.map +1 -1
  120. package/lib/modules/flow-chart/i18n/zh-cn.cjs.js.map +1 -1
  121. package/lib/modules/flow-chart/icons.cjs.js.map +1 -1
  122. package/lib/modules/flow-chart/index.cjs.js.map +1 -1
  123. package/lib/modules/flow-chart/modules/context-menu.cjs.js.map +1 -1
  124. package/lib/modules/flow-chart/modules/control-panel.cjs.js.map +1 -1
  125. package/lib/modules/flow-chart/modules/custom-resize-action.cjs.js.map +1 -1
  126. package/lib/modules/link/formats/link.cjs.js.map +1 -1
  127. package/lib/modules/link/modules/tooltip.cjs.js.map +1 -1
  128. package/lib/modules/mathlive/formats.cjs.js.map +1 -1
  129. package/lib/modules/mathlive/tooltip.cjs.js.map +1 -1
  130. package/lib/modules/mention/constants.cjs.js.map +1 -1
  131. package/lib/modules/mention/mention-link.cjs.js.map +1 -1
  132. package/lib/modules/mention/mention.cjs.js.map +1 -1
  133. package/lib/modules/mind-map/config-utils.cjs.js.map +1 -1
  134. package/lib/modules/mind-map/formats/mind-map-blot.cjs.js.map +1 -1
  135. package/lib/modules/mind-map/i18n/en-us.cjs.js.map +1 -1
  136. package/lib/modules/mind-map/i18n/index.cjs.js.map +1 -1
  137. package/lib/modules/mind-map/i18n/zh-cn.cjs.js.map +1 -1
  138. package/lib/modules/mind-map/icons.cjs.js.map +1 -1
  139. package/lib/modules/mind-map/index.cjs.js.map +1 -1
  140. package/lib/modules/mind-map/modules/context-menu.cjs.js.map +1 -1
  141. package/lib/modules/mind-map/modules/control-panel.cjs.js.map +1 -1
  142. package/lib/modules/mind-map/modules/custom-resize-action.cjs.js.map +1 -1
  143. package/lib/modules/syntax.cjs.js.map +1 -1
  144. package/lib/modules/toolbar/better-picker.cjs.js.map +1 -1
  145. package/lib/themes/snow.cjs.js.map +1 -1
  146. package/lib/tools/screenshot.cjs.js.map +1 -1
  147. package/lib/ui/icons.cjs.js.map +1 -1
  148. package/lib/ui/icons.config.cjs.js.map +1 -1
  149. package/lib/utils/debounce.cjs.js.map +1 -1
  150. package/lib/utils/merge.cjs.js.map +1 -1
  151. package/lib/utils/method.cjs.js.map +1 -1
  152. package/package.json +1 -1
  153. package/patches/quill@2.0.3.patch +33 -33
  154. package/scripts/apply-patches.cjs +248 -248
  155. package/types/attributors/font-size.d.ts +1 -1
  156. package/types/attributors/font-style.d.ts +1 -1
  157. package/types/attributors/index.d.ts +4 -4
  158. package/types/attributors/line-height.d.ts +1 -1
  159. package/types/attributors/text-indent.d.ts +1 -1
  160. package/types/config/base64-image.d.ts +2 -2
  161. package/types/config/editor.config.d.ts +55 -55
  162. package/types/config/editor.utils.d.ts +40 -40
  163. package/types/config/i18n/en-us.d.ts +125 -125
  164. package/types/config/i18n/zh-cn.d.ts +125 -125
  165. package/types/config/index.d.ts +7 -7
  166. package/types/config/types/editor-config.interface.d.ts +11 -12
  167. package/types/config/types/editor-modules.interface.d.ts +38 -39
  168. package/types/config/types/index.d.ts +3 -3
  169. package/types/config/types/type.d.ts +2 -2
  170. package/types/core/fluent-editor.d.ts +10 -11
  171. package/types/fluent-editor.d.ts +1 -2
  172. package/types/formats/emoji.d.ts +7 -8
  173. package/types/formats/index.d.ts +4 -4
  174. package/types/formats/soft-break.d.ts +11 -12
  175. package/types/formats/strike.d.ts +7 -8
  176. package/types/formats/video.d.ts +12 -13
  177. package/types/index.d.ts +7 -8
  178. package/types/modules/ai/constants.d.ts +30 -30
  179. package/types/modules/ai/icons.d.ts +21 -21
  180. package/types/modules/ai/index.d.ts +93 -94
  181. package/types/modules/ai/types.d.ts +16 -16
  182. package/types/modules/collaborative-editing/awareness/awareness.d.ts +25 -26
  183. package/types/modules/collaborative-editing/awareness/index.d.ts +2 -2
  184. package/types/modules/collaborative-editing/awareness/y-indexeddb.d.ts +2 -3
  185. package/types/modules/collaborative-editing/collaborative-editing.d.ts +20 -21
  186. package/types/modules/collaborative-editing/index.d.ts +2 -2
  187. package/types/modules/collaborative-editing/module.d.ts +10 -11
  188. package/types/modules/collaborative-editing/provider/index.d.ts +3 -3
  189. package/types/modules/collaborative-editing/provider/providerRegistry.d.ts +24 -25
  190. package/types/modules/collaborative-editing/provider/webrtc.d.ts +33 -34
  191. package/types/modules/collaborative-editing/provider/websocket.d.ts +37 -38
  192. package/types/modules/collaborative-editing/types.d.ts +45 -46
  193. package/types/modules/counter.d.ts +21 -22
  194. package/types/modules/custom-clipboard.d.ts +23 -24
  195. package/types/modules/custom-image/actions/{Action.d.ts → action.d.ts} +7 -8
  196. package/types/modules/custom-image/actions/custom-resize-action.d.ts +22 -23
  197. package/types/modules/custom-image/actions/delete-action.d.ts +5 -6
  198. package/types/modules/custom-image/actions/image-toolbar-buttons.d.ts +15 -16
  199. package/types/modules/custom-image/actions/index.d.ts +6 -6
  200. package/types/modules/custom-image/actions/toolbar-action.d.ts +7 -8
  201. package/types/modules/custom-image/actions/toolbar.d.ts +16 -17
  202. package/types/modules/custom-image/blot-formatter.d.ts +19 -20
  203. package/types/modules/custom-image/image.d.ts +26 -27
  204. package/types/modules/custom-image/index.d.ts +4 -4
  205. package/types/modules/custom-image/{Options.d.ts → options.d.ts} +45 -46
  206. package/types/modules/custom-image/specs/blot-spec.d.ts +10 -11
  207. package/types/modules/custom-image/specs/custom-image-spec.d.ts +15 -16
  208. package/types/modules/custom-image/specs/image-spec.d.ts +7 -8
  209. package/types/modules/custom-image/specs/index.d.ts +3 -3
  210. package/types/modules/custom-uploader.d.ts +37 -38
  211. package/types/modules/divider.d.ts +7 -8
  212. package/types/modules/emoji.d.ts +35 -36
  213. package/types/modules/file/formats/file.d.ts +17 -18
  214. package/types/modules/file/index.d.ts +3 -3
  215. package/types/modules/file/modules/file-bar.d.ts +14 -14
  216. package/types/modules/file/modules/file-module.d.ts +7 -8
  217. package/types/modules/flow-chart/config-utils.d.ts +9 -10
  218. package/types/modules/flow-chart/formats/flow-chart-blot.d.ts +40 -41
  219. package/types/modules/flow-chart/i18n/en-us.d.ts +26 -26
  220. package/types/modules/flow-chart/i18n/index.d.ts +1 -1
  221. package/types/modules/flow-chart/i18n/zh-cn.d.ts +26 -26
  222. package/types/modules/flow-chart/icons.d.ts +12 -12
  223. package/types/modules/flow-chart/index.d.ts +8 -9
  224. package/types/modules/flow-chart/modules/context-menu.d.ts +1 -2
  225. package/types/modules/flow-chart/modules/control-panel.d.ts +1 -2
  226. package/types/modules/flow-chart/modules/custom-resize-action.d.ts +22 -22
  227. package/types/modules/flow-chart/options.d.ts +29 -29
  228. package/types/modules/i18n.d.ts +13 -14
  229. package/types/modules/index.d.ts +18 -18
  230. package/types/modules/link/formats/link.d.ts +14 -15
  231. package/types/modules/link/index.d.ts +2 -2
  232. package/types/modules/link/modules/tooltip.d.ts +25 -26
  233. package/types/modules/mathlive/formats.d.ts +20 -21
  234. package/types/modules/mathlive/index.d.ts +3 -3
  235. package/types/modules/mathlive/module.d.ts +7 -8
  236. package/types/modules/mathlive/tooltip.d.ts +14 -15
  237. package/types/modules/mention/constants.d.ts +3 -3
  238. package/types/modules/mention/index.d.ts +2 -2
  239. package/types/modules/mention/mention-link.d.ts +14 -15
  240. package/types/modules/mention/{Mention.d.ts → mention.d.ts} +52 -53
  241. package/types/modules/mind-map/config-utils.d.ts +11 -12
  242. package/types/modules/mind-map/formats/mind-map-blot.d.ts +41 -42
  243. package/types/modules/mind-map/i18n/en-us.d.ts +25 -25
  244. package/types/modules/mind-map/i18n/index.d.ts +1 -1
  245. package/types/modules/mind-map/i18n/zh-cn.d.ts +25 -25
  246. package/types/modules/mind-map/icons.d.ts +21 -21
  247. package/types/modules/mind-map/index.d.ts +8 -9
  248. package/types/modules/mind-map/modules/context-menu.d.ts +1 -2
  249. package/types/modules/mind-map/modules/control-panel.d.ts +1 -2
  250. package/types/modules/mind-map/modules/custom-resize-action.d.ts +23 -23
  251. package/types/modules/mind-map/options.d.ts +27 -27
  252. package/types/modules/shortcut-key/index.d.ts +67 -68
  253. package/types/modules/syntax.d.ts +12 -13
  254. package/types/modules/table-up/index.d.ts +32 -33
  255. package/types/modules/toolbar/better-picker.d.ts +13 -14
  256. package/types/modules/toolbar/better-toolbar.d.ts +6 -7
  257. package/types/modules/toolbar/index.d.ts +3 -3
  258. package/types/modules/toolbar/toolbar-tip.d.ts +7 -8
  259. package/types/themes/snow.d.ts +9 -10
  260. package/types/tools/format-painter.d.ts +12 -13
  261. package/types/tools/fullscreen.d.ts +4 -5
  262. package/types/tools/screenshot.d.ts +17 -18
  263. package/types/ui/icons.config.d.ts +40 -40
  264. package/types/ui/icons.d.ts +6 -6
  265. package/types/utils/debounce.d.ts +6 -6
  266. package/types/utils/image.d.ts +1 -1
  267. package/types/utils/is.d.ts +6 -6
  268. package/types/utils/merge.d.ts +7 -7
  269. package/types/utils/method.d.ts +6 -6
  270. package/types/utils/scroll-lock.d.ts +6 -6
  271. package/types/config/types/additional-toolbar-item.interface.d.ts +0 -8
  272. package/types/config/types/content-change.interface.d.ts +0 -13
  273. package/types/config/types/content-save.interface.d.ts +0 -6
  274. package/types/config/types/counter-option.interface.d.ts +0 -9
  275. package/types/config/types/editor-toolbar.interface.d.ts +0 -6
  276. package/types/config/types/file-operation.interface.d.ts +0 -12
  277. package/types/config/types/focus-change.interface.d.ts +0 -4
  278. package/types/config/types/fullscreen-module.interface.d.ts +0 -4
  279. package/types/config/types/help-panel-item.interface.d.ts +0 -5
  280. package/types/config/types/help-panel-option.interface.d.ts +0 -7
  281. package/types/config/types/image-module.interface.d.ts +0 -3
  282. package/types/config/types/image-upload.interface.d.ts +0 -7
  283. package/types/config/types/load-on-demand-module.interface.d.ts +0 -5
  284. package/types/config/types/mention-module.interface.d.ts +0 -8
  285. package/types/config/types/paste-change.interface.d.ts +0 -6
  286. package/types/config/types/quick-menu-module.interface.d.ts +0 -3
  287. package/types/config/types/range.interface.d.ts +0 -4
  288. package/types/config/types/registry-options.interface.d.ts +0 -5
  289. package/types/config/types/selection-change.interface.d.ts +0 -8
  290. package/types/config/types/toolbar-item.interface.d.ts +0 -13
  291. package/types/config/types/validate-error.interface.d.ts +0 -13
  292. package/types/modules/custom-image/BlotFormatter.d.ts +0 -29
  293. package/types/modules/custom-image/actions/CustomResizeAction.d.ts +0 -24
  294. package/types/modules/custom-image/actions/DeleteAction.d.ts +0 -7
  295. package/types/modules/custom-image/image-bar.d.ts +0 -15
  296. package/types/modules/custom-image/specs/BlotSpec.d.ts +0 -13
  297. package/types/modules/custom-image/specs/CustomImageSpec.d.ts +0 -21
  298. package/types/modules/custom-image/specs/ImageSpec.d.ts +0 -10
  299. package/types/modules/emoji/emoji-list/index.d.ts +0 -1
  300. package/types/modules/emoji/emoji-list/people.d.ts +0 -1
  301. package/types/modules/emoji/emoji-list.d.ts +0 -2
  302. package/types/modules/emoji/emoji-map.d.ts +0 -2
  303. package/types/modules/emoji/emoji-sprite.d.ts +0 -1
  304. package/types/modules/emoji/formats/emoji-blot.d.ts +0 -13
  305. package/types/modules/emoji/index.d.ts +0 -10
  306. package/types/modules/emoji/modules/emoji.d.ts +0 -38
  307. package/types/modules/emoji/modules/toolbar-emoji.d.ts +0 -8
  308. package/types/modules/emoji/utils.d.ts +0 -1
  309. package/types/modules/global-link/constants.d.ts +0 -3
  310. package/types/modules/global-link/formats/customer-widget-link.d.ts +0 -14
  311. package/types/modules/global-link/formats/doc-link.d.ts +0 -17
  312. package/types/modules/global-link/formats/wiki-link.d.ts +0 -16
  313. package/types/modules/global-link/formats/work-item-link.d.ts +0 -16
  314. package/types/modules/global-link/global-link-panel.d.ts +0 -19
  315. package/types/modules/global-link/index.d.ts +0 -18
  316. package/types/modules/global-link/utils/createTable.d.ts +0 -1
  317. package/types/modules/mention/MentionLink.d.ts +0 -16
  318. package/types/modules/quick-menu.d.ts +0 -22
  319. package/types/modules/table/better-table.d.ts +0 -35
  320. package/types/modules/table/formats/header.d.ts +0 -23
  321. package/types/modules/table/formats/list.d.ts +0 -34
  322. package/types/modules/table/formats/table.d.ts +0 -147
  323. package/types/modules/table/modules/table-column-tool.d.ts +0 -23
  324. package/types/modules/table/modules/table-operation-menu.d.ts +0 -38
  325. package/types/modules/table/modules/table-scroll-bar.d.ts +0 -33
  326. package/types/modules/table/modules/table-selection.d.ts +0 -37
  327. package/types/modules/table/modules/table-selector.d.ts +0 -22
  328. package/types/modules/table/table-config.d.ts +0 -38
  329. package/types/modules/table/utils/index.d.ts +0 -17
  330. package/types/modules/table/utils/node-matchers.d.ts +0 -9
@@ -1,248 +1,248 @@
1
- const { execSync } = require('node:child_process')
2
- const fs = require('node:fs')
3
- const path = require('node:path')
4
-
5
- /*
6
- * 应用 Quill 补丁脚本
7
- * 功能:修复 Quill 编辑器输入法状态下的批处理问题,提升中文输入体验
8
- *
9
- * 自动应用:安装包时 postinstall 脚本自动应用,支持所有包管理器-受限于 postinstall 规则暂未实现
10
- *
11
- * 手动应用:在项目根目录执行
12
- * node node_modules/@opentiny/fluent-editor/scripts/apply-patches.cjs
13
- *
14
- * 工作原理:
15
- * 1. 检测包管理器类型(pnpm/npm/yarn)
16
- * 2. 自动检测 Quill 安装位置
17
- * 3. 根据包管理器类型应用不同的补丁策略
18
- *
19
- * 注意事项:
20
- * - 补丁是幂等的,多次运行无副作用
21
- * - 需要 node_modules 写入权限
22
- * - 不影响其他包或项目的补丁
23
- */
24
-
25
- // 获取包管理器
26
- function detectPackageManager() {
27
- try {
28
- const lockFiles = {
29
- 'pnpm-lock.yaml': 'pnpm',
30
- 'yarn.lock': 'yarn',
31
- 'package-lock.json': 'npm',
32
- }
33
-
34
- for (const [file, manager] of Object.entries(lockFiles)) {
35
- if (fs.existsSync(file)) return manager
36
- }
37
-
38
- const userAgent = process.env.npm_config_user_agent || ''
39
- if (userAgent.includes('pnpm')) return 'pnpm'
40
- if (userAgent.includes('yarn')) return 'yarn'
41
- if (userAgent.includes('npm')) return 'npm'
42
- }
43
- catch {
44
- return 'npm'
45
- }
46
-
47
- return 'npm'
48
- }
49
-
50
- // 拷贝 patches 文件
51
- function copyPatchFile() {
52
- const packageManager = detectPackageManager()
53
- // 把 patch 文件复制到哪里
54
- const dest = `patches/${packageManager === 'pnpm' ? 'quill@2.0.3.patch' : 'quill+2.0.3.patch'}`
55
-
56
- // 文件存在直接返回
57
- if (fs.existsSync(dest)) {
58
- return true
59
- }
60
-
61
- // 复制 patch 文件的路径
62
- const src = path.resolve(__dirname, '../patches/quill@2.0.3.patch')
63
-
64
- if (fs.existsSync(src)) {
65
- fs.mkdirSync('patches', { recursive: true })
66
-
67
- if (packageManager === 'pnpm') {
68
- fs.copyFileSync(src, dest)
69
- }
70
- else {
71
- let content = fs.readFileSync(src, 'utf-8')
72
- content = content.replaceAll('core/editor.js', 'node_modules/quill/core/editor.js')
73
- fs.writeFileSync(dest, content)
74
- }
75
-
76
- console.log(`✅ 已复制 patch 文件到 ${dest}`)
77
- return true
78
- }
79
- else {
80
- console.log(`⚠️ 未找到 patch 文件,请手动创建 ${dest}`)
81
- return false
82
- }
83
- }
84
-
85
- // pnpm 应用 patch 文件
86
- function setupPnpmPatch() {
87
- try {
88
- const packageJsonPath = 'package.json'
89
- if (!fs.existsSync(packageJsonPath)) {
90
- console.log('⚠️ 未找到 package.json')
91
- return false
92
- }
93
-
94
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'))
95
-
96
- // 检查是否已经有 pnpm.patchedDependencies 配置
97
- if (packageJson.pnpm?.patchedDependencies?.['quill@2.0.3']) {
98
- console.log('✅ pnpm patchedDependencies 已配置')
99
- return true
100
- }
101
-
102
- // 添加 pnpm.patchedDependencies 配置
103
- if (!packageJson.pnpm) {
104
- packageJson.pnpm = {}
105
- }
106
-
107
- if (!packageJson.pnpm.patchedDependencies) {
108
- packageJson.pnpm.patchedDependencies = {}
109
- }
110
-
111
- packageJson.pnpm.patchedDependencies['quill@2.0.3'] = 'patches/quill@2.0.3.patch'
112
-
113
- fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
114
- console.log('✅ 已添加 pnpm patchedDependencies 配置')
115
-
116
- try {
117
- execSync('pnpm install', { stdio: 'inherit' })
118
- console.log('✅ pnpm patch quill@2.0.3 应用成功!')
119
- }
120
- catch (error) {
121
- console.warn('❌ pnpm patch 命令执行失败:', error.message)
122
- }
123
-
124
- return true
125
- }
126
- catch (error) {
127
- console.error('❌ pnpm 补丁配置失败:', error.message)
128
- return false
129
- }
130
- }
131
-
132
- // npm、yarn 应用 patch 文件
133
- function applyPatchPackage() {
134
- try {
135
- const packageManager = detectPackageManager()
136
-
137
- // 检查 patch-package 是否安装
138
- let patchPackageInstalled = false
139
- try {
140
- require.resolve('patch-package')
141
- patchPackageInstalled = true
142
- }
143
- catch (e) {
144
- // patch-package 未安装
145
- }
146
-
147
- if (!patchPackageInstalled) {
148
- console.log('📦 正在安装 patch-package...')
149
- try {
150
- const installCommand = packageManager === 'yarn' ? 'yarn add --dev patch-package' : 'npm install --save-dev patch-package'
151
- execSync(installCommand, { stdio: 'inherit' })
152
- console.log('✅ patch-package 安装成功')
153
- }
154
- catch (error) {
155
- console.error('❌ patch-package 安装失败:', error.message)
156
- return false
157
- }
158
- }
159
-
160
- // 应用补丁
161
- console.log('🔄 正在应用 patch...')
162
- try {
163
- execSync('npx patch-package', { stdio: 'inherit' })
164
- console.log('✅ 补丁应用成功')
165
- }
166
- catch (error) {
167
- console.error('❌ 补丁应用失败:', error.message)
168
- return false
169
- }
170
-
171
- // 添加 postinstall 脚本
172
- const packageJsonPath = 'package.json'
173
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'))
174
-
175
- if (!packageJson.scripts) {
176
- packageJson.scripts = {}
177
- }
178
-
179
- if (!packageJson.scripts.postinstall || !packageJson.scripts.postinstall.includes('patch-package')) {
180
- const existingPostinstall = packageJson.scripts.postinstall || ''
181
- packageJson.scripts.postinstall = existingPostinstall ? `${existingPostinstall} && npx patch-package` : 'npx patch-package'
182
-
183
- fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
184
- console.log('✅ 已更新 postinstall 脚本')
185
- }
186
-
187
- return true
188
- }
189
- catch (error) {
190
- console.error('❌ patch-package 应用失败:', error.message)
191
- return false
192
- }
193
- }
194
-
195
- function handlePatchFailure() {
196
- console.log(`
197
- ❌ 补丁处理失败,请尝试手动安装
198
-
199
- 🔧 手动安装:
200
- 在项目根目录执行:
201
- node node_modules/@opentiny/fluent-editor/scripts/apply-patches.cjs
202
-
203
- ⚠️ 注意:未应用补丁可能影响中文输入体验
204
- `)
205
- }
206
-
207
- function applyQuillPatch() {
208
- const packageManager = detectPackageManager()
209
- console.log(`🔍 检测到包管理器: ${packageManager}`)
210
- console.log('📋 准备 patch 文件...')
211
-
212
- if (!copyPatchFile()) return handlePatchFailure()
213
-
214
- let strategy
215
- if (packageManager == 'pnpm') {
216
- strategy = {
217
- label: '📦 使用 pnpm 补丁策略...',
218
- handler: setupPnpmPatch,
219
- successMsg: '✅ quill@2.0.3.patch 补丁配置已完成',
220
- }
221
- }
222
- else {
223
- strategy = {
224
- label: '📦 使用 patch-package 补丁策略...',
225
- handler: applyPatchPackage,
226
- successMsg: '🎉 补丁处理完成',
227
- }
228
- }
229
-
230
- if (!strategy) {
231
- console.log('❌ 不支持的包管理器,仅支持 pnpm、yarn、npm')
232
- handlePatchFailure()
233
- return
234
- }
235
-
236
- console.log(strategy.label)
237
- // 调用处理函数
238
- const success = strategy.handler()
239
-
240
- if (success) {
241
- console.log(strategy.successMsg)
242
- }
243
- else {
244
- handlePatchFailure()
245
- }
246
- }
247
-
248
- applyQuillPatch()
1
+ const { execSync } = require('node:child_process')
2
+ const fs = require('node:fs')
3
+ const path = require('node:path')
4
+
5
+ /*
6
+ * 应用 Quill 补丁脚本
7
+ * 功能:修复 Quill 编辑器输入法状态下的批处理问题,提升中文输入体验
8
+ *
9
+ * 自动应用:安装包时 postinstall 脚本自动应用,支持所有包管理器-受限于 postinstall 规则暂未实现
10
+ *
11
+ * 手动应用:在项目根目录执行
12
+ * node node_modules/@opentiny/fluent-editor/scripts/apply-patches.cjs
13
+ *
14
+ * 工作原理:
15
+ * 1. 检测包管理器类型(pnpm/npm/yarn)
16
+ * 2. 自动检测 Quill 安装位置
17
+ * 3. 根据包管理器类型应用不同的补丁策略
18
+ *
19
+ * 注意事项:
20
+ * - 补丁是幂等的,多次运行无副作用
21
+ * - 需要 node_modules 写入权限
22
+ * - 不影响其他包或项目的补丁
23
+ */
24
+
25
+ // 获取包管理器
26
+ function detectPackageManager() {
27
+ try {
28
+ const lockFiles = {
29
+ 'pnpm-lock.yaml': 'pnpm',
30
+ 'yarn.lock': 'yarn',
31
+ 'package-lock.json': 'npm',
32
+ }
33
+
34
+ for (const [file, manager] of Object.entries(lockFiles)) {
35
+ if (fs.existsSync(file)) return manager
36
+ }
37
+
38
+ const userAgent = process.env.npm_config_user_agent || ''
39
+ if (userAgent.includes('pnpm')) return 'pnpm'
40
+ if (userAgent.includes('yarn')) return 'yarn'
41
+ if (userAgent.includes('npm')) return 'npm'
42
+ }
43
+ catch {
44
+ return 'npm'
45
+ }
46
+
47
+ return 'npm'
48
+ }
49
+
50
+ // 拷贝 patches 文件
51
+ function copyPatchFile() {
52
+ const packageManager = detectPackageManager()
53
+ // 把 patch 文件复制到哪里
54
+ const dest = `patches/${packageManager === 'pnpm' ? 'quill@2.0.3.patch' : 'quill+2.0.3.patch'}`
55
+
56
+ // 文件存在直接返回
57
+ if (fs.existsSync(dest)) {
58
+ return true
59
+ }
60
+
61
+ // 复制 patch 文件的路径
62
+ const src = path.resolve(__dirname, '../patches/quill@2.0.3.patch')
63
+
64
+ if (fs.existsSync(src)) {
65
+ fs.mkdirSync('patches', { recursive: true })
66
+
67
+ if (packageManager === 'pnpm') {
68
+ fs.copyFileSync(src, dest)
69
+ }
70
+ else {
71
+ let content = fs.readFileSync(src, 'utf-8')
72
+ content = content.replaceAll('core/editor.js', 'node_modules/quill/core/editor.js')
73
+ fs.writeFileSync(dest, content)
74
+ }
75
+
76
+ console.log(`✅ 已复制 patch 文件到 ${dest}`)
77
+ return true
78
+ }
79
+ else {
80
+ console.log(`⚠️ 未找到 patch 文件,请手动创建 ${dest}`)
81
+ return false
82
+ }
83
+ }
84
+
85
+ // pnpm 应用 patch 文件
86
+ function setupPnpmPatch() {
87
+ try {
88
+ const packageJsonPath = 'package.json'
89
+ if (!fs.existsSync(packageJsonPath)) {
90
+ console.log('⚠️ 未找到 package.json')
91
+ return false
92
+ }
93
+
94
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'))
95
+
96
+ // 检查是否已经有 pnpm.patchedDependencies 配置
97
+ if (packageJson.pnpm?.patchedDependencies?.['quill@2.0.3']) {
98
+ console.log('✅ pnpm patchedDependencies 已配置')
99
+ return true
100
+ }
101
+
102
+ // 添加 pnpm.patchedDependencies 配置
103
+ if (!packageJson.pnpm) {
104
+ packageJson.pnpm = {}
105
+ }
106
+
107
+ if (!packageJson.pnpm.patchedDependencies) {
108
+ packageJson.pnpm.patchedDependencies = {}
109
+ }
110
+
111
+ packageJson.pnpm.patchedDependencies['quill@2.0.3'] = 'patches/quill@2.0.3.patch'
112
+
113
+ fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
114
+ console.log('✅ 已添加 pnpm patchedDependencies 配置')
115
+
116
+ try {
117
+ execSync('pnpm install', { stdio: 'inherit' })
118
+ console.log('✅ pnpm patch quill@2.0.3 应用成功!')
119
+ }
120
+ catch (error) {
121
+ console.warn('❌ pnpm patch 命令执行失败:', error.message)
122
+ }
123
+
124
+ return true
125
+ }
126
+ catch (error) {
127
+ console.error('❌ pnpm 补丁配置失败:', error.message)
128
+ return false
129
+ }
130
+ }
131
+
132
+ // npm、yarn 应用 patch 文件
133
+ function applyPatchPackage() {
134
+ try {
135
+ const packageManager = detectPackageManager()
136
+
137
+ // 检查 patch-package 是否安装
138
+ let patchPackageInstalled = false
139
+ try {
140
+ require.resolve('patch-package')
141
+ patchPackageInstalled = true
142
+ }
143
+ catch (e) {
144
+ // patch-package 未安装
145
+ }
146
+
147
+ if (!patchPackageInstalled) {
148
+ console.log('📦 正在安装 patch-package...')
149
+ try {
150
+ const installCommand = packageManager === 'yarn' ? 'yarn add --dev patch-package' : 'npm install --save-dev patch-package'
151
+ execSync(installCommand, { stdio: 'inherit' })
152
+ console.log('✅ patch-package 安装成功')
153
+ }
154
+ catch (error) {
155
+ console.error('❌ patch-package 安装失败:', error.message)
156
+ return false
157
+ }
158
+ }
159
+
160
+ // 应用补丁
161
+ console.log('🔄 正在应用 patch...')
162
+ try {
163
+ execSync('npx patch-package', { stdio: 'inherit' })
164
+ console.log('✅ 补丁应用成功')
165
+ }
166
+ catch (error) {
167
+ console.error('❌ 补丁应用失败:', error.message)
168
+ return false
169
+ }
170
+
171
+ // 添加 postinstall 脚本
172
+ const packageJsonPath = 'package.json'
173
+ const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'))
174
+
175
+ if (!packageJson.scripts) {
176
+ packageJson.scripts = {}
177
+ }
178
+
179
+ if (!packageJson.scripts.postinstall || !packageJson.scripts.postinstall.includes('patch-package')) {
180
+ const existingPostinstall = packageJson.scripts.postinstall || ''
181
+ packageJson.scripts.postinstall = existingPostinstall ? `${existingPostinstall} && npx patch-package` : 'npx patch-package'
182
+
183
+ fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
184
+ console.log('✅ 已更新 postinstall 脚本')
185
+ }
186
+
187
+ return true
188
+ }
189
+ catch (error) {
190
+ console.error('❌ patch-package 应用失败:', error.message)
191
+ return false
192
+ }
193
+ }
194
+
195
+ function handlePatchFailure() {
196
+ console.log(`
197
+ ❌ 补丁处理失败,请尝试手动安装
198
+
199
+ 🔧 手动安装:
200
+ 在项目根目录执行:
201
+ node node_modules/@opentiny/fluent-editor/scripts/apply-patches.cjs
202
+
203
+ ⚠️ 注意:未应用补丁可能影响中文输入体验
204
+ `)
205
+ }
206
+
207
+ function applyQuillPatch() {
208
+ const packageManager = detectPackageManager()
209
+ console.log(`🔍 检测到包管理器: ${packageManager}`)
210
+ console.log('📋 准备 patch 文件...')
211
+
212
+ if (!copyPatchFile()) return handlePatchFailure()
213
+
214
+ let strategy
215
+ if (packageManager == 'pnpm') {
216
+ strategy = {
217
+ label: '📦 使用 pnpm 补丁策略...',
218
+ handler: setupPnpmPatch,
219
+ successMsg: '✅ quill@2.0.3.patch 补丁配置已完成',
220
+ }
221
+ }
222
+ else {
223
+ strategy = {
224
+ label: '📦 使用 patch-package 补丁策略...',
225
+ handler: applyPatchPackage,
226
+ successMsg: '🎉 补丁处理完成',
227
+ }
228
+ }
229
+
230
+ if (!strategy) {
231
+ console.log('❌ 不支持的包管理器,仅支持 pnpm、yarn、npm')
232
+ handlePatchFailure()
233
+ return
234
+ }
235
+
236
+ console.log(strategy.label)
237
+ // 调用处理函数
238
+ const success = strategy.handler()
239
+
240
+ if (success) {
241
+ console.log(strategy.successMsg)
242
+ }
243
+ else {
244
+ handlePatchFailure()
245
+ }
246
+ }
247
+
248
+ applyQuillPatch()
@@ -1 +1 @@
1
- export declare const SizeStyle: import('parchment').StyleAttributor;
1
+ export declare const SizeStyle: import('parchment').StyleAttributor;
@@ -1 +1 @@
1
- export declare const FontStyle: import('parchment').StyleAttributor;
1
+ export declare const FontStyle: import('parchment').StyleAttributor;
@@ -1,4 +1,4 @@
1
- export * from './font-size';
2
- export * from './font-style';
3
- export * from './line-height';
4
- export * from './text-indent';
1
+ export * from './font-size';
2
+ export * from './font-style';
3
+ export * from './line-height';
4
+ export * from './text-indent';
@@ -1 +1 @@
1
- export declare const LineHeightStyle: import('parchment').StyleAttributor;
1
+ export declare const LineHeightStyle: import('parchment').StyleAttributor;
@@ -1 +1 @@
1
- export declare const TextIndentStyle: import('parchment').StyleAttributor;
1
+ export declare const TextIndentStyle: import('parchment').StyleAttributor;