@ebl-vue/editor-full 2.31.25 → 2.31.31

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 (114) hide show
  1. package/dist/index.d.ts +1 -28
  2. package/dist/index.mjs +549 -728
  3. package/package.json +3 -3
  4. package/types/index.d.ts +5 -1
  5. package/.postcssrc.yml +0 -33
  6. package/dist/index.mjs.map +0 -1
  7. package/postcss.config.js +0 -15
  8. package/src/components/Editor/Editor.vue +0 -293
  9. package/src/components/Editor/EditorRender.vue +0 -274
  10. package/src/components/index.ts +0 -29
  11. package/src/constants/index.ts +0 -1
  12. package/src/i18n/zh-cn.ts +0 -158
  13. package/src/icons/index.ts +0 -93
  14. package/src/index.ts +0 -22
  15. package/src/installer.ts +0 -21
  16. package/src/plugins/alert/index.css +0 -150
  17. package/src/plugins/alert/index.ts +0 -456
  18. package/src/plugins/block-alignment/index.css +0 -9
  19. package/src/plugins/block-alignment/index.ts +0 -117
  20. package/src/plugins/block-alignment/readme.md +0 -1
  21. package/src/plugins/code/LICENSE +0 -21
  22. package/src/plugins/code/index.css +0 -214
  23. package/src/plugins/code/index.ts +0 -621
  24. package/src/plugins/code/utils/string.ts +0 -34
  25. package/src/plugins/color-picker/index.ts +0 -130
  26. package/src/plugins/color-picker/styles.css +0 -27
  27. package/src/plugins/delimiter/index.css +0 -14
  28. package/src/plugins/delimiter/index.ts +0 -121
  29. package/src/plugins/drag-drop/index.css +0 -19
  30. package/src/plugins/drag-drop/index.ts +0 -151
  31. package/src/plugins/drag-drop/readme.md +0 -1
  32. package/src/plugins/header/H1.ts +0 -404
  33. package/src/plugins/header/H2.ts +0 -403
  34. package/src/plugins/header/H3.ts +0 -404
  35. package/src/plugins/header/H4.ts +0 -404
  36. package/src/plugins/header/H5.ts +0 -403
  37. package/src/plugins/header/H6.ts +0 -404
  38. package/src/plugins/header/index.css +0 -20
  39. package/src/plugins/header/index.ts +0 -15
  40. package/src/plugins/header/types.d.ts +0 -46
  41. package/src/plugins/imageResizeCrop/ImageTune.ts +0 -916
  42. package/src/plugins/imageResizeCrop/index.css +0 -230
  43. package/src/plugins/imageResizeCrop/index.ts +0 -5
  44. package/src/plugins/imageResizeCrop/types.d.ts +0 -23
  45. package/src/plugins/imageTool/index.css +0 -156
  46. package/src/plugins/imageTool/index.ts +0 -538
  47. package/src/plugins/imageTool/types/codexteam__ajax.d.ts +0 -89
  48. package/src/plugins/imageTool/types/types.ts +0 -236
  49. package/src/plugins/imageTool/ui.ts +0 -313
  50. package/src/plugins/imageTool/uploader.ts +0 -272
  51. package/src/plugins/imageTool/utils/dom.ts +0 -24
  52. package/src/plugins/imageTool/utils/index.ts +0 -73
  53. package/src/plugins/imageTool/utils/isPromise.ts +0 -10
  54. package/src/plugins/indent/index.css +0 -86
  55. package/src/plugins/indent/index.ts +0 -695
  56. package/src/plugins/inline-code/index.css +0 -11
  57. package/src/plugins/inline-code/index.ts +0 -202
  58. package/src/plugins/list/ListRenderer/ChecklistRenderer.ts +0 -208
  59. package/src/plugins/list/ListRenderer/ListRenderer.ts +0 -73
  60. package/src/plugins/list/ListRenderer/OrderedListRenderer.ts +0 -123
  61. package/src/plugins/list/ListRenderer/UnorderedListRenderer.ts +0 -123
  62. package/src/plugins/list/ListRenderer/index.ts +0 -6
  63. package/src/plugins/list/ListTabulator/index.ts +0 -1179
  64. package/src/plugins/list/index.ts +0 -480
  65. package/src/plugins/list/styles/CssPrefix.ts +0 -4
  66. package/src/plugins/list/styles/input.css +0 -36
  67. package/src/plugins/list/styles/list.css +0 -165
  68. package/src/plugins/list/types/Elements.ts +0 -14
  69. package/src/plugins/list/types/ItemMeta.ts +0 -40
  70. package/src/plugins/list/types/ListParams.ts +0 -102
  71. package/src/plugins/list/types/ListRenderer.ts +0 -6
  72. package/src/plugins/list/types/OlCounterType.ts +0 -63
  73. package/src/plugins/list/types/index.ts +0 -14
  74. package/src/plugins/list/utils/focusItem.ts +0 -18
  75. package/src/plugins/list/utils/getChildItems.ts +0 -40
  76. package/src/plugins/list/utils/getItemChildWrapper.ts +0 -10
  77. package/src/plugins/list/utils/getItemContentElement.ts +0 -10
  78. package/src/plugins/list/utils/getSiblings.ts +0 -52
  79. package/src/plugins/list/utils/isLastItem.ts +0 -9
  80. package/src/plugins/list/utils/itemHasSublist.ts +0 -10
  81. package/src/plugins/list/utils/normalizeData.ts +0 -83
  82. package/src/plugins/list/utils/removeChildWrapperIfEmpty.ts +0 -31
  83. package/src/plugins/list/utils/renderToolboxInput.ts +0 -105
  84. package/src/plugins/list/utils/stripNumbers.ts +0 -7
  85. package/src/plugins/list/utils/type-guards.ts +0 -8
  86. package/src/plugins/marker/index.css +0 -4
  87. package/src/plugins/marker/index.ts +0 -199
  88. package/src/plugins/outline/index.css +0 -52
  89. package/src/plugins/outline/index.ts +0 -63
  90. package/src/plugins/paragraph/index.css +0 -23
  91. package/src/plugins/paragraph/index.ts +0 -381
  92. package/src/plugins/paragraph/types/icons.d.ts +0 -4
  93. package/src/plugins/paragraph/utils/makeFragment.ts +0 -17
  94. package/src/plugins/quote/index.css +0 -26
  95. package/src/plugins/quote/index.ts +0 -203
  96. package/src/plugins/table/index.ts +0 -4
  97. package/src/plugins/table/plugin.ts +0 -254
  98. package/src/plugins/table/style.css +0 -388
  99. package/src/plugins/table/table.ts +0 -1195
  100. package/src/plugins/table/toolbox.ts +0 -166
  101. package/src/plugins/table/utils/dom.ts +0 -130
  102. package/src/plugins/table/utils/popover.ts +0 -185
  103. package/src/plugins/table/utils/throttled.ts +0 -22
  104. package/src/plugins/underline/index.css +0 -3
  105. package/src/plugins/underline/index.ts +0 -214
  106. package/src/plugins/undo/index.ts +0 -524
  107. package/src/plugins/undo/observer.ts +0 -101
  108. package/src/style.css +0 -114
  109. package/src/types.ts +0 -3
  110. package/src/utils/AxiosService.ts +0 -87
  111. package/src/utils/index.ts +0 -15
  112. package/src/utils/install.ts +0 -19
  113. package/tsconfig.json +0 -37
  114. package/vite.config.ts +0 -81
