@agilehub/agile-editor 1.7.0 → 1.8.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 (42) hide show
  1. package/README.md +1 -0
  2. package/dist/agile-editor.css +1 -1
  3. package/dist/agile-editor.js +18075 -18079
  4. package/dist/i18n-DkkDy5cy.js +2813 -0
  5. package/dist/types/components/editor/courseware-dialog.vue.d.ts +3 -0
  6. package/dist/types/components/editor/smart-sheet-dialog.vue.d.ts +3 -0
  7. package/dist/types/components/editor/thousands-separator-dialog.vue.d.ts +3 -0
  8. package/dist/types/components/index.d.ts +2 -1
  9. package/dist/types/components/index.vue.d.ts +397 -19
  10. package/dist/types/components/menus/button.vue.d.ts +1 -1
  11. package/dist/types/components/menus/toolbar/insert/courseware.vue.d.ts +3 -0
  12. package/dist/types/components/menus/toolbar/insert/smart-sheet.vue.d.ts +3 -0
  13. package/dist/types/components/menus/toolbar/tools/thousands-separator.vue.d.ts +3 -0
  14. package/dist/types/components/preview-toolbar/index.vue.d.ts +2 -2
  15. package/dist/types/components/toolbar/classic.vue.d.ts +14 -14
  16. package/dist/types/components/toolbar/ribbon.vue.d.ts +14 -14
  17. package/dist/types/composables/i18n.d.ts +393 -15
  18. package/dist/types/extensions/bookmark-transaction.d.ts +6 -0
  19. package/dist/types/extensions/bubble-note.d.ts +1 -0
  20. package/dist/types/extensions/courseware/annotation-session.d.ts +4 -0
  21. package/dist/types/extensions/courseware/index.d.ts +49 -0
  22. package/dist/types/extensions/courseware/model.d.ts +20 -0
  23. package/dist/types/extensions/courseware/node-view.vue.d.ts +93 -0
  24. package/dist/types/extensions/courseware/reader.vue.d.ts +22 -0
  25. package/dist/types/extensions/smart-sheet/index.d.ts +47 -0
  26. package/dist/types/extensions/smart-sheet/model.d.ts +18 -0
  27. package/dist/types/extensions/smart-sheet/node-view.vue.d.ts +93 -0
  28. package/dist/types/extensions/smart-sheet/viewer.vue.d.ts +36 -0
  29. package/dist/types/extensions/thousands-separator.d.ts +60 -0
  30. package/dist/types/i18n.d.ts +393 -15
  31. package/dist/types/utils/bubble-note-icon.d.ts +1 -0
  32. package/dist/types/utils/document-formatting.d.ts +41 -37
  33. package/dist/types/utils/document-import.d.ts +2 -0
  34. package/dist/types/utils/html-element-id.d.ts +9 -2
  35. package/dist/types/utils/md5.d.ts +2 -0
  36. package/dist/types/utils/thousands-separator.d.ts +15 -0
  37. package/dist/viewer-BLXXdsVI.js +97 -0
  38. package/docs/FORMATTING_TEMPLATES.md +253 -250
  39. package/docs/FORMATTING_TEMPLATE_BUSINESS_GUIDE.md +536 -0
  40. package/docs/README.md +1 -0
  41. package/docs/configuration.md +25 -0
  42. package/package.json +165 -162
