@ebl-vue/editor-full 1.0.8

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 (101) hide show
  1. package/.postcssrc.yml +33 -0
  2. package/LICENSE +21 -0
  3. package/README.md +1 -0
  4. package/dist/index.d.ts +5 -0
  5. package/dist/index.mjs +2565 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/package.json +55 -0
  8. package/postcss.config.js +15 -0
  9. package/src/components/Editor/Editor.vue +209 -0
  10. package/src/components/index.ts +27 -0
  11. package/src/constants/index.ts +1 -0
  12. package/src/i18n/zh-cn.ts +151 -0
  13. package/src/icons/index.ts +78 -0
  14. package/src/index.ts +11 -0
  15. package/src/installer.ts +22 -0
  16. package/src/plugins/alert/index.css +150 -0
  17. package/src/plugins/alert/index.ts +463 -0
  18. package/src/plugins/block-alignment/index.css +9 -0
  19. package/src/plugins/block-alignment/index.ts +116 -0
  20. package/src/plugins/block-alignment/readme.md +1 -0
  21. package/src/plugins/code/LICENSE +21 -0
  22. package/src/plugins/code/index.css +120 -0
  23. package/src/plugins/code/index.ts +530 -0
  24. package/src/plugins/code/utils/string.ts +34 -0
  25. package/src/plugins/color-picker/index.ts +138 -0
  26. package/src/plugins/color-picker/styles.css +27 -0
  27. package/src/plugins/delimiter/index.css +14 -0
  28. package/src/plugins/delimiter/index.ts +122 -0
  29. package/src/plugins/drag-drop/index.css +19 -0
  30. package/src/plugins/drag-drop/index.ts +151 -0
  31. package/src/plugins/drag-drop/readme.md +1 -0
  32. package/src/plugins/header/H1.ts +405 -0
  33. package/src/plugins/header/H2.ts +403 -0
  34. package/src/plugins/header/H3.ts +404 -0
  35. package/src/plugins/header/H4.ts +405 -0
  36. package/src/plugins/header/H5.ts +405 -0
  37. package/src/plugins/header/H6.ts +406 -0
  38. package/src/plugins/header/index.css +20 -0
  39. package/src/plugins/header/index.ts +15 -0
  40. package/src/plugins/header/types.d.ts +46 -0
  41. package/src/plugins/indent/index.css +86 -0
  42. package/src/plugins/indent/index.ts +697 -0
  43. package/src/plugins/inline-code/index.css +11 -0
  44. package/src/plugins/inline-code/index.ts +205 -0
  45. package/src/plugins/list/ListRenderer/ChecklistRenderer.ts +211 -0
  46. package/src/plugins/list/ListRenderer/ListRenderer.ts +73 -0
  47. package/src/plugins/list/ListRenderer/OrderedListRenderer.ts +123 -0
  48. package/src/plugins/list/ListRenderer/UnorderedListRenderer.ts +123 -0
  49. package/src/plugins/list/ListRenderer/index.ts +6 -0
  50. package/src/plugins/list/ListTabulator/index.ts +1179 -0
  51. package/src/plugins/list/index.ts +502 -0
  52. package/src/plugins/list/styles/CssPrefix.ts +4 -0
  53. package/src/plugins/list/styles/icons/index.ts +10 -0
  54. package/src/plugins/list/styles/input.css +36 -0
  55. package/src/plugins/list/styles/list.css +165 -0
  56. package/src/plugins/list/types/Elements.ts +14 -0
  57. package/src/plugins/list/types/ItemMeta.ts +40 -0
  58. package/src/plugins/list/types/ListParams.ts +102 -0
  59. package/src/plugins/list/types/ListRenderer.ts +6 -0
  60. package/src/plugins/list/types/OlCounterType.ts +63 -0
  61. package/src/plugins/list/types/index.ts +14 -0
  62. package/src/plugins/list/utils/focusItem.ts +18 -0
  63. package/src/plugins/list/utils/getChildItems.ts +40 -0
  64. package/src/plugins/list/utils/getItemChildWrapper.ts +10 -0
  65. package/src/plugins/list/utils/getItemContentElement.ts +10 -0
  66. package/src/plugins/list/utils/getSiblings.ts +52 -0
  67. package/src/plugins/list/utils/isLastItem.ts +9 -0
  68. package/src/plugins/list/utils/itemHasSublist.ts +10 -0
  69. package/src/plugins/list/utils/normalizeData.ts +84 -0
  70. package/src/plugins/list/utils/removeChildWrapperIfEmpty.ts +31 -0
  71. package/src/plugins/list/utils/renderToolboxInput.ts +105 -0
  72. package/src/plugins/list/utils/stripNumbers.ts +7 -0
  73. package/src/plugins/list/utils/type-guards.ts +8 -0
  74. package/src/plugins/list.md +15 -0
  75. package/src/plugins/marker/index.css +4 -0
  76. package/src/plugins/marker/index.ts +187 -0
  77. package/src/plugins/paragraph/index.css +23 -0
  78. package/src/plugins/paragraph/index.ts +380 -0
  79. package/src/plugins/paragraph/types/icons.d.ts +4 -0
  80. package/src/plugins/paragraph/utils/makeFragment.ts +17 -0
  81. package/src/plugins/quote/index.css +26 -0
  82. package/src/plugins/quote/index.ts +206 -0
  83. package/src/plugins/table/index.ts +4 -0
  84. package/src/plugins/table/plugin.ts +254 -0
  85. package/src/plugins/table/style.css +388 -0
  86. package/src/plugins/table/table.ts +1192 -0
  87. package/src/plugins/table/toolbox.ts +165 -0
  88. package/src/plugins/table/utils/dom.ts +128 -0
  89. package/src/plugins/table/utils/popover.ts +172 -0
  90. package/src/plugins/table/utils/throttled.ts +22 -0
  91. package/src/plugins/underline/index.css +3 -0
  92. package/src/plugins/underline/index.ts +216 -0
  93. package/src/plugins/undo/index.ts +509 -0
  94. package/src/plugins/undo/observer.ts +101 -0
  95. package/src/style.css +89 -0
  96. package/src/utils/index.ts +15 -0
  97. package/src/utils/install.ts +19 -0
  98. package/tsconfig.json +37 -0
  99. package/types/index.d.ts +13 -0
  100. package/types/plugins/index.d.ts +0 -0
  101. package/vite.config.ts +79 -0
