@wangeditor-next/editor-for-vue2 1.0.2 → 6.1.1
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/LICENSE +21 -0
- package/dist/index.esm.js +287 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/src/components/Editor.vue.d.ts +3 -0
- package/dist/{components → src/components}/Toolbar.vue.d.ts +10 -5
- package/dist/{index.d.ts → src/index.d.ts} +7 -7
- package/dist/src/shims-vue.d.ts +5 -0
- package/package.json +36 -62
- package/README.md +0 -20
- package/dist/components/Editor.vue.d.ts +0 -9
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 - present wangEditor-team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.esm.js
CHANGED
|
@@ -1,2 +1,288 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createEditor, DomEditor, createToolbar } from "@wangeditor-next/editor";
|
|
2
|
+
import Vue from "vue";
|
|
3
|
+
function genErrorInfo(fnName) {
|
|
4
|
+
let info = `\u8BF7\u4F7F\u7528 '@${fnName}' \u4E8B\u4EF6\uFF0C\u4E0D\u8981\u653E\u5728 props \u4E2D`;
|
|
5
|
+
info += `
|
|
6
|
+
Please use '@${fnName}' event instead of props`;
|
|
7
|
+
return info;
|
|
8
|
+
}
|
|
9
|
+
var _sfc_main$1 = Vue.extend({
|
|
10
|
+
render(h) {
|
|
11
|
+
return h("div", { ref: "box" });
|
|
12
|
+
},
|
|
13
|
+
name: "Editor",
|
|
14
|
+
data() {
|
|
15
|
+
return {
|
|
16
|
+
curValue: "",
|
|
17
|
+
editor: null
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
props: {
|
|
21
|
+
defaultContent: {
|
|
22
|
+
type: Array,
|
|
23
|
+
default: () => []
|
|
24
|
+
},
|
|
25
|
+
defaultConfig: {
|
|
26
|
+
type: Object,
|
|
27
|
+
default: () => ({})
|
|
28
|
+
},
|
|
29
|
+
mode: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: "default"
|
|
32
|
+
},
|
|
33
|
+
defaultHtml: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: ""
|
|
36
|
+
},
|
|
37
|
+
value: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: ""
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
emits: [
|
|
43
|
+
"onCreated",
|
|
44
|
+
"input",
|
|
45
|
+
"onChange",
|
|
46
|
+
"onDestroyed",
|
|
47
|
+
"onMaxLength",
|
|
48
|
+
"onFocus",
|
|
49
|
+
"onBlur",
|
|
50
|
+
"customAlert",
|
|
51
|
+
"customPaste"
|
|
52
|
+
],
|
|
53
|
+
mounted() {
|
|
54
|
+
this.create();
|
|
55
|
+
},
|
|
56
|
+
watch: {
|
|
57
|
+
value(newVal) {
|
|
58
|
+
const isEqual = newVal === this.curValue;
|
|
59
|
+
if (isEqual) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
this.setHtml(newVal);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
methods: {
|
|
66
|
+
setHtml(newHtml) {
|
|
67
|
+
const editor = this.editor;
|
|
68
|
+
if (editor == null) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
editor.setHtml(newHtml);
|
|
72
|
+
},
|
|
73
|
+
create() {
|
|
74
|
+
if (this.$refs.box == null) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const defaultConfig = this.defaultConfig || {};
|
|
78
|
+
const defaultContent = JSON.stringify(
|
|
79
|
+
Array.isArray(this.defaultContent) ? this.defaultContent : []
|
|
80
|
+
);
|
|
81
|
+
createEditor({
|
|
82
|
+
selector: this.$refs.box,
|
|
83
|
+
html: this.defaultHtml || this.value || "",
|
|
84
|
+
config: {
|
|
85
|
+
...defaultConfig,
|
|
86
|
+
onCreated: (editor) => {
|
|
87
|
+
this.editor = Object.seal(editor);
|
|
88
|
+
this.$emit("onCreated", editor);
|
|
89
|
+
if (defaultConfig.onCreated) {
|
|
90
|
+
const info = genErrorInfo("onCreated");
|
|
91
|
+
throw new Error(info);
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
onChange: (editor) => {
|
|
95
|
+
const editorHtml = editor.getHtml();
|
|
96
|
+
this.curValue = editorHtml;
|
|
97
|
+
this.$emit("input", editorHtml);
|
|
98
|
+
this.$emit("onChange", editor);
|
|
99
|
+
if (defaultConfig.onChange) {
|
|
100
|
+
const info = genErrorInfo("onChange");
|
|
101
|
+
throw new Error(info);
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
onDestroyed: (editor) => {
|
|
105
|
+
this.$emit("onDestroyed", editor);
|
|
106
|
+
if (defaultConfig.onDestroyed) {
|
|
107
|
+
const info = genErrorInfo("onDestroyed");
|
|
108
|
+
throw new Error(info);
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
onMaxLength: (editor) => {
|
|
112
|
+
this.$emit("onMaxLength", editor);
|
|
113
|
+
if (defaultConfig.onMaxLength) {
|
|
114
|
+
const info = genErrorInfo("onMaxLength");
|
|
115
|
+
throw new Error(info);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
onFocus: (editor) => {
|
|
119
|
+
this.$emit("onFocus", editor);
|
|
120
|
+
if (defaultConfig.onFocus) {
|
|
121
|
+
const info = genErrorInfo("onFocus");
|
|
122
|
+
throw new Error(info);
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
onBlur: (editor) => {
|
|
126
|
+
this.$emit("onBlur", editor);
|
|
127
|
+
if (defaultConfig.onBlur) {
|
|
128
|
+
const info = genErrorInfo("onBlur");
|
|
129
|
+
throw new Error(info);
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
customAlert: (info, type) => {
|
|
133
|
+
this.$emit("customAlert", info, type);
|
|
134
|
+
if (defaultConfig.customAlert) {
|
|
135
|
+
const errorInfo = genErrorInfo("customAlert");
|
|
136
|
+
throw new Error(errorInfo);
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
customPaste: (editor, event) => {
|
|
140
|
+
if (defaultConfig.customPaste) {
|
|
141
|
+
const info = genErrorInfo("customPaste");
|
|
142
|
+
throw new Error(info);
|
|
143
|
+
}
|
|
144
|
+
let res;
|
|
145
|
+
this.$emit("customPaste", editor, event, (val) => {
|
|
146
|
+
res = val;
|
|
147
|
+
});
|
|
148
|
+
return res;
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
content: JSON.parse(defaultContent),
|
|
152
|
+
mode: this.mode || "default"
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
|
|
158
|
+
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
|
|
159
|
+
if (render) {
|
|
160
|
+
options.render = render;
|
|
161
|
+
options.staticRenderFns = staticRenderFns;
|
|
162
|
+
options._compiled = true;
|
|
163
|
+
}
|
|
164
|
+
if (functionalTemplate) {
|
|
165
|
+
options.functional = true;
|
|
166
|
+
}
|
|
167
|
+
if (scopeId) {
|
|
168
|
+
options._scopeId = "data-v-" + scopeId;
|
|
169
|
+
}
|
|
170
|
+
var hook;
|
|
171
|
+
if (moduleIdentifier) {
|
|
172
|
+
hook = function(context) {
|
|
173
|
+
context = context || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
|
|
174
|
+
if (!context && typeof __VUE_SSR_CONTEXT__ !== "undefined") {
|
|
175
|
+
context = __VUE_SSR_CONTEXT__;
|
|
176
|
+
}
|
|
177
|
+
if (injectStyles) {
|
|
178
|
+
injectStyles.call(this, context);
|
|
179
|
+
}
|
|
180
|
+
if (context && context._registeredComponents) {
|
|
181
|
+
context._registeredComponents.add(moduleIdentifier);
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
options._ssrRegister = hook;
|
|
185
|
+
} else if (injectStyles) {
|
|
186
|
+
hook = shadowMode ? function() {
|
|
187
|
+
injectStyles.call(
|
|
188
|
+
this,
|
|
189
|
+
(options.functional ? this.parent : this).$root.$options.shadowRoot
|
|
190
|
+
);
|
|
191
|
+
} : injectStyles;
|
|
192
|
+
}
|
|
193
|
+
if (hook) {
|
|
194
|
+
if (options.functional) {
|
|
195
|
+
options._injectStyles = hook;
|
|
196
|
+
var originalRender = options.render;
|
|
197
|
+
options.render = function renderWithStyleInjection(h, context) {
|
|
198
|
+
hook.call(context);
|
|
199
|
+
return originalRender(h, context);
|
|
200
|
+
};
|
|
201
|
+
} else {
|
|
202
|
+
var existing = options.beforeCreate;
|
|
203
|
+
options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return {
|
|
207
|
+
exports: scriptExports,
|
|
208
|
+
options
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
const _sfc_render$1 = null;
|
|
212
|
+
const _sfc_staticRenderFns$1 = null;
|
|
213
|
+
var __component__$1 = /* @__PURE__ */ normalizeComponent(
|
|
214
|
+
_sfc_main$1,
|
|
215
|
+
_sfc_render$1,
|
|
216
|
+
_sfc_staticRenderFns$1,
|
|
217
|
+
false,
|
|
218
|
+
null,
|
|
219
|
+
null,
|
|
220
|
+
null,
|
|
221
|
+
null
|
|
222
|
+
);
|
|
223
|
+
var Editor = __component__$1.exports;
|
|
224
|
+
var _sfc_main = Vue.extend({
|
|
225
|
+
name: "Toolbar",
|
|
226
|
+
render(h) {
|
|
227
|
+
return h("div", { ref: "box" });
|
|
228
|
+
},
|
|
229
|
+
props: {
|
|
230
|
+
editor: {
|
|
231
|
+
type: Object,
|
|
232
|
+
default: void 0
|
|
233
|
+
},
|
|
234
|
+
defaultConfig: {
|
|
235
|
+
type: Object,
|
|
236
|
+
default: () => ({})
|
|
237
|
+
},
|
|
238
|
+
mode: {
|
|
239
|
+
type: String,
|
|
240
|
+
default: "default"
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
methods: {
|
|
244
|
+
create(editor) {
|
|
245
|
+
if (this.$refs.box == null) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
if (editor == null) {
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
if (DomEditor.getToolbar(editor)) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
createToolbar({
|
|
255
|
+
editor,
|
|
256
|
+
selector: this.$refs.box,
|
|
257
|
+
config: this.defaultConfig || {},
|
|
258
|
+
mode: this.mode || "default"
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
watch: {
|
|
263
|
+
editor: {
|
|
264
|
+
handler(e) {
|
|
265
|
+
if (e == null) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
this.create(e);
|
|
269
|
+
},
|
|
270
|
+
immediate: true
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
const _sfc_render = null;
|
|
275
|
+
const _sfc_staticRenderFns = null;
|
|
276
|
+
var __component__ = /* @__PURE__ */ normalizeComponent(
|
|
277
|
+
_sfc_main,
|
|
278
|
+
_sfc_render,
|
|
279
|
+
_sfc_staticRenderFns,
|
|
280
|
+
false,
|
|
281
|
+
null,
|
|
282
|
+
null,
|
|
283
|
+
null,
|
|
284
|
+
null
|
|
285
|
+
);
|
|
286
|
+
var Toolbar = __component__.exports;
|
|
287
|
+
export { Editor, Toolbar };
|
|
2
288
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/components/Editor.vue","../src/components/Toolbar.vue"],"sourcesContent":["<script lang=\"ts\">\nimport Vue from 'vue';\nimport { createEditor } from '@wangeditor-next/editor';\n\nfunction genErrorInfo(fnName: string) {\n let info = `请使用 '@${fnName}' 事件,不要放在 props 中`;\n info += `\\nPlease use '@${fnName}' event instead of props`;\n return info;\n}\n\nexport default Vue.extend({\n //【注意】单独写 <template>...</template> 时,rollup 打包完浏览器运行时报错,所以先在这里写 template\n render(h) {\n return h('div', { ref: 'box' });\n },\n name: 'Editor',\n data() {\n return {\n curValue: '',\n editor: null,\n };\n },\n props: ['defaultContent', 'defaultConfig', 'mode', 'defaultHtml', 'value'], // value 用于自定义 v-model\n mounted() {\n this.create();\n },\n watch: {\n // 监听 'value' 属性变化 - value 用于自定义 v-model\n value(newVal) {\n const isEqual = newVal === this.curValue;\n if (isEqual) return; // 和当前内容一样,则忽略\n\n // 重置 HTML\n this.setHtml(newVal);\n },\n },\n methods: {\n // 重置 HTML\n setHtml(newHtml: string) {\n const editor = this.editor as any;\n if (editor == null) return;\n editor.setHtml(newHtml);\n },\n\n // 创建 editor\n create() {\n if (this.$refs.box == null) return;\n\n const defaultConfig = this.defaultConfig || {};\n\n const defaultContent = JSON.stringify(\n Array.isArray(this.defaultContent) ? this.defaultContent : []\n );\n\n createEditor({\n selector: this.$refs.box as Element,\n html: this.defaultHtml || this.value || '',\n config: {\n ...defaultConfig,\n onCreated: (editor) => {\n this.editor = Object.seal(editor) as any; // 注意,一定要用 Object.seal() 否则会报错\n\n this.$emit('onCreated', editor);\n if (defaultConfig.onCreated) {\n const info = genErrorInfo('onCreated');\n throw new Error(info);\n }\n },\n onChange: (editor) => {\n const editorHtml = editor.getHtml();\n this.curValue = editorHtml; // 记录当前 html 内容\n this.$emit('input', editorHtml); // 用于自定义 v-model\n\n this.$emit('onChange', editor);\n if (defaultConfig.onChange) {\n const info = genErrorInfo('onChange');\n throw new Error(info);\n }\n },\n onDestroyed: (editor) => {\n this.$emit('onDestroyed', editor);\n if (defaultConfig.onDestroyed) {\n const info = genErrorInfo('onDestroyed');\n throw new Error(info);\n }\n },\n onMaxLength: (editor) => {\n this.$emit('onMaxLength', editor);\n if (defaultConfig.onMaxLength) {\n const info = genErrorInfo('onMaxLength');\n throw new Error(info);\n }\n },\n onFocus: (editor) => {\n this.$emit('onFocus', editor);\n if (defaultConfig.onFocus) {\n const info = genErrorInfo('onFocus');\n throw new Error(info);\n }\n },\n onBlur: (editor) => {\n this.$emit('onBlur', editor);\n if (defaultConfig.onBlur) {\n const info = genErrorInfo('onBlur');\n throw new Error(info);\n }\n },\n customAlert: (info, type) => {\n this.$emit('customAlert', info, type);\n if (defaultConfig.customAlert) {\n const info = genErrorInfo('customAlert');\n throw new Error(info);\n }\n },\n customPaste: (editor, event) => {\n if (defaultConfig.customPaste) {\n const info = genErrorInfo('customPaste');\n throw new Error(info);\n }\n let res;\n this.$emit('customPaste', editor, event, (val: any) => {\n res = val;\n });\n return res;\n },\n },\n content: JSON.parse(defaultContent),\n mode: this.mode || 'default',\n });\n },\n },\n});\n</script>\n","<script lang=\"ts\">\nimport Vue from 'vue';\nimport { createToolbar, DomEditor } from '@wangeditor-next/editor';\n\nexport default Vue.extend({\n name: 'Toolbar',\n render(h) {\n return h('div', { ref: 'box' });\n },\n props: ['editor', 'defaultConfig', 'mode'],\n methods: {\n // 创建 toolbar\n create(editor: any) {\n if (this.$refs.box == null) return;\n if (editor == null) return;\n if (DomEditor.getToolbar(editor)) return // 不重复创建\n\n createToolbar({\n editor,\n selector: this.$refs.box as Element,\n config: this.defaultConfig || {},\n mode: this.mode || 'default',\n });\n },\n },\n watch: {\n editor: {\n handler(e) {\n if (e == null) return;\n this.create(e);\n },\n immediate: true,\n }\n }\n});\n</script>\n"],"names":["genErrorInfo","fnName","info","concat","script$1","Vue","extend","render","h","ref","name","data","curValue","editor","props","mounted","this","create","watch","value","newVal","setHtml","methods","newHtml","_this","$refs","box","defaultConfig","defaultContent","JSON","stringify","Array","isArray","createEditor","selector","html","defaultHtml","config","onCreated","Object","seal","$emit","Error","onChange","editorHtml","getHtml","onDestroyed","onMaxLength","onFocus","onBlur","customAlert","type","info_1","customPaste","event","res","val","content","parse","mode","script","DomEditor","getToolbar","createToolbar","handler","e","immediate"],"mappings":"gUAIA,SAASA,EAAaC,GACpB,IAAIC,EAAO,SAASC,OAAAF,uBAEpB,OADAC,GAAQ,kBAAAC,OAAkBF,EAAM,2BAElC,qDAEA,IAAeG,EAAAC,EAAIC,OAAO,CAExBC,gBAAOC,GACL,OAAOA,EAAE,MAAO,CAAEC,IAAK,OACxB,EACDC,KAAM,SACNC,KAAI,WACF,MAAO,CACLC,SAAU,GACVC,OAAQ,KAEX,EACDC,MAAO,CAAC,iBAAkB,gBAAiB,OAAQ,cAAe,SAClEC,QAAO,WACLC,KAAKC,QACN,EACDC,MAAO,CAELC,eAAMC,GACYA,IAAW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ACzB,IAAM9C,EAAOF,EAAa,WAC1B,MAAM,IAAI0C,MAAMxC,EAClB,CACF,EACA+C,OAAQ,SAACpC,GAEP,GADAW,EAAKiB,MAAM,SAAU5B,GACjBc,EAAcsB,OAAQ,CACxB,IAAM/C,EAAOF,EAAa,UAC1B,MAAM,IAAI0C,MAAMxC,EAClB,CACF,EACAgD,YAAa,SAAChD,EAAMiD,GAElB,GADA3B,EAAKiB,MAAM,cAAevC,EAAMiD,GAC5BxB,EAAcuB,YAAa,CAC7B,IAAME,EAAOpD,EAAa,eAC1B,MAAM,IAAI0C,MAAMU,EAClB,CACF,EACAC,YAAa,SAACxC,EAAQyC,GACpB,GAAI3B,EAAc0B,YAAa,CAC7B,IAAMnD,EAAOF,EAAa,eAC1B,MAAM,IAAI0C,MAAMxC,EAClB,CACA,IAAIqD,EAIJ,OAHA/B,EAAKiB,MAAM,cAAe5B,EAAQyC,GAAO,SAACE,GACxCD,EAAMC,CACR,IACOD,CACT,IAEFE,QAAS5B,KAAK6B,MAAM9B,GACpB+B,KAAM3C,KAAK2C,MAAQ,WAjFa,CAmFnC,KC7HUC,EAAAvD,EAAIC,OAAO,CACxBI,KAAM,UACNH,gBAAOC,GACL,OAAOA,EAAE,MAAO,CAAEC,IAAK,OACxB,EACDK,MAAO,CAAC,SAAU,gBAAiB,QACnCQ,QAAS,CAEPL,gBAAOJ,GACiB,MAAlBG,KAAKS,MAAMC,KACD,MAAVb,IACAgD,EAAUC,WAAWjD,IAEzBkD,EAAc,CACZlD,OAAMA,EACNqB,SAAUlB,KAAKS,MAAMC,IACrBW,OAAQrB,KAAKW,eAAiB,CAAE,EAChCgC,KAAM3C,KAAK2C,MAAQ,YAEtB,GAEHzC,MAAO,CACLL,OAAQ,CACNmD,iBAAQC,GACG,MAALA,GACJjD,KAAKC,OAAOgD,EACb,EACDC,WAAW"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/components/Editor.vue","../plugin-vue2:normalizer","../src/components/Toolbar.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { createEditor, IDomEditor } from '@wangeditor-next/editor'\nimport Vue from 'vue'\n\ntype AlertType = 'success' | 'info' | 'warning' | 'error'\n\nfunction genErrorInfo(fnName: string) {\n let info = `请使用 '@${fnName}' 事件,不要放在 props 中`\n\n info += `\\nPlease use '@${fnName}' event instead of props`\n return info\n}\n\nexport default Vue.extend({\n //【注意】单独写 <template>...</template> 时,rollup 打包完浏览器运行时报错,所以先在这里写 template\n render(h) {\n return h('div', { ref: 'box' })\n },\n name: 'Editor',\n data() {\n return {\n curValue: '',\n editor: null,\n }\n },\n props: {\n defaultContent: {\n type: Array,\n default: () => [],\n },\n defaultConfig: {\n type: Object,\n default: () => ({}),\n },\n mode: {\n type: String,\n default: 'default',\n },\n defaultHtml: {\n type: String,\n default: '',\n },\n // value 用于自定义 v-model\n value: {\n type: String,\n default: '',\n },\n },\n emits: [\n 'onCreated',\n 'input',\n 'onChange',\n 'onDestroyed',\n 'onMaxLength',\n 'onFocus',\n 'onBlur',\n 'customAlert',\n 'customPaste',\n ],\n mounted() {\n this.create()\n },\n watch: {\n // 监听 'value' 属性变化 - value 用于自定义 v-model\n value(newVal: string) {\n const isEqual = newVal === this.curValue\n\n if (isEqual) {\n return\n } // 和当前内容一样,则忽略\n\n // 重置 HTML\n this.setHtml(newVal)\n },\n },\n methods: {\n // 重置 HTML\n setHtml(newHtml: string) {\n const editor = this.editor as any\n\n if (editor == null) {\n return\n }\n editor.setHtml(newHtml)\n },\n\n // 创建 editor\n create() {\n if (this.$refs.box == null) {\n return\n }\n\n const defaultConfig = this.defaultConfig || {}\n\n const defaultContent = JSON.stringify(\n Array.isArray(this.defaultContent) ? this.defaultContent : []\n )\n\n createEditor({\n selector: this.$refs.box as Element,\n html: this.defaultHtml || this.value || '',\n config: {\n ...defaultConfig,\n onCreated: (editor: IDomEditor) => {\n this.editor = Object.seal(editor) as any // 注意,一定要用 Object.seal() 否则会报错\n\n this.$emit('onCreated', editor)\n if (defaultConfig.onCreated) {\n const info = genErrorInfo('onCreated')\n\n throw new Error(info)\n }\n },\n onChange: (editor: IDomEditor) => {\n const editorHtml = editor.getHtml()\n\n this.curValue = editorHtml // 记录当前 html 内容\n this.$emit('input', editorHtml) // 用于自定义 v-model\n\n this.$emit('onChange', editor)\n if (defaultConfig.onChange) {\n const info = genErrorInfo('onChange')\n\n throw new Error(info)\n }\n },\n onDestroyed: (editor: IDomEditor) => {\n this.$emit('onDestroyed', editor)\n if (defaultConfig.onDestroyed) {\n const info = genErrorInfo('onDestroyed')\n\n throw new Error(info)\n }\n },\n onMaxLength: (editor: IDomEditor) => {\n this.$emit('onMaxLength', editor)\n if (defaultConfig.onMaxLength) {\n const info = genErrorInfo('onMaxLength')\n\n throw new Error(info)\n }\n },\n onFocus: (editor: IDomEditor) => {\n this.$emit('onFocus', editor)\n if (defaultConfig.onFocus) {\n const info = genErrorInfo('onFocus')\n\n throw new Error(info)\n }\n },\n onBlur: (editor: IDomEditor) => {\n this.$emit('onBlur', editor)\n if (defaultConfig.onBlur) {\n const info = genErrorInfo('onBlur')\n\n throw new Error(info)\n }\n },\n customAlert: (info: string, type: AlertType) => {\n this.$emit('customAlert', info, type)\n if (defaultConfig.customAlert) {\n const errorInfo = genErrorInfo('customAlert')\n\n throw new Error(errorInfo)\n }\n },\n customPaste: (editor: IDomEditor, event: ClipboardEvent) => {\n if (defaultConfig.customPaste) {\n const info = genErrorInfo('customPaste')\n\n throw new Error(info)\n }\n let res\n\n this.$emit('customPaste', editor, event, (val: any) => {\n res = val\n })\n return res\n },\n },\n content: JSON.parse(defaultContent),\n mode: this.mode || 'default',\n })\n },\n },\n})\n</script>\n","\nexport default function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode /* vue-cli only */\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inference\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () {\n injectStyles.call(\n this,\n (options.functional ? this.parent : this).$root.$options.shadowRoot\n )\n }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functional component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}","<script lang=\"ts\">\nimport { createToolbar, DomEditor, IDomEditor } from '@wangeditor-next/editor'\nimport Vue from 'vue'\n\nexport default Vue.extend({\n name: 'Toolbar',\n render(h) {\n return h('div', { ref: 'box' })\n },\n props: {\n editor: {\n type: Object,\n default: undefined,\n },\n defaultConfig: {\n type: Object,\n default: () => ({}),\n },\n mode: {\n type: String,\n default: 'default',\n },\n },\n methods: {\n // 创建 toolbar\n create(editor: IDomEditor) {\n if (this.$refs.box == null) {\n return\n }\n if (editor == null) {\n return\n }\n if (DomEditor.getToolbar(editor)) {\n return\n } // 不重复创建\n\n createToolbar({\n editor,\n selector: this.$refs.box as Element,\n config: this.defaultConfig || {},\n mode: this.mode || 'default',\n })\n },\n },\n watch: {\n editor: {\n handler(e: IDomEditor | null) {\n if (e == null) {\n return\n }\n this.create(e)\n },\n immediate: true,\n },\n },\n})\n</script>\n"],"names":[],"mappings":";;AAMA,SAAA,aAAA,QAAA;AACA,MAAA,OAAA,wBAAA;AAEA,UAAA;AAAA,eAAA;AACA,SAAA;AACA;AAEA,IAAA,cAAA,IAAA,OAAA;AAAA,EAEA,OAAA,GAAA;AACA,WAAA,EAAA,OAAA,EAAA,KAAA,MAAA,CAAA;AAAA,EACA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AACA,WAAA;AAAA,MACA,UAAA;AAAA,MACA,QAAA;AAAA,IAAA;AAAA,EAEA;AAAA,EACA,OAAA;AAAA,IACA,gBAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA,MAAA,CAAA;AAAA,IACA;AAAA,IACA,eAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA,OAAA,CAAA;AAAA,IACA;AAAA,IACA,MAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA,IACA,aAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA,IAEA,OAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA,EACA;AAAA,EACA,OAAA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACA;AAAA,EACA,UAAA;AACA,SAAA,OAAA;AAAA,EACA;AAAA,EACA,OAAA;AAAA,IAEA,MAAA,QAAA;AACA,YAAA,UAAA,WAAA,KAAA;AAEA,UAAA,SAAA;AACA;AAAA,MACA;AAGA,WAAA,QAAA,MAAA;AAAA,IACA;AAAA,E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MAAA;AAAA,MACA,SAAA;AAAA,IACA;AAAA,EACA;AAAA,EACA,SAAA;AAAA,IAEA,OAAA,QAAA;AACA,UAAA,KAAA,MAAA,OAAA,MAAA;AACA;AAAA,MACA;AACA,UAAA,UAAA,MAAA;AACA;AAAA,MACA;AACA,UAAA,UAAA,WAAA,MAAA,GAAA;AACA;AAAA,MACA;AAEA,oBAAA;AAAA,QACA;AAAA,QACA,UAAA,KAAA,MAAA;AAAA,QACA,QAAA,KAAA,iBAAA,CAAA;AAAA,QACA,MAAA,KAAA,QAAA;AAAA,MAAA,CACA;AAAA,IACA;AAAA,EACA;AAAA,EACA,OAAA;AAAA,IACA,QAAA;AAAA,MACA,QAAA,GAAA;AACA,YAAA,KAAA,MAAA;AACA;AAAA,QACA;AACA,aAAA,OAAA,CAAA;AAAA,MACA;AAAA,MACA,WAAA;AAAA,IACA;AAAA,EACA;AACA,CAAA;;;;;;;;;;;;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
(function(s,l){typeof exports=="object"&&typeof module!="undefined"?l(exports,require("@wangeditor-next/editor"),require("vue")):typeof define=="function"&&define.amd?define(["exports","@wangeditor-next/editor","vue"],l):(s=typeof globalThis!="undefined"?globalThis:s||self,l(s.WangEditorForVue={},s.wangEditor,s.Vue))})(this,function(s,l,g){"use strict";function C(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var c=C(g);function a(e){let i=`\u8BF7\u4F7F\u7528 '@${e}' \u4E8B\u4EF6\uFF0C\u4E0D\u8981\u653E\u5728 props \u4E2D`;return i+=`
|
|
2
|
+
Please use '@${e}' event instead of props`,i}var v=c.default.extend({render(e){return e("div",{ref:"box"})},name:"Editor",data(){return{curValue:"",editor:null}},props:{defaultContent:{type:Array,default:()=>[]},defaultConfig:{type:Object,default:()=>({})},mode:{type:String,default:"default"},defaultHtml:{type:String,default:""},value:{type:String,default:""}},emits:["onCreated","input","onChange","onDestroyed","onMaxLength","onFocus","onBlur","customAlert","customPaste"],mounted(){this.create()},watch:{value(e){e!==this.curValue&&this.setHtml(e)}},methods:{setHtml(e){const i=this.editor;i!=null&&i.setHtml(e)},create(){if(this.$refs.box==null)return;const e=this.defaultConfig||{},i=JSON.stringify(Array.isArray(this.defaultContent)?this.defaultContent:[]);l.createEditor({selector:this.$refs.box,html:this.defaultHtml||this.value||"",config:{...e,onCreated:t=>{if(this.editor=Object.seal(t),this.$emit("onCreated",t),e.onCreated){const n=a("onCreated");throw new Error(n)}},onChange:t=>{const n=t.getHtml();if(this.curValue=n,this.$emit("input",n),this.$emit("onChange",t),e.onChange){const r=a("onChange");throw new Error(r)}},onDestroyed:t=>{if(this.$emit("onDestroyed",t),e.onDestroyed){const n=a("onDestroyed");throw new Error(n)}},onMaxLength:t=>{if(this.$emit("onMaxLength",t),e.onMaxLength){const n=a("onMaxLength");throw new Error(n)}},onFocus:t=>{if(this.$emit("onFocus",t),e.onFocus){const n=a("onFocus");throw new Error(n)}},onBlur:t=>{if(this.$emit("onBlur",t),e.onBlur){const n=a("onBlur");throw new Error(n)}},customAlert:(t,n)=>{if(this.$emit("customAlert",t,n),e.customAlert){const r=a("customAlert");throw new Error(r)}},customPaste:(t,n)=>{if(e.customPaste){const d=a("customPaste");throw new Error(d)}let r;return this.$emit("customPaste",t,n,d=>{r=d}),r}},content:JSON.parse(i),mode:this.mode||"default"})}}});function h(e,i,t,n,r,d,m,F){var o=typeof e=="function"?e.options:e;i&&(o.render=i,o.staticRenderFns=t,o._compiled=!0),n&&(o.functional=!0),d&&(o._scopeId="data-v-"+d);var f;if(m?(f=function(u){u=u||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!u&&typeof __VUE_SSR_CONTEXT__!="undefined"&&(u=__VUE_SSR_CONTEXT__),r&&r.call(this,u),u&&u._registeredComponents&&u._registeredComponents.add(m)},o._ssrRegister=f):r&&(f=F?function(){r.call(this,(o.functional?this.parent:this).$root.$options.shadowRoot)}:r),f)if(o.functional){o._injectStyles=f;var T=o.render;o.render=function(S,p){return f.call(p),T(S,p)}}else{var _=o.beforeCreate;o.beforeCreate=_?[].concat(_,f):[f]}return{exports:e,options:o}}var $=h(v,null,null,!1,null,null,null,null),E=$.exports,y=c.default.extend({name:"Toolbar",render(e){return e("div",{ref:"box"})},props:{editor:{type:Object,default:void 0},defaultConfig:{type:Object,default:()=>({})},mode:{type:String,default:"default"}},methods:{create(e){this.$refs.box!=null&&e!=null&&(l.DomEditor.getToolbar(e)||l.createToolbar({editor:e,selector:this.$refs.box,config:this.defaultConfig||{},mode:this.mode||"default"}))}},watch:{editor:{handler(e){e!=null&&this.create(e)},immediate:!0}}}),w=h(y,null,null,!1,null,null,null,null),b=w.exports;s.Editor=E,s.Toolbar=b,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
2
3
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/components/Editor.vue","../src/components/Toolbar.vue"],"sourcesContent":["<script lang=\"ts\">\nimport Vue from 'vue';\nimport { createEditor } from '@wangeditor-next/editor';\n\nfunction genErrorInfo(fnName: string) {\n let info = `请使用 '@${fnName}' 事件,不要放在 props 中`;\n info += `\\nPlease use '@${fnName}' event instead of props`;\n return info;\n}\n\nexport default Vue.extend({\n //【注意】单独写 <template>...</template> 时,rollup 打包完浏览器运行时报错,所以先在这里写 template\n render(h) {\n return h('div', { ref: 'box' });\n },\n name: 'Editor',\n data() {\n return {\n curValue: '',\n editor: null,\n };\n },\n props: ['defaultContent', 'defaultConfig', 'mode', 'defaultHtml', 'value'], // value 用于自定义 v-model\n mounted() {\n this.create();\n },\n watch: {\n // 监听 'value' 属性变化 - value 用于自定义 v-model\n value(newVal) {\n const isEqual = newVal === this.curValue;\n if (isEqual) return; // 和当前内容一样,则忽略\n\n // 重置 HTML\n this.setHtml(newVal);\n },\n },\n methods: {\n // 重置 HTML\n setHtml(newHtml: string) {\n const editor = this.editor as any;\n if (editor == null) return;\n editor.setHtml(newHtml);\n },\n\n // 创建 editor\n create() {\n if (this.$refs.box == null) return;\n\n const defaultConfig = this.defaultConfig || {};\n\n const defaultContent = JSON.stringify(\n Array.isArray(this.defaultContent) ? this.defaultContent : []\n );\n\n createEditor({\n selector: this.$refs.box as Element,\n html: this.defaultHtml || this.value || '',\n config: {\n ...defaultConfig,\n onCreated: (editor) => {\n this.editor = Object.seal(editor) as any; // 注意,一定要用 Object.seal() 否则会报错\n\n this.$emit('onCreated', editor);\n if (defaultConfig.onCreated) {\n const info = genErrorInfo('onCreated');\n throw new Error(info);\n }\n },\n onChange: (editor) => {\n const editorHtml = editor.getHtml();\n this.curValue = editorHtml; // 记录当前 html 内容\n this.$emit('input', editorHtml); // 用于自定义 v-model\n\n this.$emit('onChange', editor);\n if (defaultConfig.onChange) {\n const info = genErrorInfo('onChange');\n throw new Error(info);\n }\n },\n onDestroyed: (editor) => {\n this.$emit('onDestroyed', editor);\n if (defaultConfig.onDestroyed) {\n const info = genErrorInfo('onDestroyed');\n throw new Error(info);\n }\n },\n onMaxLength: (editor) => {\n this.$emit('onMaxLength', editor);\n if (defaultConfig.onMaxLength) {\n const info = genErrorInfo('onMaxLength');\n throw new Error(info);\n }\n },\n onFocus: (editor) => {\n this.$emit('onFocus', editor);\n if (defaultConfig.onFocus) {\n const info = genErrorInfo('onFocus');\n throw new Error(info);\n }\n },\n onBlur: (editor) => {\n this.$emit('onBlur', editor);\n if (defaultConfig.onBlur) {\n const info = genErrorInfo('onBlur');\n throw new Error(info);\n }\n },\n customAlert: (info, type) => {\n this.$emit('customAlert', info, type);\n if (defaultConfig.customAlert) {\n const info = genErrorInfo('customAlert');\n throw new Error(info);\n }\n },\n customPaste: (editor, event) => {\n if (defaultConfig.customPaste) {\n const info = genErrorInfo('customPaste');\n throw new Error(info);\n }\n let res;\n this.$emit('customPaste', editor, event, (val: any) => {\n res = val;\n });\n return res;\n },\n },\n content: JSON.parse(defaultContent),\n mode: this.mode || 'default',\n });\n },\n },\n});\n</script>\n","<script lang=\"ts\">\nimport Vue from 'vue';\nimport { createToolbar, DomEditor } from '@wangeditor-next/editor';\n\nexport default Vue.extend({\n name: 'Toolbar',\n render(h) {\n return h('div', { ref: 'box' });\n },\n props: ['editor', 'defaultConfig', 'mode'],\n methods: {\n // 创建 toolbar\n create(editor: any) {\n if (this.$refs.box == null) return;\n if (editor == null) return;\n if (DomEditor.getToolbar(editor)) return // 不重复创建\n\n createToolbar({\n editor,\n selector: this.$refs.box as Element,\n config: this.defaultConfig || {},\n mode: this.mode || 'default',\n });\n },\n },\n watch: {\n editor: {\n handler(e) {\n if (e == null) return;\n this.create(e);\n },\n immediate: true,\n }\n }\n});\n</script>\n"],"names":["genErrorInfo","fnName","info","concat","Vue","extend","render","h","ref","name","data","curValue","editor","props","mounted","this","create","watch","value","newVal","setHtml","methods","newHtml","_this","$refs","box","defaultConfig","defaultContent","JSON","stringify","Array","isArray","createEditor","selector","html","defaultHtml","config","onCreated","Object","seal","$emit","Error","onChange","editorHtml","getHtml","onDestroyed","onMaxLength","onFocus","onBlur","customAlert","type","info_1","customPaste","event","res","val","content","parse","mode","DomEditor","getToolbar","createToolbar","handler","e","immediate"],"mappings":"goBAIA,SAASA,EAAaC,GACpB,IAAIC,EAAO,SAASC,OAAAF,uBAEpB,OADAC,GAAQ,kBAAAC,OAAkBF,EAAM,2BAElC,qDAEeG,IAAAA,EAAAA,EAAAA,QAAIC,OAAO,CAExBC,gBAAOC,GACL,OAAOA,EAAE,MAAO,CAAEC,IAAK,OACxB,EACDC,KAAM,SACNC,KAAI,WACF,MAAO,CACLC,SAAU,GACVC,OAAQ,KAEX,EACDC,MAAO,CAAC,iBAAkB,gBAAiB,OAAQ,cAAe,SAClEC,QAAO,WACLC,KAAKC,QACN,EACDC,MAAO,CAELC,eAAMC,GACYA,IAAWJ,KAAKJ,UAIhCI,KAAKK,Q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C1B,MAAM,IAAIyC,MAAMvC,EAClB,CACF,EACA8C,OAAQ,SAACpC,GAEP,GADAW,EAAKiB,MAAM,SAAU5B,GACjBc,EAAcsB,OAAQ,CACxB,IAAM9C,EAAOF,EAAa,UAC1B,MAAM,IAAIyC,MAAMvC,EAClB,CACF,EACA+C,YAAa,SAAC/C,EAAMgD,GAElB,GADA3B,EAAKiB,MAAM,cAAetC,EAAMgD,GAC5BxB,EAAcuB,YAAa,CAC7B,IAAME,EAAOnD,EAAa,eAC1B,MAAM,IAAIyC,MAAMU,EAClB,CACF,EACAC,YAAa,SAACxC,EAAQyC,GACpB,GAAI3B,EAAc0B,YAAa,CAC7B,IAAMlD,EAAOF,EAAa,eAC1B,MAAM,IAAIyC,MAAMvC,EAClB,CACA,IAAIoD,EAIJ,OAHA/B,EAAKiB,MAAM,cAAe5B,EAAQyC,GAAO,SAACE,GACxCD,EAAMC,CACR,IACOD,CACT,IAEFE,QAAS5B,KAAK6B,MAAM9B,GACpB+B,KAAM3C,KAAK2C,MAAQ,WAjFa,CAmFnC,KC7HUtD,EAAAA,EAAAA,QAAIC,OAAO,CACxBI,KAAM,UACNH,gBAAOC,GACL,OAAOA,EAAE,MAAO,CAAEC,IAAK,OACxB,EACDK,MAAO,CAAC,SAAU,gBAAiB,QACnCQ,QAAS,CAEPL,gBAAOJ,GACiB,MAAlBG,KAAKS,MAAMC,KACD,MAAVb,IACA+C,EAASA,UAACC,WAAWhD,IAEzBiD,gBAAc,CACZjD,OAAMA,EACNqB,SAAUlB,KAAKS,MAAMC,IACrBW,OAAQrB,KAAKW,eAAiB,CAAE,EAChCgC,KAAM3C,KAAK2C,MAAQ,YAEtB,GAEHzC,MAAO,CACLL,OAAQ,CACNkD,iBAAQC,GACG,MAALA,GACJhD,KAAKC,OAAO+C,EACb,EACDC,WAAW"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/components/Editor.vue","../plugin-vue2:normalizer","../src/components/Toolbar.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { createEditor, IDomEditor } from '@wangeditor-next/editor'\nimport Vue from 'vue'\n\ntype AlertType = 'success' | 'info' | 'warning' | 'error'\n\nfunction genErrorInfo(fnName: string) {\n let info = `请使用 '@${fnName}' 事件,不要放在 props 中`\n\n info += `\\nPlease use '@${fnName}' event instead of props`\n return info\n}\n\nexport default Vue.extend({\n //【注意】单独写 <template>...</template> 时,rollup 打包完浏览器运行时报错,所以先在这里写 template\n render(h) {\n return h('div', { ref: 'box' })\n },\n name: 'Editor',\n data() {\n return {\n curValue: '',\n editor: null,\n }\n },\n props: {\n defaultContent: {\n type: Array,\n default: () => [],\n },\n defaultConfig: {\n type: Object,\n default: () => ({}),\n },\n mode: {\n type: String,\n default: 'default',\n },\n defaultHtml: {\n type: String,\n default: '',\n },\n // value 用于自定义 v-model\n value: {\n type: String,\n default: '',\n },\n },\n emits: [\n 'onCreated',\n 'input',\n 'onChange',\n 'onDestroyed',\n 'onMaxLength',\n 'onFocus',\n 'onBlur',\n 'customAlert',\n 'customPaste',\n ],\n mounted() {\n this.create()\n },\n watch: {\n // 监听 'value' 属性变化 - value 用于自定义 v-model\n value(newVal: string) {\n const isEqual = newVal === this.curValue\n\n if (isEqual) {\n return\n } // 和当前内容一样,则忽略\n\n // 重置 HTML\n this.setHtml(newVal)\n },\n },\n methods: {\n // 重置 HTML\n setHtml(newHtml: string) {\n const editor = this.editor as any\n\n if (editor == null) {\n return\n }\n editor.setHtml(newHtml)\n },\n\n // 创建 editor\n create() {\n if (this.$refs.box == null) {\n return\n }\n\n const defaultConfig = this.defaultConfig || {}\n\n const defaultContent = JSON.stringify(\n Array.isArray(this.defaultContent) ? this.defaultContent : []\n )\n\n createEditor({\n selector: this.$refs.box as Element,\n html: this.defaultHtml || this.value || '',\n config: {\n ...defaultConfig,\n onCreated: (editor: IDomEditor) => {\n this.editor = Object.seal(editor) as any // 注意,一定要用 Object.seal() 否则会报错\n\n this.$emit('onCreated', editor)\n if (defaultConfig.onCreated) {\n const info = genErrorInfo('onCreated')\n\n throw new Error(info)\n }\n },\n onChange: (editor: IDomEditor) => {\n const editorHtml = editor.getHtml()\n\n this.curValue = editorHtml // 记录当前 html 内容\n this.$emit('input', editorHtml) // 用于自定义 v-model\n\n this.$emit('onChange', editor)\n if (defaultConfig.onChange) {\n const info = genErrorInfo('onChange')\n\n throw new Error(info)\n }\n },\n onDestroyed: (editor: IDomEditor) => {\n this.$emit('onDestroyed', editor)\n if (defaultConfig.onDestroyed) {\n const info = genErrorInfo('onDestroyed')\n\n throw new Error(info)\n }\n },\n onMaxLength: (editor: IDomEditor) => {\n this.$emit('onMaxLength', editor)\n if (defaultConfig.onMaxLength) {\n const info = genErrorInfo('onMaxLength')\n\n throw new Error(info)\n }\n },\n onFocus: (editor: IDomEditor) => {\n this.$emit('onFocus', editor)\n if (defaultConfig.onFocus) {\n const info = genErrorInfo('onFocus')\n\n throw new Error(info)\n }\n },\n onBlur: (editor: IDomEditor) => {\n this.$emit('onBlur', editor)\n if (defaultConfig.onBlur) {\n const info = genErrorInfo('onBlur')\n\n throw new Error(info)\n }\n },\n customAlert: (info: string, type: AlertType) => {\n this.$emit('customAlert', info, type)\n if (defaultConfig.customAlert) {\n const errorInfo = genErrorInfo('customAlert')\n\n throw new Error(errorInfo)\n }\n },\n customPaste: (editor: IDomEditor, event: ClipboardEvent) => {\n if (defaultConfig.customPaste) {\n const info = genErrorInfo('customPaste')\n\n throw new Error(info)\n }\n let res\n\n this.$emit('customPaste', editor, event, (val: any) => {\n res = val\n })\n return res\n },\n },\n content: JSON.parse(defaultContent),\n mode: this.mode || 'default',\n })\n },\n },\n})\n</script>\n","\nexport default function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode /* vue-cli only */\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inference\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () {\n injectStyles.call(\n this,\n (options.functional ? this.parent : this).$root.$options.shadowRoot\n )\n }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functional component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}","<script lang=\"ts\">\nimport { createToolbar, DomEditor, IDomEditor } from '@wangeditor-next/editor'\nimport Vue from 'vue'\n\nexport default Vue.extend({\n name: 'Toolbar',\n render(h) {\n return h('div', { ref: 'box' })\n },\n props: {\n editor: {\n type: Object,\n default: undefined,\n },\n defaultConfig: {\n type: Object,\n default: () => ({}),\n },\n mode: {\n type: String,\n default: 'default',\n },\n },\n methods: {\n // 创建 toolbar\n create(editor: IDomEditor) {\n if (this.$refs.box == null) {\n return\n }\n if (editor == null) {\n return\n }\n if (DomEditor.getToolbar(editor)) {\n return\n } // 不重复创建\n\n createToolbar({\n editor,\n selector: this.$refs.box as Element,\n config: this.defaultConfig || {},\n mode: this.mode || 'default',\n })\n },\n },\n watch: {\n editor: {\n handler(e: IDomEditor | null) {\n if (e == null) {\n return\n }\n this.create(e)\n },\n immediate: true,\n },\n },\n})\n</script>\n"],"names":["genErrorInfo","fnName","info","Vue","h","newVal","newHtml","editor","defaultConfig","defaultContent","createEditor","editorHtml","type","errorInfo","event","res","val","normalizeComponent","scriptExports","render","staticRenderFns","functionalTemplate","injectStyles","scopeId","moduleIdentifier","shadowMode","options","hook","context","originalRender","existing","DomEditor","createToolbar"],"mappings":"sbAMA,SAAAA,EAAAC,EAAA,CACA,IAAAC,EAAA,wBAAAD,6DAEA,OAAAC,GAAA;AAAA,eAAAD,4BACAC,CACA,CAEAC,IAAAA,EAAAA,EAAAA,QAAA,OAAA,CAEA,OAAAC,EAAA,CACA,OAAAA,EAAA,MAAA,CAAA,IAAA,KAAA,CAAA,CACA,EACA,KAAA,SACA,MAAA,CACA,MAAA,CACA,SAAA,GACA,OAAA,IAAA,CAEA,EACA,MAAA,CACA,eAAA,CACA,KAAA,MACA,QAAA,IAAA,CAAA,CACA,EACA,cAAA,CACA,KAAA,OACA,QAAA,KAAA,CAAA,EACA,EACA,KAAA,CACA,KAAA,OACA,QAAA,SACA,EACA,YAAA,CACA,KAAA,OACA,QAAA,EACA,EAEA,MAAA,CACA,KAAA,OACA,QAAA,EACA,CACA,EACA,MAAA,CACA,YACA,QACA,WACA,cACA,cACA,UACA,SACA,cACA,aACA,EACA,SAAA,CACA,KAAA,OAAA,CACA,EACA,MAAA,CAEA,MAAAC,EAAA,CACAA,IAAA,KAAA,UAOA,KAAA,QAAAA,CAAA,CACA,CACA,EACA,QAAA,CAEA,QAAAC,EAAA,CACA,MAAAC,EAAA,KAAA,OAEAA,GAAA,MAGAA,EAAA,QAAAD,CAAA,CACA,EAGA,QAAA,CACA,GAAA,KAAA,MA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,EAAQ,OAAS,SAAmCtB,EAAGwB,EAAS,CAC9D,OAAAD,EAAK,KAAKC,CAAO,EACVC,EAAezB,EAAGwB,CAAO,CACjC,CACP,KAAW,CAEL,IAAIE,EAAWJ,EAAQ,aACvBA,EAAQ,aAAeI,EACjB,GAAG,OAAOA,EAAUH,CAAI,EACxB,CAACA,CAAI,CACZ,CAGH,MAAO,CACL,QAAST,EACT,QAASQ,CACV,CACH,yDCxFAvB,EAAAA,EAAAA,QAAA,OAAA,CACA,KAAA,UACA,OAAAC,EAAA,CACA,OAAAA,EAAA,MAAA,CAAA,IAAA,KAAA,CAAA,CACA,EACA,MAAA,CACA,OAAA,CACA,KAAA,OACA,QAAA,MACA,EACA,cAAA,CACA,KAAA,OACA,QAAA,KAAA,CAAA,EACA,EACA,KAAA,CACA,KAAA,OACA,QAAA,SACA,CACA,EACA,QAAA,CAEA,OAAAG,EAAA,CACA,KAAA,MAAA,KAAA,MAGAA,GAAA,OAGAwB,EAAA,UAAA,WAAAxB,CAAA,GAIAyB,gBAAA,CAAA,OACAzB,EACA,SAAA,KAAA,MAAA,IACA,OAAA,KAAA,eAAA,CAAA,EACA,KAAA,KAAA,MAAA,SAAA,CACA,EACA,CACA,EACA,MAAA,CACA,OAAA,CACA,QAAA,EAAA,CACA,GAAA,MAGA,KAAA,OAAA,CAAA,CACA,EACA,UAAA,EACA,CACA,CACA,CAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import Vue from 'vue';
|
|
2
|
+
declare const _default: import("vue/types/vue").ExtendedVue<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, any>>, unknown, unknown, unknown, Record<never, any>, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin>;
|
|
3
|
+
export default _default;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { IDomEditor } from '@wangeditor-next/editor';
|
|
2
|
+
import Vue from 'vue';
|
|
3
|
+
declare const _default: import("vue/types/vue").ExtendedVue<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, any>>, unknown, {
|
|
4
|
+
create(editor: IDomEditor): void;
|
|
5
|
+
}, unknown, {
|
|
6
|
+
editor: any;
|
|
7
|
+
defaultConfig: any;
|
|
8
|
+
mode: string;
|
|
9
|
+
}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin>;
|
|
10
|
+
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description editor-for-vue entry
|
|
3
|
-
* @author wangfupeng
|
|
4
|
-
*/
|
|
5
|
-
import Editor from './components/Editor.vue';
|
|
6
|
-
import Toolbar from './components/Toolbar.vue';
|
|
7
|
-
export { Editor, Toolbar };
|
|
1
|
+
/**
|
|
2
|
+
* @description editor-for-vue entry
|
|
3
|
+
* @author wangfupeng
|
|
4
|
+
*/
|
|
5
|
+
import Editor from './components/Editor.vue';
|
|
6
|
+
import Toolbar from './components/Toolbar.vue';
|
|
7
|
+
export { Editor, Toolbar };
|
package/package.json
CHANGED
|
@@ -1,88 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wangeditor-next/editor-for-vue2",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "wangEditor component for
|
|
3
|
+
"version": "6.1.1",
|
|
4
|
+
"description": "wangEditor component for Vue 2",
|
|
5
5
|
"author": "cycleccc <ylf2991205548@qq.com>",
|
|
6
|
-
"
|
|
7
|
-
"homepage": "https://github.com/cycleccc/wangEditor-for-vue2#readme",
|
|
6
|
+
"homepage": "https://github.com/wangeditor-next/wangEditor-next#readme",
|
|
8
7
|
"license": "MIT",
|
|
9
|
-
"types": "dist/index.d.ts",
|
|
8
|
+
"types": "dist/src/index.d.ts",
|
|
10
9
|
"main": "dist/index.js",
|
|
11
10
|
"module": "dist/index.esm.js",
|
|
12
11
|
"browser": {
|
|
13
12
|
"./dist/index.js": "./dist/index.js",
|
|
14
13
|
"./dist/index.esm.js": "./dist/index.esm.js"
|
|
15
14
|
},
|
|
16
|
-
"directories": {
|
|
17
|
-
"lib": "dist",
|
|
18
|
-
"test": "__tests__"
|
|
19
|
-
},
|
|
20
15
|
"files": [
|
|
21
16
|
"dist"
|
|
22
17
|
],
|
|
23
18
|
"keywords": [
|
|
24
19
|
"wangEditor",
|
|
25
20
|
"wangEditor-next",
|
|
26
|
-
"
|
|
27
|
-
"富文本",
|
|
21
|
+
"rich text editor",
|
|
28
22
|
"vue2"
|
|
29
23
|
],
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/src/index.d.ts",
|
|
27
|
+
"import": "./dist/index.esm.js",
|
|
28
|
+
"require": "./dist/index.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
30
34
|
"repository": {
|
|
31
35
|
"type": "git",
|
|
32
|
-
"url": "git+https://github.com/
|
|
33
|
-
|
|
34
|
-
"scripts": {
|
|
35
|
-
"test": "jest",
|
|
36
|
-
"test-c": "jest --coverage",
|
|
37
|
-
"release": "release-it",
|
|
38
|
-
"example": "cross-env NODE_ENV=development:example rollup -c rollup.example.config.js -w",
|
|
39
|
-
"dev": "cross-env NODE_ENV=development rollup -c rollup.config.js",
|
|
40
|
-
"dev-watch": "cross-env NODE_ENV=development rollup -c rollup.config.js -w",
|
|
41
|
-
"build": "cross-env NODE_ENV=production rollup -c rollup.config.js",
|
|
42
|
-
"dev-size-stats": "cross-env NODE_ENV=development:size_stats rollup -c rollup.config.js",
|
|
43
|
-
"size-stats": "cross-env NODE_ENV=production:size_stats rollup -c rollup.config.js"
|
|
36
|
+
"url": "git+https://github.com/wangeditor-next/wangEditor-next.git",
|
|
37
|
+
"directory": "packages/editor-for-vue2"
|
|
44
38
|
},
|
|
45
39
|
"bugs": {
|
|
46
|
-
"url": "https://github.com/
|
|
40
|
+
"url": "https://github.com/wangeditor-next/wangEditor-next/issues"
|
|
47
41
|
},
|
|
48
42
|
"peerDependencies": {
|
|
49
|
-
"
|
|
50
|
-
"
|
|
43
|
+
"vue": "^2.7.16",
|
|
44
|
+
"@wangeditor-next/editor": "^6.1.1"
|
|
51
45
|
},
|
|
52
46
|
"devDependencies": {
|
|
53
|
-
"@
|
|
54
|
-
"@
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"@
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"postcss": "^8.3.11",
|
|
70
|
-
"release-it": "^14.11.6",
|
|
71
|
-
"rollup": "^2.59.0",
|
|
72
|
-
"rollup-plugin-cleanup": "^3.2.1",
|
|
73
|
-
"rollup-plugin-copy": "^3.4.0",
|
|
74
|
-
"rollup-plugin-delete": "^2.0.0",
|
|
75
|
-
"rollup-plugin-generate-html-template": "^1.7.0",
|
|
76
|
-
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
77
|
-
"rollup-plugin-postcss": "^4.0.1",
|
|
78
|
-
"rollup-plugin-serve": "^1.1.0",
|
|
79
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
80
|
-
"rollup-plugin-typescript2": "^0.31.0",
|
|
81
|
-
"rollup-plugin-visualizer": "^5.5.0",
|
|
82
|
-
"rollup-plugin-vue": "^6.0.0",
|
|
83
|
-
"ts-jest": "^27.0.4",
|
|
84
|
-
"tslib": "^2.3.0",
|
|
85
|
-
"typescript": "^4.4.4",
|
|
86
|
-
"vue-template-compiler": "^2.6.14"
|
|
87
|
-
}
|
|
88
|
-
}
|
|
47
|
+
"@types/node": "^20.19.0",
|
|
48
|
+
"@vitejs/plugin-vue2": "^1.1.2",
|
|
49
|
+
"typescript": "5.2.2",
|
|
50
|
+
"vite": "^2.9.16",
|
|
51
|
+
"vite-plugin-dts": "^0.7.0",
|
|
52
|
+
"vue": "^2.7.16",
|
|
53
|
+
"vue-template-compiler": "^2.7.16",
|
|
54
|
+
"@wangeditor-next/editor": "^6.1.1"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"dev": "vite",
|
|
58
|
+
"dev-watch": "vite build --watch",
|
|
59
|
+
"build": "tsc --noEmit && vite build",
|
|
60
|
+
"typecheck": "tsc --noEmit"
|
|
61
|
+
}
|
|
62
|
+
}
|
package/README.md
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# wangEditor for Vue
|
|
2
|
-
|
|
3
|
-
[](https://github.com/facebook/react/blob/main/LICENSE) [](https://www.npmjs.com/package/@wangeditor-next/editor-for-vue/v/next) [](https://github.com//wangEditor-for-vue/actions)
|
|
4
|
-
|
|
5
|
-
[English documentation](./README-en.md)
|
|
6
|
-
|
|
7
|
-
## 介绍
|
|
8
|
-
|
|
9
|
-
基于 [wangEditor](https://www.wangeditor.com/) 封装的开箱即用的 [Vue2 组件](https://www.wangeditor.com/v5/for-frame.html#vue2)
|
|
10
|
-
|
|
11
|
-
## 安装
|
|
12
|
-
|
|
13
|
-
```shell
|
|
14
|
-
yarn add @wangeditor-next/editor
|
|
15
|
-
yarn add @wangeditor-next/editor-for-vue
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## 使用
|
|
19
|
-
|
|
20
|
-
参考[文档](https://www.wangeditor.com/v5/for-frame.html#vue2)
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import Vue from 'vue';
|
|
2
|
-
declare const _default: import("vue/types/vue").ExtendedVue<Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, any>>, {
|
|
3
|
-
curValue: string;
|
|
4
|
-
editor: null;
|
|
5
|
-
}, {
|
|
6
|
-
setHtml(newHtml: string): void;
|
|
7
|
-
create(): void;
|
|
8
|
-
}, unknown, Record<"defaultContent" | "defaultConfig" | "mode" | "defaultHtml" | "value", any>, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin>;
|
|
9
|
-
export default _default;
|