@opentiny/fluent-editor 3.25.4 → 4.0.0-alpha.1

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 (247) hide show
  1. package/es/attributors/font-style.es.js +1 -1
  2. package/es/attributors/font-style.es.js.map +1 -1
  3. package/es/attributors/line-height.es.js +1 -1
  4. package/es/attributors/line-height.es.js.map +1 -1
  5. package/es/config/editor.config.es.js +0 -7
  6. package/es/config/editor.config.es.js.map +1 -1
  7. package/es/config/editor.utils.es.js +0 -9
  8. package/es/config/editor.utils.es.js.map +1 -1
  9. package/es/config/i18n/en-us.es.js +33 -17
  10. package/es/config/i18n/en-us.es.js.map +1 -1
  11. package/es/config/i18n/zh-cn.es.js +33 -17
  12. package/es/config/i18n/zh-cn.es.js.map +1 -1
  13. package/es/config/index.es.js +7 -13
  14. package/es/config/index.es.js.map +1 -1
  15. package/es/core/fluent-editor.es.js +6 -4
  16. package/es/core/fluent-editor.es.js.map +1 -1
  17. package/es/fluent-editor.es.js +24 -12
  18. package/es/fluent-editor.es.js.map +1 -1
  19. package/es/formats/video.es.js +2 -2
  20. package/es/formats/video.es.js.map +1 -1
  21. package/es/index.es.js +8 -4
  22. package/es/index.es.js.map +1 -1
  23. package/es/modules/custom-clipboard.es.js +3 -61
  24. package/es/modules/custom-clipboard.es.js.map +1 -1
  25. package/es/modules/custom-image/BlotFormatter.es.js +1 -2
  26. package/es/modules/custom-image/BlotFormatter.es.js.map +1 -1
  27. package/es/modules/custom-image/image.es.js +4 -16
  28. package/es/modules/custom-image/image.es.js.map +1 -1
  29. package/es/modules/custom-uploader.es.js +60 -193
  30. package/es/modules/custom-uploader.es.js.map +1 -1
  31. package/es/modules/file/formats/file.es.js +12 -14
  32. package/es/modules/file/formats/file.es.js.map +1 -1
  33. package/es/modules/file/index.es.js +6 -7
  34. package/es/modules/file/index.es.js.map +1 -1
  35. package/es/modules/i18n.es.js +32 -12
  36. package/es/modules/i18n.es.js.map +1 -1
  37. package/es/modules/link/index.es.js +0 -17
  38. package/es/modules/link/index.es.js.map +1 -1
  39. package/es/modules/link/modules/tooltip.es.js +3 -2
  40. package/es/modules/link/modules/tooltip.es.js.map +1 -1
  41. package/es/modules/shortcut-key/index.es.js +229 -0
  42. package/es/modules/shortcut-key/index.es.js.map +1 -0
  43. package/es/modules/table-up/index.es.js +64 -0
  44. package/es/modules/table-up/index.es.js.map +1 -0
  45. package/es/modules/toolbar/better-picker.es.js +21 -269
  46. package/es/modules/toolbar/better-picker.es.js.map +1 -1
  47. package/es/modules/toolbar/index.es.js +0 -1
  48. package/es/modules/toolbar/index.es.js.map +1 -1
  49. package/es/modules/toolbar/toolbar-tip.es.js +44 -9
  50. package/es/modules/toolbar/toolbar-tip.es.js.map +1 -1
  51. package/es/themes/snow.es.js +198 -50
  52. package/es/themes/snow.es.js.map +1 -1
  53. package/es/ui/icons.config.es.js +6 -5
  54. package/es/ui/icons.config.es.js.map +1 -1
  55. package/es/ui/icons.es.js +3 -12
  56. package/es/ui/icons.es.js.map +1 -1
  57. package/es/utils/is.es.js +4 -0
  58. package/es/utils/is.es.js.map +1 -1
  59. package/lib/attributors/font-style.cjs.js +1 -1
  60. package/lib/attributors/font-style.cjs.js.map +1 -1
  61. package/lib/attributors/line-height.cjs.js +1 -1
  62. package/lib/attributors/line-height.cjs.js.map +1 -1
  63. package/lib/config/editor.config.cjs.js +0 -7
  64. package/lib/config/editor.config.cjs.js.map +1 -1
  65. package/lib/config/editor.utils.cjs.js +0 -9
  66. package/lib/config/editor.utils.cjs.js.map +1 -1
  67. package/lib/config/i18n/en-us.cjs.js +33 -17
  68. package/lib/config/i18n/en-us.cjs.js.map +1 -1
  69. package/lib/config/i18n/zh-cn.cjs.js +33 -17
  70. package/lib/config/i18n/zh-cn.cjs.js.map +1 -1
  71. package/lib/config/index.cjs.js +5 -11
  72. package/lib/config/index.cjs.js.map +1 -1
  73. package/lib/core/fluent-editor.cjs.js +5 -3
  74. package/lib/core/fluent-editor.cjs.js.map +1 -1
  75. package/lib/fluent-editor.cjs.js +23 -11
  76. package/lib/fluent-editor.cjs.js.map +1 -1
  77. package/lib/formats/video.cjs.js +2 -2
  78. package/lib/formats/video.cjs.js.map +1 -1
  79. package/lib/index.cjs.js +9 -2
  80. package/lib/index.cjs.js.map +1 -1
  81. package/lib/modules/custom-clipboard.cjs.js +2 -60
  82. package/lib/modules/custom-clipboard.cjs.js.map +1 -1
  83. package/lib/modules/custom-image/BlotFormatter.cjs.js +0 -1
  84. package/lib/modules/custom-image/BlotFormatter.cjs.js.map +1 -1
  85. package/lib/modules/custom-image/image.cjs.js +4 -16
  86. package/lib/modules/custom-image/image.cjs.js.map +1 -1
  87. package/lib/modules/custom-uploader.cjs.js +61 -194
  88. package/lib/modules/custom-uploader.cjs.js.map +1 -1
  89. package/lib/modules/file/formats/file.cjs.js +12 -14
  90. package/lib/modules/file/formats/file.cjs.js.map +1 -1
  91. package/lib/modules/file/index.cjs.js +6 -7
  92. package/lib/modules/file/index.cjs.js.map +1 -1
  93. package/lib/modules/i18n.cjs.js +31 -11
  94. package/lib/modules/i18n.cjs.js.map +1 -1
  95. package/lib/modules/link/index.cjs.js +0 -17
  96. package/lib/modules/link/index.cjs.js.map +1 -1
  97. package/lib/modules/link/modules/tooltip.cjs.js +2 -1
  98. package/lib/modules/link/modules/tooltip.cjs.js.map +1 -1
  99. package/lib/modules/shortcut-key/index.cjs.js +229 -0
  100. package/lib/modules/shortcut-key/index.cjs.js.map +1 -0
  101. package/lib/modules/table-up/index.cjs.js +64 -0
  102. package/lib/modules/table-up/index.cjs.js.map +1 -0
  103. package/lib/modules/toolbar/better-picker.cjs.js +21 -270
  104. package/lib/modules/toolbar/better-picker.cjs.js.map +1 -1
  105. package/lib/modules/toolbar/index.cjs.js +0 -1
  106. package/lib/modules/toolbar/index.cjs.js.map +1 -1
  107. package/lib/modules/toolbar/toolbar-tip.cjs.js +44 -9
  108. package/lib/modules/toolbar/toolbar-tip.cjs.js.map +1 -1
  109. package/lib/themes/snow.cjs.js +200 -52
  110. package/lib/themes/snow.cjs.js.map +1 -1
  111. package/lib/ui/icons.cjs.js +2 -11
  112. package/lib/ui/icons.cjs.js.map +1 -1
  113. package/lib/ui/icons.config.cjs.js +6 -5
  114. package/lib/ui/icons.config.cjs.js.map +1 -1
  115. package/lib/utils/is.cjs.js +4 -0
  116. package/lib/utils/is.cjs.js.map +1 -1
  117. package/package.json +4 -2
  118. package/style.css +316 -2149
  119. package/types/attributors/font-style.d.ts +1 -1
  120. package/types/config/editor.config.d.ts +0 -218
  121. package/types/config/editor.utils.d.ts +0 -1
  122. package/types/config/i18n/en-us.d.ts +31 -16
  123. package/types/config/i18n/zh-cn.d.ts +31 -16
  124. package/types/config/index.d.ts +1 -1
  125. package/types/config/types/editor-config.interface.d.ts +0 -19
  126. package/types/config/types/editor-modules.interface.d.ts +2 -0
  127. package/types/config/types/toolbar-item.interface.d.ts +11 -11
  128. package/types/core/fluent-editor.d.ts +4 -1
  129. package/types/index.d.ts +3 -0
  130. package/types/modules/counter.d.ts +1 -1
  131. package/types/modules/custom-clipboard.d.ts +1 -1
  132. package/types/modules/custom-image/image.d.ts +8 -11
  133. package/types/modules/file/formats/file.d.ts +12 -8
  134. package/types/modules/file/index.d.ts +5 -5
  135. package/types/modules/i18n.d.ts +4 -4
  136. package/types/modules/shortcut-key/index.d.ts +68 -0
  137. package/types/modules/table-up/index.d.ts +66 -0
  138. package/types/modules/toolbar/better-picker.d.ts +15 -0
  139. package/types/themes/snow.d.ts +10 -2
  140. package/types/ui/icons.config.d.ts +2 -2
  141. package/types/utils/is.d.ts +2 -0
  142. package/es/modules/global-link/constants.es.js +0 -9
  143. package/es/modules/global-link/constants.es.js.map +0 -1
  144. package/es/modules/global-link/formats/customer-widget-link.es.js +0 -28
  145. package/es/modules/global-link/formats/customer-widget-link.es.js.map +0 -1
  146. package/es/modules/global-link/formats/doc-link.es.js +0 -42
  147. package/es/modules/global-link/formats/doc-link.es.js.map +0 -1
  148. package/es/modules/global-link/formats/wiki-link.es.js +0 -34
  149. package/es/modules/global-link/formats/wiki-link.es.js.map +0 -1
  150. package/es/modules/global-link/formats/work-item-link.es.js +0 -36
  151. package/es/modules/global-link/formats/work-item-link.es.js.map +0 -1
  152. package/es/modules/global-link/global-link-panel.es.js +0 -2
  153. package/es/modules/global-link/global-link-panel.es.js.map +0 -1
  154. package/es/modules/global-link/index.es.js +0 -139
  155. package/es/modules/global-link/index.es.js.map +0 -1
  156. package/es/modules/global-link/utils/createTable.es.js +0 -50
  157. package/es/modules/global-link/utils/createTable.es.js.map +0 -1
  158. package/es/modules/quick-menu.es.js +0 -82
  159. package/es/modules/quick-menu.es.js.map +0 -1
  160. package/es/modules/table/better-table.es.js +0 -485
  161. package/es/modules/table/better-table.es.js.map +0 -1
  162. package/es/modules/table/formats/header.es.js +0 -94
  163. package/es/modules/table/formats/header.es.js.map +0 -1
  164. package/es/modules/table/formats/list.es.js +0 -163
  165. package/es/modules/table/formats/list.es.js.map +0 -1
  166. package/es/modules/table/formats/table.es.js +0 -969
  167. package/es/modules/table/formats/table.es.js.map +0 -1
  168. package/es/modules/table/modules/table-column-tool.es.js +0 -400
  169. package/es/modules/table/modules/table-column-tool.es.js.map +0 -1
  170. package/es/modules/table/modules/table-operation-menu.es.js +0 -475
  171. package/es/modules/table/modules/table-operation-menu.es.js.map +0 -1
  172. package/es/modules/table/modules/table-scroll-bar.es.js +0 -190
  173. package/es/modules/table/modules/table-scroll-bar.es.js.map +0 -1
  174. package/es/modules/table/modules/table-selection.es.js +0 -305
  175. package/es/modules/table/modules/table-selection.es.js.map +0 -1
  176. package/es/modules/table/modules/table-selector.es.js +0 -158
  177. package/es/modules/table/modules/table-selector.es.js.map +0 -1
  178. package/es/modules/table/table-config.es.js +0 -74
  179. package/es/modules/table/table-config.es.js.map +0 -1
  180. package/es/modules/table/utils/index.es.js +0 -54
  181. package/es/modules/table/utils/index.es.js.map +0 -1
  182. package/es/modules/table/utils/node-matchers.es.js +0 -292
  183. package/es/modules/table/utils/node-matchers.es.js.map +0 -1
  184. package/lib/modules/global-link/constants.cjs.js +0 -9
  185. package/lib/modules/global-link/constants.cjs.js.map +0 -1
  186. package/lib/modules/global-link/formats/customer-widget-link.cjs.js +0 -28
  187. package/lib/modules/global-link/formats/customer-widget-link.cjs.js.map +0 -1
  188. package/lib/modules/global-link/formats/doc-link.cjs.js +0 -42
  189. package/lib/modules/global-link/formats/doc-link.cjs.js.map +0 -1
  190. package/lib/modules/global-link/formats/wiki-link.cjs.js +0 -34
  191. package/lib/modules/global-link/formats/wiki-link.cjs.js.map +0 -1
  192. package/lib/modules/global-link/formats/work-item-link.cjs.js +0 -36
  193. package/lib/modules/global-link/formats/work-item-link.cjs.js.map +0 -1
  194. package/lib/modules/global-link/global-link-panel.cjs.js +0 -2
  195. package/lib/modules/global-link/global-link-panel.cjs.js.map +0 -1
  196. package/lib/modules/global-link/index.cjs.js +0 -139
  197. package/lib/modules/global-link/index.cjs.js.map +0 -1
  198. package/lib/modules/global-link/utils/createTable.cjs.js +0 -50
  199. package/lib/modules/global-link/utils/createTable.cjs.js.map +0 -1
  200. package/lib/modules/quick-menu.cjs.js +0 -82
  201. package/lib/modules/quick-menu.cjs.js.map +0 -1
  202. package/lib/modules/table/better-table.cjs.js +0 -485
  203. package/lib/modules/table/better-table.cjs.js.map +0 -1
  204. package/lib/modules/table/formats/header.cjs.js +0 -94
  205. package/lib/modules/table/formats/header.cjs.js.map +0 -1
  206. package/lib/modules/table/formats/list.cjs.js +0 -163
  207. package/lib/modules/table/formats/list.cjs.js.map +0 -1
  208. package/lib/modules/table/formats/table.cjs.js +0 -969
  209. package/lib/modules/table/formats/table.cjs.js.map +0 -1
  210. package/lib/modules/table/modules/table-column-tool.cjs.js +0 -400
  211. package/lib/modules/table/modules/table-column-tool.cjs.js.map +0 -1
  212. package/lib/modules/table/modules/table-operation-menu.cjs.js +0 -475
  213. package/lib/modules/table/modules/table-operation-menu.cjs.js.map +0 -1
  214. package/lib/modules/table/modules/table-scroll-bar.cjs.js +0 -190
  215. package/lib/modules/table/modules/table-scroll-bar.cjs.js.map +0 -1
  216. package/lib/modules/table/modules/table-selection.cjs.js +0 -305
  217. package/lib/modules/table/modules/table-selection.cjs.js.map +0 -1
  218. package/lib/modules/table/modules/table-selector.cjs.js +0 -158
  219. package/lib/modules/table/modules/table-selector.cjs.js.map +0 -1
  220. package/lib/modules/table/table-config.cjs.js +0 -74
  221. package/lib/modules/table/table-config.cjs.js.map +0 -1
  222. package/lib/modules/table/utils/index.cjs.js +0 -54
  223. package/lib/modules/table/utils/index.cjs.js.map +0 -1
  224. package/lib/modules/table/utils/node-matchers.cjs.js +0 -292
  225. package/lib/modules/table/utils/node-matchers.cjs.js.map +0 -1
  226. package/types/modules/custom-uploader.d.ts +0 -31
  227. package/types/modules/global-link/constants.d.ts +0 -3
  228. package/types/modules/global-link/formats/customer-widget-link.d.ts +0 -14
  229. package/types/modules/global-link/formats/doc-link.d.ts +0 -17
  230. package/types/modules/global-link/formats/wiki-link.d.ts +0 -16
  231. package/types/modules/global-link/formats/work-item-link.d.ts +0 -16
  232. package/types/modules/global-link/global-link-panel.d.ts +0 -19
  233. package/types/modules/global-link/index.d.ts +0 -18
  234. package/types/modules/global-link/utils/createTable.d.ts +0 -1
  235. package/types/modules/quick-menu.d.ts +0 -22
  236. package/types/modules/table/better-table.d.ts +0 -35
  237. package/types/modules/table/formats/header.d.ts +0 -23
  238. package/types/modules/table/formats/list.d.ts +0 -34
  239. package/types/modules/table/formats/table.d.ts +0 -147
  240. package/types/modules/table/modules/table-column-tool.d.ts +0 -23
  241. package/types/modules/table/modules/table-operation-menu.d.ts +0 -38
  242. package/types/modules/table/modules/table-scroll-bar.d.ts +0 -33
  243. package/types/modules/table/modules/table-selection.d.ts +0 -37
  244. package/types/modules/table/modules/table-selector.d.ts +0 -22
  245. package/types/modules/table/table-config.d.ts +0 -38
  246. package/types/modules/table/utils/index.d.ts +0 -17
  247. package/types/modules/table/utils/node-matchers.d.ts +0 -9
