md-editor-v3 3.0.1 → 4.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/README.md +131 -95
  2. package/lib/cjs/DropdownToolbar.cjs +1 -0
  3. package/lib/cjs/MdCatalog.cjs +1 -0
  4. package/lib/cjs/MdEditor.cjs +60 -0
  5. package/lib/cjs/MdPreview.cjs +1 -0
  6. package/lib/cjs/ModalToolbar.cjs +1 -0
  7. package/lib/cjs/NormalToolbar.cjs +1 -0
  8. package/lib/cjs/chunks/config.cjs +1 -0
  9. package/lib/cjs/chunks/dom.cjs +1 -0
  10. package/lib/cjs/chunks/event-bus.cjs +1 -0
  11. package/lib/cjs/chunks/index.cjs +8 -0
  12. package/lib/cjs/chunks/index2.cjs +1 -0
  13. package/lib/cjs/chunks/index3.cjs +1 -0
  14. package/lib/cjs/chunks/index4.cjs +2 -0
  15. package/lib/cjs/chunks/vue-tsx.cjs +1 -0
  16. package/lib/cjs/config.cjs +1 -0
  17. package/lib/cjs/index.cjs +1 -0
  18. package/lib/es/DropdownToolbar.mjs +7 -0
  19. package/lib/es/MdCatalog.mjs +215 -0
  20. package/lib/es/MdEditor.mjs +2286 -0
  21. package/lib/es/MdPreview.mjs +15 -0
  22. package/lib/es/ModalToolbar.mjs +9 -0
  23. package/lib/es/NormalToolbar.mjs +39 -0
  24. package/lib/es/chunks/config.mjs +271 -0
  25. package/lib/es/chunks/dom.mjs +32 -0
  26. package/lib/es/chunks/event-bus.mjs +38 -0
  27. package/lib/es/chunks/index.mjs +1061 -0
  28. package/lib/es/chunks/index2.mjs +135 -0
  29. package/lib/es/chunks/index3.mjs +229 -0
  30. package/lib/es/chunks/index4.mjs +57 -0
  31. package/lib/es/chunks/vue-tsx.mjs +11 -0
  32. package/lib/es/config.mjs +4 -0
  33. package/lib/es/index.mjs +35 -0
  34. package/lib/preview.css +1 -0
  35. package/lib/style.css +1 -1
  36. package/lib/types/DropdownToolbar/index.d.ts +129 -0
  37. package/lib/{MdEditor/extensions → types}/MdCatalog/CatalogLink.d.ts +4 -4
  38. package/lib/{MdEditor/extensions/MdCatalog/index.d.ts → types/MdCatalog/MdCatalog.d.ts} +3 -3
  39. package/lib/types/MdCatalog/index.d.ts +193 -0
  40. package/lib/{MdEditor → types/MdEditor}/Editor.d.ts +153 -162
  41. package/lib/types/MdEditor/components/Checkbox/index.d.ts +24 -0
  42. package/lib/types/MdEditor/components/Divider/index.d.ts +2 -0
  43. package/lib/types/MdEditor/components/Dropdown/index.d.ts +53 -0
  44. package/lib/types/MdEditor/components/Modal/index.d.ts +84 -0
  45. package/lib/types/MdEditor/composition.d.ts +66 -0
  46. package/lib/{MdEditor → types/MdEditor}/index.d.ts +343 -388
  47. package/lib/types/MdEditor/layouts/Content/ContentPreview.d.ts +154 -0
  48. package/lib/types/MdEditor/layouts/Content/codemirror/commands.d.ts +4 -0
  49. package/lib/types/MdEditor/layouts/Content/codemirror/index.d.ts +56 -0
  50. package/lib/types/MdEditor/layouts/Content/codemirror/themeLight.d.ts +23 -0
  51. package/lib/types/MdEditor/layouts/Content/codemirror/themeOneDark.d.ts +26 -0
  52. package/lib/types/MdEditor/layouts/Content/composition/index.d.ts +6 -0
  53. package/lib/types/MdEditor/layouts/Content/composition/useAttach.d.ts +7 -0
  54. package/lib/types/MdEditor/layouts/Content/composition/useAutoScroll.d.ts +5 -0
  55. package/lib/types/MdEditor/layouts/Content/composition/useCodeMirror.d.ts +13 -0
  56. package/lib/types/MdEditor/layouts/Content/composition/useCopyCode.d.ts +4 -0
  57. package/lib/types/MdEditor/layouts/Content/composition/useHighlight.d.ts +8 -0
  58. package/lib/types/MdEditor/layouts/Content/composition/useKatex.d.ts +8 -0
  59. package/lib/types/MdEditor/layouts/Content/composition/useMarkdownIt.d.ts +5 -0
  60. package/lib/types/MdEditor/layouts/Content/composition/useMermaid.d.ts +11 -0
  61. package/lib/types/MdEditor/layouts/Content/composition/usePasteUpload.d.ts +6 -0
  62. package/lib/types/MdEditor/layouts/Content/composition/userZoom.d.ts +10 -0
  63. package/lib/types/MdEditor/layouts/Content/index.d.ts +173 -0
  64. package/lib/types/MdEditor/layouts/Content/markdownIt/admonition/index.d.ts +5 -0
  65. package/lib/types/MdEditor/layouts/Content/markdownIt/codetabs/index.d.ts +14 -0
  66. package/lib/types/MdEditor/layouts/Content/markdownIt/heading/index.d.ts +9 -0
  67. package/lib/types/MdEditor/layouts/Content/markdownIt/katex/index.d.ts +10 -0
  68. package/lib/types/MdEditor/layouts/Content/markdownIt/mermaid/index.d.ts +6 -0
  69. package/lib/types/MdEditor/layouts/Content/props.d.ts +89 -0
  70. package/lib/types/MdEditor/layouts/Footer/MarkdownTotal.d.ts +15 -0
  71. package/lib/types/MdEditor/layouts/Footer/ScrollAuto.d.ts +21 -0
  72. package/lib/types/MdEditor/layouts/Footer/index.d.ts +50 -0
  73. package/lib/types/MdEditor/layouts/Modals/Clip.d.ts +33 -0
  74. package/lib/types/MdEditor/layouts/Modals/Link.d.ts +42 -0
  75. package/lib/types/MdEditor/layouts/Modals/index.d.ts +51 -0
  76. package/lib/types/MdEditor/layouts/Toolbar/TableShape.d.ts +28 -0
  77. package/lib/types/MdEditor/layouts/Toolbar/composition.d.ts +4 -0
  78. package/lib/types/MdEditor/layouts/Toolbar/index.d.ts +91 -0
  79. package/lib/types/MdEditor/layouts/Toolbar/props.d.ts +45 -0
  80. package/lib/types/MdEditor/props.d.ts +546 -0
  81. package/lib/types/MdEditor/static/event-name.d.ts +9 -0
  82. package/lib/{MdEditor → types/MdEditor}/type.d.ts +2 -1
  83. package/lib/types/MdEditor/utils/content-help.d.ts +19 -0
  84. package/lib/types/MdEditor/utils/dom.d.ts +22 -0
  85. package/lib/types/MdEditor/utils/event-bus.d.ts +17 -0
  86. package/lib/types/MdEditor/utils/index.d.ts +66 -0
  87. package/lib/types/MdEditor/utils/scroll-auto.d.ts +18 -0
  88. package/lib/types/MdEditor/utils/smooth-scroll.d.ts +8 -0
  89. package/lib/types/MdEditor/utils/vue-tsx.d.ts +23 -0
  90. package/lib/types/MdPreview/MdPreview.d.ts +186 -0
  91. package/lib/types/MdPreview/index.d.ts +453 -0
  92. package/lib/types/ModalToolbar/index.d.ts +244 -0
  93. package/lib/types/NormalToolbar/index.d.ts +105 -0
  94. package/lib/types/config.d.ts +1 -0
  95. package/lib/types/index.d.ts +8 -0
  96. package/lib/{md-editor-v3.umd.js → umd/index.js} +38 -38
  97. package/package.json +16 -20
  98. package/lib/md-editor-v3.cjs +0 -63
  99. package/lib/md-editor-v3.mjs +0 -4143
  100. /package/lib/{MdEditor/extensions → types/DropdownToolbar}/DropdownToolbar.d.ts +0 -0
  101. /package/lib/{MdEditor → types/MdEditor}/config.d.ts +0 -0
  102. /package/lib/{MdEditor/extensions → types/ModalToolbar}/ModalToolbar.d.ts +0 -0
  103. /package/lib/{MdEditor/extensions → types/NormalToolbar}/NormalToolbar.d.ts +0 -0
