free-fe-core-modules 0.0.33 → 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 +37 -2
- package/package.json +1 -1
|
@@ -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);
|
|
@@ -347,6 +354,34 @@ export default defineComponent({
|
|
|
347
354
|
toolbar,
|
|
348
355
|
quickbars_selection_toolbar,
|
|
349
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
|
+
},
|
|
350
385
|
};
|
|
351
386
|
},
|
|
352
387
|
});
|