@@ -0,0 +1,66 @@
1
+ import { Parchment } from 'quill';
2
+ import { Constructor } from '../../config/types';
3
+ import { default as FluentEditor } from '../../core/fluent-editor';
4
+
5
+ interface InternalModule {
6
+ show: () => void;
7
+ hide: () => void;
8
+ update: () => void;
9
+ destroy: () => void;
10
+ }
11
+ interface InternalTableSelectionModule extends InternalModule {
12
+ dragging: boolean;
13
+ boundary: {
14
+ x: number;
15
+ y: number;
16
+ x1: number;
17
+ y1: number;
18
+ width: number;
19
+ height: number;
20
+ } | null;
21
+ selectedTds: Parchment.Blot[];
22
+ cellSelect: HTMLElement;
23
+ tableMenu?: InternalModule;
24
+ computeSelectedTds: (startPoint: {
25
+ x: number;
26
+ y: number;
27
+ }, endPoint: {
28
+ x: number;
29
+ y: number;
30
+ }) => Parchment.Blot[];
31
+ updateWithSelectedTds: () => void;
32
+ }
33
+ export declare function generateTableUp(QuillTableUp: Constructor): {
34
+ new (quill: FluentEditor, options: Partial<any>): {
35
+ [x: string]: any;
36
+ tableSelection?: InternalTableSelectionModule;
37
+ quill: FluentEditor;
38
+ resolveTexts(options?: Partial<Record<string, string>>): {
39
+ fullCheckboxText: string;
40
+ customBtnText: string;
41
+ confirmText: string;
42
+ cancelText: string;
43
+ rowText: string;
44
+ colText: string;
45
+ notPositiveNumberError: string;
46
+ custom: string;
47
+ clear: string;
48
+ transparent: string;
49
+ perWidthInsufficient: string;
50
+ CopyCell: string;
51
+ CutCell: string;
52
+ InsertTop: string;
53
+ InsertRight: string;
54
+ InsertBottom: string;
55
+ InsertLeft: string;
56
+ MergeCell: string;
57
+ SplitCell: string;
58
+ DeleteRow: string;
59
+ DeleteColumn: string;
60
+ DeleteTable: string;
61
+ BackgroundColor: string;
62
+ BorderColor: string;
63
+ };
64
+ };
65
+ };
66
+ export {};
@@ -1 +1,16 @@
1
+ import { default as TypePicker } from 'quill/ui/picker';
2
+ import { EasyColorPicker } from 'quill-easy-color';
3
+
4
+ declare const OriginPicker: typeof TypePicker;
5
+ export declare class Picker extends OriginPicker {
6
+ buildLabel(): HTMLSpanElement;
7
+ buildItem(option: HTMLOptionElement): HTMLSpanElement;
8
+ selectItem(item: HTMLElement | null, trigger?: boolean): void;
9
+ }
10
+ export declare class ColorPicker extends EasyColorPicker {
11
+ static clearText: string;
12
+ static customText: string;
13
+ constructor(select: HTMLSelectElement, label: string, options: any);
14
+ buildItem(option: HTMLOptionElement): any;
15
+ }
1
16
  export {};
