@itshixun/qckeditor-vue2 1.0.11 → 1.0.13

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/README.md CHANGED
@@ -26,13 +26,14 @@ npm install vue@^2.6.0 ckeditor5@>=42.0.0
26
26
 
27
27
  ### 引入样式
28
28
 
29
- 在使用组件前,需要先引入 CKEditor 的样式文件:
29
+ 在使用组件前,需要引入本库的样式文件:
30
30
 
31
31
  ```javascript
32
- import 'ckeditor5/ckeditor5.css';
33
- import '@itshixun/qckeditor-vue2/dist/style.css';
32
+ import '@itshixun/qckeditor-vue2/dist/index.css';
34
33
  ```
35
34
 
35
+ > 本样式文件已内置 CKEditor 5 官方样式,无需再单独引入 `ckeditor5/ckeditor5.css`。
36
+
36
37
  ### 基础编辑器(CKEditor)
37
38
 
38
39
  底层 CKEditor 封装组件,支持任意 CKEditor 构建:
@@ -51,7 +52,7 @@ import '@itshixun/qckeditor-vue2/dist/style.css';
51
52
  <script>
52
53
  import { ClassicEditor } from 'ckeditor5';
53
54
  import { CKEditor } from '@itshixun/qckeditor-vue2';
54
- import 'ckeditor5/ckeditor5.css';
55
+ import '@itshixun/qckeditor-vue2/dist/index.css';
55
56
 
