@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.
- package/.postcssrc.yml +33 -0
- package/dist/index.d.ts +3 -7
- package/dist/index.mjs +183 -182
- package/dist/index.mjs.map +1 -0
- package/package.json +1 -1
- package/postcss.config.js +15 -0
- package/src/components/Editor/Editor.vue +293 -0
- package/src/components/index.ts +27 -0
- package/src/constants/index.ts +1 -0
- package/src/i18n/zh-cn.ts +160 -0
- package/src/icons/index.ts +93 -0
- package/src/index.ts +21 -0
- package/src/installer.ts +21 -0
- package/src/plugins/alert/index.ts +455 -0
- package/src/plugins/block-alignment/index.ts +117 -0
- package/src/plugins/block-alignment/readme.md +1 -0
- package/src/plugins/code/LICENSE +21 -0
- package/src/plugins/code/index.ts +619 -0
- package/src/plugins/code/utils/string.ts +34 -0
- package/src/plugins/color-picker/index.ts +132 -0
- package/src/plugins/delimiter/index.ts +121 -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 +404 -0
- package/src/plugins/header/H2.ts +403 -0
- package/src/plugins/header/H3.ts +404 -0
- package/src/plugins/header/H4.ts +404 -0
- package/src/plugins/header/H5.ts +403 -0
- package/src/plugins/header/H6.ts +404 -0
- package/src/plugins/header/index.ts +15 -0
- package/src/plugins/header/types.d.ts +46 -0
- package/src/plugins/imageResizeCrop/ImageTune.ts +635 -0
- package/src/plugins/imageResizeCrop/index.css +230 -0
- package/src/plugins/imageResizeCrop/index.ts +5 -0
- package/src/plugins/imageResizeCrop/types.d.ts +23 -0
- package/src/plugins/imageTool/index.ts +510 -0
- package/src/plugins/imageTool/types/codexteam__ajax.d.ts +89 -0
- package/src/plugins/imageTool/types/types.ts +236 -0
- package/src/plugins/imageTool/ui.ts +313 -0
- package/src/plugins/imageTool/uploader.ts +287 -0
- package/src/plugins/imageTool/utils/dom.ts +24 -0
- package/src/plugins/imageTool/utils/index.ts +73 -0
- package/src/plugins/imageTool/utils/isPromise.ts +10 -0
- package/src/plugins/indent/index.ts +695 -0
- package/src/plugins/inline-code/index.ts +203 -0
- package/src/plugins/list/ListRenderer/ChecklistRenderer.ts +208 -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 +488 -0
- package/src/plugins/list/styles/CssPrefix.ts +4 -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 +83 -0
- package/src/plugins/list/utils/removeChildWrapperIfEmpty.ts +31 -0
- package/src/plugins/list/utils/renderToolboxInput.ts +113 -0
- package/src/plugins/list/utils/stripNumbers.ts +7 -0
- package/src/plugins/list/utils/type-guards.ts +8 -0
- package/src/plugins/marker/index.ts +199 -0
- package/src/plugins/outline/index.ts +62 -0
- package/src/plugins/outline/outline.css +52 -0
- package/src/plugins/paragraph/index.ts +384 -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.ts +203 -0
- package/src/plugins/table/index.ts +4 -0
- package/src/plugins/table/plugin.ts +255 -0
- package/src/plugins/table/table.ts +1202 -0
- package/src/plugins/table/toolbox.ts +166 -0
- package/src/plugins/table/utils/dom.ts +130 -0
- package/src/plugins/table/utils/popover.ts +185 -0
- package/src/plugins/table/utils/throttled.ts +22 -0
- package/src/plugins/underline/index.ts +214 -0
- package/src/plugins/undo/index.ts +526 -0
- package/src/plugins/undo/observer.ts +101 -0
- package/src/plugins/undo/vanilla-caret-js.ts +102 -0
- package/src/style.css +139 -0
- package/src/types.ts +3 -0
- package/src/utils/AxiosService.ts +87 -0
- package/src/utils/index.ts +15 -0
- package/src/utils/install.ts +19 -0
- package/tsconfig.json +37 -0
- package/vite.config.ts +81 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
export default class VanillaCaret {
|
|
2
|
+
target: any;
|
|
3
|
+
isContentEditable: any;
|
|
4
|
+
/**
|
|
5
|
+
* Create a new caret helper.
|
|
6
|
+
*
|
|
7
|
+
* @param {HTMLElement} target element to read or set the caret position on
|
|
8
|
+
*/
|
|
9
|
+
constructor(target: any) {
|
|
10
|
+
this.target = target
|
|
11
|
+
this.isContentEditable = target && target.contentEditable
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Return the current caret position.
|
|
16
|
+
*
|
|
17
|
+
* @returns {number} -1 if element is not in focus
|
|
18
|
+
*/
|
|
19
|
+
getPos() {
|
|
20
|
+
// for contenteditable field
|
|
21
|
+
if (document.activeElement !== this.target) {
|
|
22
|
+
return -1
|
|
23
|
+
}
|
|
24
|
+
if (this.isContentEditable === 'true') {
|
|
25
|
+
this.target.focus()
|
|
26
|
+
const selection = document.getSelection();
|
|
27
|
+
if(!selection) {
|
|
28
|
+
return -1
|
|
29
|
+
}
|
|
30
|
+
let _range = selection.getRangeAt(0)
|
|
31
|
+
let range = _range.cloneRange()
|
|
32
|
+
range.selectNodeContents(this.target)
|
|
33
|
+
range.setEnd(_range.endContainer, _range.endOffset)
|
|
34
|
+
return range.toString().length
|
|
35
|
+
}
|
|
36
|
+
// for textarea/input element
|
|
37
|
+
return this.target.selectionStart
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Set the caret position.
|
|
42
|
+
*
|
|
43
|
+
* @param {number} position caret position to set
|
|
44
|
+
*/
|
|
45
|
+
setPos(position:number) {
|
|
46
|
+
if (this.isContentEditable === 'true') {
|
|
47
|
+
if (position >= 0) {
|
|
48
|
+
const selection = window.getSelection();
|
|
49
|
+
if (!selection) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const range = this.createRange(this.target, {
|
|
53
|
+
count: position
|
|
54
|
+
})
|
|
55
|
+
if (range) {
|
|
56
|
+
range.collapse(false)
|
|
57
|
+
selection.removeAllRanges()
|
|
58
|
+
selection.addRange(range)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
this.target.focus();
|
|
63
|
+
this.target.setSelectionRange(position, position)
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Helper used to create a range for a given position.
|
|
69
|
+
*
|
|
70
|
+
* @param {Node} node node to inspect
|
|
71
|
+
* @param {{count: number}} chars current characters left
|
|
72
|
+
* @param {Range} [range] working range
|
|
73
|
+
* @returns {Range}
|
|
74
|
+
*/
|
|
75
|
+
createRange(node: Node, chars: { count: number }, range?: Range) : Range {
|
|
76
|
+
if (!range) {
|
|
77
|
+
range = document.createRange()
|
|
78
|
+
range.selectNode(node)
|
|
79
|
+
range.setStart(node, 0)
|
|
80
|
+
}
|
|
81
|
+
if (chars.count === 0) {
|
|
82
|
+
range.setEnd(node, chars.count)
|
|
83
|
+
} else if (node && chars.count > 0) {
|
|
84
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
85
|
+
if (node.textContent && node.textContent.length < chars.count) {
|
|
86
|
+
chars.count -= node.textContent.length
|
|
87
|
+
} else {
|
|
88
|
+
range.setEnd(node, chars.count)
|
|
89
|
+
chars.count = 0
|
|
90
|
+
}
|
|
91
|
+
} else {
|
|
92
|
+
for (let lp = 0; lp < node.childNodes.length; lp++) {
|
|
93
|
+
range = this.createRange(node.childNodes[lp], chars, range)
|
|
94
|
+
if (chars.count === 0) {
|
|
95
|
+
break
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return range
|
|
101
|
+
}
|
|
102
|
+
}
|
package/src/style.css
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
:root{
|
|
2
|
+
--color-border: #EFF0F1;
|
|
3
|
+
}
|
|
4
|
+
.ebl-editor{
|
|
5
|
+
cursor:text;
|
|
6
|
+
font-size: 16px;
|
|
7
|
+
font-weight: 400;
|
|
8
|
+
background-color: #fff;
|
|
9
|
+
|
|
10
|
+
height: 100%;
|
|
11
|
+
overflow: auto;
|
|
12
|
+
position: relative;
|
|
13
|
+
padding-top:15px;
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
/* .codex-editor{
|
|
17
|
+
height: 100%;
|
|
18
|
+
overflow: auto;
|
|
19
|
+
|
|
20
|
+
} */
|
|
21
|
+
.ebl-editor.outline{
|
|
22
|
+
padding-right: 280px;
|
|
23
|
+
}
|
|
24
|
+
.ebl-editor.outline .codex-editor{flex:1;}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@media(max-width:1240px){
|
|
28
|
+
.ebl-outline{
|
|
29
|
+
display: none;
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
.ebl-editor.outline{
|
|
33
|
+
padding-right: 0;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
@media(min-width:1240px){
|
|
37
|
+
.ebl-editor.readonly .ce-block__content{
|
|
38
|
+
max-width: 100%;
|
|
39
|
+
padding-left: 100px;
|
|
40
|
+
padding-right: 100px;
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
.ce-toolbar,.ce-inline-toolbar{
|
|
49
|
+
z-index: 1000;
|
|
50
|
+
}
|
|
51
|
+
.ce-toolbar__plus{
|
|
52
|
+
border: 1px solid var(--color-border);
|
|
53
|
+
}
|
|
54
|
+
.ce-toolbar {
|
|
55
|
+
.ce-popover__items{
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-direction: row;
|
|
58
|
+
flex-wrap: wrap
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
.ce-popover__items .ce-popover-item{
|
|
63
|
+
position: relative;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.ce-popover__items .ce-popover-item__title{
|
|
67
|
+
display: none;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.ce-popover-item-html,
|
|
71
|
+
.ce-popover-item-separator,
|
|
72
|
+
.ce-popover-item[data-item-name="convert-to"]
|
|
73
|
+
{
|
|
74
|
+
width: 100%;
|
|
75
|
+
}
|
|
76
|
+
.ce-popover-item-html[data-item-name="list-setting"]{
|
|
77
|
+
width: auto;
|
|
78
|
+
overflow: hidden;
|
|
79
|
+
}
|
|
80
|
+
.ce-popover-item-html[data-item-name="list-setting-start-with"]{
|
|
81
|
+
border-radius: 6px;
|
|
82
|
+
padding: 3px;
|
|
83
|
+
}
|
|
84
|
+
.ce-popover-item-html[data-item-name="list-setting-start-with"]:hover{
|
|
85
|
+
background-color: #f8f8f8;
|
|
86
|
+
}
|
|
87
|
+
.ce-popover-item[data-item-name="convert-to"] .ce-popover-item__title{
|
|
88
|
+
display: block;
|
|
89
|
+
}
|
|
90
|
+
.ce-popover-item[data-item-name="add-below"]{
|
|
91
|
+
width: 100%;
|
|
92
|
+
}
|
|
93
|
+
.ce-popover-item[data-item-name="add-below"] .ce-popover-item__title{
|
|
94
|
+
display: block;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.ce-popover-item[data-item-name="list-setting"]{
|
|
98
|
+
width: 100%;
|
|
99
|
+
}
|
|
100
|
+
.ce-popover-item[data-item-name="list-setting"] .ce-popover-item__title{
|
|
101
|
+
display: block;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.ce-inline-toolbar .ce-popover__items{
|
|
106
|
+
display: flex!important;
|
|
107
|
+
flex-direction: row;
|
|
108
|
+
flex-wrap: wrap;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.ce-inline-toolbar .ce-popover__items .ce-popover-item__title{
|
|
112
|
+
display: none
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
/* 滚动条整体部分 */
|
|
118
|
+
.ebl-editor ::-webkit-scrollbar {
|
|
119
|
+
width: 6px; /* 滚动条的宽度 */
|
|
120
|
+
height: 6px; /* 滚动条的高度 */
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* 滚动条轨道 */
|
|
124
|
+
.ebl-editor ::-webkit-scrollbar-track {
|
|
125
|
+
background: #f1f1f1; /* 轨道颜色 */
|
|
126
|
+
border-radius: 1px; /* 轨道圆角 */
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* 滚动条滑块 */
|
|
130
|
+
.ebl-editor ::-webkit-scrollbar-thumb {
|
|
131
|
+
background: #C0C0C0; /* 滑块颜色 */
|
|
132
|
+
border-radius: 10px; /* 滑块圆角 */
|
|
133
|
+
border: 1px solid #fff; /* 滑块边框 */
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* 滑块悬停时 */
|
|
137
|
+
.ebl-editor ::-webkit-scrollbar-thumb:hover {
|
|
138
|
+
background: #555; /* 滑块悬停时的颜色 */
|
|
139
|
+
}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import axios, { AxiosInstance, InternalAxiosRequestConfig, AxiosResponse } from "axios";
|
|
2
|
+
import { ElMessage } from "element-plus"
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
interface IAxiosServiceConstructorParams{
|
|
6
|
+
appBaseApi?: string,
|
|
7
|
+
timeout?:number,
|
|
8
|
+
eblStoreUser?: any|undefined
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
class AxiosService {
|
|
12
|
+
appBaseApi: string = "";
|
|
13
|
+
timeout: number = 30000;
|
|
14
|
+
eblStoreUser: any|undefined;
|
|
15
|
+
axiosInstance: AxiosInstance | undefined;
|
|
16
|
+
|
|
17
|
+
constructor(params?: IAxiosServiceConstructorParams | undefined ) {
|
|
18
|
+
if (typeof params !== "undefined") {
|
|
19
|
+
if (params.appBaseApi) {
|
|
20
|
+
this.appBaseApi = params.appBaseApi;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (params.timeout) {
|
|
24
|
+
this.timeout = params.timeout;
|
|
25
|
+
}
|
|
26
|
+
if (params.eblStoreUser) {
|
|
27
|
+
this.eblStoreUser = params.eblStoreUser;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
createAxios():AxiosInstance {
|
|
34
|
+
//创建实例
|
|
35
|
+
this.axiosInstance = axios.create({
|
|
36
|
+
baseURL: this.appBaseApi,
|
|
37
|
+
timeout: this.timeout,
|
|
38
|
+
headers: { "Content-Type": "application/json;charset=utf-8" },
|
|
39
|
+
});
|
|
40
|
+
//请求拦截
|
|
41
|
+
this.axiosInstance.interceptors.request.use((config: InternalAxiosRequestConfig) => {
|
|
42
|
+
|
|
43
|
+
if (this.eblStoreUser) {
|
|
44
|
+
const token = this.eblStoreUser.token;
|
|
45
|
+
const tokenName = this.eblStoreUser.tokenName;
|
|
46
|
+
const tokenPrefix = this.eblStoreUser.tokenPrefix;
|
|
47
|
+
if (token && tokenName) {
|
|
48
|
+
config.headers[tokenName] = tokenPrefix + " " + token;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return config;
|
|
52
|
+
}, (error: any) => {
|
|
53
|
+
return Promise.reject(error);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// 响应拦截器
|
|
57
|
+
this.axiosInstance.interceptors.response.use((response: AxiosResponse) => {
|
|
58
|
+
const { code, message } = response.data;
|
|
59
|
+
if (code === 1) {
|
|
60
|
+
return response.data;
|
|
61
|
+
}
|
|
62
|
+
ElMessage.error(message || "系统出错");
|
|
63
|
+
return response.data;
|
|
64
|
+
}, (error: any) => {
|
|
65
|
+
if (error) {
|
|
66
|
+
const { message } = error;
|
|
67
|
+
ElMessage.error(message || "系统出错");
|
|
68
|
+
}
|
|
69
|
+
return Promise.reject(error.message);
|
|
70
|
+
});
|
|
71
|
+
return this.axiosInstance;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
static instance(appBaseApi: string|undefined, timeout: number, eblStoreUser?: any) {
|
|
75
|
+
let options:any = { appBaseApi: appBaseApi, timeout: timeout };
|
|
76
|
+
if (eblStoreUser) {
|
|
77
|
+
options.eblStoreUser = eblStoreUser;
|
|
78
|
+
}
|
|
79
|
+
let service = new AxiosService(options);
|
|
80
|
+
return service.createAxios();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
}
|
|
85
|
+
export default AxiosService;
|
|
86
|
+
type IAxiosService = InstanceType<typeof AxiosService>;
|
|
87
|
+
export { IAxiosService }
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
copy: (o: any) => {
|
|
5
|
+
return JSON.parse(JSON.stringify(o));
|
|
6
|
+
},
|
|
7
|
+
createUniqueString: () => {
|
|
8
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
9
|
+
const r = Math.random() * 16 | 0;
|
|
10
|
+
const v = c === 'x' ? r : (r & 0x3 | 0x8);
|
|
11
|
+
console.log(v)
|
|
12
|
+
return v.toString(16);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { SFCWithInstall } from 'types'
|
|
2
|
+
import type {App} from 'vue'
|
|
3
|
+
export const withInstall = <T, E extends Record<string, any>>(
|
|
4
|
+
main: T,
|
|
5
|
+
extra?: E
|
|
6
|
+
) => {
|
|
7
|
+
;(main as SFCWithInstall<T>).install = (app:App): void => {
|
|
8
|
+
for (const comp of [main, ...Object.values(extra ?? {})]) {
|
|
9
|
+
app.component(comp.name, comp)
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (extra) {
|
|
14
|
+
for (const [key, comp] of Object.entries(extra)) {
|
|
15
|
+
;(main as any)[key] = comp
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return main as SFCWithInstall<T> & E
|
|
19
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"outDir": "dist",
|
|
4
|
+
"target": "es2018",
|
|
5
|
+
"module": "esnext",
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"strict": true,
|
|
8
|
+
"sourceMap": false,
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
"noUnusedLocals": true,
|
|
11
|
+
"resolveJsonModule": true,
|
|
12
|
+
"esModuleInterop": true,
|
|
13
|
+
"removeComments": false,
|
|
14
|
+
"jsx": "preserve",
|
|
15
|
+
"baseUrl": "./",
|
|
16
|
+
"declaration":true,
|
|
17
|
+
"declarationDir": "./types",
|
|
18
|
+
"skipLibCheck":true,
|
|
19
|
+
"rootDir": ".",
|
|
20
|
+
"lib": [
|
|
21
|
+
"ES2017",
|
|
22
|
+
"ES2018",
|
|
23
|
+
"ES2019",
|
|
24
|
+
"DOM"
|
|
25
|
+
],
|
|
26
|
+
"paths": {
|
|
27
|
+
"@/*": ["./src/*"],
|
|
28
|
+
"@/types": [ "./types/" ],
|
|
29
|
+
"@/types/*": [ "./types/*" ],
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"include": [
|
|
33
|
+
"./src/index.ts",
|
|
34
|
+
"./src/**/*",
|
|
35
|
+
"./types/index.d.ts"
|
|
36
|
+
]
|
|
37
|
+
}
|
package/vite.config.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import vue from '@vitejs/plugin-vue'
|
|
4
|
+
import vueJsx from '@vitejs/plugin-vue-jsx'
|
|
5
|
+
import { defineConfig, UserConfig, ConfigEnv } from 'vite'
|
|
6
|
+
import path from 'path';
|
|
7
|
+
import dts from "vite-plugin-dts";
|
|
8
|
+
import terser from '@rollup/plugin-terser'
|
|
9
|
+
import cssInjectedByJsPlugin from 'vite-plugin-css-injected-by-js';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
export default defineConfig(({ mode }: ConfigEnv): UserConfig => {
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
plugins: [
|
|
16
|
+
cssInjectedByJsPlugin(),
|
|
17
|
+
vue(),
|
|
18
|
+
vueJsx(),
|
|
19
|
+
dts({
|
|
20
|
+
rollupTypes: true,
|
|
21
|
+
tsconfigPath: "./tsconfig.json",
|
|
22
|
+
insertTypesEntry: true,
|
|
23
|
+
pathsToAliases:true
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
],
|
|
27
|
+
resolve: {
|
|
28
|
+
alias: {
|
|
29
|
+
"@": path.resolve(__dirname, "src"),
|
|
30
|
+
'@/types': path.resolve(__dirname, './types'),
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
build: {
|
|
34
|
+
copyPublicDir: false,
|
|
35
|
+
target: 'es2018',
|
|
36
|
+
emptyOutDir: true,
|
|
37
|
+
sourcemap:true,
|
|
38
|
+
lib: {
|
|
39
|
+
entry: path.resolve(__dirname,"src","index.ts"),
|
|
40
|
+
name: '@ebl-vue/editor-full',
|
|
41
|
+
formats:['es'],
|
|
42
|
+
fileName: format => `index.mjs`,
|
|
43
|
+
cssFileName: 'style',
|
|
44
|
+
},
|
|
45
|
+
rollupOptions: {
|
|
46
|
+
plugins: [
|
|
47
|
+
terser({
|
|
48
|
+
compress: {
|
|
49
|
+
drop_console:true,
|
|
50
|
+
drop_debugger: true
|
|
51
|
+
},
|
|
52
|
+
format: {
|
|
53
|
+
comments:false
|
|
54
|
+
}
|
|
55
|
+
}),
|
|
56
|
+
|
|
57
|
+
],
|
|
58
|
+
external: [
|
|
59
|
+
'vue',
|
|
60
|
+
'@ebl-vue/editorjs',
|
|
61
|
+
'@ebl-vue/editor-render',
|
|
62
|
+
'shiki',
|
|
63
|
+
'@editorjs/caret',
|
|
64
|
+
'@editorjs/dom',
|
|
65
|
+
'@codexteam/ajax',
|
|
66
|
+
'axios'
|
|
67
|
+
|
|
68
|
+
],
|
|
69
|
+
output: [
|
|
70
|
+
{
|
|
71
|
+
exports: 'named',
|
|
72
|
+
globals: {
|
|
73
|
+
vue: 'Vue'
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
});
|