free-fe-core-modules 0.0.32 → 0.0.34
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/free-field/Fields/Rich.vue +41 -4
- package/package.json +1 -1
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
<span
|
|
26
26
|
v-if="Field.ReadOnly"
|
|
27
27
|
class="col readonly"
|
|
28
|
-
ref="readonlyContent"
|
|
28
|
+
:ref="readonlyContent"
|
|
29
29
|
></span>
|
|
30
30
|
<tiny
|
|
31
31
|
v-if="!Field.ReadOnly"
|
|
@@ -48,7 +48,12 @@
|
|
|
48
48
|
extended_valid_elements:'efield',
|
|
49
49
|
setup: tinySetup,
|
|
50
50
|
default_link_target: (Field && Field.Options && Field.Options.LinkTarget) || '_blank',
|
|
51
|
-
|
|
51
|
+
|
|
52
|
+
automatic_uploads: true,
|
|
53
|
+
images_upload_url: '/api/upload',
|
|
54
|
+
images_reuse_filename: true,
|
|
55
|
+
images_upload_handler,
|
|
56
|
+
}"
|
|
52
57
|
initial-value
|
|
53
58
|
model-events
|
|
54
59
|
plugins
|
|
@@ -63,7 +68,7 @@
|
|
|
63
68
|
</template>
|
|
64
69
|
|
|
65
70
|
<script>
|
|
66
|
-
import { defineComponent, watchEffect, ref } from 'vue';
|
|
71
|
+
import { defineComponent, watchEffect, ref, getCurrentInstance } from 'vue';
|
|
67
72
|
import tiny from '@tinymce/tinymce-vue';
|
|
68
73
|
import { fileSizeStrToNumber } from '../composible/useFileSizeUtils';
|
|
69
74
|
import { useFreeField, freeFieldProps } from '../composible/useFreeField';
|
|
@@ -115,6 +120,8 @@ export default defineComponent({
|
|
|
115
120
|
enableField: { type: Boolean, default: false },
|
|
116
121
|
},
|
|
117
122
|
setup(props, { expose, emit }) {
|
|
123
|
+
const { proxy:vm } = getCurrentInstance();
|
|
124
|
+
|
|
118
125
|
if (!props.Field) return {};
|
|
119
126
|
|
|
120
127
|
const { fieldData, setFieldData } = useFreeField(props);
|
|
@@ -219,7 +226,9 @@ export default defineComponent({
|
|
|
219
226
|
|
|
220
227
|
if (props.Field.ReadOnly) {
|
|
221
228
|
watchEffect(() => {
|
|
222
|
-
readonlyContent.value
|
|
229
|
+
if (readonlyContent.value) {
|
|
230
|
+
readonlyContent.value.innerHTML = fieldData.value;
|
|
231
|
+
}
|
|
223
232
|
});
|
|
224
233
|
}
|
|
225
234
|
|
|
@@ -345,6 +354,34 @@ export default defineComponent({
|
|
|
345
354
|
toolbar,
|
|
346
355
|
quickbars_selection_toolbar,
|
|
347
356
|
contextmenu,
|
|
357
|
+
|
|
358
|
+
images_upload_handler: (
|
|
359
|
+
blobInfo,
|
|
360
|
+
success,
|
|
361
|
+
failure,
|
|
362
|
+
) => {
|
|
363
|
+
const formData = new FormData();
|
|
364
|
+
formData.append('file', blobInfo.blob(), blobInfo.filename());
|
|
365
|
+
|
|
366
|
+
vm.postRequest('/upload', formData, {
|
|
367
|
+
__ignoreDecycle: true,
|
|
368
|
+
headers: {
|
|
369
|
+
'Content-Type': 'multipart/form-data',
|
|
370
|
+
},
|
|
371
|
+
}).then((res) => {
|
|
372
|
+
if (res && res.data && res.data.id) {
|
|
373
|
+
success(`${vm.ctx.config.imageUrlBase}${res.data.id}`);
|
|
374
|
+
} else {
|
|
375
|
+
failure('上传失败', {
|
|
376
|
+
remove: true,
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
}).catch((err) => {
|
|
380
|
+
failure(err, {
|
|
381
|
+
remove: true,
|
|
382
|
+
});
|
|
383
|
+
});
|
|
384
|
+
},
|
|
348
385
|
};
|
|
349
386
|
},
|
|
350
387
|
});
|