@ebl-vue/editor-full 2.31.35 → 2.31.36

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 (97) hide show
  1. package/.postcssrc.yml +33 -0
  2. package/dist/index.d.ts +3 -7
  3. package/dist/index.mjs +183 -182
  4. package/dist/index.mjs.map +1 -0
  5. package/package.json +1 -1
  6. package/postcss.config.js +15 -0
  7. package/src/components/Editor/Editor.vue +293 -0
  8. package/src/components/index.ts +27 -0
  9. package/src/constants/index.ts +1 -0
  10. package/src/i18n/zh-cn.ts +160 -0
  11. package/src/icons/index.ts +93 -0
  12. package/src/index.ts +21 -0
  13. package/src/installer.ts +21 -0
  14. package/src/plugins/alert/index.ts +455 -0
  15. package/src/plugins/block-alignment/index.ts +117 -0
  16. package/src/plugins/block-alignment/readme.md +1 -0
  17. package/src/plugins/code/LICENSE +21 -0
  18. package/src/plugins/code/index.ts +619 -0
  19. package/src/plugins/code/utils/string.ts +34 -0
  20. package/src/plugins/color-picker/index.ts +132 -0
  21. package/src/plugins/delimiter/index.ts +121 -0
  22. package/src/plugins/drag-drop/index.css +19 -0
  23. package/src/plugins/drag-drop/index.ts +151 -0
  24. package/src/plugins/drag-drop/readme.md +1 -0
  25. package/src/plugins/header/H1.ts +404 -0
  26. package/src/plugins/header/H2.ts +403 -0
  27. package/src/plugins/header/H3.ts +404 -0
  28. package/src/plugins/header/H4.ts +404 -0
  29. package/src/plugins/header/H5.ts +403 -0
  30. package/src/plugins/header/H6.ts +404 -0
  31. package/src/plugins/header/index.ts +15 -0
  32. package/src/plugins/header/types.d.ts +46 -0
  33. package/src/plugins/imageResizeCrop/ImageTune.ts +635 -0
  34. package/src/plugins/imageResizeCrop/index.css +230 -0
  35. package/src/plugins/imageResizeCrop/index.ts +5 -0
  36. package/src/plugins/imageResizeCrop/types.d.ts +23 -0
  37. package/src/plugins/imageTool/index.ts +510 -0
  38. package/src/plugins/imageTool/types/codexteam__ajax.d.ts +89 -0
  39. package/src/plugins/imageTool/types/types.ts +236 -0
  40. package/src/plugins/imageTool/ui.ts +313 -0
  41. package/src/plugins/imageTool/uploader.ts +287 -0
  42. package/src/plugins/imageTool/utils/dom.ts +24 -0
  43. package/src/plugins/imageTool/utils/index.ts +73 -0
  44. package/src/plugins/imageTool/utils/isPromise.ts +10 -0
  45. package/src/plugins/indent/index.ts +695 -0
  46. package/src/plugins/inline-code/index.ts +203 -0
  47. package/src/plugins/list/ListRenderer/ChecklistRenderer.ts +208 -0
  48. package/src/plugins/list/ListRenderer/ListRenderer.ts +73 -0
  49. package/src/plugins/list/ListRenderer/OrderedListRenderer.ts +123 -0
  50. package/src/plugins/list/ListRenderer/UnorderedListRenderer.ts +123 -0
  51. package/src/plugins/list/ListRenderer/index.ts +6 -0
  52. package/src/plugins/list/ListTabulator/index.ts +1179 -0
  53. package/src/plugins/list/index.ts +488 -0
  54. package/src/plugins/list/styles/CssPrefix.ts +4 -0
  55. package/src/plugins/list/types/Elements.ts +14 -0
  56. package/src/plugins/list/types/ItemMeta.ts +40 -0
  57. package/src/plugins/list/types/ListParams.ts +102 -0
  58. package/src/plugins/list/types/ListRenderer.ts +6 -0
  59. package/src/plugins/list/types/OlCounterType.ts +63 -0
  60. package/src/plugins/list/types/index.ts +14 -0
  61. package/src/plugins/list/utils/focusItem.ts +18 -0
  62. package/src/plugins/list/utils/getChildItems.ts +40 -0
  63. package/src/plugins/list/utils/getItemChildWrapper.ts +10 -0
  64. package/src/plugins/list/utils/getItemContentElement.ts +10 -0
  65. package/src/plugins/list/utils/getSiblings.ts +52 -0
  66. package/src/plugins/list/utils/isLastItem.ts +9 -0
  67. package/src/plugins/list/utils/itemHasSublist.ts +10 -0
  68. package/src/plugins/list/utils/normalizeData.ts +83 -0
  69. package/src/plugins/list/utils/removeChildWrapperIfEmpty.ts +31 -0
  70. package/src/plugins/list/utils/renderToolboxInput.ts +113 -0
  71. package/src/plugins/list/utils/stripNumbers.ts +7 -0
  72. package/src/plugins/list/utils/type-guards.ts +8 -0
  73. package/src/plugins/marker/index.ts +199 -0
  74. package/src/plugins/outline/index.ts +62 -0
  75. package/src/plugins/outline/outline.css +52 -0
  76. package/src/plugins/paragraph/index.ts +384 -0
  77. package/src/plugins/paragraph/types/icons.d.ts +4 -0
  78. package/src/plugins/paragraph/utils/makeFragment.ts +17 -0
  79. package/src/plugins/quote/index.ts +203 -0
  80. package/src/plugins/table/index.ts +4 -0
  81. package/src/plugins/table/plugin.ts +255 -0
  82. package/src/plugins/table/table.ts +1202 -0
  83. package/src/plugins/table/toolbox.ts +166 -0
  84. package/src/plugins/table/utils/dom.ts +130 -0
  85. package/src/plugins/table/utils/popover.ts +185 -0
  86. package/src/plugins/table/utils/throttled.ts +22 -0
  87. package/src/plugins/underline/index.ts +214 -0
  88. package/src/plugins/undo/index.ts +526 -0
  89. package/src/plugins/undo/observer.ts +101 -0
  90. package/src/plugins/undo/vanilla-caret-js.ts +102 -0
  91. package/src/style.css +139 -0
  92. package/src/types.ts +3 -0
  93. package/src/utils/AxiosService.ts +87 -0
  94. package/src/utils/index.ts +15 -0
  95. package/src/utils/install.ts +19 -0
  96. package/tsconfig.json +37 -0
  97. package/vite.config.ts +81 -0
