diff --git a/admin/src/components/editor/index.vue b/admin/src/components/editor/index.vue index 831bbcd3..badcd467 100644 --- a/admin/src/components/editor/index.vue +++ b/admin/src/components/editor/index.vue @@ -15,9 +15,10 @@ /> @@ -42,9 +43,7 @@ const props = withDefaults( mode: 'default', height: '100%', width: 'auto', - toolbarConfig: () => ({ - excludeKeys: ['fullScreen'] - }) + toolbarConfig: () => ({}) } ) @@ -55,16 +54,24 @@ const emit = defineEmits<{ // 编辑器实例,必须用 shallowRef const editorRef = shallowRef() const materialPickerRef = shallowRef>() +const fileType = ref('') -let insertImageFn: any +let insertFn: any const editorConfig: Partial = { MENU_CONF: { uploadImage: { - customBrowseAndUpload(insertFn: any) { - console.log(insertFn) + customBrowseAndUpload(insert: any) { + fileType.value = 'image' materialPickerRef.value?.showPopup(-1) - insertImageFn = insertFn + insertFn = insert + } + }, + uploadVideo: { + customBrowseAndUpload(insert: any) { + fileType.value = 'video' + materialPickerRef.value?.showPopup(-1) + insertFn = insert } } } @@ -83,9 +90,9 @@ const valueHtml = computed({ } }) -const imageSelectChange = (image: string[]) => { - image.forEach((url) => { - insertImageFn(url) +const selectChange = (fileUrl: string[]) => { + fileUrl.forEach((url) => { + insertFn(url) }) } @@ -102,6 +109,9 @@ const handleCreated = (editor: any) => {