@@ -3,10 +3,24 @@ export declare const i18n: import("vue-i18n").I18n<{
3
3
  formatting: {
4
4
  none: string;
5
5
  labels: {
6
- paragraph: string;
7
- heading: string;
6
+ p: string;
7
+ span: string;
8
+ h1: string;
9
+ h2: string;
10
+ h3: string;
11
+ h4: string;
12
+ h5: string;
13
+ h6: string;
8
14
  table: string;
9
- image: string;
15
+ th: string;
16
+ td: string;
17
+ caption: string;
18
+ figure: string;
19
+ figcaption: string;
20
+ img: string;
21
+ ol: string;
22
+ ul: string;
23
+ li: string;
10
24
  audio: string;
11
25
  video: string;
12
26
  fontFamily: string;
@@ -22,6 +36,8 @@ export declare const i18n: import("vue-i18n").I18n<{
22
36
  textDecoration: string;
23
37
  marginTop: string;
24
38
  marginBottom: string;
39
+ marginLeft: string;
40
+ marginRight: string;
25
41
  paddingTop: string;
26
42
  paddingRight: string;
27
43
  paddingBottom: string;
@@ -39,7 +55,6 @@ export declare const i18n: import("vue-i18n").I18n<{
39
55
  themeColor: string;
40
56
  shading: string;
41
57
  cellText: string;
42
- caption: string;
43
58
  bulletList: string;
44
59
  orderedList: string;
45
60
  taskList: string;
@@ -49,7 +64,6 @@ export declare const i18n: import("vue-i18n").I18n<{
49
64
  callout: string;
50
65
  footnote: string;
51
66
  codeBlock: string;
52
- custom: string;
53
67
  };
54
68
  values: {
55
69
  left: string;
@@ -207,6 +221,100 @@ export declare const i18n: import("vue-i18n").I18n<{
207
221
  undo: string;
208
222
  };
209
223
  insert: {
224
+ smartSheet: {
225
+ text: string;
226
+ insert: string;
227
+ edit: string;
228
+ open: string;
229
+ delete: string;
230
+ title: string;
231
+ titlePlaceholder: string;
232
+ description: string;
233
+ descriptionPlaceholder: string;
234
+ defaultExpanded: string;
235
+ expandDescription: string;
236
+ collapseDescription: string;
237
+ worksheetCount: string;
238
+ export: string;
239
+ exportExcel: string;
240
+ exportCsv: string;
241
+ exportJson: string;
242
+ exportImage: string;
243
+ exportPdf: string;
244
+ zoomIn: string;
245
+ zoomOut: string;
246
+ selectFile: string;
247
+ changeFile: string;
248
+ noFile: string;
249
+ fileTip: string;
250
+ invalidFile: string;
251
+ uploadNotConfigured: string;
252
+ uploadInvalid: string;
253
+ loading: string;
254
+ loadFailed: string;
255
+ unsaved: string;
256
+ close: string;
257
+ unsavedTitle: string;
258
+ unsavedTip: string;
259
+ closeWithoutExport: string;
260
+ };
261
+ courseware: {
262
+ text: string;
263
+ insert: string;
264
+ edit: string;
265
+ delete: string;
266
+ title: string;
267
+ titlePlaceholder: string;
268
+ file: string;
269
+ selectFile: string;
270
+ changeFile: string;
271
+ noFile: string;
272
+ invalidFile: string;
273
+ uploading: string;
274
+ uploadNotConfigured: string;
275
+ uploadInvalid: string;
276
+ retryUpload: string;
277
+ retryLoad: string;
278
+ defaultExpanded: string;
279
+ layout: string;
280
+ single: string;
281
+ double: string;
282
+ preview: string;
283
+ expand: string;
284
+ collapse: string;
285
+ fullscreen: string;
286
+ exitFullscreen: string;
287
+ readerToolbar: string;
288
+ firstPage: string;
289
+ previousPage: string;
290
+ nextPage: string;
291
+ switchToSingle: string;
292
+ switchToDouble: string;
293
+ zoomIn: string;
294
+ zoomOut: string;
295
+ resetZoom: string;
296
+ thumbnails: string;
297
+ closeThumbnails: string;
298
+ thumbnailPage: string;
299
+ annotation: string;
300
+ annotationRect: string;
301
+ annotationLine: string;
302
+ annotationPath: string;
303
+ annotationAnchor: string;
304
+ annotationStyle: string;
305
+ annotationColor: string;
306
+ annotationUndo: string;
307
+ annotationRedo: string;
308
+ annotationSolid: string;
309
+ annotationDashed: string;
310
+ annotationWavy: string;
311
+ annotationSolidBorder: string;
312
+ annotationDashedBorder: string;
313
+ annotationNoBorder: string;
314
+ annotationStorageUnavailable: string;
315
+ loading: string;
316
+ changedError: string;
317
+ };
210
318
  timeline: {
211
319
  text: string;
212
320
  insert: string;
@@ -583,6 +691,20 @@ export declare const i18n: import("vue-i18n").I18n<{
583
691
  text: string;
584
692
  tip: string;
585
693
  };
694
+ "thousands-separator": {
695
+ text: string;
696
+ tip: string;
697
+ edit: string;
698
+ delete: string;
699
+ separator: string;
700
+ space: string;
701
+ comma: string;
702
+ "group-size": string;
703
+ "allow-wrap": string;
704
+ preview: string;
705
+ "selection-required": string;
706
+ "invalid-number": string;
707
+ };
586
708
  math: {
587
709
  text: string;
588
710
  insert: string;
@@ -738,6 +860,7 @@ export declare const i18n: import("vue-i18n").I18n<{
738
860
  "line-color": string;
739
861
  "line-type": string;
740
862
  "line-types": {
863
+ none: string;
741
864
  solid: string;
742
865
  dashed: string;
743
866
  dotted: string;
@@ -759,6 +882,9 @@ export declare const i18n: import("vue-i18n").I18n<{
759
882
  "reference-icon-placeholder": string;
760
883
  "reference-icon-invalid": string;
761
884
  "reference-icon-upload-failed": string;
885
+ "show-icon": string;
886
+ yes: string;
887
+ no: string;
762
888
  edit: string;
763
889
  delete: string;
764
890
  "open-reference": string;
@@ -1269,10 +1395,24 @@ export declare const i18n: import("vue-i18n").I18n<{
1269
1395
  formatting: {
1270
1396
  none: string;
1271
1397
  labels: {
1272
- paragraph: string;
1273
- heading: string;
1398
+ p: string;
1399
+ span: string;
1400
+ h1: string;
1401
+ h2: string;
1402
+ h3: string;
1403
+ h4: string;
1404
+ h5: string;
1405
+ h6: string;
1274
1406
  table: string;
1275
- image: string;
1407
+ th: string;
1408
+ td: string;
1409
+ caption: string;
1410
+ figure: string;
1411
+ figcaption: string;
1412
+ img: string;
1413
+ ol: string;
1414
+ ul: string;
1415
+ li: string;
1276
1416
  audio: string;
1277
1417
  video: string;
1278
1418
  fontFamily: string;
@@ -1288,6 +1428,8 @@ export declare const i18n: import("vue-i18n").I18n<{
1288
1428
  textDecoration: string;
1289
1429
  marginTop: string;
1290
1430
  marginBottom: string;
1431
+ marginLeft: string;
1432
+ marginRight: string;
1291
1433
  paddingTop: string;
1292
1434
  paddingRight: string;
1293
1435
  paddingBottom: string;
@@ -1305,7 +1447,6 @@ export declare const i18n: import("vue-i18n").I18n<{
1305
1447
  themeColor: string;
1306
1448
  shading: string;
1307
1449
  cellText: string;
1308
- caption: string;
1309
1450
  bulletList: string;
1310
1451
  orderedList: string;
1311
1452
  taskList: string;
@@ -1315,7 +1456,6 @@ export declare const i18n: import("vue-i18n").I18n<{
1315
1456
  callout: string;
1316
1457
  footnote: string;
1317
1458
  codeBlock: string;
1318
- custom: string;
1319
1459
  };
1320
1460
  values: {
1321
1461
  left: string;
@@ -1474,6 +1614,100 @@ export declare const i18n: import("vue-i18n").I18n<{
1474
1614
  undo: string;
1475
1615
  };
1476
1616
  insert: {
1617
+ smartSheet: {
1618
+ text: string;
1619
+ insert: string;
1620
+ edit: string;
1621
+ open: string;
1622
+ delete: string;
1623
+ title: string;
1624
+ titlePlaceholder: string;
1625
+ description: string;
1626
+ descriptionPlaceholder: string;
1627
+ defaultExpanded: string;
1628
+ expandDescription: string;
1629
+ collapseDescription: string;
1630
+ worksheetCount: string;
1631
+ export: string;
1632
+ exportExcel: string;
1633
+ exportCsv: string;
1634
+ exportJson: string;
1635
+ exportImage: string;
1636
+ exportPdf: string;
1637
+ zoomIn: string;
1638
+ zoomOut: string;
1639
+ selectFile: string;
1640
+ changeFile: string;
1641
+ noFile: string;
1642
+ fileTip: string;
1643
+ invalidFile: string;
1644
+ uploadNotConfigured: string;
1645
+ uploadInvalid: string;
1646
+ loading: string;
1647
+ loadFailed: string;
1648
+ unsaved: string;
1649
+ close: string;
1650
+ unsavedTitle: string;
1651
+ unsavedTip: string;
1652
+ closeWithoutExport: string;
1653
+ };
1654
+ courseware: {
1655
+ text: string;
1656
+ insert: string;
1657
+ edit: string;
1658
+ delete: string;
1659
+ title: string;
1660
+ titlePlaceholder: string;
1661
+ file: string;
1662
+ selectFile: string;
1663
+ changeFile: string;
1664
+ noFile: string;
1665
+ invalidFile: string;
1666
+ uploading: string;
1667
+ uploadNotConfigured: string;
1668
+ uploadInvalid: string;
1669
+ retryUpload: string;
1670
+ retryLoad: string;
1671
+ defaultExpanded: string;
1672
+ layout: string;
1673
+ single: string;
1674
+ double: string;
1675
+ preview: string;
1676
+ expand: string;
1677
+ collapse: string;
1678
+ fullscreen: string;
1679
+ exitFullscreen: string;
1680
+ readerToolbar: string;
1681
+ firstPage: string;
1682
+ previousPage: string;
1683
+ nextPage: string;
1684
+ switchToSingle: string;
1685
+ switchToDouble: string;
1686
+ zoomIn: string;
1687
+ zoomOut: string;
1688
+ resetZoom: string;
1689
+ thumbnails: string;
1690
+ closeThumbnails: string;
1691
+ thumbnailPage: string;
1692
+ annotation: string;
1693
+ annotationRect: string;
1694
+ annotationLine: string;
1695
+ annotationPath: string;
1696
+ annotationAnchor: string;
1697
+ annotationStyle: string;
1698
+ annotationColor: string;
1699
+ annotationUndo: string;
1700
+ annotationRedo: string;
1701
+ annotationSolid: string;
1702
+ annotationDashed: string;
1703
+ annotationWavy: string;
1704
+ annotationSolidBorder: string;
1705
+ annotationDashedBorder: string;
1706
+ annotationNoBorder: string;
1707
+ annotationStorageUnavailable: string;
1708
+ loading: string;
1709
+ changedError: string;
1710
+ };
1477
1711
  timeline: {
1478
1712
  text: string;
1479
1713
  insert: string;
@@ -1854,6 +2088,20 @@ export declare const i18n: import("vue-i18n").I18n<{
1854
2088
  text: string;
1855
2089
  tip: string;
1856
2090
  };
2091
+ "thousands-separator": {
2092
+ text: string;
2093
+ tip: string;
2094
+ edit: string;
2095
+ delete: string;
2096
+ separator: string;
2097
+ space: string;
2098
+ comma: string;
2099
+ "group-size": string;
2100
+ "allow-wrap": string;
2101
+ preview: string;
2102
+ "selection-required": string;
2103
+ "invalid-number": string;
2104
+ };
1857
2105
  math: {
1858
2106
  text: string;
1859
2107
  insert: string;
@@ -2020,6 +2268,7 @@ export declare const i18n: import("vue-i18n").I18n<{
2020
2268
  "line-color": string;
2021
2269
  "line-type": string;
2022
2270
  "line-types": {
2271
+ none: string;
2023
2272
  solid: string;
2024
2273
  dashed: string;
2025
2274
  dotted: string;
@@ -2041,6 +2290,9 @@ export declare const i18n: import("vue-i18n").I18n<{
2041
2290
  "reference-icon-placeholder": string;
2042
2291
  "reference-icon-invalid": string;
2043
2292
  "reference-icon-upload-failed": string;
2293
+ "show-icon": string;
2294
+ yes: string;
2295
+ no: string;
2044
2296
  edit: string;
2045
2297
  delete: string;
2046
2298
  "open-reference": string;
@@ -2528,10 +2780,24 @@ export declare const i18n: import("vue-i18n").I18n<{
2528
2780
  formatting: {
2529
2781
  none: string;
2530
2782
  labels: {
2531
- paragraph: string;
2532
- heading: string;
2783
+ p: string;
2784
+ span: string;
2785
+ h1: string;
2786
+ h2: string;
2787
+ h3: string;
2788
+ h4: string;
2789
+ h5: string;
2790
+ h6: string;
2533
2791
  table: string;
2534
- image: string;
2792
+ th: string;
2793
+ td: string;
2794
+ caption: string;
2795
+ figure: string;
2796
+ figcaption: string;
2797
+ img: string;
2798
+ ol: string;
2799
+ ul: string;
2800
+ li: string;
2535
2801
  audio: string;
2536
2802
  video: string;
2537
2803
  fontFamily: string;
@@ -2547,6 +2813,8 @@ export declare const i18n: import("vue-i18n").I18n<{
2547
2813
  textDecoration: string;
2548
2814
  marginTop: string;
2549
2815
  marginBottom: string;
2816
+ marginLeft: string;
2817
+ marginRight: string;
2550
2818
  paddingTop: string;
2551
2819
  paddingRight: string;
2552
2820
  paddingBottom: string;
@@ -2564,7 +2832,6 @@ export declare const i18n: import("vue-i18n").I18n<{
2564
2832
  themeColor: string;
2565
2833
  shading: string;
2566
2834
  cellText: string;
2567
- caption: string;
2568
2835
  bulletList: string;
2569
2836
  orderedList: string;
2570
2837
  taskList: string;
@@ -2574,7 +2841,6 @@ export declare const i18n: import("vue-i18n").I18n<{
2574
2841
  callout: string;
2575
2842
  footnote: string;
2576
2843
  codeBlock: string;
2577
- custom: string;
2578
2844
  };
2579
2845
  values: {
2580
2846
  left: string;
@@ -2733,6 +2999,100 @@ export declare const i18n: import("vue-i18n").I18n<{
2733
2999
  undo: string;
2734
3000
  };
2735
3001
  insert: {
3002
+ smartSheet: {
3003
+ text: string;
3004
+ insert: string;
3005
+ edit: string;
3006
+ open: string;
3007
+ delete: string;
3008
+ title: string;
3009
+ titlePlaceholder: string;
3010
+ description: string;
3011
+ descriptionPlaceholder: string;
3012
+ defaultExpanded: string;
3013
+ expandDescription: string;
3014
+ collapseDescription: string;
3015
+ worksheetCount: string;
3016
+ export: string;
3017
+ exportExcel: string;
3018
+ exportCsv: string;
3019
+ exportJson: string;
3020
+ exportImage: string;
3021
+ exportPdf: string;
3022
+ zoomIn: string;
3023
+ zoomOut: string;
3024
+ selectFile: string;
3025
+ changeFile: string;
3026
+ noFile: string;
3027
+ fileTip: string;
3028
+ invalidFile: string;
3029
+ uploadNotConfigured: string;
3030
+ uploadInvalid: string;
3031
+ loading: string;
3032
+ loadFailed: string;
3033
+ unsaved: string;
3034
+ close: string;
3035
+ unsavedTitle: string;
3036
+ unsavedTip: string;
3037
+ closeWithoutExport: string;
3038
+ };
3039
+ courseware: {
3040
+ text: string;
3041
+ insert: string;
3042
+ edit: string;
3043
+ delete: string;
3044
+ title: string;
3045
+ titlePlaceholder: string;
3046
+ file: string;
3047
+ selectFile: string;
3048
+ changeFile: string;
3049
+ noFile: string;
3050
+ invalidFile: string;
3051
+ uploading: string;
3052
+ uploadNotConfigured: string;
3053
+ uploadInvalid: string;
3054
+ retryUpload: string;
3055
+ retryLoad: string;
3056
+ defaultExpanded: string;
3057
+ layout: string;
3058
+ single: string;
3059
+ double: string;
3060
+ preview: string;
3061
+ expand: string;
3062
+ collapse: string;
3063
+ fullscreen: string;
3064
+ exitFullscreen: string;
3065
+ readerToolbar: string;
3066
+ firstPage: string;
3067
+ previousPage: string;
3068
+ nextPage: string;
3069
+ switchToSingle: string;
3070
+ switchToDouble: string;
3071
+ zoomIn: string;
3072
+ zoomOut: string;
3073
+ resetZoom: string;
3074
+ thumbnails: string;
3075
+ closeThumbnails: string;
3076
+ thumbnailPage: string;
3077
+ annotation: string;
3078
+ annotationRect: string;
3079
+ annotationLine: string;
3080
+ annotationPath: string;
3081
+ annotationAnchor: string;
3082
+ annotationStyle: string;
3083
+ annotationColor: string;
3084
+ annotationUndo: string;
3085
+ annotationRedo: string;
3086
+ annotationSolid: string;
3087
+ annotationDashed: string;
3088
+ annotationWavy: string;
3089
+ annotationSolidBorder: string;
3090
+ annotationDashedBorder: string;
3091
+ annotationNoBorder: string;
3092
+ annotationStorageUnavailable: string;
3093
+ loading: string;
3094
+ changedError: string;
3095
+ };
2736
3096
  timeline: {
2737
3097
  text: string;
2738
3098
  insert: string;
@@ -3113,6 +3473,20 @@ export declare const i18n: import("vue-i18n").I18n<{
3113
3473
  text: string;
3114
3474
  tip: string;
3115
3475
  };
3476
+ "thousands-separator": {
3477
+ text: string;
3478
+ tip: string;
3479
+ edit: string;
3480
+ delete: string;
3481
+ separator: string;
3482
+ space: string;
3483
+ comma: string;
3484
+ "group-size": string;
3485
+ "allow-wrap": string;
3486
+ preview: string;
3487
+ "selection-required": string;
3488
+ "invalid-number": string;
3489
+ };
3116
3490
  math: {
3117
3491
  text: string;
3118
3492
  insert: string;
@@ -3279,6 +3653,7 @@ export declare const i18n: import("vue-i18n").I18n<{
3279
3653
  "line-color": string;
3280
3654
  "line-type": string;
3281
3655
  "line-types": {
3656
+ none: string;
3282
3657
  solid: string;
3283
3658
  dashed: string;
3284
3659
  dotted: string;
@@ -3300,6 +3675,9 @@ export declare const i18n: import("vue-i18n").I18n<{
3300
3675
  "reference-icon-placeholder": string;
3301
3676
  "reference-icon-invalid": string;
3302
3677
  "reference-icon-upload-failed": string;
3678
+ "show-icon": string;
3679
+ yes: string;
3680
+ no: string;
3303
3681
  edit: string;
3304
3682
  delete: string;
3305
3683
  "open-reference": string;
@@ -1,6 +1,7 @@
1
1
  type BubbleNoteIconDefinition = {
2
2
  svg?: string;
3
3
  base64?: string;
4
+ url?: string;
4
5
  value?: string;
5
6
  };
6
7
  export declare const normalizeBubbleNoteIconName: (value: any) => string;
@@ -1,58 +1,62 @@
1
1
  import type { Editor } from '@tiptap/core';
2
- import { type Node as PMNode } from '@tiptap/pm/model';
3
2
  /** Only these presentation properties can be supplied by a JSON template. */
4
- export declare const formattingProperties: readonly ["fontFamily", "fontSize", "fontWeight", "fontStyle", "color", "backgroundColor", "letterSpacing", "lineHeight", "textAlign", "textIndent", "textDecoration", "marginTop", "marginBottom", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "border", "borderColor", "borderWidth", "borderStyle", "borderRadius", "width", "maxWidth", "minHeight", "verticalAlign"];
3
+ export declare const formattingProperties: readonly ["fontFamily", "fontSize", "fontWeight", "fontStyle", "color", "backgroundColor", "letterSpacing", "lineHeight", "textAlign", "textIndent", "textDecoration", "marginTop", "marginBottom", "marginLeft", "marginRight", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "border", "borderColor", "borderWidth", "borderStyle", "borderRadius", "width", "maxWidth", "minHeight", "verticalAlign"];
5
4
  export type FormattingStyle = Partial<Record<(typeof formattingProperties)[number], string | number | null>>;
6
- export type FormattingJSONValue = string | number | boolean | null | FormattingJSONValue[] | {
7
- [key: string]: FormattingJSONValue;
8
- };
9
- export interface FormattingNodeRule extends FormattingStyle {
10
- /** Business-specific JSON, interpreted only by this node's adapter. */
11
- custom?: Record<string, FormattingJSONValue>;
5
+ /**
6
+ * New-style element rules use the same JSON shape as the HTML-like document
7
+ * tree. For example `rules.table.td.p` styles only paragraphs inside table
8
+ * cells, while `rules.table.th.p` handles header cells.
9
+ */
10
+ export interface FormattingElementRule extends FormattingStyle {
11
+ [selector: string]: unknown;
12
12
  }
13
- export interface FormattingAdapterResult {
14
- /** Partial existing schema attributes, not replacement content. */
15
- attrs?: Record<string, unknown>;
16
- /** Explicit styles for this node's direct text children (if marks are allowed). */
17
- textStyle?: FormattingStyle;
18
- }
19
- export type FormattingNodeAdapter = (context: {
20
- node: PMNode;
21
- rule: Readonly<FormattingNodeRule>;
22
- }) => FormattingAdapterResult;
23
- export interface FormattingTableRule extends FormattingStyle {
13
+ export interface FormattingTableRule extends FormattingElementRule {
24
14
  preset?: string;
25
15
  themeColor?: string;
26
16
  shading?: string[];
27
17
  cellText?: FormattingStyle;
28
- caption?: FormattingStyle;
18
+ caption?: FormattingElementRule;
19
+ th?: FormattingElementRule;
20
+ td?: FormattingElementRule;
21
+ }
22
+ export interface FormattingFigureRule extends FormattingElementRule {
23
+ img?: FormattingElementRule;
24
+ figcaption?: FormattingElementRule;
25
+ }
26
+ export interface FormattingListRule extends FormattingElementRule {
27
+ li?: FormattingElementRule;
29
28
  }
30
- export interface FormattingImageRule extends FormattingStyle {
31
- caption?: FormattingStyle;
29
+ export interface FormattingTemplateRules {
30
+ p?: FormattingElementRule;
31
+ h1?: FormattingElementRule;
32
+ h2?: FormattingElementRule;
33
+ h3?: FormattingElementRule;
34
+ h4?: FormattingElementRule;
35
+ h5?: FormattingElementRule;
36
+ h6?: FormattingElementRule;
37
+ table?: FormattingTableRule;
38
+ figure?: FormattingFigureRule;
39
+ img?: FormattingElementRule;
40
+ audio?: FormattingElementRule;
41
+ video?: FormattingElementRule;
42
+ ol?: FormattingListRule;
43
+ ul?: FormattingListRule;
44
+ li?: FormattingElementRule;
45
+ codeBlock?: FormattingElementRule;
46
+ blockquote?: FormattingElementRule;
47
+ taskItem?: FormattingElementRule;
48
+ footnote?: FormattingElementRule;
32
49
  }
33
50
  export interface FormattingTemplate {
34
51
  id: string;
35
52
  name: string;
36
53
  description: string;
37
- rules: {
38
- paragraph?: FormattingStyle;
39
- heading?: Partial<Record<1 | 2 | 3 | 4 | 5 | 6, FormattingStyle>>;
40
- table?: FormattingTableRule;
41
- image?: FormattingImageRule;
42
- audio?: FormattingStyle;
43
- video?: FormattingStyle;
44
- /** Presentation of a registered node; unknown/unadapted nodes are reported. */
45
- nodes?: Record<string, FormattingNodeRule>;
46
- /** Paragraph styles within these ancestor node types, nearest ancestor wins. */
47
- contexts?: Record<string, FormattingStyle>;
48
- };
54
+ rules: FormattingTemplateRules;
49
55
  }
50
56
  export interface FormattingOptions {
51
57
  enabled?: boolean;
52
58
  defaultTemplateId?: string;
53
59
  templates?: FormattingTemplate[];
54
- /** Component adapters override editor.storage[nodeType].formatting adapters. */
55
- adapters?: Record<string, FormattingNodeAdapter>;
56
60
  }
57
61
  export declare class FormattingValidationError extends Error {
58
62
  readonly path: string;
@@ -63,7 +67,7 @@ export declare function validateFormattingOptions(value: unknown): asserts value
63
67
  export declare class FormattingCancelled extends Error {
64
68
  }
65
69
  /** Plan against a snapshot, yield periodically, then commit only changed attributes/marks. */
66
- export declare function applyFormattingTemplate(editor: Editor, template: FormattingTemplate, signal?: AbortSignal, adapters?: Record<string, FormattingNodeAdapter>): Promise<{
70
+ export declare function applyFormattingTemplate(editor: Editor, template: FormattingTemplate, signal?: AbortSignal): Promise<{
67
71
  changed: number;
68
72
  skipped: string[];
69
73
  }>;
@@ -0,0 +1,2 @@
1
+ /** 标记外部 HTML 的初始化导入事务,避免业务编辑过滤器误拦截。 */
2
+ export declare const DOCUMENT_IMPORT_META = "documentImport";