@@ -1,272 +0,0 @@
1
-
2
- import isPromise from './utils/isPromise';
3
- import type { IUploadResponseFormat, UploadOptions } from './types/types';
4
- import type { UploadResponseFormat, ImageConfig } from './types/types';
5
- import axios, { AxiosInstance } from "axios";
6
- import { selectFiles } from './utils/index';
7
- /**
8
- * Params interface for Uploader constructor
9
- */
10
- interface UploaderParams {
11
- /**
12
- * Configuration for the uploader
13
- */
14
- config: ImageConfig;
15
-
16
- /**
17
- * Handles the upload response.
18
- * @param {UploadResponseFormat} response - Response format expected from the backend on file uploading.
19
- * @returns {void}
20
- */
21
- onUpload: (response: UploadResponseFormat) => void;
22
-
23
- /**
24
- *
25
- * @param error : error type
26
- * @returns void
27
- */
28
- onError: (error: string) => void;
29
- }
30
-
31
- /**
32
- * Module for file uploading. Handle 3 scenarios:
33
- * 1. Select file from device and upload
34
- * 2. Upload by pasting URL
35
- * 3. Upload by pasting file from Clipboard or by Drag'n'Drop
36
- */
37
- export default class Uploader {
38
- private config: ImageConfig;
39
- private onUpload: (response: UploadResponseFormat) => void;
40
- private onError: (error: string) => void;
41
- /**
42
- * @param params - uploader module params
43
- * @param params.config - image tool config
44
- * @param params.onUpload - one callback for all uploading (file, url, d-n-d, pasting)
45
- * @param params.onError - callback for uploading errors
46
- */
47
- constructor({ config, onUpload, onError }: UploaderParams) {
48
- this.config = config;
49
- this.onUpload = onUpload;
50
- this.onError = onError;
51
- }
52
-
53
- /**
54
- * Handle clicks on the upload file button
55
- * Fires ajax.transport()
56
- * @param onPreview - callback fired when preview is ready
57
- */
58
- public async uploadSelectedFile({ onPreview, noSelectedFile }: UploadOptions) {
59
-
60
- const preparePreview = function (file: File): void {
61
- const reader = new FileReader();
62
-
63
- reader.readAsDataURL(file);
64
- reader.onload = (e) => {
65
- onPreview((e.target as FileReader).result as string);
66
- };
67
- };
68
-
69
- /**
70
- * Custom uploading
71
- * or default uploading
72
- */
73
-
74
- let cdn: string = "";
75
- let objectKey: string = "";
76
-
77
-
78
-
79
- //选获取上传文件的地址
80
- const files = await selectFiles({ accept: this.config.types ?? 'image/*' });
81
-
82
- if (files && files.length > 0) {
83
- preparePreview(files[0]);
84
- } else {
85
- noSelectedFile();
86
- return
87
- }
88
-
89
- const file = files[0];
90
- const fileTypes = this.config.types.split(",");
91
- let suffixIndex = file.name.lastIndexOf(".");
92
- let suffix = file.name.slice(suffixIndex);
93
-
94
- if (!fileTypes.includes(suffix.toLowerCase())) {
95
- this.onError("文件类型不支持");
96
- return;
97
- }
98
-
99
- let headers: Record<string, string> = {};
100
- if (this.config.userStore) {
101
- const token = this.config.userStore.token;
102
- const tokenName = this.config.userStore.tokenName;
103
- const tokenPrefix = this.config.userStore.tokenPrefix;
104
- if (token && tokenName) {
105
- headers[tokenName] = tokenPrefix + " " + token
106
- }
107
- }
108
- headers["Content-Type"] = "application/json";
109
- const axiosInstance: AxiosInstance = axios.create({
110
- timeout: 1800000,
111
- headers: headers,
112
- });
113
-
114
- //console.log("this.config.endpoints", this.config.endpoints);
115
- const uploadBodyRes = await axiosInstance.post(this.config.endpoints.byFile!, {
116
- "fileName": file.name,
117
- "contentType": file.type
118
- })
119
- if (uploadBodyRes.status !== 200) {
120
- this.onError(uploadBodyRes.statusText);
121
- return;
122
- }
123
- const uploadRes = uploadBodyRes.data;
124
- if (!uploadRes.success) {
125
- this.onError(uploadRes.message!);
126
- return;
127
- }
128
- console.log(uploadRes);
129
- cdn = uploadRes.data.cdn;
130
- objectKey = uploadRes.data.objectKey;
131
-
132
- //headers["Content-Type"] = file.type;
133
-
134
- const axiosUpload: AxiosInstance = axios.create({
135
- timeout: 1800000,
136
- headers: { "Content-Type": file.type }
137
- });
138
- let upload = axiosUpload.put(uploadRes.data.presignedUrl, file);
139
-
140
-
141
- upload.then((response) => {
142
-
143
- if (response.status === 200) {
144
- response = {
145
- success: 1,
146
- file: { url: cdn + objectKey }
147
- }
148
- }
149
- this.onUpload(response);
150
- }).catch((error: string) => {
151
- this.onError(error);
152
- });
153
- }
154
-
155
- /**
156
- * Handle clicks on the upload file button
157
- * Fires ajax.post()
158
- * @param url - image source url
159
- */
160
- public uploadByUrl(url: string): void {
161
- let upload;
162
- let headers: Record<string, string> = { "Content-Type": "application/json" };
163
- if (this.config.userStore) {
164
- const token = this.config.userStore.token;
165
- const tokenName = this.config.userStore.tokenName;
166
- const tokenPrefix = this.config.userStore.tokenPrefix;
167
- if (token && tokenName) {
168
- headers[tokenName] = tokenPrefix + " " + token
169
- }
170
- }
171
- const axiosInstance: AxiosInstance = axios.create({
172
- timeout: 1800000,
173
- headers: headers,
174
- });
175
- upload = axiosInstance.post(this.config.endpoints.byUrl!, {
176
- "url": url,
177
- "accept": ".jpg,.jpeg,.gif,.png,.webp"
178
- })
179
-
180
-
181
-
182
-
183
- upload.then((response) => {
184
-
185
- if(response.status !== 200||response.data.success===false){
186
- this.onError(response.data.message!);
187
- return;
188
- }
189
-
190
- let cdn = response.data.data.cdn;
191
- let objectKey = response.data.data.objectKey;
192
-
193
- let res = {
194
- success: 1,
195
- file: { url: cdn + objectKey }
196
- };
197
- this.onUpload(res);
198
- }).catch((error: string) => {
199
- this.onError(error);
200
- });
201
-
202
- }
203
-
204
- /**
205
- * Handle clicks on the upload file button
206
- * Fires ajax.post()
207
- * @param file - file pasted by drag-n-drop
208
- * @param onPreview - file pasted by drag-n-drop
209
- */
210
- public async uploadByFile(file: Blob, { onPreview }: UploadOptions) {
211
-
212
-
213
- const fileTypes = this.config.types.split(",");
214
-
215
- let suffixIndex = file.name.lastIndexOf(".");
216
- let suffix = file.name.slice(suffixIndex);
217
-
218
- if (!fileTypes.includes(suffix.toLowerCase())) {
219
- this.onError("文件类型不支持");
220
- return;
221
- }
222
-
223
-
224
-
225
- let headers: Record<string, string> = {};
226
- if (this.config.userStore) {
227
- const token = this.config.userStore.token;
228
- const tokenName = this.config.userStore.tokenName;
229
- const tokenPrefix = this.config.userStore.tokenPrefix;
230
- if (token && tokenName) {
231
- headers[tokenName] = tokenPrefix + " " + token
232
- }
233
- }
234
- const axiosInstance: AxiosInstance = axios.create({
235
- timeout: 1800000,
236
- headers: headers,
237
- });
238
- headers["Content-Type"] = "application/json";
239
-
240
- const uploadBodyRes = await axiosInstance.post(this.config.endpoints.byFile!, {
241
- "fileName": file.name,
242
- "contentType": file.type
243
- })
244
- if (uploadBodyRes.status !== 200) {
245
- this.onError(uploadBodyRes.statusText);
246
- return;
247
- }
248
- const uploadRes = uploadBodyRes.data;
249
- if (!uploadRes.success) {
250
- this.onError(uploadRes.message!);
251
- return;
252
- }
253
- console.log(uploadRes);
254
- let cdn = uploadRes.data.cdn;
255
- let objectKey = uploadRes.data.objectKey;
256
-
257
-
258
- headers["Content-Type"] = file.type;
259
- let upload = axiosInstance.put(uploadRes.data.presignedUrl, file);
260
- upload.then((response) => {
261
- if (response.status === 200) {
262
- response = {
263
- success: 1,
264
- file: { url: cdn + objectKey }
265
- }
266
- }
267
- this.onUpload(response);
268
- }).catch((error: string) => {
269
- this.onError(error);
270
- });
271
- }
272
- }
@@ -1,24 +0,0 @@
1
- /**
2
- * Helper for making Elements with attributes
3
- * @param tagName - new Element tag name
4
- * @param classNames - list or name of CSS class
5
- * @param attributes - any attributes
6
- * @returns
7
- */
8
- export function make(tagName: string, classNames: string[] | string | null = null, attributes: { [key: string]: string | boolean } = {}): HTMLElement {
9
- const el = document.createElement(tagName);
10
-
11
- if (Array.isArray(classNames)) {
12
- el.classList.add(...classNames);
13
- } else if (classNames !== null) {
14
- el.classList.add(classNames);
15
- }
16
-
17
- for (const attrName in attributes) {
18
- if (attributes.hasOwnProperty(attrName)) {
19
- (el as unknown as { [key: string]: string | boolean })[attrName] = attributes[attrName];
20
- }
21
- }
22
-
23
- return el;
24
- }
@@ -1,73 +0,0 @@
1
- interface IConfig {
2
- multiple?: boolean;
3
- accept?: string;
4
- }
5
- export function selectFiles(config = {} as IConfig): Promise<File[]> {
6
- let fileCancle = true;
7
- return new Promise((resolve, reject) => {
8
- /**
9
- * Create a new INPUT element
10
- * @type {HTMLElement}
11
- */
12
- let inputElement = document.createElement('INPUT');
13
-
14
- /**
15
- * Set a 'FILE' type for this input element
16
- * @type {string}
17
- */
18
- inputElement.type = 'file';
19
-
20
- if (config.multiple) {
21
- inputElement.setAttribute('multiple', 'multiple');
22
- }
23
-
24
- if (config.accept) {
25
- inputElement.setAttribute('accept', config.accept);
26
- }
27
-
28
- /**
29
- * Do not show element
30
- */
31
- inputElement.style.display = 'none';
32
-
33
- /**
34
- * Append element to the body
35
- * Fix using module on mobile devices
36
- */
37
- document.body.appendChild(inputElement);
38
-
39
- /**
40
- * Add onchange listener for «choose file» pop-up
41
- */
42
- inputElement.addEventListener('change', event => {
43
- console.log("选中文件")
44
- fileCancle = false;
45
- /**
46
- * Get files from input field
47
- */
48
- const files = event.target.files;
49
-
50
- /**
51
- * Return ready to be uploaded files array
52
- */
53
- resolve(files);
54
-
55
- /**
56
- * Remove element from a DOM
57
- */
58
- document.body.removeChild(inputElement);
59
- }, false);
60
- window.addEventListener("focus", () => {
61
- setTimeout(() => {
62
- if (fileCancle) {
63
- console.log("取消选择文件")
64
- resolve([]);
65
- }
66
- }, 1000)
67
- },{once: true})
68
- /**
69
- * Fire click event on «input file» field
70
- */
71
- inputElement.click();
72
- });
73
- };
@@ -1,10 +0,0 @@
1
- import type { UploadResponseFormat } from '../types/types';
2
-
3
- /**
4
- * Check if passed object is a Promise
5
- * @param object - object to check
6
- * @returns
7
- */
8
- export default function isPromise(object: Promise<UploadResponseFormat>): object is Promise<UploadResponseFormat> {
9
- return object !== undefined && typeof object.then === 'function';
10
- }
@@ -1,86 +0,0 @@
1
- .ce-popover-indent-item {
2
- cursor: default !important;
3
- display: flex;
4
- align-items: center;
5
- padding: 3px;
6
- }
7
-
8
- .ce-popover-indent-item[version^="2.26"] {
9
- gap: 10px;
10
- }
11
-
12
- .ce-popover-indent-item:hover {
13
- background-color: transparent !important;
14
- }
15
-
16
- .ce-popover-indent-item .ce-popover-item__icon {
17
- width: 26px;
18
- height: 26px;
19
- cursor: pointer;
20
- will-change: background-color, color;
21
- transition: 0.3s background-color, 0.3s color;
22
- padding-block: 0px;
23
- padding-inline: 0px;
24
- border-width: 0px;
25
- color: var(--color-text-primary, black);
26
- background-color: #fff;
27
- border-radius: 5px;
28
- -webkit-border-radius: 5px;
29
- -moz-border-radius: 5px;
30
- -ms-border-radius: 5px;
31
- -o-border-radius: 5px;
32
- -webkit-transition: 0.3s background-color, 0.3s color;
33
- -moz-transition: 0.3s background-color, 0.3s color;
34
- -ms-transition: 0.3s background-color, 0.3s color;
35
- -o-transition: 0.3s background-color, 0.3s color;
36
- }
37
-
38
- .ce-popover-indent-item .ce-popover-item--disabled {
39
- color: var(--color-text-secondary, #707684);
40
- opacity: 0.3;
41
- cursor: default;
42
- }
43
-
44
- .ce-popover-indent-item .ce-popover-item__icon:focus {
45
- outline: none;
46
- }
47
-
48
- .ce-popover-indent-item:is([version^="2.26"], [version^="2.27"], [version^="2.28"], [version^="2.29"]):hover .ce-popover-item__icon {
49
- box-shadow: 0 0 0 1px var(--color-border-icon, rgba(201, 201, 204, 0.48)) !important;
50
- -webkit-box-shadow: 0 0 0 1px var(--color-border-icon, rgba(201, 201, 204, 0.48)) !important;
51
- }
52
-
53
- .ce-popover-indent-item:is([version^="2.26"], [version^="2.27"], [version^="2.28"], [version^="2.29"]) .ce-popover-item__icon {
54
- box-shadow: 0 0 0 1px var(--color-border-icon, rgba(201, 201, 204, 0.48)) !important;
55
- -webkit-box-shadow: 0 0 0 1px var(--color-border-icon, rgba(201, 201, 204, 0.48)) !important;
56
- }
57
-
58
- .ce-popover-indent-item:is([version^="2.26"], [version^="2.27"], [version^="2.28"], [version^="2.29"]) .ce-popover-item__icon:hover {
59
- background-color: var(--color-background-item-hover, #eff2f5);
60
- }
61
-
62
- [data-block-indent-wrapper] {
63
- /* will-change: padding-left, padding-right;
64
- transition: padding-left .4s, padding-right .4s;
65
- -webkit-transition: padding-left .4s, padding-right .4s;
66
- -moz-transition: padding-left .4s, padding-right .4s;
67
- -ms-transition: padding-left .4s, padding-right .4s;
68
- -o-transition: padding-left .4s, padding-right .4s; */
69
- }
70
-
71
- .ce-highlight-indent {
72
- display: inline-block;
73
- height: 1.6em;
74
- top: 50%;
75
- position: absolute;
76
- transform: translate(0px, -50%);
77
- -webkit-transform: translate(0px, -50%);
78
- -moz-transform: translate(0px, -50%);
79
- -ms-transform: translate(0px, -50%);
80
- -o-transform: translate(0px, -50%);
81
- }
82
-
83
-
84
- .ce-popover-indent-item[version^="2.3"] .ce-popover-item__title {
85
- margin-left: 4px;
86
- }