56
57
  export default {
57
58
  components: {
@@ -89,7 +90,7 @@ export default {
89
90
 
90
91
  <script>
91
92
  import { QCKClassic } from '@itshixun/qckeditor-vue2';
92
- import 'ckeditor5/ckeditor5.css';
93
+ import '@itshixun/qckeditor-vue2/dist/index.css';
93
94
 
94
95
  export default {
95
96
  components: {
@@ -129,7 +130,7 @@ export default {
129
130
 
130
131
  <script>
131
132
  import { QCKEditorPro } from '@itshixun/qckeditor-vue2';
132
- import 'ckeditor5/ckeditor5.css';
133
+ import '@itshixun/qckeditor-vue2/dist/index.css';
133
134
 
134
135
  export default {
135
136
  components: {
@@ -163,7 +164,7 @@ export default {
163
164
 
164
165
  <script>
165
166
  import { QCKContent } from '@itshixun/qckeditor-vue2';
166
- import 'ckeditor5/ckeditor5.css';
167
+ import '@itshixun/qckeditor-vue2/dist/index.css';
167
168
 
168
169
  export default {
169
170
  components: {
@@ -388,7 +389,7 @@ import type { Props, ExtractEditorType } from '@itshixun/qckeditor-vue2';
388
389
 
389
390
  1. **CKEditor 授权**:本库使用 CKEditor 5 的 GPL 授权。如需商业使用,请购买 [CKEditor 商业授权](https://ckeditor.com/pricing/)。
390
391
 
391
- 2. **样式文件**:必须导入 `ckeditor5/ckeditor5.css` 以确保编辑器样式正确。
392
+ 2. **样式文件**:导入 `@itshixun/qckeditor-vue2/dist/index.css` 即可,该文件已内置 CKEditor 5 官方样式。
392
393
 
393
394
  3. **HTML 清洗**:`QCKContent` 和 `QCKEditorPro` 默认开启 XSS 防护,会自动过滤危险标签和属性。
394
395
 
package/dist/index.d.ts CHANGED
@@ -27,6 +27,10 @@ declare const _default: {
27
27
  type: BooleanConstructor;
28
28
  default: boolean;
29
29
  };
30
+ dataNormalizer: {
31
+ type: import('vue').PropType<(data: string) => string>;
32
+ default: (data: string) => string;
33
+ };
30
34
  value: {
31
35
  type: StringConstructor;
32
36
  default: string;
@@ -60,6 +64,10 @@ declare const _default: {
60
64
  type: BooleanConstructor;
61
65
  default: boolean;
62
66
  };
67
+ dataNormalizer: {
68
+ type: import('vue').PropType<(data: string) => string>;
69
+ default: (data: string) => string;
70
+ };
63
71
  value: {
64
72
  type: StringConstructor;
65
73
  default: string;
@@ -74,6 +82,7 @@ declare const _default: {
74
82
  tagName: string;
75
83
  disabled: boolean;
76
84
  disableTwoWayDataBinding: boolean;
85
+ dataNormalizer: (data: string) => string;
77
86
  modelValue: string;
78
87
  }>;
79
88
  QCKClassic: import('vue').DefineComponent<{
@@ -101,6 +110,10 @@ declare const _default: {
101
110
  type: BooleanConstructor;
102
111
  default: boolean;
103
112
  };
113
+ dataNormalizer: {
114
+ type: import('vue').PropType<(data: string) => string>;
115
+ default: (data: string) => string;
116
+ };
104
117
  }, {
105
118
  ClassicEditor: typeof import('ckeditor5').ClassicEditor;
106
119
  ckeditorRef: any;
@@ -129,12 +142,17 @@ declare const _default: {
129
142
  type: BooleanConstructor;
130
143
  default: boolean;
131
144
  };
145
+ dataNormalizer: {
146
+ type: import('vue').PropType<(data: string) => string>;
147
+ default: (data: string) => string;
148
+ };
132
149
  }>>, {
133
150
  value: string;
134
151
  config: import('ckeditor5').EditorConfig;
135
152
  tagName: string;
136
153
  disabled: boolean;
137
154
  disableTwoWayDataBinding: boolean;
155
+ dataNormalizer: (data: string) => string;
138
156
  modelValue: string;
139
157
  }>;
140
158
  QCKEditorPro: import('vue').DefineComponent<{
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,OAAO,wBAAwB,CAAC;AAGhC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAGpE,YAAY,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAG5D,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACtH,YAAY,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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 @@ const ys = _a({
82
82
  type: Boolean,
83
83
  default: !1
84
84
  },
85
+ dataNormalizer: {
86
+ type: Function,
87
+ default: (r) => r
88
+ },
85
89
  value: {
86
90
  type: String,
87
91
  default: ""
@@ -104,12 +108,20 @@ const ys = _a({
104
108
  ra(
105
109
  () => r.modelValue,
106
110
  (m) => {
107
- m !== void 0 && m !== c.value && (c.value = m, i.value && m !== o.value && i.value.data.set(m));
111
+ if (m !== void 0 && m !== c.value) {
112
+ c.value = m;
113
+ const E = r.dataNormalizer;
114
+ i.value && E(m) !== E(o.value) && i.value.data.set(m);
115
+ }
108
116
  }
109
117
  ), ra(
110
118
  () => r.value,
111
119
  (m) => {
112
- m !== void 0 && m !== c.value && (c.value = m, i.value && m !== o.value && i.value.data.set(m));
120
+ if (m !== void 0 && m !== c.value) {
121
+ c.value = m;
122
+ const E = r.dataNormalizer;
123
+ i.value && E(m) !== E(o.value) && i.value.data.set(m);
124
+ }
113
125
  }
114
126
  ), ra(
115
127
  () => r.disabled,
@@ -198,6 +210,10 @@ const ys = _a({
198
210
  disableTwoWayDataBinding: {
199
211
  type: Boolean,
200
212
  default: !1
213
+ },
214
+ dataNormalizer: {
215
+ type: Function,
216
+ default: (r) => r
201
217
  }
202
218
  },
203
219
  emits: ["ready", "destroy", "blur", "focus", "input", "update:modelValue"],
@@ -218,7 +234,8 @@ const ys = _a({
218
234
  config: this.config,
219
235
  tagName: this.tagName,
220
236
  disabled: this.disabled,
221
- disableTwoWayDataBinding: this.disableTwoWayDataBinding
237
+ disableTwoWayDataBinding: this.disableTwoWayDataBinding,
238
+ dataNormalizer: this.dataNormalizer
222
239
  },
223
240
  on: {
224
241
  ready: (t) => this.$emit("ready", t),
@@ -21,6 +21,10 @@ declare const _default: import('vue').DefineComponent<{
21
21
  type: BooleanConstructor;
22
22
  default: boolean;
23
23
  };
24
+ dataNormalizer: {
25
+ type: PropType<(data: string) => string>;
26
+ default: (data: string) => string;
27
+ };
24
28
  value: {
25
29
  type: StringConstructor;
26
30
  default: string;
@@ -54,6 +58,10 @@ declare const _default: import('vue').DefineComponent<{
54
58
  type: BooleanConstructor;
55
59
  default: boolean;
56
60
  };
61
+ dataNormalizer: {
62
+ type: PropType<(data: string) => string>;
63
+ default: (data: string) => string;
64
+ };
57
65
  value: {
58
66
  type: StringConstructor;
59
67
  default: string;
@@ -68,6 +76,7 @@ declare const _default: import('vue').DefineComponent<{
68
76
  tagName: string;
69
77
  disabled: boolean;
70
78
  disableTwoWayDataBinding: boolean;
79
+ dataNormalizer: (data: string) => string;
71
80
  modelValue: string;
72
81
  }>;
73
82
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"CKEditor.d.ts","sourceRoot":"","sources":["../../../src/components/CKEditor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAoE,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAC;AAEtG,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAa,MAAM,WAAW,CAAC;;;cAazC,QAAQ,CAAC,GAAG,CAAC;;;;cAIf,QAAQ,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAJpB,QAAQ,CAAC,GAAG,CAAC;;;;cAIf,QAAQ,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAT5C,wBAwMG"}
1
+ {"version":3,"file":"CKEditor.d.ts","sourceRoot":"","sources":["../../../src/components/CKEditor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAoE,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAC;AAEtG,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAa,MAAM,WAAW,CAAC;;;cAazC,QAAQ,CAAC,GAAG,CAAC;;;;cAIf,QAAQ,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;cAgBpB,QAAQ,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;wBACpC,MAAM;;;;;;;;;;;;;;;;cArBJ,QAAQ,CAAC,GAAG,CAAC;;;;cAIf,QAAQ,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;cAgBpB,QAAQ,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;wBACpC,MAAM;;;;;;;;;;;;;;;;2BADY,MAAM,KAAK,MAAM;;;AAzBzD,wBA8MG"}
@@ -25,6 +25,10 @@ declare const _default: import('vue').DefineComponent<{
25
25
  type: BooleanConstructor;
26
26
  default: boolean;
27
27
  };
28
+ dataNormalizer: {
29
+ type: PropType<(data: string) => string>;
30
+ default: (data: string) => string;
31
+ };
28
32
  }, {
29
33
  ClassicEditor: typeof ClassicEditor;
30
34
  ckeditorRef: any;
@@ -53,12 +57,17 @@ declare const _default: import('vue').DefineComponent<{
53
57
  type: BooleanConstructor;
54
58
  default: boolean;
55
59
  };
60
+ dataNormalizer: {
61
+ type: PropType<(data: string) => string>;
62
+ default: (data: string) => string;
63
+ };
56
64
  }>>, {
57
65
  value: string;
58
66
  config: EditorConfig;
59
67
  tagName: string;
60
68
  disabled: boolean;
61
69
  disableTwoWayDataBinding: boolean;
70
+ dataNormalizer: (data: string) => string;
62
71
  modelValue: string;
63
72
  }>;
64
73
  export default _default;
@@ -1 +1 @@
1
- {"version":3,"file":"QCKClassic.d.ts","sourceRoot":"","sources":["../../../src/components/QCKClassic.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAwB,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAkB,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAI7E,OAAO,yBAAyB,CAAC;;;;;;;;;;;cAqBX,QAAQ,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAtB,QAAQ,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;AAjB5C,wBAsEG"}
1
+ {"version":3,"file":"QCKClassic.d.ts","sourceRoot":"","sources":["../../../src/components/QCKClassic.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAwB,KAAK,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAkB,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAI7E,OAAO,yBAAyB,CAAC;;;;;;;;;;;cAqBX,QAAQ,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;cAgBpB,QAAQ,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;wBACpC,MAAM;;;;;;;;;;;;;;;cAjBN,QAAQ,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;cAgBpB,QAAQ,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;wBACpC,MAAM;;;;;;;;2BADY,MAAM,KAAK,MAAM;;;AAjCzD,wBA2EG"}
@@ -11,6 +11,7 @@ export interface Props<TEditor> {
11
11
  tagName?: string;
12
12
  disabled?: boolean;
13
13
  disableTwoWayDataBinding?: boolean;
14
+ dataNormalizer?: (data: string) => string;
14
15
  }
15
16
  /**
16
17
  * The editor type extracted from the editor instance type.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,KAAK,CAAC,OAAO;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,OAAO,IAAI,OAAO,SAAS;IAAE,MAAM,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;CAAE,GAAG,CAAC,GAAG,KAAK,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE9C;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,KAAK,CAAC,OAAO;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CAC3C;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,OAAO,IAAI,OAAO,SAAS;IAAE,MAAM,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;CAAE,GAAG,CAAC,GAAG,KAAK,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itshixun/qckeditor-vue2",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "Vue2 components for CKEditor 5",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -53,4 +53,4 @@
53
53
  "type": "git",
54
54
  "url": ""
55
55
  }
56
- }
56
+ }