zydx-plus 1.10.35 → 1.10.37
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/package.json
CHANGED
|
@@ -84,25 +84,31 @@ const Editable = defineComponent({
|
|
|
84
84
|
const { mode, config, defaultContent, extendCache } = toRaw(opts).editable;
|
|
85
85
|
const option = {
|
|
86
86
|
selector: rootRef.value,
|
|
87
|
-
mode: mode
|
|
87
|
+
mode: mode || 'default',
|
|
88
88
|
config: Object.assign({}, config, {
|
|
89
89
|
customAlert(info, type) {
|
|
90
|
-
opts.editable.config.customAlert?.(info, type)
|
|
90
|
+
// opts.editable.config.customAlert?.(info, type)
|
|
91
|
+
if(opts.editable.config.customAlert) opts.editable.config.customAlert(info, type);
|
|
91
92
|
},
|
|
92
93
|
onCreated(editor) {
|
|
93
|
-
opts.editable.config.onCreated?.(editor);
|
|
94
|
+
// opts.editable.config.onCreated?.(editor);
|
|
95
|
+
if(opts.editable.config.onCreated) opts.editable.config.onCreated(editor);
|
|
94
96
|
},
|
|
95
97
|
onDestroyed(editor) {
|
|
96
|
-
opts.editable.config.onDestroyed
|
|
98
|
+
if(opts.editable.config.onDestroyed) opts.editable.config.onDestroyed(editor);
|
|
99
|
+
// opts.editable.config.onDestroyed?.(editor);
|
|
97
100
|
},
|
|
98
101
|
onMaxLength(editor) {
|
|
99
|
-
opts.editable.config.onMaxLength
|
|
102
|
+
if(opts.editable.config.onMaxLength) opts.editable.config.onMaxLength(editor);
|
|
103
|
+
// opts.editable.config.onMaxLength?.(editor);
|
|
100
104
|
},
|
|
101
105
|
onFocus(editor) {
|
|
102
|
-
opts.editable.config.onFocus
|
|
106
|
+
if(opts.editable.config.onFocus) opts.editable.config.onFocus(editor);
|
|
107
|
+
// opts.editable.config.onFocus?.(editor);
|
|
103
108
|
},
|
|
104
109
|
onBlur(editor) {
|
|
105
|
-
opts.editable.config.onBlur
|
|
110
|
+
if(opts.editable.config.onBlur) opts.editable.config.onBlur(editor);
|
|
111
|
+
// opts.editable.config.onBlur?.(editor);
|
|
106
112
|
formField.blur();
|
|
107
113
|
},
|
|
108
114
|
onChange(editor) {
|
|
@@ -117,10 +123,10 @@ const Editable = defineComponent({
|
|
|
117
123
|
? content.jstr
|
|
118
124
|
: Array.isArray(defaultContent)
|
|
119
125
|
? JSON.stringify(defaultContent)
|
|
120
|
-
: defaultContent
|
|
126
|
+
: defaultContent || '';
|
|
121
127
|
}
|
|
122
128
|
else {
|
|
123
|
-
data = Array.isArray(defaultContent) ? JSON.stringify(defaultContent) : defaultContent
|
|
129
|
+
data = Array.isArray(defaultContent) ? JSON.stringify(defaultContent) : defaultContent || content.jstr;
|
|
124
130
|
}
|
|
125
131
|
try {
|
|
126
132
|
const json = JSON.parse(data);
|
|
@@ -139,9 +145,9 @@ const Editable = defineComponent({
|
|
|
139
145
|
instance.editable = createEditor(createOption());
|
|
140
146
|
syncContent();
|
|
141
147
|
dispatch && emit('reloaded', createEvent());
|
|
142
|
-
if (cache.toolbar
|
|
148
|
+
if (cache.toolbar.timer)
|
|
143
149
|
clearTimeout(cache.toolbar.timer);
|
|
144
|
-
cache.toolbar
|
|
150
|
+
cache.toolbar.create();
|
|
145
151
|
},
|
|
146
152
|
throttle() {
|
|
147
153
|
if (editable.timer)
|
|
@@ -218,7 +224,7 @@ const Editable = defineComponent({
|
|
|
218
224
|
// 以 v-model:json 为主,无 v-model:json 时才会继续操作
|
|
219
225
|
if (modelJson.value || !modelHtml.value)
|
|
220
226
|
return;
|
|
221
|
-
html = html
|
|
227
|
+
html = html || '';
|
|
222
228
|
if (content.html === html)
|
|
223
229
|
return;
|
|
224
230
|
const { editable: inst } = instance;
|
|
@@ -248,13 +254,20 @@ const Editable = defineComponent({
|
|
|
248
254
|
});
|
|
249
255
|
// placeholder
|
|
250
256
|
watch(() => opts.editable.config.placeholder, (nv) => {
|
|
251
|
-
|
|
257
|
+
let target = null;
|
|
258
|
+
if(rootRef.value){
|
|
259
|
+
target = rootRef.value.querySelector('.w-e-text-placeholder')
|
|
260
|
+
}
|
|
252
261
|
if (target instanceof HTMLElement)
|
|
253
|
-
target.innerHTML = nv
|
|
262
|
+
target.innerHTML = nv || '';
|
|
254
263
|
});
|
|
255
264
|
// scroll
|
|
256
265
|
watch(() => opts.editable.config.scroll, (nv) => {
|
|
257
|
-
const target = rootRef.value?.querySelector('.w-e-scroll');
|
|
266
|
+
// const target = rootRef.value?.querySelector('.w-e-scroll');
|
|
267
|
+
let target = null
|
|
268
|
+
if(rootRef.value){
|
|
269
|
+
target = rootRef.value.querySelector('.w-e-scroll')
|
|
270
|
+
}
|
|
258
271
|
if (target instanceof HTMLElement)
|
|
259
272
|
target.style.overflowY = nv ? 'auto' : '';
|
|
260
273
|
});
|
|
@@ -49,7 +49,11 @@ const GlobalPropertiesInit = {
|
|
|
49
49
|
formFieldInit: () => defaultFormFieldInit
|
|
50
50
|
};
|
|
51
51
|
export function useWeGlobalConfig(key) {
|
|
52
|
-
const properties = getCurrentInstance()?.appContext.config.globalProperties;
|
|
52
|
+
// const properties = getCurrentInstance()?.appContext.config.globalProperties;
|
|
53
|
+
let properties = null
|
|
54
|
+
if(getCurrentInstance()) {
|
|
55
|
+
properties = getCurrentInstance().appContext.config.globalProperties;
|
|
56
|
+
}
|
|
53
57
|
if (properties) {
|
|
54
58
|
const name = createGlobalPropertyName(key);
|
|
55
59
|
if (!Reflect.has(properties, name)) {
|
|
@@ -98,13 +102,16 @@ export function useWangEditor(option = null, formField) {
|
|
|
98
102
|
globalAttrs: useWeGlobalConfig('attrs')
|
|
99
103
|
});
|
|
100
104
|
function clearContent() {
|
|
101
|
-
cache.clearContent
|
|
105
|
+
if(cache.clearContent) cache.clearContent()
|
|
106
|
+
// cache.clearContent?.();
|
|
102
107
|
}
|
|
103
108
|
function syncContent() {
|
|
104
|
-
cache.syncContent
|
|
109
|
+
if(cache.syncContent) cache.syncContent()
|
|
110
|
+
// cache.syncContent?.();
|
|
105
111
|
}
|
|
106
112
|
function reloadEditor() {
|
|
107
|
-
cache.
|
|
113
|
+
if(cache.create) cache.create()
|
|
114
|
+
// cache.editable?.create();
|
|
108
115
|
}
|
|
109
116
|
return { opts, instance, handle, clearContent, syncContent, reloadEditor };
|
|
110
117
|
}
|
|
@@ -113,7 +120,7 @@ export function useWangEditor(option = null, formField) {
|
|
|
113
120
|
* @param handle - 句柄
|
|
114
121
|
*/
|
|
115
122
|
export function useWeContent(handle) {
|
|
116
|
-
return (inject(handle)
|
|
123
|
+
return (inject(handle) || {
|
|
117
124
|
cache: {},
|
|
118
125
|
opts: reactive(defaultOptions()),
|
|
119
126
|
instance: shallowReactive({
|
|
@@ -124,4 +131,4 @@ export function useWeContent(handle) {
|
|
|
124
131
|
formFieldInit: useWeGlobalConfig('formFieldInit').value
|
|
125
132
|
});
|
|
126
133
|
}
|
|
127
|
-
//# sourceMappingURL=hooks.js.map
|
|
134
|
+
//# sourceMappingURL=hooks.js.map
|
|
@@ -55,7 +55,7 @@ const Toolbar = defineComponent({
|
|
|
55
55
|
throttle() {
|
|
56
56
|
if (toolbar.timer)
|
|
57
57
|
clearTimeout(toolbar.timer);
|
|
58
|
-
if (cache.editable
|
|
58
|
+
if (cache.editable || cache.editable.timer)
|
|
59
59
|
return;
|
|
60
60
|
toolbar.timer = setTimeout(() => {
|
|
61
61
|
toolbar.timer = null;
|
|
@@ -76,4 +76,4 @@ const Toolbar = defineComponent({
|
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
78
|
export const WeToolbar = withInstall(Toolbar);
|
|
79
|
-
//# sourceMappingURL=toolbar.js.map
|
|
79
|
+
//# sourceMappingURL=toolbar.js.map
|