@@ -0,0 +1,488 @@
1
+ import type { API, BlockAPI, PasteConfig, ToolboxConfig } from '@ebl-vue/editorjs';
2
+ import type {
3
+ BlockToolConstructorOptions,
4
+ MenuConfigItem,
5
+ ToolConfig
6
+ } from '@ebl-vue/editorjs/types/tools';
7
+ import { IconListBulleted, IconListNumbered, IconChecklist } from '../../icons';
8
+ import { IconStartWith } from '../../icons';
9
+ import type { ListConfig, ListData, ListDataStyle, ListItem, OldListData } from './types/ListParams';
10
+ import ListTabulator from './ListTabulator';
11
+ import { CheckListRenderer, OrderedListRenderer, UnorderedListRenderer } from './ListRenderer';
12
+ import type { ListRenderer } from './types/ListRenderer';
13
+ import { renderToolboxInput } from './utils/renderToolboxInput';
14
+ import { OlCounterIconsMap, type OlCounterType, OlCounterTypesMap } from './types/OlCounterType';
15
+
16
+ /**
17
+ * Build styles
18
+ */
19
+ import '@ebl-vue/editor-render/styles/list.css';
20
+
21
+ import stripNumbers from './utils/stripNumbers';
22
+ import normalizeData from './utils/normalizeData';
23
+ import type { PasteEvent } from './types';
24
+ import type { OrderedListItemMeta } from './types/ItemMeta';
25
+
26
+ /**
27
+ * Constructor Params for Editorjs List Tool, use to pass initial data and settings
28
+ */
29
+ export type ListParams = BlockToolConstructorOptions<ListData | OldListData, ListConfig>;
30
+
31
+ /**
32
+ * Default class of the component used in editor
33
+ */
34
+ export default class EditorjsList {
35
+ /**
36
+ * Notify core that read-only mode is supported
37
+ */
38
+ public static get isReadOnlySupported(): boolean {
39
+ return true;
40
+ }
41
+
42
+ /**
43
+ * Allow to use native Enter behaviour
44
+ */
45
+ public static get enableLineBreaks(): boolean {
46
+ return true;
47
+ }
48
+
49
+ /**
50
+ * Get Tool toolbox settings
51
+ * icon - Tool icon's SVG
52
+ * title - title to show in toolbox
53
+ */
54
+ public static get toolbox(): ToolboxConfig {
55
+ return [
56
+ {
57
+ icon: IconListBulleted,
58
+ title: 'Unordered List',
59
+ data: {
60
+ style: 'unordered',
61
+ },
62
+ },
63
+ {
64
+ icon: IconListNumbered,
65
+ title: 'Ordered List',
66
+ data: {
67
+ style: 'ordered',
68
+ },
69
+ },
70
+ {
71
+ icon: IconChecklist,
72
+ title: 'Checklist',
73
+ data: {
74
+ style: 'checklist',
75
+ },
76
+ },
77
+ ];
78
+ }
79
+
80
+ /**
81
+ * On paste sanitzation config. Allow only tags that are allowed in the Tool.
82
+ * @returns - paste config object used in editor
83
+ */
84
+ public static get pasteConfig(): PasteConfig {
85
+ return {
86
+ tags: ['OL', 'UL', 'LI'],
87
+ };
88
+ }
89
+
90
+ /**
91
+ * Convert from text to list with import and export list to text
92
+ */
93
+ public static get conversionConfig(): {
94
+ /**
95
+ * Method that is responsible for conversion from data to string
96
+ * @param data - current list data
97
+ * @returns - contents string formed from list data
98
+ */
99
+ export: (data: ListData) => string;
100
+
101
+ /**
102
+ * Method that is responsible for conversion from string to data
103
+ * @param content - contents string
104
+ * @returns - list data formed from contents string
105
+ */
106
+ import: (content: string, config: ToolConfig<ListConfig>) => ListData;
107
+ } {
108
+ return {
109
+ export: (data) => {
110
+ return EditorjsList.joinRecursive(data);
111
+ },
112
+ import: (content, config) => {
113
+ return {
114
+ meta: {},
115
+ items: [
116
+ {
117
+ content,
118
+ meta: {},
119
+ items: [],
120
+ },
121
+ ],
122
+ style: config?.defaultStyle !== undefined ? config.defaultStyle : 'unordered',
123
+ };
124
+ },
125
+ };
126
+ }
127
+
128
+ /**
129
+ * Get list style name
130
+ */
131
+ private get listStyle(): ListDataStyle {
132
+ return this.data.style || this.defaultListStyle;
133
+ }
134
+
135
+ /**
136
+ * Set list style
137
+ * @param style - new style to set
138
+ */
139
+ private set listStyle(style: ListDataStyle) {
140
+ this.data.style = style;
141
+
142
+ this.changeTabulatorByStyle();
143
+
144
+ /**
145
+ * Create new list element
146
+ */
147
+ const newListElement = this.list!.render();
148
+
149
+ this.listElement?.replaceWith(newListElement);
150
+
151
+ this.listElement = newListElement;
152
+ }
153
+
154
+ /**
155
+ * The Editor.js API
156
+ */
157
+ private api: API;
158
+
159
+ /**
160
+ * Is Ediotrjs List Tool read-only
161
+ */
162
+ private readOnly: boolean;
163
+
164
+ /**
165
+ * Tool's configuration
166
+ */
167
+ private config: ListConfig | undefined;
168
+
169
+ /**
170
+ * Default list style formes as passed default list style from config or 'ordered' as default
171
+ */
172
+ private defaultListStyle?: ListConfig['defaultStyle'];
173
+
174
+ /**
175
+ * Default Counter type of the ordered list
176
+ */
177
+ private defaultCounterTypes: OlCounterType[];
178
+
179
+ /**
180
+ * Tool's data
181
+ */
182
+ private data: ListData;
183
+
184
+ /**
185
+ * Editor block api
186
+ */
187
+ private block: BlockAPI;
188
+
189
+ /**
190
+ * Class that is responsible for complete list rendering and saving
191
+ */
192
+ private list: ListTabulator<ListRenderer> | undefined;
193
+
194
+ /**
195
+ * Main constant wrapper of the whole list
196
+ */
197
+ private listElement: HTMLElement | undefined;
198
+
199
+ /**
200
+ * Render plugin`s main Element and fill it with saved data
201
+ * @param params - tool constructor options
202
+ * @param params.data - previously saved data
203
+ * @param params.config - user config for Tool
204
+ * @param params.api - Editor.js API
205
+ * @param params.readOnly - read-only mode flag
206
+ */
207
+ constructor({ data, config, api, readOnly, block }: ListParams) {
208
+ this.api = api;
209
+ this.readOnly = readOnly;
210
+ this.config = config;
211
+ this.block = block;
212
+
213
+ /**
214
+ * Set the default list style from the config or presetted 'unordered'.
215
+ */
216
+ this.defaultListStyle = this.config?.defaultStyle || 'unordered';
217
+
218
+ /**
219
+ * Set the default counter types for the ordered list
220
+ */
221
+ this.defaultCounterTypes = (this.config as ListConfig).counterTypes || Array.from(OlCounterTypesMap.values()) as OlCounterType[];
222
+
223
+ const initialData = {
224
+ style: this.defaultListStyle,
225
+ meta: {},
226
+ items: [],
227
+ };
228
+
229
+ this.data = Object.keys(data).length ? normalizeData(data) : initialData;
230
+
231
+ /**
232
+ * Assign default value of the property for the ordered list
233
+ */
234
+ if (this.listStyle === 'ordered' && (this.data.meta as OrderedListItemMeta).counterType === undefined) {
235
+ (this.data.meta as OrderedListItemMeta).counterType = 'numeric';
236
+ }
237
+
238
+ this.changeTabulatorByStyle();
239
+ }
240
+
241
+ /**
242
+ * Convert from list to text for conversionConfig
243
+ * @param data - current data of the list
244
+ * @returns - string of the recursively merged contents of the items of the list
245
+ */
246
+ private static joinRecursive(data: ListData | ListItem): string {
247
+ return data.items
248
+ .map(item => `${item.content} ${EditorjsList.joinRecursive(item)}`)
249
+ .join('');
250
+ }
251
+
252
+ /**
253
+ * Function that is responsible for content rendering
254
+ * @returns rendered list wrapper with all contents
255
+ */
256
+ public render(): HTMLElement {
257
+ this.listElement = this.list!.render();
258
+
259
+ return this.listElement;
260
+ }
261
+
262
+ /**
263
+ * Function that is responsible for content saving
264
+ * @returns formatted content used in editor
265
+ */
266
+ public save(): ListData {
267
+ this.data = this.list!.save();
268
+
269
+ return this.data;
270
+ }
271
+
272
+ /**
273
+ * Function that is responsible for mergind two lists into one
274
+ * @param data - data of the next standing list, that should be merged with current
275
+ */
276
+ public merge(data: ListData): void {
277
+ this.list!.merge(data);
278
+ }
279
+
280
+ /**
281
+ * Creates Block Tune allowing to change the list style
282
+ * @returns array of tune configs
283
+ */
284
+ public renderSettings(): MenuConfigItem[] {
285
+ const defaultTunes: MenuConfigItem[] = [
286
+ {
287
+ label: this.api.i18n.t('Unordered'),
288
+ icon: IconListBulleted,
289
+ closeOnActivate: true,
290
+ isActive: this.listStyle == 'unordered',
291
+ onActivate: () => {
292
+ this.listStyle = 'unordered';
293
+ },
294
+ },
295
+ {
296
+ label: this.api.i18n.t('Ordered'),
297
+ icon: IconListNumbered,
298
+ closeOnActivate: true,
299
+ isActive: this.listStyle == 'ordered',
300
+ onActivate: () => {
301
+ this.listStyle = 'ordered';
302
+ },
303
+ },
304
+ {
305
+ label: this.api.i18n.t('Checklist'),
306
+ icon: IconChecklist,
307
+ closeOnActivate: true,
308
+ isActive: this.listStyle == 'checklist',
309
+ onActivate: () => {
310
+ this.listStyle = 'checklist';
311
+ },
312
+ },
313
+ ];
314
+
315
+ if (this.listStyle === 'ordered') {
316
+ const startWithElement = renderToolboxInput(
317
+ this.api.i18n.t('Start with'),
318
+ (index: string) => this.changeStartWith(Number(index)),
319
+ {
320
+ value: String((this.data.meta as OrderedListItemMeta).start ?? 1),
321
+ placeholder: '',
322
+ attributes: {
323
+ required: 'true',
324
+ },
325
+ sanitize: input => stripNumbers(input),
326
+ });
327
+
328
+ const orderedListTunes: MenuConfigItem[] = [
329
+ {
330
+ label: this.api.i18n.t('Start with'),
331
+ icon: IconStartWith,
332
+ name: "list-setting-start-with",
333
+ element: startWithElement,
334
+ // @ts-expect-error ts(2820) can not use PopoverItem enum from editor.js types
335
+ type: 'html',
336
+ // element: { startWithElement },
337
+ // type: 'html',
338
+ // children: {
339
+ // items: [
340
+ // {
341
+ // element: startWithElement,
342
+ // // @ts-expect-error ts(2820) can not use PopoverItem enum from editor.js types
343
+ // type: 'html',
344
+ // },
345
+ // ],
346
+ // },
347
+ },
348
+ ];
349
+
350
+ const orderedListCountersTunes: MenuConfigItem = {
351
+ label: this.api.i18n.t('Counter type'),
352
+ name:"list-setting",
353
+ icon: OlCounterIconsMap.get((this.data.meta as OrderedListItemMeta).counterType!),
354
+ children: {
355
+ items: [],
356
+ },
357
+ };
358
+
359
+ /**
360
+ * For each counter type in OlCounterType create toolbox item
361
+ */
362
+ OlCounterTypesMap.forEach((_, counterType: string) => {
363
+ const counterTypeValue = OlCounterTypesMap.get(counterType)! as OlCounterType;
364
+
365
+ if (!this.defaultCounterTypes.includes(counterTypeValue)) {
366
+ return;
367
+ }
368
+
369
+ orderedListCountersTunes.children.items!.push({
370
+ title: this.api.i18n.t(counterType),
371
+ icon: OlCounterIconsMap.get(counterTypeValue),
372
+ isActive: (this.data.meta as OrderedListItemMeta).counterType === OlCounterTypesMap.get(counterType),
373
+ closeOnActivate: true,
374
+ onActivate: () => {
375
+ this.changeCounters(OlCounterTypesMap.get(counterType) as OlCounterType);
376
+ },
377
+ });
378
+ });
379
+
380
+ /**
381
+ * Dont show Counter type tune if there is no valid counter types
382
+ */
383
+ if (orderedListCountersTunes.children.items!.length > 1) {
384
+ orderedListTunes.push(orderedListCountersTunes);
385
+ }
386
+
387
+ // @ts-expect-error ts(2820) can not use PopoverItem enum from editor.js types
388
+ defaultTunes.push({ type: 'separator' }, ...orderedListTunes);
389
+ }
390
+
391
+ return defaultTunes;
392
+ }
393
+
394
+ /**
395
+ * On paste callback that is fired from Editor.
396
+ * @param event - event with pasted data
397
+ */
398
+ public onPaste(event: PasteEvent): void {
399
+ const { tagName: tag } = event.detail.data;
400
+
401
+ switch (tag) {
402
+ case 'OL':
403
+ this.listStyle = 'ordered';
404
+ break;
405
+ case 'UL':
406
+ case 'LI':
407
+ this.listStyle = 'unordered';
408
+ }
409
+
410
+ this.list!.onPaste(event);
411
+ }
412
+
413
+ /**
414
+ * Handle UL, OL and LI tags paste and returns List data
415
+ * @param element - html element that contains whole list
416
+ */
417
+ public pasteHandler(element: PasteEvent['detail']['data']): ListData {
418
+ const data = this.list!.pasteHandler(element);
419
+
420
+ return data;
421
+ }
422
+
423
+ /**
424
+ * Changes ordered list counterType property value
425
+ * @param counterType - new value of the counterType value
426
+ */
427
+ private changeCounters(counterType: OlCounterType): void {
428
+ this.list?.changeCounters(counterType);
429
+
430
+ (this.data.meta as OrderedListItemMeta).counterType = counterType;
431
+ }
432
+
433
+ /**
434
+ * Changes ordered list start property value
435
+ * @param index - new value of the start property
436
+ */
437
+ private changeStartWith(index: number): void {
438
+ this.list?.changeStartWith(index);
439
+
440
+ (this.data.meta as OrderedListItemMeta).start = index;
441
+ }
442
+
443
+ /**
444
+ * This method allows changing tabulator respectfully to passed style
445
+ */
446
+ private changeTabulatorByStyle(): void {
447
+ switch (this.listStyle) {
448
+ case 'ordered':
449
+ this.list = new ListTabulator<OrderedListRenderer>({
450
+ data: this.data,
451
+ readOnly: this.readOnly,
452
+ api: this.api,
453
+ config: this.config,
454
+ block: this.block,
455
+ },
456
+ new OrderedListRenderer(this.readOnly, this.config)
457
+ );
458
+
459
+ break;
460
+
461
+ case 'unordered':
462
+ this.list = new ListTabulator<UnorderedListRenderer>({
463
+ data: this.data,
464
+ readOnly: this.readOnly,
465
+ api: this.api,
466
+ config: this.config,
467
+ block: this.block,
468
+ },
469
+ new UnorderedListRenderer(this.readOnly, this.config)
470
+ );
471
+
472
+ break;
473
+
474
+ case 'checklist':
475
+ this.list = new ListTabulator<CheckListRenderer>({
476
+ data: this.data,
477
+ readOnly: this.readOnly,
478
+ api: this.api,
479
+ config: this.config,
480
+ block: this.block,
481
+ },
482
+ new CheckListRenderer(this.readOnly, this.config)
483
+ );
484
+
485
+ break;
486
+ }
487
+ }
488
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Default css prefix for list
3
+ */
4
+ export const CssPrefix = 'cdx-list';
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Type that represents the list item
3
+ */
4
+ export type ItemElement = HTMLElement;
5
+
6
+ /**
7
+ * Type that represents children wrapper of the list item
8
+ */
9
+ export type ItemChildWrapperElement = HTMLElement;
10
+
11
+ /**
12
+ * Type that represents content element of the item
13
+ */
14
+ export type ItemContentElement = HTMLElement;
@@ -0,0 +1,40 @@
1
+ import type { OlCounterType } from './OlCounterType';
2
+
3
+ /**
4
+ * Meta information of each list item
5
+ */
6
+ export interface ItemMetaBase {}
7
+
8
+ /**
9
+ * Meta information of checklist item
10
+ */
11
+ export interface ChecklistItemMeta extends ItemMetaBase {
12
+ /**
13
+ * State of the checkbox of the item
14
+ */
15
+ checked: boolean;
16
+ }
17
+
18
+ /**
19
+ * Meta information of ordered list item
20
+ */
21
+ export interface OrderedListItemMeta extends ItemMetaBase {
22
+ /**
23
+ * If passed, ordered list counters will start with this index
24
+ */
25
+ start?: number;
26
+ /**
27
+ * Counters type used only in ordered list
28
+ */
29
+ counterType?: OlCounterType;
30
+ }
31
+
32
+ /**
33
+ * Meta information of unordered list item
34
+ */
35
+ export interface UnorderedListItemMeta extends ItemMetaBase {}
36
+
37
+ /**
38
+ * Type that represents all available meta objects for list item
39
+ */
40
+ export type ItemMeta = ChecklistItemMeta | OrderedListItemMeta | UnorderedListItemMeta;
@@ -0,0 +1,102 @@
1
+ import type { ItemMeta } from './ItemMeta';
2
+ import type { OlCounterType } from './OlCounterType';
3
+
4
+ /**
5
+ * list style to make list as ordered or unordered
6
+ */
7
+ export type ListDataStyle = 'ordered' | 'unordered' | 'checklist';
8
+
9
+ /**
10
+ * Interface that represents data of the List tool
11
+ */
12
+ export type ListData = Omit<ListItem, 'content'> & {
13
+ /**
14
+ * Style of the list tool
15
+ */
16
+ style: ListDataStyle;
17
+ };
18
+
19
+ /**
20
+ * Interface that represents data of the List tool
21
+ */
22
+ export interface OldListData {
23
+ /**
24
+ * Style of the List tool
25
+ */
26
+ style: 'ordered' | 'unordered';
27
+ /**
28
+ * Array of items of the List tool
29
+ */
30
+ items: string[];
31
+ }
32
+
33
+ /**
34
+ * Type that represents data of the List tool
35
+ */
36
+ export type OldNestedListData = Omit<ListData, 'meta'>;
37
+
38
+ /**
39
+ * Interface that represents old checklist data format
40
+ */
41
+ export interface OldChecklistData {
42
+ /**
43
+ * Checklist items
44
+ */
45
+ items: OldChecklistItem[];
46
+ }
47
+
48
+ /**
49
+ * Interface that represents old checklist item format
50
+ */
51
+ interface OldChecklistItem {
52
+ /**
53
+ * Text of the checklist item
54
+ */
55
+ text: string;
56
+ /**
57
+ * Checked state of the checklist item
58
+ */
59
+ checked: boolean;
60
+ }
61
+
62
+ /**
63
+ * List item within the output data
64
+ */
65
+ export interface ListItem {
66
+ /**
67
+ * list item text content
68
+ */
69
+ content: string;
70
+
71
+ /**
72
+ * Meta information of each list item
73
+ */
74
+ meta: ItemMeta;
75
+
76
+ /**
77
+ * sublist items
78
+ */
79
+ items: ListItem[];
80
+ }
81
+
82
+ /**
83
+ * Tool's configuration
84
+ */
85
+ export interface ListConfig {
86
+ /**
87
+ * default list style: ordered or unordered
88
+ * default is unordered
89
+ */
90
+ defaultStyle?: ListDataStyle;
91
+ /**
92
+ * Max level of the nesting in list
93
+ * If nesting is not needed, it could be set to 1
94
+ */
95
+ maxLevel?: number;
96
+ /**
97
+ * Specifies which counter types should be shown in the ordered list style selector.
98
+ * @example ['numeric', 'upper-roman'] // Shows selector with these two options
99
+ * @default undefined // All counter types are available when not specified
100
+ */
101
+ counterTypes?: OlCounterType[];
102
+ }
@@ -0,0 +1,6 @@
1
+ import type { CheckListRenderer, OrderedListRenderer, UnorderedListRenderer } from '../ListRenderer';
2
+
3
+ /**
4
+ * Type that represents all possible list renderer types
5
+ */
6
+ export type ListRenderer = CheckListRenderer | OrderedListRenderer | UnorderedListRenderer;