@@ -0,0 +1,123 @@
1
+ import type { UnorderedListItemMeta } from '../types/ItemMeta';
2
+ import type { ListConfig } from '../types/ListParams';
3
+ import { make, isEmpty } from '@editorjs/dom';
4
+ import { DefaultListCssClasses } from './ListRenderer';
5
+ import type { ListCssClasses, ListRendererInterface } from './ListRenderer';
6
+ import { CssPrefix } from '../styles/CssPrefix';
7
+
8
+ /**
9
+ * Interface that represents all list used only in unordered list rendering
10
+ */
11
+ interface UnoderedListCssClasses extends ListCssClasses {
12
+ /**
13
+ * CSS class of the unordered list
14
+ */
15
+ unorderedList: string;
16
+ }
17
+
18
+ /**
19
+ * Class that is responsible for unordered list rendering
20
+ */
21
+ export class UnorderedListRenderer implements ListRendererInterface<UnorderedListItemMeta> {
22
+ /**
23
+ * Tool's configuration
24
+ */
25
+ protected config?: ListConfig;
26
+
27
+ /**
28
+ * Is Editorjs List Tool read-only option
29
+ */
30
+ private readOnly: boolean;
31
+
32
+ /**
33
+ * Getter for all CSS classes used in unordered list rendering
34
+ */
35
+ private static get CSS(): UnoderedListCssClasses {
36
+ return {
37
+ ...DefaultListCssClasses,
38
+ unorderedList: `${CssPrefix}-unordered`,
39
+ };
40
+ }
41
+
42
+ /**
43
+ * Assign passed readonly mode and config to relevant class properties
44
+ * @param readonly - read-only mode flag
45
+ * @param config - user config for Tool
46
+ */
47
+ constructor(readonly: boolean, config?: ListConfig) {
48
+ this.config = config;
49
+ this.readOnly = readonly;
50
+ }
51
+
52
+ /**
53
+ * Renders ol wrapper for list
54
+ * @param isRoot - boolean variable that represents level of the wrappre (root or childList)
55
+ * @returns - created html ul element
56
+ */
57
+ public renderWrapper(isRoot: boolean): HTMLUListElement {
58
+ let wrapperElement: HTMLUListElement;
59
+
60
+ /**
61
+ * Check if it's root level
62
+ */
63
+ if (isRoot === true) {
64
+ wrapperElement = make('ul', [UnorderedListRenderer.CSS.wrapper, UnorderedListRenderer.CSS.unorderedList]) as HTMLUListElement;
65
+ } else {
66
+ wrapperElement = make('ul', [UnorderedListRenderer.CSS.unorderedList, UnorderedListRenderer.CSS.itemChildren]) as HTMLUListElement;
67
+ }
68
+
69
+ return wrapperElement;
70
+ }
71
+
72
+ /**
73
+ * Redners list item element
74
+ * @param content - content used in list item rendering
75
+ * @param _meta - meta of the list item unused in rendering of the unordered list
76
+ * @returns - created html list item element
77
+ */
78
+ public renderItem(content: string, _meta: UnorderedListItemMeta): HTMLLIElement {
79
+ const itemWrapper = make('li', UnorderedListRenderer.CSS.item);
80
+ const itemContent = make('div', UnorderedListRenderer.CSS.itemContent, {
81
+ innerHTML: content,
82
+ contentEditable: (!this.readOnly).toString(),
83
+ });
84
+
85
+ itemWrapper.appendChild(itemContent);
86
+
87
+ return itemWrapper as HTMLLIElement;
88
+ }
89
+
90
+ /**
91
+ * Return the item content
92
+ * @param item - item wrapper (<li>)
93
+ * @returns - item content string
94
+ */
95
+ public getItemContent(item: Element): string {
96
+ const contentNode = item.querySelector(`.${UnorderedListRenderer.CSS.itemContent}`);
97
+
98
+ if (!contentNode) {
99
+ return '';
100
+ }
101
+
102
+ if (isEmpty(contentNode)) {
103
+ return '';
104
+ }
105
+
106
+ return contentNode.innerHTML;
107
+ }
108
+
109
+ /**
110
+ * Returns item meta, for unordered list
111
+ * @returns Item meta object
112
+ */
113
+ public getItemMeta(): UnorderedListItemMeta {
114
+ return {};
115
+ }
116
+
117
+ /**
118
+ * Returns default item meta used on creation of the new item
119
+ */
120
+ public composeDefaultMeta(): UnorderedListItemMeta {
121
+ return {};
122
+ }
123
+ }
@@ -0,0 +1,6 @@
1
+ import { CheckListRenderer } from './ChecklistRenderer';
2
+ import { OrderedListRenderer } from './OrderedListRenderer';
3
+ import { UnorderedListRenderer } from './UnorderedListRenderer';
4
+ import { DefaultListCssClasses } from './ListRenderer';
5
+
6
+ export { CheckListRenderer, OrderedListRenderer, UnorderedListRenderer, DefaultListCssClasses };