@@ -1,4 +1,12 @@
1
- import { Module } from '../core/fluent-editor';
1
+ import { ThemeOptions } from 'quill/core/theme';
2
+ import { default as FluentEditor } from '../core/fluent-editor';
2
3
 
3
- declare const SnowTheme: typeof Module;
4
+ declare const OriginSnowTheme: any;
5
+ declare class SnowTheme extends OriginSnowTheme {
6
+ quill: FluentEditor;
7
+ constructor(quill: FluentEditor, options: ThemeOptions);
8
+ i18nTextToolbar(): void;
9
+ buildPickers(selects: NodeListOf<HTMLSelectElement>, icons: Record<string, string | Record<string, string>>): void;
10
+ extendToolbar(toolbar: any): void;
11
+ }
4
12
  export default SnowTheme;
@@ -5,8 +5,8 @@ export declare const BOLD_ICON = "<svg width=\"12px\" height=\"16px\" viewBox=\"
5
5
  export declare const ITALIC_ICON = "<svg width=\"9px\" height=\"16px\" viewBox=\"0 0 9 16\">\n<g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <g transform=\"translate(-4.000000, 0.000000)\" fill=\"#293040\">\n <path d=\"M10.2565501,1.5 L8.41332415,14.5 L12,14.5 L12,16 L4,16 L4,14.5 L6.90083611,14.5 L8.74406208,1.5 L5,1.5\n L5,0 L13,0 L13,1.5 L10.2565501,1.5 Z\"></path>\n </g>\n</g>\n</svg>";
6
6
  export declare const UNDERLINE_ICON = "<svg width=\"16px\" height=\"16px\" viewBox=\"0 0 16 16\">\n<g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <polygon fill=\"#293040\" points=\"2 14 14 14 14 16 2 16\"></polygon>\n <path d=\"M4.5,3 L4.5,7 C4.5,8.93299662 6.06700338,10.5 8,10.5 C9.93299662,10.5 11.5,8.93299662 11.5,7 L11.5,1.5\n L11.4998322,0 L13,0 L13,7 C13,9.76142375 10.7614237,12 8,12 C5.23857625,12 3,9.76142375 3,7 L3,0 L4.49893188,0\n L4.49893188,3 L4.5,3 Z\" fill=\"#293040\" fill-rule=\"nonzero\"></path>\n</g>\n</svg>";
7
7
  export declare const STRIKE_ICON = "<svg width=\"14px\" height=\"16px\" viewBox=\"0 0 14 16\">\n<g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <g transform=\"translate(-1.000000, 0.000000)\" fill=\"#293040\">\n <path d=\"M9.93321102,9 L1,9 L1,7 L3.84197169,7 C3.31015092,6.28495098 3,5.42507332 3,4.5 C3,2.01471863\n 5.23857625,0 8,0 C10.5736409,0 12.6931261,1.75002477 12.969484,4 L11.4507289,4 C11.1737591,2.60626201 9.76011738,1.5 8,1.5\n C6.03382604,1.5 4.5,2.88044344 4.5,4.5 C4.5,5.52604325 5.11562351,6.45611494 6.06678898,7 L15,7 L15,9 L12.1580283,9\n C12.6898491,9.71504902 13,10.5749267 13,11.5 C13,13.9852814 10.7614237,16 8,16 C5.42635908,16 3.30687393,14.2499752\n 3.03051599,12 L4.54927112,12 C4.82624092,13.393738 6.23988262,14.5 8,14.5 C9.96617396,14.5 11.5,13.1195566 11.5,11.5\n C11.5,10.4739568 10.8843765,9.54388506 9.93321102,9 Z\"></path>\n </g>\n</g>\n</svg>";
8
- export declare const COLOR_ICON = "<svg width=\"16px\" height=\"16px\" viewBox=\"0 0 16 16\">\n<g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <polygon fill=\"#293040\" points=\"2 14 14 14 14 16 2 16\"></polygon>\n <path d=\"M10.9166667,8.5 L5.08333333,8.5 L4.26618123,10.461165 L3.62338765,12 L2,12 L7,0 L9,0 L14,12 L12.3824972,12\n L11.5753038,10.0807292 L10.9166667,8.5 Z M10.2916667,7 L8,1.5 L5.70833333,7 L10.2916667,7 Z\"\n fill=\"#293040\" fill-rule=\"nonzero\"></path>\n</g>\n</svg>";
9
- export declare const BACKGROUND_COLOR_ICON = " <svg width=\"16px\" height=\"16px\" viewBox=\"0 0 16 16\">\n<g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <path d=\"M4.64447006,9.66583547 L3.17597929,8.33216965 L6.15933183,5.11039074 L5.42508645,4.44355783\n L9.39179153,1.0658141e-13 L16,6.00149616 L12.0332949,10.445054 L11.2990495,9.77822108 L8.31569698,13 L6.84720621,11.6663342\n L5.69344476,12.9587937 L2.36400649,12.9587937 L2,12.6282074 L4.64447006,9.66583547 Z M4.57134219,8.25840959\n L8.24256911,11.5925741 L10.5648041,9.11138818 L6.89357722,5.77722364 L4.57134219,8.25840959 Z M14.6046371,6.07525623\n L9.4649194,1.40742588 L6.82044935,4.36979777 L11.960167,9.03762811 L14.6046371,6.07525623 Z M2,14 L14,14 L14,16 L2,16 L2,14 Z\"\n fill=\"#293040\"></path>\n</g>\n</svg>";
8
+ export declare const COLOR_ICON = "<svg viewBox=\"0 0 16 16\">\n<g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <polygon class=\"ql-color-label\" points=\"2 14 14 14 14 16 2 16\"></polygon>\n <path d=\"M10.9166667,8.5 L5.08333333,8.5 L4.26618123,10.461165 L3.62338765,12 L2,12 L7,0 L9,0 L14,12 L12.3824972,12\n L11.5753038,10.0807292 L10.9166667,8.5 Z M10.2916667,7 L8,1.5 L5.70833333,7 L10.2916667,7 Z\"\n fill=\"#293040\" fill-rule=\"nonzero\"></path>\n</g>\n</svg>";
9
+ export declare const BACKGROUND_COLOR_ICON = "<svg viewBox=\"0 0 16 16\">\n<g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <polygon class=\"ql-color-label\" points=\"2 14 14 14 14 16 2 16\"></polygon>\n <path class=\"ql-color-label\" d=\"M4.64447006,9.66583547 L3.17597929,8.33216965 L6.15933183,5.11039074 L5.42508645,4.44355783\n L9.39179153,1.0658141e-13 L16,6.00149616 L12.0332949,10.445054 L11.2990495,9.77822108 L8.31569698,13 L6.84720621,11.6663342\n L5.69344476,12.9587937 L2.36400649,12.9587937 L2,12.6282074 L4.64447006,9.66583547 Z M4.57134219,8.25840959\n L8.24256911,11.5925741 L10.5648041,9.11138818 L6.89357722,5.77722364 L4.57134219,8.25840959 Z M14.6046371,6.07525623\n L9.4649194,1.40742588 L6.82044935,4.36979777 L11.960167,9.03762811 L14.6046371,6.07525623 Z\"\n fill=\"#293040\"></path>\n</g>\n</svg>";
10
10
  export declare const ALIGN_LEFT_ICON = "<svg width=\"16px\" height=\"16px\" viewBox=\"0 0 16 16\">\n<g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <path d=\"M0,0 L1.5,0 L1.5,16 L0,16 L0,0 Z M4,3 L13,3 L13,7 L4,7 L4,3 Z M5,4 L5,6 L12,6 L12,4 L5,4 Z M4,9 L16,9\n L16,13 L4,13 L4,9 Z M5,10 L5,12 L15,12 L15,10 L5,10 Z\" fill=\"#293040\"></path>\n</g>\n</svg>";