@@ -0,0 +1,546 @@
1
+ import { PropType, CSSProperties } from 'vue';
2
+ import { ToolbarNames, MdHeadingId, Themes, Footers, ChangeEvent, SaveEvent, UploadImgEvent, HtmlChangedEvent, GetCatalogEvent, ErrorEvent, EditorEmits } from './type';
3
+ export declare const mdHeadingId: MdHeadingId;
4
+ export declare const mdPreviewProps: {
5
+ /**
6
+ * markdown content.
7
+ *
8
+ * @default ''
9
+ */
10
+ modelValue: {
11
+ type: PropType<string>;
12
+ default: string;
13
+ };
14
+ /**
15
+ * 主题,支持light和dark
16
+ *
17
+ * @default 'light'
18
+ */
19
+ theme: {
20
+ type: PropType<Themes>;
21
+ default: string;
22
+ };
23
+ /**
24
+ * 外层类名
25
+ *
26
+ * @default ''
27
+ */
28
+ class: {
29
+ type: StringConstructor;
30
+ default: string;
31
+ };
32
+ /**
33
+ * 预设语言名称
34
+ *
35
+ * @default 'zh-CN'
36
+ */
37
+ language: {
38
+ type: PropType<string>;
39
+ default: string;
40
+ };
41
+ /**
42
+ * html变化事件
43
+ */
44
+ onHtmlChanged: {
45
+ type: PropType<HtmlChangedEvent>;
46
+ };
47
+ /**
48
+ * 获取目录结构
49
+ */
50
+ onGetCatalog: {
51
+ type: PropType<GetCatalogEvent>;
52
+ };
53
+ /**
54
+ * 编辑器唯一标识
55
+ *
56
+ * @default 'md-editor-v3'
57
+ */
58
+ editorId: {
59
+ type: PropType<string>;
60
+ default: string;
61
+ };
62
+ /**
63
+ * 预览中代码是否显示行号
64
+ *
65
+ * @default false
66
+ */
67
+ showCodeRowNumber: {
68
+ type: PropType<boolean>;
69
+ default: boolean;
70
+ };
71
+ /**
72
+ * 预览内容样式
73
+ *
74
+ * @default 'default'
75
+ */
76
+ previewTheme: {
77
+ type: PropType<string>;
78
+ default: string;
79
+ };
80
+ /**
81
+ * 编辑器样式
82
+ */
83
+ style: {
84
+ type: PropType<string | CSSProperties>;
85
+ default: () => {};
86
+ };
87
+ /**
88
+ * 标题的id生成方式
89
+ *
90
+ * @default (text: string) => text
91
+ */
92
+ mdHeadingId: {
93
+ type: PropType<MdHeadingId>;
94
+ default: MdHeadingId;
95
+ };
96
+ /**
97
+ *
98
+ * 不能保证文本正确的情况,在marked编译md文本后通过该方法处理
99
+ * 推荐DOMPurify、sanitize-html
100
+ *
101
+ * @default (text: string) => text
102
+ */
103
+ sanitize: {
104
+ type: PropType<(html: string) => string>;
105
+ default: (html: string) => string;
106
+ };
107
+ /**
108
+ * 不使用该mermaid
109
+ *
110
+ * @default false
111
+ */
112
+ noMermaid: {
113
+ type: PropType<boolean>;
114
+ default: boolean;
115
+ };
116
+ /**
117
+ * 不使用katex
118
+ *
119
+ * @default false
120
+ */
121
+ noKatex: {
122
+ type: PropType<boolean>;
123
+ default: boolean;
124
+ };
125
+ /**
126
+ * 代码主题
127
+ *
128
+ * @default 'atom'
129
+ */
130
+ codeTheme: {
131
+ type: PropType<string>;
132
+ default: string;
133
+ };
134
+ /**
135
+ * 不插入iconfont链接
136
+ *
137
+ * @default false
138
+ */
139
+ noIconfont: {
140
+ type: PropType<boolean>;
141
+ };
142
+ /**
143
+ * 复制代码格式化方法
144
+ *
145
+ * @default (text) => text
146
+ */
147
+ formatCopiedText: {
148
+ type: PropType<(text: string) => string>;
149
+ default: (text: string) => string;
150
+ };
151
+ /**
152
+ * 某些预览主题的代码模块背景是暗色系
153
+ * 将这个属性设置为true,会自动在该主题下的light模式下使用暗色系的代码风格
154
+ *
155
+ * @default true
156
+ */
157
+ codeStyleReverse: {
158
+ type: PropType<boolean>;
159
+ default: boolean;
160
+ };
161
+ /**
162
+ * 需要自动调整的预览主题
163
+ *
164
+ * @default ['default', 'mk-cute']
165
+ */
166
+ codeStyleReverseList: {
167
+ type: PropType<string[]>;
168
+ default: string[];
169
+ };
170
+ noHighlight: {
171
+ type: PropType<boolean>;
172
+ default: boolean;
173
+ };
174
+ };
175
+ export declare const editorProps: {
176
+ /**
177
+ * input回调事件
178
+ */
179
+ onChange: {
180
+ type: PropType<ChangeEvent>;
181
+ };
182
+ /**
183
+ * input回调事件
184
+ */
185
+ onSave: {
186
+ type: PropType<SaveEvent>;
187
+ };
188
+ /**
189
+ * 上传图片事件
190
+ */
191
+ onUploadImg: {
192
+ type: PropType<UploadImgEvent>;
193
+ };
194
+ /**
195
+ * 是否页面内全屏
196
+ *
197
+ * @default false
198
+ */
199
+ pageFullscreen: {
200
+ type: PropType<boolean>;
201
+ default: boolean;
202
+ };
203
+ /**
204
+ * 是否展开预览
205
+ *
206
+ * @default true
207
+ */
208
+ preview: {
209
+ type: PropType<boolean>;
210
+ default: boolean;
211
+ };
212
+ /**
213
+ * 是否展开html预览
214
+ *
215
+ * @default false
216
+ */
217
+ htmlPreview: {
218
+ type: PropType<boolean>;
219
+ default: boolean;
220
+ };
221
+ /**
222
+ * 仅预览模式,不显示toolbar和编辑框
223
+ *
224
+ * @4.0.0开始移除该设置,使用组件MdPreview替换
225
+ *
226
+ * @default false
227
+ */
228
+ /**
229
+ * 工具栏选择显示
230
+ *
231
+ * @default allToolbar
232
+ */
233
+ toolbars: {
234
+ type: PropType<ToolbarNames[]>;
235
+ default: string[];
236
+ };
237
+ /**
238
+ * 工具栏选择不显示
239
+ *
240
+ * @default []
241
+ */
242
+ toolbarsExclude: {
243
+ type: PropType<ToolbarNames[]>;
244
+ default: never[];
245
+ };
246
+ /**
247
+ * 格式化md
248
+ *
249
+ * @default true
250
+ */
251
+ noPrettier: {
252
+ type: PropType<boolean>;
253
+ default: boolean;
254
+ };
255
+ /**
256
+ * 一个tab等于空格数
257
+ *
258
+ * @default 2
259
+ */
260
+ tabWidth: {
261
+ type: PropType<number>;
262
+ default: number;
263
+ };
264
+ /**
265
+ * 表格预设格子数
266
+ *
267
+ * @default [6, 4]
268
+ */
269
+ tableShape: {
270
+ type: PropType<number[]>;
271
+ default: () => number[];
272
+ };
273
+ /**
274
+ * 空提示
275
+ *
276
+ * @default ''
277
+ */
278
+ placeholder: {
279
+ type: PropType<string>;
280
+ default: string;
281
+ };
282
+ /**
283
+ * 自定义的工具栏列表
284
+ */
285
+ defToolbars: {
286
+ type: PropType<string | JSX.Element>;
287
+ };
288
+ /**
289
+ * 内部错误捕获
290
+ */
291
+ onError: {
292
+ type: PropType<ErrorEvent>;
293
+ };
294
+ /**
295
+ * 页脚列表显示顺序
296
+ */
297
+ footers: {
298
+ type: PropType<Footers[]>;
299
+ default: Footers[];
300
+ };
301
+ /**
302
+ * 是否默认激活输入框和预览框同步滚动
303
+ *
304
+ * @default true
305
+ */
306
+ scrollAuto: {
307
+ type: PropType<boolean>;
308
+ default: boolean;
309
+ };
310
+ /**
311
+ * 自定义的也叫工具组件列表
312
+ */
313
+ defFooters: {
314
+ type: PropType<string | JSX.Element>;
315
+ };
316
+ /**
317
+ * 是否禁用上传图片
318
+ *
319
+ * @default false
320
+ */
321
+ noUploadImg: {
322
+ type: PropType<boolean>;
323
+ };
324
+ /**
325
+ * 文本区域自动获得焦点
326
+ *
327
+ * @default false
328
+ */
329
+ autoFocus: {
330
+ type: PropType<boolean>;
331
+ };
332
+ /**
333
+ * 禁用文本区域
334
+ *
335
+ * @default false
336
+ */
337
+ disabled: {
338
+ type: PropType<boolean>;
339
+ };
340
+ /**
341
+ * 文本区域为只读
342
+ *
343
+ * @default false
344
+ */
345
+ readOnly: {
346
+ type: PropType<boolean>;
347
+ };
348
+ /**
349
+ * 文本区域允许的最大字符数
350
+ */
351
+ maxLength: {
352
+ type: PropType<number>;
353
+ };
354
+ /**
355
+ * 是否启用自动识别粘贴代码类别
356
+ * 目前支持 vscode 复制的代码识别
357
+ *
358
+ * @default false
359
+ */
360
+ autoDetectCode: {
361
+ type: PropType<boolean>;
362
+ };
363
+ /**
364
+ * 输入框失去焦点时触发事件
365
+ */
366
+ onBlur: {
367
+ type: PropType<(event: FocusEvent) => void>;
368
+ };
369
+ /**
370
+ * 输入框获得焦点时触发事件
371
+ */
372
+ onFocus: {
373
+ type: PropType<(event: FocusEvent) => void>;
374
+ };
375
+ /**
376
+ * markdown content.
377
+ *
378
+ * @default ''
379
+ */
380
+ modelValue: {
381
+ type: PropType<string>;
382
+ default: string;
383
+ };
384
+ /**
385
+ * 主题,支持light和dark
386
+ *
387
+ * @default 'light'
388
+ */
389
+ theme: {
390
+ type: PropType<Themes>;
391
+ default: string;
392
+ };
393
+ /**
394
+ * 外层类名
395
+ *
396
+ * @default ''
397
+ */
398
+ class: {
399
+ type: StringConstructor;
400
+ default: string;
401
+ };
402
+ /**
403
+ * 预设语言名称
404
+ *
405
+ * @default 'zh-CN'
406
+ */
407
+ language: {
408
+ type: PropType<string>;
409
+ default: string;
410
+ };
411
+ /**
412
+ * html变化事件
413
+ */
414
+ onHtmlChanged: {
415
+ type: PropType<HtmlChangedEvent>;
416
+ };
417
+ /**
418
+ * 获取目录结构
419
+ */
420
+ onGetCatalog: {
421
+ type: PropType<GetCatalogEvent>;
422
+ };
423
+ /**
424
+ * 编辑器唯一标识
425
+ *
426
+ * @default 'md-editor-v3'
427
+ */
428
+ editorId: {
429
+ type: PropType<string>;
430
+ default: string;
431
+ };
432
+ /**
433
+ * 预览中代码是否显示行号
434
+ *
435
+ * @default false
436
+ */
437
+ showCodeRowNumber: {
438
+ type: PropType<boolean>;
439
+ default: boolean;
440
+ };
441
+ /**
442
+ * 预览内容样式
443
+ *
444
+ * @default 'default'
445
+ */
446
+ previewTheme: {
447
+ type: PropType<string>;
448
+ default: string;
449
+ };
450
+ /**
451
+ * 编辑器样式
452
+ */
453
+ style: {
454
+ type: PropType<string | CSSProperties>;
455
+ default: () => {};
456
+ };
457
+ /**
458
+ * 标题的id生成方式
459
+ *
460
+ * @default (text: string) => text
461
+ */
462
+ mdHeadingId: {
463
+ type: PropType<MdHeadingId>;
464
+ default: MdHeadingId;
465
+ };
466
+ /**
467
+ *
468
+ * 不能保证文本正确的情况,在marked编译md文本后通过该方法处理
469
+ * 推荐DOMPurify、sanitize-html
470
+ *
471
+ * @default (text: string) => text
472
+ */
473
+ sanitize: {
474
+ type: PropType<(html: string) => string>;
475
+ default: (html: string) => string;
476
+ };
477
+ /**
478
+ * 不使用该mermaid
479
+ *
480
+ * @default false
481
+ */
482
+ noMermaid: {
483
+ type: PropType<boolean>;
484
+ default: boolean;
485
+ };
486
+ /**
487
+ * 不使用katex
488
+ *
489
+ * @default false
490
+ */
491
+ noKatex: {
492
+ type: PropType<boolean>;
493
+ default: boolean;
494
+ };
495
+ /**
496
+ * 代码主题
497
+ *
498
+ * @default 'atom'
499
+ */
500
+ codeTheme: {
501
+ type: PropType<string>;
502
+ default: string;
503
+ };
504
+ /**
505
+ * 不插入iconfont链接
506
+ *
507
+ * @default false
508
+ */
509
+ noIconfont: {
510
+ type: PropType<boolean>;
511
+ };
512
+ /**
513
+ * 复制代码格式化方法
514
+ *
515
+ * @default (text) => text
516
+ */
517
+ formatCopiedText: {
518
+ type: PropType<(text: string) => string>;
519
+ default: (text: string) => string;
520
+ };
521
+ /**
522
+ * 某些预览主题的代码模块背景是暗色系
523
+ * 将这个属性设置为true,会自动在该主题下的light模式下使用暗色系的代码风格
524
+ *
525
+ * @default true
526
+ */
527
+ codeStyleReverse: {
528
+ type: PropType<boolean>;
529
+ default: boolean;
530
+ };
531
+ /**
532
+ * 需要自动调整的预览主题
533
+ *
534
+ * @default ['default', 'mk-cute']
535
+ */
536
+ codeStyleReverseList: {
537
+ type: PropType<string[]>;
538
+ default: string[];
539
+ };
540
+ noHighlight: {
541
+ type: PropType<boolean>;
542
+ default: boolean;
543
+ };
544
+ };
545
+ export declare const mdPreviewEmits: EditorEmits;
546
+ export declare const editorEmits: EditorEmits;
@@ -0,0 +1,9 @@
1
+ export declare const ON_SAVE = "onSave";
2
+ export declare const CHANGE_CATALOG_VISIBLE = "changeCatalogVisible";
3
+ export declare const CHANGE_FULL_SCREEN = "changeFullscreen";
4
+ export declare const PAGE_FULL_SCREEN_CHANGED = "pageFullscreenChanged";
5
+ export declare const FULL_SCREEN_CHANGED = "fullscreenChanged";
6
+ export declare const PREVIEW_CHANGED = "previewChanged";
7
+ export declare const HTML_PREVIEW_CHANGED = "htmlPreviewChanged";
8
+ export declare const CATALOG_VISIBLE_CHANGED = "catalogVisibleChanged";
9
+ export declare const TEXTAREA_FOCUS = "textareaFocus";
@@ -2,7 +2,7 @@ import { LooseRequired } from '@vue/shared';
2
2
  import { ExtractPropTypes, SetupContext } from 'vue';
