@wangeditor-next/editor-for-vue2 1.0.2 → 6.2.0

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 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.
@@ -1,9 +1,15 @@
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;
1
+ import { default as 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, {
9
+ defaultContent: unknown[];
10
+ defaultConfig: any;
11
+ mode: string;
12
+ defaultHtml: string;
13
+ value: string;
14
+ }, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin>;
15
+ export default _default;
@@ -1,5 +1,10 @@
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, {
3
- create(editor: any): void;
4
- }, unknown, Record<"editor" | "defaultConfig" | "mode", any>, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin>;
5
- export default _default;
1
+ import { IDomEditor } from '@wangeditor-next/editor';
2
+ import { default as 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;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,3 @@
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
+ import { default as Editor } from './components/Editor.vue';
2
+ import { default as Toolbar } from './components/Toolbar.vue';
3
+ export { Editor, Toolbar };
package/dist/index.esm.js CHANGED
@@ -1,2 +1,187 @@
1
- import t from"vue";import{createEditor as e,DomEditor as o,createToolbar as r}from"@wangeditor-next/editor";var n=function(){return n=Object.assign||function(t){for(var e,o=1,r=arguments.length;o<r;o++)for(var n in e=arguments[o])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},n.apply(this,arguments)};function i(t){var e="请使用 '@".concat(t,"' 事件,不要放在 props 中");return e+="\nPlease use '@".concat(t,"' event instead of props")}"function"==typeof SuppressedError&&SuppressedError;var a=t.extend({render:function(t){return t("div",{ref:"box"})},name:"Editor",data:function(){return{curValue:"",editor:null}},props:["defaultContent","defaultConfig","mode","defaultHtml","value"],mounted:function(){this.create()},watch:{value:function(t){t===this.curValue||this.setHtml(t)}},methods:{setHtml:function(t){var e=this.editor;null!=e&&e.setHtml(t)},create:function(){var t=this;if(null!=this.$refs.box){var o=this.defaultConfig||{},r=JSON.stringify(Array.isArray(this.defaultContent)?this.defaultContent:[]);e({selector:this.$refs.box,html:this.defaultHtml||this.value||"",config:n(n({},o),{onCreated:function(e){if(t.editor=Object.seal(e),t.$emit("onCreated",e),o.onCreated){var r=i("onCreated");throw new Error(r)}},onChange:function(e){var r=e.getHtml();if(t.curValue=r,t.$emit("input",r),t.$emit("onChange",e),o.onChange){var n=i("onChange");throw new Error(n)}},onDestroyed:function(e){if(t.$emit("onDestroyed",e),o.onDestroyed){var r=i("onDestroyed");throw new Error(r)}},onMaxLength:function(e){if(t.$emit("onMaxLength",e),o.onMaxLength){var r=i("onMaxLength");throw new Error(r)}},onFocus:function(e){if(t.$emit("onFocus",e),o.onFocus){var r=i("onFocus");throw new Error(r)}},onBlur:function(e){if(t.$emit("onBlur",e),o.onBlur){var r=i("onBlur");throw new Error(r)}},customAlert:function(e,r){if(t.$emit("customAlert",e,r),o.customAlert){var n=i("customAlert");throw new Error(n)}},customPaste:function(e,r){if(o.customPaste){var n=i("customPaste");throw new Error(n)}var a;return t.$emit("customPaste",e,r,(function(t){a=t})),a}}),content:JSON.parse(r),mode:this.mode||"default"})}}}}),u=t.extend({name:"Toolbar",render:function(t){return t("div",{ref:"box"})},props:["editor","defaultConfig","mode"],methods:{create:function(t){null!=this.$refs.box&&null!=t&&(o.getToolbar(t)||r({editor:t,selector:this.$refs.box,config:this.defaultConfig||{},mode:this.mode||"default"}))}},watch:{editor:{handler:function(t){null!=t&&this.create(t)},immediate:!0}}});export{a as Editor,u as Toolbar};
1
+ import { createEditor as f, DomEditor as d, createToolbar as c } from "@wangeditor-next/editor";
2
+ import a from "vue";
3
+ function r(t) {
4
+ let n = `请使用 '@${t}' 事件,不要放在 props 中`;
5
+ return n += `
6
+ Please use '@${t}' event instead of props`, n;
7
+ }
8
+ const h = a.extend({
9
+ //【注意】单独写 <template>...</template> 时,rollup 打包完浏览器运行时报错,所以先在这里写 template
10
+ render(t) {
11
+ return t("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 用于自定义 v-model
38
+ value: {
39
+ type: String,
40
+ default: ""
41
+ }
42
+ },
43
+ mounted() {
44
+ this.create();
45
+ },
46
+ watch: {
47
+ // 监听 'value' 属性变化 - value 用于自定义 v-model
48
+ value(t) {
49
+ t !== this.curValue && this.setHtml(t);
50
+ }
51
+ },
52
+ methods: {
53
+ // 重置 HTML
54
+ setHtml(t) {
55
+ const n = this.editor;
56
+ n != null && n.setHtml(t);
57
+ },
58
+ // 创建 editor
59
+ create() {
60
+ if (this.$refs.box == null)
61
+ return;
62
+ const t = this.defaultConfig || {}, n = JSON.stringify(
63
+ Array.isArray(this.defaultContent) ? this.defaultContent : []
64
+ );
65
+ f({
66
+ selector: this.$refs.box,
67
+ html: this.defaultHtml || this.value || "",
68
+ config: {
69
+ ...t,
70
+ onCreated: (e) => {
71
+ if (this.editor = Object.seal(e), this.$emit("onCreated", e), t.onCreated) {
72
+ const o = r("onCreated");
73
+ throw new Error(o);
74
+ }
75
+ },
76
+ onChange: (e) => {
77
+ const o = e.getHtml();
78
+ if (this.curValue = o, this.$emit("input", o), this.$emit("onChange", e), t.onChange) {
79
+ const i = r("onChange");
80
+ throw new Error(i);
81
+ }
82
+ },
83
+ onDestroyed: (e) => {
84
+ if (this.$emit("onDestroyed", e), t.onDestroyed) {
85
+ const o = r("onDestroyed");
86
+ throw new Error(o);
87
+ }
88
+ },
89
+ onMaxLength: (e) => {
90
+ if (this.$emit("onMaxLength", e), t.onMaxLength) {
91
+ const o = r("onMaxLength");
92
+ throw new Error(o);
93
+ }
94
+ },
95
+ onFocus: (e) => {
96
+ if (this.$emit("onFocus", e), t.onFocus) {
97
+ const o = r("onFocus");
98
+ throw new Error(o);
99
+ }
100
+ },
101
+ onBlur: (e) => {
102
+ if (this.$emit("onBlur", e), t.onBlur) {
103
+ const o = r("onBlur");
104
+ throw new Error(o);
105
+ }
106
+ },
107
+ customAlert: (e, o) => {
108
+ if (this.$emit("customAlert", e, o), t.customAlert) {
109
+ const i = r("customAlert");
110
+ throw new Error(i);
111
+ }
112
+ },
113
+ customPaste: (e, o) => {
114
+ if (t.customPaste) {
115
+ const s = r("customPaste");
116
+ throw new Error(s);
117
+ }
118
+ let i;
119
+ return this.$emit("customPaste", e, o, (s) => {
120
+ i = s;
121
+ }), i;
122
+ }
123
+ },
124
+ content: JSON.parse(n),
125
+ mode: this.mode || "default"
126
+ });
127
+ }
128
+ }
129
+ });
130
+ function u(t, n, e, o, i, s, w, y) {
131
+ var l = typeof t == "function" ? t.options : t;
132
+ return {
133
+ exports: t,
134
+ options: l
135
+ };
136
+ }
137
+ var m = /* @__PURE__ */ u(
138
+ h
139
+ );
140
+ const b = m.exports, p = a.extend({
141
+ name: "Toolbar",
142
+ render(t) {
143
+ return t("div", { ref: "box" });
144
+ },
145
+ props: {
146
+ editor: {
147
+ type: Object,
148
+ default: void 0
149
+ },
150
+ defaultConfig: {
151
+ type: Object,
152
+ default: () => ({})
153
+ },
154
+ mode: {
155
+ type: String,
156
+ default: "default"
157
+ }
158
+ },
159
+ methods: {
160
+ // 创建 toolbar
161
+ create(t) {
162
+ this.$refs.box != null && t != null && (d.getToolbar(t) || c({
163
+ editor: t,
164
+ selector: this.$refs.box,
165
+ config: this.defaultConfig || {},
166
+ mode: this.mode || "default"
167
+ }));
168
+ }
169
+ },
170
+ watch: {
171
+ editor: {
172
+ handler(t) {
173
+ t != null && this.create(t);
174
+ },
175
+ immediate: !0
176
+ }
177
+ }
178
+ });
179
+ var g = /* @__PURE__ */ u(
180
+ p
181
+ );
182
+ const x = g.exports;
183
+ export {
184
+ b as Editor,
185
+ x as Toolbar
186
+ };
2
187
  //# sourceMappingURL=index.esm.js.map
@@ -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,IAAWJ,KAAKJ,UAIhCI,KAAKK,QAAQD,EACd,GAEHE,QAAS,CAEPD,iBAAQE,GACN,IAAMV,EAASG,KAAKH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P,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","../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 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","<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","_sfc_main$1","Vue","h","newVal","newHtml","editor","defaultConfig","defaultContent","createEditor","editorHtml","type","errorInfo","event","res","val","_sfc_main","DomEditor","createToolbar","e"],"mappings":";;AAMA,SAAAA,EAAAC,GAAA;AACA,MAAAC,IAAA,SAAAD,CAAA;AAEA,SAAAC,KAAA;AAAA,eAAAD,CAAA,4BACAC;AACA;AAEA,MAAAC,IAAAC,EAAA,OAAA;AAAA;AAAA,EAEA,OAAAC,GAAA;AACA,WAAAA,EAAA,OAAA,EAAA,KAAA,OAAA;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,IAAA;AAAA,IAEA,eAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA,OAAA,CAAA;AAAA,IAAA;AAAA,IAEA,MAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IAAA;AAAA,IAEA,aAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IAAA;AAAA;AAAA,IAGA,OAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,IAAA;AAAA,EACA;AAAA,EAEA,UAAA;AACA,SAAA,OAAA;AAAA,EACA;AAAA,EACA,OAAA;AAAA;AAAA,IAEA,MAAAC,GAAA;AAGA,MAFAA,MAAA,KAAA,YAOA,KAAA,QAAAA,CAAA;AAAA,IACA;AAAA,EAAA;AAAA,EAEA,SAAA;AAAA;AAAA,IAEA,QAAAC,GAAA;AACA,YAAAC,IAAA,KAAA;AAEA,MAAAA,KAAA,QAGAA,EAAA,QAAAD,C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AG,GAAA;AACA,MAAA,KAAA,MAAA,OAAA,QAGAA,KAAA,SAGAW,EAAA,WAAAX,CAAA,KAIAY,EAAA;AAAA,QACA,QAAAZ;AAAA,QACA,UAAA,KAAA,MAAA;AAAA,QACA,QAAA,KAAA,iBAAA,CAAA;AAAA,QACA,MAAA,KAAA,QAAA;AAAA,MAAA,CACA;AAAA,IACA;AAAA,EAAA;AAAA,EAEA,OAAA;AAAA,IACA,QAAA;AAAA,MACA,QAAAa,GAAA;AACA,QAAAA,KAAA,QAGA,KAAA,OAAAA,CAAA;AAAA,MACA;AAAA,MACA,WAAA;AAAA,IAAA;AAAA,EACA;AAEA,CAAA;;;;;"}
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue"),require("@wangeditor-next/editor")):"function"==typeof define&&define.amd?define(["exports","vue","@wangeditor-next/editor"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).WangEditorForVue={},e.Vue,e.editor)}(this,(function(e,t,o){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(t),i=function(){return i=Object.assign||function(e){for(var t,o=1,r=arguments.length;o<r;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},i.apply(this,arguments)};function u(e){var t="请使用 '@".concat(e,"' 事件,不要放在 props 中");return t+="\nPlease use '@".concat(e,"' event instead of props")}"function"==typeof SuppressedError&&SuppressedError;var a=n.default.extend({render:function(e){return e("div",{ref:"box"})},name:"Editor",data:function(){return{curValue:"",editor:null}},props:["defaultContent","defaultConfig","mode","defaultHtml","value"],mounted:function(){this.create()},watch:{value:function(e){e===this.curValue||this.setHtml(e)}},methods:{setHtml:function(e){var t=this.editor;null!=t&&t.setHtml(e)},create:function(){var e=this;if(null!=this.$refs.box){var t=this.defaultConfig||{},r=JSON.stringify(Array.isArray(this.defaultContent)?this.defaultContent:[]);o.createEditor({selector:this.$refs.box,html:this.defaultHtml||this.value||"",config:i(i({},t),{onCreated:function(o){if(e.editor=Object.seal(o),e.$emit("onCreated",o),t.onCreated){var r=u("onCreated");throw new Error(r)}},onChange:function(o){var r=o.getHtml();if(e.curValue=r,e.$emit("input",r),e.$emit("onChange",o),t.onChange){var n=u("onChange");throw new Error(n)}},onDestroyed:function(o){if(e.$emit("onDestroyed",o),t.onDestroyed){var r=u("onDestroyed");throw new Error(r)}},onMaxLength:function(o){if(e.$emit("onMaxLength",o),t.onMaxLength){var r=u("onMaxLength");throw new Error(r)}},onFocus:function(o){if(e.$emit("onFocus",o),t.onFocus){var r=u("onFocus");throw new Error(r)}},onBlur:function(o){if(e.$emit("onBlur",o),t.onBlur){var r=u("onBlur");throw new Error(r)}},customAlert:function(o,r){if(e.$emit("customAlert",o,r),t.customAlert){var n=u("customAlert");throw new Error(n)}},customPaste:function(o,r){if(t.customPaste){var n=u("customPaste");throw new Error(n)}var i;return e.$emit("customPaste",o,r,(function(e){i=e})),i}}),content:JSON.parse(r),mode:this.mode||"default"})}}}}),f=n.default.extend({name:"Toolbar",render:function(e){return e("div",{ref:"box"})},props:["editor","defaultConfig","mode"],methods:{create:function(e){null!=this.$refs.box&&null!=e&&(o.DomEditor.getToolbar(e)||o.createToolbar({editor:e,selector:this.$refs.box,config:this.defaultConfig||{},mode:this.mode||"default"}))}},watch:{editor:{handler:function(e){null!=e&&this.create(e)},immediate:!0}}});e.Editor=a,e.Toolbar=f,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ (function(n,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("@wangeditor-next/editor"),require("vue")):typeof define=="function"&&define.amd?define(["exports","@wangeditor-next/editor","vue"],s):(n=typeof globalThis<"u"?globalThis:n||self,s(n.WangEditorForVue={},n.wangEditor,n.Vue))})(this,(function(n,s,d){"use strict";function i(t){let r=`请使用 '@${t}' 事件,不要放在 props 中`;return r+=`
2
+ Please use '@${t}' event instead of props`,r}const l=d.extend({render(t){return t("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:""}},mounted(){this.create()},watch:{value(t){t!==this.curValue&&this.setHtml(t)}},methods:{setHtml(t){const r=this.editor;r!=null&&r.setHtml(t)},create(){if(this.$refs.box==null)return;const t=this.defaultConfig||{},r=JSON.stringify(Array.isArray(this.defaultContent)?this.defaultContent:[]);s.createEditor({selector:this.$refs.box,html:this.defaultHtml||this.value||"",config:{...t,onCreated:e=>{if(this.editor=Object.seal(e),this.$emit("onCreated",e),t.onCreated){const o=i("onCreated");throw new Error(o)}},onChange:e=>{const o=e.getHtml();if(this.curValue=o,this.$emit("input",o),this.$emit("onChange",e),t.onChange){const u=i("onChange");throw new Error(u)}},onDestroyed:e=>{if(this.$emit("onDestroyed",e),t.onDestroyed){const o=i("onDestroyed");throw new Error(o)}},onMaxLength:e=>{if(this.$emit("onMaxLength",e),t.onMaxLength){const o=i("onMaxLength");throw new Error(o)}},onFocus:e=>{if(this.$emit("onFocus",e),t.onFocus){const o=i("onFocus");throw new Error(o)}},onBlur:e=>{if(this.$emit("onBlur",e),t.onBlur){const o=i("onBlur");throw new Error(o)}},customAlert:(e,o)=>{if(this.$emit("customAlert",e,o),t.customAlert){const u=i("customAlert");throw new Error(u)}},customPaste:(e,o)=>{if(t.customPaste){const a=i("customPaste");throw new Error(a)}let u;return this.$emit("customPaste",e,o,a=>{u=a}),u}},content:JSON.parse(r),mode:this.mode||"default"})}}});function f(t,r,e,o,u,a,w,C){var y=typeof t=="function"?t.options:t;return{exports:t,options:y}}var c=f(l);const h=c.exports,m=d.extend({name:"Toolbar",render(t){return t("div",{ref:"box"})},props:{editor:{type:Object,default:void 0},defaultConfig:{type:Object,default:()=>({})},mode:{type:String,default:"default"}},methods:{create(t){this.$refs.box!=null&&t!=null&&(s.DomEditor.getToolbar(t)||s.createToolbar({editor:t,selector:this.$refs.box,config:this.defaultConfig||{},mode:this.mode||"default"}))}},watch:{editor:{handler(t){t!=null&&this.create(t)},immediate:!0}}});var p=f(m);const g=p.exports;n.Editor=h,n.Toolbar=g,Object.defineProperty(n,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,QAAQD,EACd,GAEHE,QAAS,CAEPD,iBAAQE,GACN,IAAMV,EAASG,KAAKH,OACN,MAAVA,GACJA,EAAOQ,QAAQE,EAChB,EAGDN,OAAM,WAAN,IAoFCO,EAAAR,KAnFC,GAAsB,MAAlBA,KAAKS,MAAMC,IAAf,CAEA,IAAMC,EAAgBX,KAAKW,eAAiB,GAEtCC,EAAiBC,KAAKC,UAC1BC,MAAMC,QAAQhB,KAAKY,gBAAkBZ,KAAKY,eAAiB,IAG7DK,eAAa,CACXC,SAAUlB,KAAKS,MAAMC,IACrBS,KAAMnB,KAAKoB,aAAepB,KAAKG,OAAS,GACxCkB,cACKV,GAAa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,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","../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 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","<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","_sfc_main$1","Vue","h","newVal","newHtml","editor","defaultConfig","defaultContent","createEditor","editorHtml","type","errorInfo","event","res","val","_sfc_main","DomEditor","createToolbar","e"],"mappings":"kVAMA,SAAAA,EAAAC,EAAA,CACA,IAAAC,EAAA,SAAAD,CAAA,oBAEA,OAAAC,GAAA;AAAA,e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CACA,EACA,MAAA,CACA,OAAA,CACA,KAAA,OACA,QAAA,MAAA,EAEA,cAAA,CACA,KAAA,OACA,QAAA,KAAA,CAAA,EAAA,EAEA,KAAA,CACA,KAAA,OACA,QAAA,SAAA,CACA,EAEA,QAAA,CAEA,OAAAG,EAAA,CACA,KAAA,MAAA,KAAA,MAGAA,GAAA,OAGAW,EAAAA,UAAA,WAAAX,CAAA,GAIAY,gBAAA,CAAA,OACAZ,EACA,SAAA,KAAA,MAAA,IACA,OAAA,KAAA,eAAA,CAAA,EACA,KAAA,KAAA,MAAA,SAAA,CACA,EACA,CAAA,EAEA,MAAA,CACA,OAAA,CACA,QAAAa,EAAA,CACAA,GAAA,MAGA,KAAA,OAAAA,CAAA,CACA,EACA,UAAA,EAAA,CACA,CAEA,CAAA"}
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "@wangeditor-next/editor-for-vue2",
3
- "version": "1.0.2",
4
- "description": "wangEditor component for vue2.x",
3
+ "version": "6.2.0",
4
+ "description": "wangEditor component for Vue 2",
5
5
  "author": "cycleccc <ylf2991205548@qq.com>",
6
- "contributors": [],
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
8
  "types": "dist/index.d.ts",
10
9
  "main": "dist/index.js",
@@ -13,76 +12,50 @@
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/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/cycleccc/wangEditor-for-vue2.git"
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/cycleccc/wangEditor-for-vue2/issues"
40
+ "url": "https://github.com/wangeditor-next/wangEditor-next/issues"
47
41
  },
48
42
  "peerDependencies": {
49
- "@wangeditor-next/editor": ">=5.2.5",
50
- "vue": "^2.7.16"
43
+ "vue": "^2.7.16",
44
+ "@wangeditor-next/editor": "^6.2.0"
51
45
  },
52
46
  "devDependencies": {
53
- "@babel/core": "^7.16.0",
54
- "@babel/plugin-transform-runtime": "^7.16.0",
55
- "@babel/preset-env": "^7.16.0",
56
- "@rollup/plugin-babel": "^5.3.0",
57
- "@rollup/plugin-commonjs": "^21.0.1",
58
- "@rollup/plugin-json": "^4.1.0",
59
- "@rollup/plugin-node-resolve": "^13.0.6",
60
- "@rollup/plugin-replace": "^3.0.0",
61
- "@types/vue": "^2.0.0",
62
- "@vue/compiler-sfc": "^3.2.21",
63
- "@wangeditor-next/editor": "^5.2.5",
64
- "autoprefixer": "^10.4.0",
65
- "cross-env": "^7.0.3",
66
- "cssnano": "^5.0.10",
67
- "jest": "^27.3.1",
68
- "lodash": "^4.17.21",
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": "^2.3.4",
49
+ "typescript": "5.2.2",
50
+ "vite": "^6.4.3",
51
+ "vite-plugin-dts": "^5.0.3",
52
+ "vue": "^2.7.16",
53
+ "@wangeditor-next/editor": "^6.2.0"
54
+ },
55
+ "scripts": {
56
+ "dev": "vite",
57
+ "dev-watch": "vite build --watch",
58
+ "build": "tsc --noEmit && vite build",
59
+ "typecheck": "tsc --noEmit"
60
+ }
61
+ }
package/README.md DELETED
@@ -1,20 +0,0 @@
1
- # wangEditor for Vue
2
-
3
- [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/facebook/react/blob/main/LICENSE) [![npm](https://img.shields.io/npm/v/@wangeditor-next/editor-for-vue.svg)](https://www.npmjs.com/package/@wangeditor-next/editor-for-vue/v/next) [![build status](https://github.com/cycleccc/wangEditor-for-vue/actions/workflows/npm-publish.yml/badge.svg?branch=main)](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)