11
11
  export declare const ALIGN_CENTER_ICON = "<svg width=\"16px\" height=\"16px\" viewBox=\"0 0 16 16\">\n<g stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\">\n <path d=\"M8.75,7 L8.75,9 L16,9 L16,13 L8.75,13 L8.75,16 L7.25,16 L7.25,13 L0,13 L0,9 L7.25,9 L7.25,7 L2,7\n L2,3 L7.25,3 L7.25,0 L8.75,0 L8.75,3 L14,3 L14,7 L8.75,7 Z M1,10 L1,12 L15,12 L15,10 L1,10 Z M3,4 L3,6 L13,6\n L13,4 L3,4 Z\" fill=\"#293040\"></path>\n</g>\n</svg>";
12
12
  export declare const ALIGN_JUSTIFY_ICON = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"32\" height=\"32\" viewBox=\"0 0 15 15\"><path fill=\"none\" stroke=\"currentColor\" d=\"M0 3.5h15m-15 8h15m-15-4h15\"/></svg>";
@@ -2,3 +2,5 @@ export declare function isObject(value: unknown): value is object;
2
2
  export declare const isUndefined: (val: unknown) => val is undefined;
3
3
  export declare const isFunction: (val: unknown) => val is Function;
4
4
  export declare const isString: (val: unknown) => val is string;