3
3
  import { Extension } from '@codemirror/state';
4
4
  import { KeyBinding } from '@codemirror/view';
5
- import { editorProps } from './props';
5
+ import { editorProps, mdPreviewProps } from './props';
6
6
  declare global {
7
7
  interface Window {
8
8
  hljs: any;
@@ -327,5 +327,6 @@ export interface ExposeParam {
327
327
  focus(): void;
328
328
  }
329
329
  export type EditorProps = Readonly<LooseRequired<Readonly<ExtractPropTypes<typeof editorProps>>>>;
330
+ export type MdPreviewProps = Readonly<LooseRequired<Readonly<ExtractPropTypes<typeof mdPreviewProps>>>>;
330
331
  export type EditorEmits = Array<'onChange' | 'onSave' | 'onUploadImg' | 'onHtmlChanged' | 'onGetCatalog' | 'onError' | 'update:modelValue' | 'onBlur' | 'onFocus'>;
331
332
  export type EditorContext = SetupContext<EditorEmits>;
@@ -0,0 +1,19 @@
1
+ import CodeMirrorUt from '../layouts/Content/codemirror';
2
+ export type ToolDirective = 'bold' | 'underline' | 'italic' | 'strikeThrough' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'quote' | 'unorderedList' | 'orderedList' | 'task' | 'codeRow' | 'code' | 'link' | 'image' | 'table' | 'sub' | 'sup' | 'prettier' | 'flow' | 'sequence' | 'gantt' | 'class' | 'state' | 'pie' | 'relationship' | 'journey' | 'katexInline' | 'katexBlock' | 'universal';
3
+ /**
4
+ *
5
+ * @param direct 操作指令
6
+ * @param codeMirrorUt 编辑区辅助实例
7
+ * @param params 自定义参数
8
+ *
9
+ * @returns string
10
+ */
11
+ export declare const directive2flag: (direct: ToolDirective, codeMirrorUt: CodeMirrorUt, params?: any) => {
12
+ text: string;
13
+ options: {
14
+ select: boolean;
15
+ deviationStart: number;
16
+ deviationEnd: number;
17
+ replaceAll: boolean;
18
+ };
19
+ };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * 设置页面元素可移动
3
+ *
4
+ * @param trigger 触发器,通过该元素移动父级元素
5
+ * @param moveHandler
6
+ */
7
+ export declare const keyMove: (trigger: HTMLElement, moveHandler?: ((left: number, top: number) => void) | undefined) => (() => void);
8
+ /**
9
+ * 向页面插入外链标签
10
+ *
11
+ * @param ele
12
+ * @param checkKey 全局名称
13
+ */
14
+ export declare const appendHandler: (ele: HTMLElement, checkKey?: string) => void;
15
+ /**
16
+ * 更新插入的元素属性
17
+ *
18
+ * @param id id选择器
19
+ * @param attr 属性名
20
+ * @param value 属性值
21
+ */
22
+ export declare const updateHandler: (...params: any[]) => Promise<unknown>;
@@ -0,0 +1,17 @@
1
+ export interface BusEvent {
2
+ name: string;
3
+ callback: (p?: any, p2?: any) => any;
4
+ }
5
+ declare class Bus {
6
+ pools: {
7
+ [race: string]: {
8
+ [eventName: string]: Array<(p?: any) => any>;
9
+ };
10
+ };
11
+ remove(race: string, name: string, func: (p?: any) => any): void;
12
+ clear(race: string): void;
13
+ on(race: string, event: BusEvent): boolean;
14
+ emit(race: string, name: string, ...params: any): void;
15
+ }
16
+ declare const _default: Bus;
17
+ export default _default;
@@ -0,0 +1,66 @@
1
+ /**
2
+ * js模拟a链接点击
3
+ *
4
+ * @param {string} url 目标地址
5
+ * @param {*} option 是否新窗口、是否要求不跟踪
6
+ */
7
+ export declare const goto: (url: string, option?: {
8
+ newWindow: boolean;
9
+ nofollow: boolean;
10
+ }) => void;
11
+ /**
12
+ * 转换base64为file对象
13
+ * 方法来自网络
14
+ *
15
+ * @param base64 Base64
16
+ * @param fileName 图片名称
17
+ * @returns
18
+ */
19
+ export declare const base642File: (base64: string, fileName?: string) => File | null;
20
+ /**
21
+ * 对代码块添加行号
22
+ *
23
+ * @param code 代码html内容
24
+ * @returns string
25
+ */
26
+ export declare const generateCodeRowNumber: (code: string) => string;
27
+ /**
28
+ * 防抖方法封装
29
+ *
30
+ * @param fn 目标方法
31
+ * @param ms 防抖延迟
32
+ * @returns
33
+ */
34
+ export declare const debounce: (fn: (...params: Array<any>) => any, ms?: number) => (...params: Array<any>) => Promise<unknown>;
35
+ /**
36
+ * 节流函数
37
+ *
38
+ * @param fn 目标方法
39
+ * @param ms 节流延迟
40
+ * @returns
41
+ */
42
+ export declare const throttle: (fn: (...params: Array<any>) => any, ms?: number) => (...params: Array<any>) => void;
43
+ /**
44
+ * 逻辑分离katex相关文本
45
+ * 不再采用正确匹配,会导致性能问题
46
+ *
47
+ * @param str 待处理字符串
48
+ * @param key 单行或多行标识符
49
+ * @returns []
50
+ */
51
+ export declare const splitKatexValue: (str: string, key?: string) => Array<string>;
52
+ /**
53
+ * 获取元素相对目标元素顶部位置
54
+ * 代码来自antd
55
+ *
56
+ * @param element
57
+ * @param container
58
+ * @returns
59
+ */
60
+ export declare const getRelativeTop: (element: HTMLElement, container: HTMLElement) => number;
61
+ /**
62
+ * 获取随机字符
63
+ *
64
+ * @returns string
65
+ */
66
+ export declare const uuid: () => string;
@@ -0,0 +1,18 @@
1
+ import CodeMirrorUt from '../layouts/Content/codemirror';
2
+ /**
3
+ * 两块区域同步滚动
4
+ *
5
+ * @param pEle 宿主区域
6
+ * @param cEle 寄主区域
7
+ * @returns 清除监听的方法
8
+ */
9
+ export declare const scrollAutoWithScale: (pEle: HTMLElement, cEle: HTMLElement) => (() => void)[];
10
+ /**
11
+ * 两块区域同步滚动
12
+ *
13
+ * @param pEle 宿主区域
14
+ * @param cEle 寄主区域
15
+ * @returns 清除监听的方法
16
+ */
17
+ declare const scrollAuto: (pEle: HTMLElement, cEle: HTMLElement, codeMirrorUt: CodeMirrorUt) => (() => void)[];
18
+ export default scrollAuto;