@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.
- package/.postcssrc.yml +33 -0
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.mjs +2565 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +55 -0
- package/postcss.config.js +15 -0
- package/src/components/Editor/Editor.vue +209 -0
- package/src/components/index.ts +27 -0
- package/src/constants/index.ts +1 -0
- package/src/i18n/zh-cn.ts +151 -0
- package/src/icons/index.ts +78 -0
- package/src/index.ts +11 -0
- package/src/installer.ts +22 -0
- package/src/plugins/alert/index.css +150 -0
- package/src/plugins/alert/index.ts +463 -0
- package/src/plugins/block-alignment/index.css +9 -0
- package/src/plugins/block-alignment/index.ts +116 -0
- package/src/plugins/block-alignment/readme.md +1 -0
- package/src/plugins/code/LICENSE +21 -0
- package/src/plugins/code/index.css +120 -0
- package/src/plugins/code/index.ts +530 -0
- package/src/plugins/code/utils/string.ts +34 -0
- package/src/plugins/color-picker/index.ts +138 -0
- package/src/plugins/color-picker/styles.css +27 -0
- package/src/plugins/delimiter/index.css +14 -0
- package/src/plugins/delimiter/index.ts +122 -0
- package/src/plugins/drag-drop/index.css +19 -0
- package/src/plugins/drag-drop/index.ts +151 -0
- package/src/plugins/drag-drop/readme.md +1 -0
- package/src/plugins/header/H1.ts +405 -0
- package/src/plugins/header/H2.ts +403 -0
- package/src/plugins/header/H3.ts +404 -0
- package/src/plugins/header/H4.ts +405 -0
- package/src/plugins/header/H5.ts +405 -0
- package/src/plugins/header/H6.ts +406 -0
- package/src/plugins/header/index.css +20 -0
- package/src/plugins/header/index.ts +15 -0
- package/src/plugins/header/types.d.ts +46 -0
- package/src/plugins/indent/index.css +86 -0
- package/src/plugins/indent/index.ts +697 -0
- package/src/plugins/inline-code/index.css +11 -0
- package/src/plugins/inline-code/index.ts +205 -0
- package/src/plugins/list/ListRenderer/ChecklistRenderer.ts +211 -0
- package/src/plugins/list/ListRenderer/ListRenderer.ts +73 -0
- package/src/plugins/list/ListRenderer/OrderedListRenderer.ts +123 -0
- package/src/plugins/list/ListRenderer/UnorderedListRenderer.ts +123 -0
- package/src/plugins/list/ListRenderer/index.ts +6 -0
- package/src/plugins/list/ListTabulator/index.ts +1179 -0
- package/src/plugins/list/index.ts +502 -0
- package/src/plugins/list/styles/CssPrefix.ts +4 -0
- package/src/plugins/list/styles/icons/index.ts +10 -0
- package/src/plugins/list/styles/input.css +36 -0
- package/src/plugins/list/styles/list.css +165 -0
- package/src/plugins/list/types/Elements.ts +14 -0
- package/src/plugins/list/types/ItemMeta.ts +40 -0
- package/src/plugins/list/types/ListParams.ts +102 -0
- package/src/plugins/list/types/ListRenderer.ts +6 -0
- package/src/plugins/list/types/OlCounterType.ts +63 -0
- package/src/plugins/list/types/index.ts +14 -0
- package/src/plugins/list/utils/focusItem.ts +18 -0
- package/src/plugins/list/utils/getChildItems.ts +40 -0
- package/src/plugins/list/utils/getItemChildWrapper.ts +10 -0
- package/src/plugins/list/utils/getItemContentElement.ts +10 -0
- package/src/plugins/list/utils/getSiblings.ts +52 -0
- package/src/plugins/list/utils/isLastItem.ts +9 -0
- package/src/plugins/list/utils/itemHasSublist.ts +10 -0
- package/src/plugins/list/utils/normalizeData.ts +84 -0
- package/src/plugins/list/utils/removeChildWrapperIfEmpty.ts +31 -0
- package/src/plugins/list/utils/renderToolboxInput.ts +105 -0
- package/src/plugins/list/utils/stripNumbers.ts +7 -0
- package/src/plugins/list/utils/type-guards.ts +8 -0
- package/src/plugins/list.md +15 -0
- package/src/plugins/marker/index.css +4 -0
- package/src/plugins/marker/index.ts +187 -0
- package/src/plugins/paragraph/index.css +23 -0
- package/src/plugins/paragraph/index.ts +380 -0
- package/src/plugins/paragraph/types/icons.d.ts +4 -0
- package/src/plugins/paragraph/utils/makeFragment.ts +17 -0
- package/src/plugins/quote/index.css +26 -0
- package/src/plugins/quote/index.ts +206 -0
- package/src/plugins/table/index.ts +4 -0
- package/src/plugins/table/plugin.ts +254 -0
- package/src/plugins/table/style.css +388 -0
- package/src/plugins/table/table.ts +1192 -0
- package/src/plugins/table/toolbox.ts +165 -0
- package/src/plugins/table/utils/dom.ts +128 -0
- package/src/plugins/table/utils/popover.ts +172 -0
- package/src/plugins/table/utils/throttled.ts +22 -0
- package/src/plugins/underline/index.css +3 -0
- package/src/plugins/underline/index.ts +216 -0
- package/src/plugins/undo/index.ts +509 -0
- package/src/plugins/undo/observer.ts +101 -0
- package/src/style.css +89 -0
- package/src/utils/index.ts +15 -0
- package/src/utils/install.ts +19 -0
- package/tsconfig.json +37 -0
- package/types/index.d.ts +13 -0
- package/types/plugins/index.d.ts +0 -0
- 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 };
|