5
+ export declare const isBoolean: (val: unknown) => val is boolean;
6
+ export declare const isArray: (arg: any) => arg is any[];
@@ -1,9 +0,0 @@
1
- const ON_WIKI_LINK_REMOVE = "wiki-link/remove";
2
- const ON_DOC_LINK_REMOVE = "doc-link/remove";
3
- const ON_WORK_ITEM_LINK_REMOVE = "work-item-link/remove";
4
- export {
5
- ON_DOC_LINK_REMOVE,
6
- ON_WIKI_LINK_REMOVE,
7
- ON_WORK_ITEM_LINK_REMOVE
8
- };
9
- //# sourceMappingURL=constants.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.es.js","sources":["../../../../src/modules/global-link/constants.ts"],"sourcesContent":["export const ON_WIKI_LINK_REMOVE = 'wiki-link/remove'\r\nexport const ON_DOC_LINK_REMOVE = 'doc-link/remove'\r\nexport const ON_WORK_ITEM_LINK_REMOVE = 'work-item-link/remove'\r\n"],"names":[],"mappings":"AAAO,MAAM,sBAAsB;AAC5B,MAAM,qBAAqB;AAC3B,MAAM,2BAA2B;"}
@@ -1,28 +0,0 @@
1
- import Quill from "quill";
2
- const BlockEmbed = Quill.imports["blots/block/embed"];
3
- class CustomerWidgetLink extends BlockEmbed {
4
- static create(value) {
5
- const node = super.create(value);
6
- node.setAttribute("data-widget-type", value.type);
7
- node.setAttribute("data-widget-id", value.id);
8
- node.setAttribute("src", value.value);
9
- return node;
10
- }
11
- static value(domNode) {
12
- return {
13
- type: domNode.getAttribute("data-widget-type"),
14
- id: domNode.getAttribute("data-widget-id"),
15
- value: domNode.getAttribute("src")
16
- };
17
- }
18
- constructor(scroll, domNode, data) {
19
- super(scroll, domNode, data);
20
- }
21
- }
22
- CustomerWidgetLink.blotName = "customer-widget-link";
23
- CustomerWidgetLink.tagName = "img";
24
- CustomerWidgetLink.className = "ql-customer-widget-link";
25
- export {
26
- CustomerWidgetLink as default
27
- };
28
- //# sourceMappingURL=customer-widget-link.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customer-widget-link.es.js","sources":["../../../../../src/modules/global-link/formats/customer-widget-link.ts"],"sourcesContent":["import Quill from 'quill'\r\n\r\nconst BlockEmbed = Quill.imports['blots/block/embed']\r\n\r\n// @dynamic\r\nclass CustomerWidgetLink extends BlockEmbed {\r\n static blotName: string\r\n static tagName: string\r\n static className: string\r\n\r\n static create(value) {\r\n const node = super.create(value)\r\n node.setAttribute('data-widget-type', value.type)\r\n node.setAttribute('data-widget-id', value.id)\r\n node.setAttribute('src', value.value)\r\n return node\r\n }\r\n\r\n static value(domNode) {\r\n return {\r\n type: domNode.getAttribute('data-widget-type'),\r\n id: domNode.getAttribute('data-widget-id'),\r\n value: domNode.getAttribute('src'),\r\n }\r\n }\r\n\r\n constructor(scroll, domNode, data) {\r\n super(scroll, domNode, data)\r\n }\r\n}\r\n\r\nCustomerWidgetLink.blotName = 'customer-widget-link'\r\nCustomerWidgetLink.tagName = 'img'\r\nCustomerWidgetLink.className = 'ql-customer-widget-link'\r\n\r\nexport default CustomerWidgetLink\r\n"],"names":[],"mappings":";AAEA,MAAM,aAAa,MAAM,QAAQ,mBAAmB;AAGpD,MAAM,2BAA2B,WAAW;AAAA,EAK1C,OAAO,OAAO,OAAO;AACb,UAAA,OAAO,MAAM,OAAO,KAAK;AAC1B,SAAA,aAAa,oBAAoB,MAAM,IAAI;AAC3C,SAAA,aAAa,kBAAkB,MAAM,EAAE;AACvC,SAAA,aAAa,OAAO,MAAM,KAAK;AAC7B,WAAA;AAAA,EAAA;AAAA,EAGT,OAAO,MAAM,SAAS;AACb,WAAA;AAAA,MACL,MAAM,QAAQ,aAAa,kBAAkB;AAAA,MAC7C,IAAI,QAAQ,aAAa,gBAAgB;AAAA,MACzC,OAAO,QAAQ,aAAa,KAAK;AAAA,IACnC;AAAA,EAAA;AAAA,EAGF,YAAY,QAAQ,SAAS,MAAM;AAC3B,UAAA,QAAQ,SAAS,IAAI;AAAA,EAAA;AAE/B;AAEA,mBAAmB,WAAW;AAC9B,mBAAmB,UAAU;AAC7B,mBAAmB,YAAY;"}
@@ -1,42 +0,0 @@
1
- import Quill from "quill";
2
- import { ON_DOC_LINK_REMOVE } from "../constants.es.js";
3
- const Embed = Quill.imports["blots/embed"];
4
- class DocumentLink extends Embed {
5
- static create(value) {
6
- const node = super.create(value);
7
- node.setAttribute("href", value.link);
8
- node.setAttribute("title", value.text);
9
- node.setAttribute("target", "_blank");
10
- node.setAttribute("icon-link", value.icon);
11
- const icon = document.createElement("span");
12
- icon.classList.add("ql-doc-link-icon");
13
- icon.style.background = `url(${value.icon}) no-repeat center`;
14
- icon.style.backgroundSize = "contain";
15
- node.insertAdjacentElement("afterbegin", icon);
16
- const text = document.createTextNode(value.text);
17
- node.appendChild(text);
18
- return node;
19
- }
20
- static value(domNode) {
21
- return {
22
- link: domNode.getAttribute("href"),
23
- icon: domNode.getAttribute("icon-link"),
24
- text: domNode.textContent
25
- };
26
- }
27
- constructor(scroll, domNode, data) {
28
- super(scroll, domNode, data);
29
- this.docData = data;
30
- }
31
- remove() {
32
- this.scroll.emitter.emit(ON_DOC_LINK_REMOVE, this.docData);
33
- return super.remove();
34
- }
35
- }
36
- DocumentLink.blotName = "doc-link";
37
- DocumentLink.tagName = "A";
38
- DocumentLink.className = "ql-doc-link";
39
- export {
40
- DocumentLink as default
41
- };
42
- //# sourceMappingURL=doc-link.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"doc-link.es.js","sources":["../../../../../src/modules/global-link/formats/doc-link.ts"],"sourcesContent":["import Quill from 'quill'\r\nimport { ON_DOC_LINK_REMOVE } from '../constants'\r\n\r\nconst Embed = Quill.imports['blots/embed']\r\n\r\n// @dynamic\r\nclass DocumentLink extends Embed {\r\n static blotName: string\r\n static tagName: string\r\n static className: string\r\n docData: any\r\n scroll: any\r\n\r\n static create(value) {\r\n const node = super.create(value)\r\n node.setAttribute('href', value.link)\r\n node.setAttribute('title', value.text)\r\n node.setAttribute('target', '_blank')\r\n node.setAttribute('icon-link', value.icon)\r\n\r\n const icon = document.createElement('span')\r\n icon.classList.add('ql-doc-link-icon')\r\n icon.style.background = `url(${value.icon}) no-repeat center`\r\n icon.style.backgroundSize = 'contain'\r\n\r\n node.insertAdjacentElement('afterbegin', icon)\r\n const text = document.createTextNode(value.text)\r\n node.appendChild(text)\r\n return node\r\n }\r\n\r\n static value(domNode) {\r\n return {\r\n link: domNode.getAttribute('href'),\r\n icon: domNode.getAttribute('icon-link'),\r\n text: domNode.textContent,\r\n }\r\n }\r\n\r\n constructor(scroll, domNode, data) {\r\n super(scroll, domNode, data)\r\n this.docData = data\r\n }\r\n\r\n remove() {\r\n this.scroll.emitter.emit(ON_DOC_LINK_REMOVE, this.docData)\r\n return super.remove()\r\n }\r\n}\r\n\r\nDocumentLink.blotName = 'doc-link'\r\nDocumentLink.tagName = 'A'\r\nDocumentLink.className = 'ql-doc-link'\r\n\r\nexport default DocumentLink\r\n"],"names":[],"mappings":";;AAGA,MAAM,QAAQ,MAAM,QAAQ,aAAa;AAGzC,MAAM,qBAAqB,MAAM;AAAA,EAO/B,OAAO,OAAO,OAAO;AACb,UAAA,OAAO,MAAM,OAAO,KAAK;AAC1B,SAAA,aAAa,QAAQ,MAAM,IAAI;AAC/B,SAAA,aAAa,SAAS,MAAM,IAAI;AAChC,SAAA,aAAa,UAAU,QAAQ;AAC/B,SAAA,aAAa,aAAa,MAAM,IAAI;AAEnC,UAAA,OAAO,SAAS,cAAc,MAAM;AACrC,SAAA,UAAU,IAAI,kBAAkB;AACrC,SAAK,MAAM,aAAa,OAAO,MAAM,IAAI;AACzC,SAAK,MAAM,iBAAiB;AAEvB,SAAA,sBAAsB,cAAc,IAAI;AAC7C,UAAM,OAAO,SAAS,eAAe,MAAM,IAAI;AAC/C,SAAK,YAAY,IAAI;AACd,WAAA;AAAA,EAAA;AAAA,EAGT,OAAO,MAAM,SAAS;AACb,WAAA;AAAA,MACL,MAAM,QAAQ,aAAa,MAAM;AAAA,MACjC,MAAM,QAAQ,aAAa,WAAW;AAAA,MACtC,MAAM,QAAQ;AAAA,IAChB;AAAA,EAAA;AAAA,EAGF,YAAY,QAAQ,SAAS,MAAM;AAC3B,UAAA,QAAQ,SAAS,IAAI;AAC3B,SAAK,UAAU;AAAA,EAAA;AAAA,EAGjB,SAAS;AACP,SAAK,OAAO,QAAQ,KAAK,oBAAoB,KAAK,OAAO;AACzD,WAAO,MAAM,OAAO;AAAA,EAAA;AAExB;AAEA,aAAa,WAAW;AACxB,aAAa,UAAU;AACvB,aAAa,YAAY;"}
@@ -1,34 +0,0 @@
1
- import Quill from "quill";
2
- import { ON_WIKI_LINK_REMOVE } from "../constants.es.js";
3
- const Embed = Quill.imports["blots/embed"];
4
- class WikiLink extends Embed {
5
- static create(value) {
6
- const node = super.create(value);
7
- node.setAttribute("href", value.link);
8
- node.setAttribute("target", "_blank");
9
- node.setAttribute("title", value.text);
10
- node.textContent = value.text;
11
- return node;
12
- }
13
- static value(domNode) {
14
- return {
15
- link: domNode.getAttribute("href"),
16
- text: domNode.textContent
17
- };
18
- }
19
- constructor(scroll, domNode, data) {
20
- super(scroll, domNode, data);
21
- this.wikiData = data;
22
- }
23
- remove() {
24
- this.scroll.emitter.emit(ON_WIKI_LINK_REMOVE, this.wikiData);
25
- return super.remove();
26
- }
27
- }
28
- WikiLink.blotName = "wiki-link";
29
- WikiLink.tagName = "A";
30
- WikiLink.className = "ql-wiki-link";
31
- export {
32
- WikiLink as default
33
- };
34
- //# sourceMappingURL=wiki-link.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"wiki-link.es.js","sources":["../../../../../src/modules/global-link/formats/wiki-link.ts"],"sourcesContent":["import Quill from 'quill'\r\nimport { ON_WIKI_LINK_REMOVE } from '../constants'\r\n\r\nconst Embed = Quill.imports['blots/embed']\r\n\r\n// @dynamic\r\nclass WikiLink extends Embed {\r\n static blotName: string\r\n static tagName: string\r\n static className: string\r\n wikiData: any\r\n scroll: any\r\n\r\n static create(value) {\r\n const node = super.create(value)\r\n node.setAttribute('href', value.link)\r\n node.setAttribute('target', '_blank')\r\n node.setAttribute('title', value.text)\r\n node.textContent = value.text\r\n return node\r\n }\r\n\r\n static value(domNode) {\r\n return {\r\n link: domNode.getAttribute('href'),\r\n text: domNode.textContent,\r\n }\r\n }\r\n\r\n constructor(scroll, domNode, data) {\r\n super(scroll, domNode, data)\r\n this.wikiData = data\r\n }\r\n\r\n remove() {\r\n this.scroll.emitter.emit(ON_WIKI_LINK_REMOVE, this.wikiData)\r\n return super.remove()\r\n }\r\n}\r\n\r\nWikiLink.blotName = 'wiki-link'\r\nWikiLink.tagName = 'A'\r\nWikiLink.className = 'ql-wiki-link'\r\n\r\nexport default WikiLink\r\n"],"names":[],"mappings":";;AAGA,MAAM,QAAQ,MAAM,QAAQ,aAAa;AAGzC,MAAM,iBAAiB,MAAM;AAAA,EAO3B,OAAO,OAAO,OAAO;AACb,UAAA,OAAO,MAAM,OAAO,KAAK;AAC1B,SAAA,aAAa,QAAQ,MAAM,IAAI;AAC/B,SAAA,aAAa,UAAU,QAAQ;AAC/B,SAAA,aAAa,SAAS,MAAM,IAAI;AACrC,SAAK,cAAc,MAAM;AAClB,WAAA;AAAA,EAAA;AAAA,EAGT,OAAO,MAAM,SAAS;AACb,WAAA;AAAA,MACL,MAAM,QAAQ,aAAa,MAAM;AAAA,MACjC,MAAM,QAAQ;AAAA,IAChB;AAAA,EAAA;AAAA,EAGF,YAAY,QAAQ,SAAS,MAAM;AAC3B,UAAA,QAAQ,SAAS,IAAI;AAC3B,SAAK,WAAW;AAAA,EAAA;AAAA,EAGlB,SAAS;AACP,SAAK,OAAO,QAAQ,KAAK,qBAAqB,KAAK,QAAQ;AAC3D,WAAO,MAAM,OAAO;AAAA,EAAA;AAExB;AAEA,SAAS,WAAW;AACpB,SAAS,UAAU;AACnB,SAAS,YAAY;"}
@@ -1,36 +0,0 @@
1
- import Quill from "quill";
2
- import { ON_WORK_ITEM_LINK_REMOVE } from "../constants.es.js";
3
- import { createTable } from "../utils/createTable.es.js";
4
- const BlockEmbed = Quill.imports["blots/block/embed"];
5
- class WorkItemLink extends BlockEmbed {
6
- static create(value) {
7
- const node = super.create(value);
8
- node.setAttribute("contenteditable", "false");
9
- node.setAttribute("href", value.link);
10
- node.setAttribute("__work_item_data__", JSON.stringify(value.data));
11
- const table = createTable(value.data);
12
- node.appendChild(table);
13
- return node;
14
- }
15
- static value(domNode) {
16
- return {
17
- link: domNode.getAttribute("href"),
18
- data: JSON.parse(domNode.getAttribute("__work_item_data__"))
19
- };
20
- }
21
- constructor(scroll, domNode, data) {
22
- super(scroll, domNode, data);
23
- this.workItemData = data;
24
- }
25
- remove() {
26
- this.scroll.emitter.emit(ON_WORK_ITEM_LINK_REMOVE, this.workItemData);
27
- return super.remove();
28
- }
29
- }
30
- WorkItemLink.blotName = "work-item-link";
31
- WorkItemLink.tagName = "div";
32
- WorkItemLink.className = "ql-work-item-link";
33
- export {
34
- WorkItemLink as default
35
- };
36
- //# sourceMappingURL=work-item-link.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"work-item-link.es.js","sources":["../../../../../src/modules/global-link/formats/work-item-link.ts"],"sourcesContent":["import Quill from 'quill'\r\nimport { ON_WORK_ITEM_LINK_REMOVE } from '../constants'\r\nimport { createTable } from '../utils/createTable'\r\n\r\nconst BlockEmbed = Quill.imports['blots/block/embed']\r\n\r\n// @dynamic\r\nclass WorkItemLink extends BlockEmbed {\r\n static blotName: string\r\n static tagName: string\r\n static className: string\r\n workItemData: any\r\n scroll: any\r\n\r\n static create(value) {\r\n const node = super.create(value)\r\n node.setAttribute('contenteditable', 'false')\r\n node.setAttribute('href', value.link)\r\n node.setAttribute('__work_item_data__', JSON.stringify(value.data))\r\n const table = createTable(value.data)\r\n node.appendChild(table)\r\n return node\r\n }\r\n\r\n static value(domNode) {\r\n return {\r\n link: domNode.getAttribute('href'),\r\n data: JSON.parse(domNode.getAttribute('__work_item_data__')),\r\n }\r\n }\r\n\r\n constructor(scroll, domNode, data) {\r\n super(scroll, domNode, data)\r\n this.workItemData = data\r\n }\r\n\r\n remove() {\r\n this.scroll.emitter.emit(ON_WORK_ITEM_LINK_REMOVE, this.workItemData)\r\n return super.remove()\r\n }\r\n}\r\n\r\nWorkItemLink.blotName = 'work-item-link'\r\nWorkItemLink.tagName = 'div'\r\nWorkItemLink.className = 'ql-work-item-link'\r\n\r\nexport default WorkItemLink\r\n"],"names":[],"mappings":";;;AAIA,MAAM,aAAa,MAAM,QAAQ,mBAAmB;AAGpD,MAAM,qBAAqB,WAAW;AAAA,EAOpC,OAAO,OAAO,OAAO;AACb,UAAA,OAAO,MAAM,OAAO,KAAK;AAC1B,SAAA,aAAa,mBAAmB,OAAO;AACvC,SAAA,aAAa,QAAQ,MAAM,IAAI;AACpC,SAAK,aAAa,sBAAsB,KAAK,UAAU,MAAM,IAAI,CAAC;AAC5D,UAAA,QAAQ,YAAY,MAAM,IAAI;AACpC,SAAK,YAAY,KAAK;AACf,WAAA;AAAA,EAAA;AAAA,EAGT,OAAO,MAAM,SAAS;AACb,WAAA;AAAA,MACL,MAAM,QAAQ,aAAa,MAAM;AAAA,MACjC,MAAM,KAAK,MAAM,QAAQ,aAAa,oBAAoB,CAAC;AAAA,IAC7D;AAAA,EAAA;AAAA,EAGF,YAAY,QAAQ,SAAS,MAAM;AAC3B,UAAA,QAAQ,SAAS,IAAI;AAC3B,SAAK,eAAe;AAAA,EAAA;AAAA,EAGtB,SAAS;AACP,SAAK,OAAO,QAAQ,KAAK,0BAA0B,KAAK,YAAY;AACpE,WAAO,MAAM,OAAO;AAAA,EAAA;AAExB;AAEA,aAAa,WAAW;AACxB,aAAa,UAAU;AACvB,aAAa,YAAY;"}
@@ -1,2 +0,0 @@
1
-
2
- //# sourceMappingURL=global-link-panel.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"global-link-panel.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,139 +0,0 @@
1
- import Quill from "quill";
2
- import { getEventComposedPath } from "../../config/editor.utils.es.js";
3
- import CustomerWidgetLink from "./formats/customer-widget-link.es.js";
4
- import DocumentLink from "./formats/doc-link.es.js";
5
- import WikiLink from "./formats/wiki-link.es.js";
6
- import WorkItemLink from "./formats/work-item-link.es.js";
7
- const Module = Quill.imports["core/module"];
8
- const Delta = Quill.imports.delta;
9
- class GlobalLink extends Module {
10
- static register() {
11
- Quill.register("formats/wiki-link", WikiLink);
12
- Quill.register("formats/doc-link", DocumentLink);
13
- Quill.register("formats/work-item-link", WorkItemLink);
14
- Quill.register("formats/customer-widget-link", CustomerWidgetLink);
15
- }
16
- constructor(quill, options) {
17
- super(quill, options);
18
- const toolbar = quill.getModule("toolbar");
19
- this.open = false;
20
- this.panel = options.component;
21
- this.wrap = options.wrap;
22
- const globalLinkBtn = toolbar.container && toolbar.container.querySelector(".ql-global-link");
23
- toolbar.addHandler("global-link", this.handleGlobalLinkButtonClick.bind(this));
24
- quill.root.addEventListener("click", this.onEditorClick.bind(this));
25
- document.body.addEventListener("click", (evt) => {
26
- if (!this.wrap.contains(evt.target) && !(globalLinkBtn && globalLinkBtn.contains(evt.target))) {
27
- this.open = false;
28
- this.wrap.classList.add("global-link-hide");
29
- }
30
- });
31
- this.panel.wikiLink.subscribe(this.addWikiLink.bind(this));
32
- this.panel.docLink.subscribe(this.addDocLink.bind(this));
33
- this.panel.workItemLink.subscribe(this.addWorkItemLink.bind(this));
34
- if (this.panel.close) {
35
- this.panel.close.subscribe(this.closePanel.bind(this));
36
- }
37
- }
38
- onEditorClick(evt) {
39
- if (!evt.ctrlKey) return;
40
- const path = getEventComposedPath(evt);
41
- if (!path || path.length <= 0) return;
42
- const linkNode = path.filter((node) => {
43
- return node.classList && (node.classList.contains(WikiLink.className) || node.classList.contains(DocumentLink.className) || node.classList.contains(WorkItemLink.className));
44
- })[0];
45
- if (!linkNode) return;
46
- if (linkNode.classList.contains(WikiLink.className)) {
47
- this.handleLinkClick(linkNode);
48
- } else if (linkNode.classList.contains(DocumentLink.className)) {
49
- this.handleLinkClick(linkNode);
50
- } else if (linkNode.classList.contains(WorkItemLink.className)) {
51
- const tableRow = path.filter((node) => {
52
- return node.tagName && node.tagName.toUpperCase() === "TR";
53
- })[0];
54
- if (tableRow) {
55
- this.handleLinkClick(tableRow);
56
- }
57
- }
58
- }
59
- handleLinkClick(linkNode) {
60
- const href = linkNode.getAttribute("href");
61
- if (href) {
62
- window.open(href);
63
- }
64
- }
65
- handleGlobalLinkButtonClick(_value) {
66
- this.open = !this.open;
67
- this.triggerPanel();
68
- }
69
- triggerPanel() {
70
- if (this.open) {
71
- this.wrap.classList.remove("global-link-hide");
72
- } else {
73
- this.wrap.classList.add("global-link-hide");
74
- }
75
- }
76
- addWikiLink(wikiData) {
77
- const index = this.quill.getSelection(true).index;
78
- const arr = [];
79
- const delta = arr.reduce.call(wikiData, (op, wiki) => {
80
- op.insert({
81
- [WikiLink.blotName]: {
82
- link: wiki.link,
83
- text: wiki.text
84
- }
85
- });
86
- return op;
87
- }, new Delta().retain(index));
88
- this.quill.updateContents(delta, Quill.sources.USER);
89
- this.quill.setSelection(index + 1, Quill.sources.USER);
90
- if (this.panel.autoClose) {
91
- this.closePanel();
92
- }
93
- }
94
- addDocLink(docData) {
95
- const index = this.quill.getSelection(true).index;
96
- const arr = [];
97
- const delta = arr.reduce.call(docData, (op, doc) => {
98
- op.insert({
99
- [DocumentLink.blotName]: {
100
- link: doc.link,
101
- text: doc.text,
102
- icon: doc.icon
103
- }
104
- });
105
- return op;
106
- }, new Delta().retain(index));
107
- this.quill.updateContents(delta, Quill.sources.USER);
108
- this.quill.setSelection(index + 1, Quill.sources.USER);
109
- if (this.panel.autoClose) {
110
- this.closePanel();
111
- }
112
- }
113
- addWorkItemLink(workItemData) {
114
- const index = this.quill.getSelection(true).index;
115
- const arr = [];
116
- const delta = arr.reduce.call(workItemData, (op, workItem) => {
117
- op.insert({
118
- [WorkItemLink.blotName]: {
119
- link: workItem.url,
120
- data: workItem.table
121
- }
122
- });
123
- return op;
124
- }, new Delta().retain(index));
125
- this.quill.updateContents(delta, Quill.sources.USER);
126
- this.quill.setSelection(index + 1, Quill.sources.USER);
127
- if (this.panel.autoClose) {
128
- this.closePanel();
129
- }
130
- }
131
- closePanel() {
132
- this.open = false;
133
- this.triggerPanel();
134
- }
135
- }
136
- export {
137
- GlobalLink as default
138
- };
139
- //# sourceMappingURL=index.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.es.js","sources":["../../../../src/modules/global-link/index.ts"],"sourcesContent":["import Quill from 'quill'\r\nimport { getEventComposedPath } from '../../config/editor.utils'\r\nimport CustomerWidgetLink from './formats/customer-widget-link'\r\nimport DocumentLink from './formats/doc-link'\r\nimport WikiLink from './formats/wiki-link'\r\nimport WorkItemLink from './formats/work-item-link'\r\n\r\nconst Module = Quill.imports['core/module']\r\nconst Delta = Quill.imports.delta\r\n\r\n// @dynamic\r\nclass GlobalLink extends Module {\r\n open: boolean\r\n wrap: any\r\n panel: any\r\n quill: any\r\n\r\n static register() {\r\n Quill.register('formats/wiki-link', WikiLink)\r\n Quill.register('formats/doc-link', DocumentLink)\r\n Quill.register('formats/work-item-link', WorkItemLink)\r\n Quill.register('formats/customer-widget-link', CustomerWidgetLink)\r\n }\r\n\r\n constructor(quill, options) {\r\n super(quill, options)\r\n const toolbar = quill.getModule('toolbar')\r\n this.open = false\r\n this.panel = options.component\r\n this.wrap = options.wrap\r\n const globalLinkBtn = toolbar.container && toolbar.container.querySelector('.ql-global-link')\r\n toolbar.addHandler('global-link', this.handleGlobalLinkButtonClick.bind(this))\r\n quill.root.addEventListener('click', this.onEditorClick.bind(this))\r\n document.body.addEventListener('click', (evt) => {\r\n if (!this.wrap.contains(evt.target) && !(globalLinkBtn && globalLinkBtn.contains(evt.target))) {\r\n this.open = false\r\n this.wrap.classList.add('global-link-hide')\r\n }\r\n })\r\n this.panel.wikiLink.subscribe(this.addWikiLink.bind(this))\r\n this.panel.docLink.subscribe(this.addDocLink.bind(this))\r\n this.panel.workItemLink.subscribe(this.addWorkItemLink.bind(this))\r\n if (this.panel.close) {\r\n this.panel.close.subscribe(this.closePanel.bind(this))\r\n }\r\n }\r\n\r\n onEditorClick(evt: any) {\r\n if (!evt.ctrlKey) return\r\n const path = getEventComposedPath(evt)\r\n if (!path || path.length <= 0) return\r\n const linkNode = path.filter((node) => {\r\n return node.classList && (node.classList.contains(WikiLink.className)\r\n || node.classList.contains(DocumentLink.className)\r\n || node.classList.contains(WorkItemLink.className))\r\n })[0]\r\n\r\n if (!linkNode) return\r\n\r\n if (linkNode.classList.contains(WikiLink.className)) {\r\n this.handleLinkClick(linkNode)\r\n }\r\n else if (linkNode.classList.contains(DocumentLink.className)) {\r\n this.handleLinkClick(linkNode)\r\n }\r\n else if (linkNode.classList.contains(WorkItemLink.className)) {\r\n const tableRow = path.filter((node) => {\r\n return node.tagName && node.tagName.toUpperCase() === 'TR'\r\n })[0]\r\n\r\n if (tableRow) {\r\n this.handleLinkClick(tableRow)\r\n }\r\n }\r\n }\r\n\r\n handleLinkClick(linkNode) {\r\n const href = linkNode.getAttribute('href')\r\n if (href) {\r\n window.open(href)\r\n }\r\n }\r\n\r\n handleGlobalLinkButtonClick(_value) {\r\n this.open = !this.open\r\n this.triggerPanel()\r\n }\r\n\r\n triggerPanel() {\r\n if (this.open) {\r\n this.wrap.classList.remove('global-link-hide')\r\n }\r\n else {\r\n this.wrap.classList.add('global-link-hide')\r\n }\r\n }\r\n\r\n addWikiLink(wikiData) {\r\n const index = this.quill.getSelection(true).index\r\n const arr: { link: any, text: any } [] = []\r\n const delta = arr.reduce.call(wikiData, (op: any, wiki) => {\r\n op.insert({\r\n [WikiLink.blotName]: {\r\n link: wiki.link,\r\n text: wiki.text,\r\n },\r\n })\r\n return op\r\n }, new Delta().retain(index))\r\n\r\n this.quill.updateContents(delta, Quill.sources.USER)\r\n this.quill.setSelection(index + 1, Quill.sources.USER)\r\n if (this.panel.autoClose) {\r\n this.closePanel()\r\n }\r\n }\r\n\r\n addDocLink(docData) {\r\n const index = this.quill.getSelection(true).index\r\n const arr: { link: any, text: any, icon: any } [] = []\r\n const delta = arr.reduce.call(docData, (op: any, doc) => {\r\n op.insert({\r\n [DocumentLink.blotName]: {\r\n link: doc.link,\r\n text: doc.text,\r\n icon: doc.icon,\r\n },\r\n })\r\n return op\r\n }, new Delta().retain(index))\r\n\r\n this.quill.updateContents(delta, Quill.sources.USER)\r\n this.quill.setSelection(index + 1, Quill.sources.USER)\r\n if (this.panel.autoClose) {\r\n this.closePanel()\r\n }\r\n }\r\n\r\n addWorkItemLink(workItemData) {\r\n const index = this.quill.getSelection(true).index\r\n const arr: { url: any, table: any } [] = []\r\n const delta = arr.reduce.call(workItemData, (op: any, workItem) => {\r\n op.insert({\r\n [WorkItemLink.blotName]: {\r\n link: workItem.url,\r\n data: workItem.table,\r\n },\r\n })\r\n return op\r\n }, new Delta().retain(index))\r\n\r\n this.quill.updateContents(delta, Quill.sources.USER)\r\n this.quill.setSelection(index + 1, Quill.sources.USER)\r\n if (this.panel.autoClose) {\r\n this.closePanel()\r\n }\r\n }\r\n\r\n closePanel() {\r\n this.open = false\r\n this.triggerPanel()\r\n }\r\n}\r\n\r\nexport default GlobalLink\r\n"],"names":[],"mappings":";;;;;;AAOA,MAAM,SAAS,MAAM,QAAQ,aAAa;AAC1C,MAAM,QAAQ,MAAM,QAAQ;AAG5B,MAAM,mBAAmB,OAAO;AAAA,EAM9B,OAAO,WAAW;AACV,UAAA,SAAS,qBAAqB,QAAQ;AACtC,UAAA,SAAS,oBAAoB,YAAY;AACzC,UAAA,SAAS,0BAA0B,YAAY;AAC/C,UAAA,SAAS,gCAAgC,kBAAkB;A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AACZ,SAAK,aAAa;AAAA,EAAA;AAEtB;"}
@@ -1,50 +0,0 @@
1
- const tableConfig = [
2
- { title: "Number", field: "id", width: "100" },
3
- { title: "Title", field: "subject", width: "200" },
4
- { title: "Priority", field: "priority", width: "100" },
5
- { title: "Iteration", field: "iteration", width: "100" },
6
- { title: "Status", field: "status", width: "100" },
7
- { title: "Conductor", field: "assigned_to", width: "100" }
8
- ];
9
- function createTable(data) {
10
- const table = document.createElement("table");
11
- createColGroup(table);
12
- createTableHead(table);
13
- createTableBody(table, data);
14
- return table;
15
- }
16
- function createColGroup(table) {
17
- const colGroup = document.createElement("colgroup");
18
- tableConfig.forEach(({ width }) => {
19
- const col = document.createElement("col");
20
- col.setAttribute("width", width);
21
- colGroup.appendChild(col);
22
- });
23
- table.insertAdjacentElement("afterbegin", colGroup);
24
- }
25
- function createTableHead(table) {
26
- const tHead = table.createTHead();
27
- const tRow = tHead.insertRow();
28
- tableConfig.forEach(({ title }) => {
29
- const tCell = tRow.insertCell();
30
- tCell.textContent = title;
31
- });
32
- return tHead;
33
- }
34
- function createTableBody(table, data) {
35
- const tBody = table.createTBody();
36
- [].forEach.call(data, (d) => {
37
- const tRow = tBody.insertRow();
38
- tRow.setAttribute("href", d.url);
39
- tableConfig.forEach(({ field }) => {
40
- const tCell = tRow.insertCell();
41
- tCell.classList.add(`work-item-${field}`);
42
- tCell.textContent = d[field];
43
- });
44
- });
45
- return tBody;
46
- }
47
- export {
48
- createTable
49
- };
50
- //# sourceMappingURL=createTable.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createTable.es.js","sources":["../../../../../src/modules/global-link/utils/createTable.ts"],"sourcesContent":["const tableConfig = [\r\n { title: 'Number', field: 'id', width: '100' },\r\n { title: 'Title', field: 'subject', width: '200' },\r\n { title: 'Priority', field: 'priority', width: '100' },\r\n { title: 'Iteration', field: 'iteration', width: '100' },\r\n { title: 'Status', field: 'status', width: '100' },\r\n { title: 'Conductor', field: 'assigned_to', width: '100' },\r\n]\r\n\r\nexport function createTable(data: any[]) {\r\n const table = document.createElement<'table'>('table')\r\n createColGroup(table)\r\n createTableHead(table)\r\n createTableBody(table, data)\r\n return table\r\n}\r\n\r\nfunction createColGroup(table: HTMLTableElement) {\r\n const colGroup = document.createElement<'colgroup'>('colgroup')\r\n tableConfig.forEach(({ width }) => {\r\n const col = document.createElement<'col'>('col')\r\n col.setAttribute('width', width)\r\n colGroup.appendChild(col)\r\n })\r\n table.insertAdjacentElement('afterbegin', colGroup)\r\n}\r\n\r\nfunction createTableHead(table: HTMLTableElement) {\r\n const tHead = table.createTHead()\r\n const tRow = tHead.insertRow()\r\n tableConfig.forEach(({ title }) => {\r\n const tCell = tRow.insertCell()\r\n tCell.textContent = title\r\n })\r\n return tHead\r\n}\r\n\r\nfunction createTableBody(table: HTMLTableElement, data: any[]) {\r\n const tBody = table.createTBody();\r\n\r\n [].forEach.call(data, (d) => {\r\n const tRow = tBody.insertRow()\r\n // @ts-ignore\r\n tRow.setAttribute('href', d.url)\r\n tableConfig.forEach(({ field }) => {\r\n const tCell = tRow.insertCell()\r\n tCell.classList.add(`work-item-${field}`)\r\n // @ts-ignore\r\n tCell.textContent = d[field]\r\n })\r\n })\r\n\r\n return tBody\r\n}\r\n"],"names":[],"mappings":"AAAA,MAAM,cAAc;AAAA,EAClB,EAAE,OAAO,UAAU,OAAO,MAAM,OAAO,MAAM;AAAA,EAC7C,EAAE,OAAO,SAAS,OAAO,WAAW,OAAO,MAAM;AAAA,EACjD,EAAE,OAAO,YAAY,OAAO,YAAY,OAAO,MAAM;AAAA,EACrD,EAAE,OAAO,aAAa,OAAO,aAAa,OAAO,MAAM;AAAA,EACvD,EAAE,OAAO,UAAU,OAAO,UAAU,OAAO,MAAM;AAAA,EACjD,EAAE,OAAO,aAAa,OAAO,eAAe,OAAO,MAAM;AAC3D;AAEO,SAAS,YAAY,MAAa;AACjC,QAAA,QAAQ,SAAS,cAAuB,OAAO;AACrD,iBAAe,KAAK;AACpB,kBAAgB,KAAK;AACrB,kBAAgB,OAAO,IAAI;AACpB,SAAA;AACT;AAEA,SAAS,eAAe,OAAyB;AACzC,QAAA,WAAW,SAAS,cAA0B,UAAU;AAC9D,cAAY,QAAQ,CAAC,EAAE,YAAY;AAC3B,UAAA,MAAM,SAAS,cAAqB,KAAK;AAC3C,QAAA,aAAa,SAAS,KAAK;AAC/B,aAAS,YAAY,GAAG;AAAA,EAAA,CACzB;AACK,QAAA,sBAAsB,cAAc,QAAQ;AACpD;AAEA,SAAS,gBAAgB,OAAyB;AAC1C,QAAA,QAAQ,MAAM,YAAY;AAC1B,QAAA,OAAO,MAAM,UAAU;AAC7B,cAAY,QAAQ,CAAC,EAAE,YAAY;AAC3B,UAAA,QAAQ,KAAK,WAAW;AAC9B,UAAM,cAAc;AAAA,EAAA,CACrB;AACM,SAAA;AACT;AAEA,SAAS,gBAAgB,OAAyB,MAAa;AACvD,QAAA,QAAQ,MAAM,YAAY;AAEhC,GAAA,EAAG,QAAQ,KAAK,MAAM,CAAC,MAAM;AACrB,UAAA,OAAO,MAAM,UAAU;AAExB,SAAA,aAAa,QAAQ,EAAE,GAAG;AAC/B,gBAAY,QAAQ,CAAC,EAAE,YAAY;AAC3B,YAAA,QAAQ,KAAK,WAAW;AAC9B,YAAM,UAAU,IAAI,aAAa,KAAK,EAAE;AAElC,YAAA,cAAc,EAAE,KAAK;AAAA,IAAA,CAC5B;AAAA,EAAA,CACF;AAEM,SAAA;AACT;"}
@@ -1,82 +0,0 @@
1
- class QuickMenu {
2
- // @ts-ignore
3
- constructor(quill, options) {
4
- this.quill = quill;
5
- this.options = options;
6
- this.handleSlashKeyDown = (_range, context) => {
7
- const index = this.quill.selection.savedRange.index;
8
- this.quill.insertText(index, "/");
9
- const shouldTriggerQuickMenu = context.prefix === "" && Object.keys(context.format).length === 0;
10
- if (shouldTriggerQuickMenu) {
11
- const cursorIndex = this.quill.selection.savedRange.index;
12
- const cursorBounds = this.quill.getBounds(cursorIndex);
13
- const { left, top } = cursorBounds;
14
- const { left: editorLeft, top: editorTop } = this.container.getBoundingClientRect();
15
- const { left: hostElementLeft, top: hostElementTop } = this.hostElement.getBoundingClientRect();
16
- const relativeLeft = editorLeft - hostElementLeft;
17
- const relativeTop = editorTop - hostElementTop;
18
- const menuLeft = left + relativeLeft - 5;
19
- const menuTop = top + relativeTop + 20;
20
- this.quickMenu.style.display = "block";
21
- const zIndex = this.quill.options.modules.quickmenu.zIndex;
22
- let style = `left:${menuLeft}px;top:${menuTop}px;`;
23
- if (zIndex || zIndex === 0) {
24
- style += `z-index:${zIndex}`;
25
- }
26
- this.quickMenuContainer.setAttribute("style", style);
27
- this.options.component.activeIndex = 0;
28
- } else {
29
- this.quickMenu.style.display = "none";
30
- }
31
- };
32
- this.hideQuickMenu = (event) => {
33
- if (this.quickMenuContainer && !this.quickMenuContainer.contains(event.target)) {
34
- this.quickMenuContainer.style.display = "none";
35
- }
36
- };
37
- this.handleArrowUpKey = (_range, _context) => {
38
- if (this.isOpen()) {
39
- const index = this.options.component.activeIndex;
40
- const total = this.options.component.quickMenus.length;
41
- this.options.component.activeIndex = (index + total - 1) % total;
42
- return false;
43
- }
44
- return true;
45
- };
46
- this.handleArrowDownKey = (_range, _context) => {
47
- if (this.isOpen()) {
48
- const index = this.options.component.activeIndex;
49
- const total = this.options.component.quickMenus.length;
50
- this.options.component.activeIndex = (index + 1) % total;
51
- return false;
52
- }
53
- return true;
54
- };
55
- this.handleEnterKey = (_range, _context) => {
56
- if (this.isOpen()) {
57
- this.options.component.onEnter();
58
- return false;
59
- }
60
- return true;
61
- };
62
- this.quill = quill;
63
- this.options = options;
64
- this.container = this.quill.container;
65
- this.hostElement = this.container.parentNode;
66
- this.quickMenu = this.hostElement.querySelector(".quick-menu");
67
- this.quickMenuContainer = this.quickMenu.querySelector(".quick-menu-container");
68
- quill.keyboard.addBinding({ key: "/" }, this.handleSlashKeyDown);
69
- quill.keyboard.addBinding({ key: "ArrowUp" }, this.handleArrowUpKey);
70
- quill.keyboard.addBinding({ key: "ArrowDown" }, this.handleArrowDownKey);
71
- quill.keyboard.addBinding({ key: "Enter" }, this.handleEnterKey);
72
- quill.keyboard.bindings.Enter.unshift(quill.keyboard.bindings.Enter.pop());
73
- document.body.addEventListener("click", this.hideQuickMenu.bind(this));
74
- }
75
- isOpen() {
76
- return this.quickMenuContainer.style.display !== "none" && this.quickMenu.style.display === "block";
77
- }
78
- }
79
- export {
80
- QuickMenu as default
81
- };
82
- //# sourceMappingURL=quick-menu.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"quick-menu.es.js","sources":["../../../src/modules/quick-menu.ts"],"sourcesContent":["import type Quill from 'quill'\r\n\r\ninterface QuickMenuOptions {\r\n container: string\r\n component: any\r\n}\r\n\r\nclass QuickMenu {\r\n private container: HTMLDivElement\r\n private hostElement: HTMLDivElement\r\n private quickMenu: HTMLDivElement\r\n private quickMenuContainer: HTMLDivElement\r\n\r\n // @ts-ignore\r\n constructor(private quill: Quill, private options: QuickMenuOptions) {\r\n this.quill = quill\r\n this.options = options\r\n this.container = this.quill.container\r\n this.hostElement = this.container.parentNode as HTMLDivElement\r\n this.quickMenu = this.hostElement.querySelector('.quick-menu')\r\n this.quickMenuContainer = this.quickMenu.querySelector('.quick-menu-container')\r\n quill.keyboard.addBinding({ key: '/' }, this.handleSlashKeyDown)\r\n quill.keyboard.addBinding({ key: 'ArrowUp' }, this.handleArrowUpKey)\r\n quill.keyboard.addBinding({ key: 'ArrowDown' }, this.handleArrowDownKey)\r\n quill.keyboard.addBinding({ key: 'Enter' }, this.handleEnterKey)\r\n quill.keyboard.bindings.Enter.unshift(quill.keyboard.bindings.Enter.pop())\r\n document.body.addEventListener('click', this.hideQuickMenu.bind(this))\r\n }\r\n\r\n handleSlashKeyDown = (_range, context) => {\r\n const index = this.quill.selection.savedRange.index\r\n this.quill.insertText(index, '/')\r\n\r\n // 一行的第一个字符为 '/',且没有格式化,则触发快捷菜单\r\n const shouldTriggerQuickMenu = context.prefix === '' && Object.keys(context.format).length === 0\r\n if (shouldTriggerQuickMenu) {\r\n const cursorIndex = this.quill.selection.savedRange.index\r\n const cursorBounds = this.quill.getBounds(cursorIndex)\r\n const { left, top } = cursorBounds\r\n const { left: editorLeft, top: editorTop } = this.container.getBoundingClientRect()\r\n const { left: hostElementLeft, top: hostElementTop } = this.hostElement.getBoundingClientRect()\r\n const relativeLeft = editorLeft - hostElementLeft\r\n const relativeTop = editorTop - hostElementTop\r\n const menuLeft = left + relativeLeft - 5\r\n const menuTop = top + relativeTop + 20\r\n\r\n this.quickMenu.style.display = 'block'\r\n const zIndex = this.quill.options.modules.quickmenu.zIndex\r\n let style = `left:${menuLeft}px;top:${menuTop}px;`\r\n if (zIndex || zIndex === 0) {\r\n style += `z-index:${zIndex}`\r\n }\r\n this.quickMenuContainer.setAttribute('style', style)\r\n this.options.component.activeIndex = 0\r\n }\r\n else {\r\n this.quickMenu.style.display = 'none'\r\n }\r\n }\r\n\r\n private isOpen() {\r\n return this.quickMenuContainer.style.display !== 'none' && this.quickMenu.style.display === 'block'\r\n }\r\n\r\n hideQuickMenu = (event) => {\r\n if (this.quickMenuContainer && !this.quickMenuContainer.contains(event.target)) {\r\n this.quickMenuContainer.style.display = 'none'\r\n }\r\n }\r\n\r\n handleArrowUpKey = (_range, _context) => {\r\n if (this.isOpen()) {\r\n const index = this.options.component.activeIndex\r\n const total = this.options.component.quickMenus.length\r\n this.options.component.activeIndex = (index + total - 1) % total\r\n return false\r\n }\r\n return true\r\n }\r\n\r\n handleArrowDownKey = (_range, _context) => {\r\n if (this.isOpen()) {\r\n const index = this.options.component.activeIndex\r\n const total = this.options.component.quickMenus.length\r\n this.options.component.activeIndex = (index + 1) % total\r\n return false\r\n }\r\n return true\r\n }\r\n\r\n handleEnterKey = (_range, _context) => {\r\n if (this.isOpen()) {\r\n this.options.component.onEnter()\r\n return false\r\n }\r\n return true\r\n }\r\n}\r\n\r\nexport default QuickMenu\r\n"],"names":[],"mappings":"AAOA,MAAM,UAAU;AAA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