富文本优化

This commit is contained in:
Jason 2022-09-29 10:16:59 +08:00
parent 235ab92413
commit b74724084e
1 changed files with 21 additions and 11 deletions

View File

@ -15,9 +15,10 @@
/> />
<material-picker <material-picker
ref="materialPickerRef" ref="materialPickerRef"
:type="fileType"
:limit="-1" :limit="-1"
hidden-upload hidden-upload
@change="imageSelectChange" @change="selectChange"
/> />
</div> </div>
</template> </template>
@ -42,9 +43,7 @@ const props = withDefaults(
mode: 'default', mode: 'default',
height: '100%', height: '100%',
width: 'auto', width: 'auto',
toolbarConfig: () => ({ toolbarConfig: () => ({})
excludeKeys: ['fullScreen']
})
} }
) )
@ -55,16 +54,24 @@ const emit = defineEmits<{
// shallowRef // shallowRef
const editorRef = shallowRef() const editorRef = shallowRef()
const materialPickerRef = shallowRef<InstanceType<typeof MaterialPicker>>() const materialPickerRef = shallowRef<InstanceType<typeof MaterialPicker>>()
const fileType = ref('')
let insertImageFn: any let insertFn: any
const editorConfig: Partial<IEditorConfig> = { const editorConfig: Partial<IEditorConfig> = {
MENU_CONF: { MENU_CONF: {
uploadImage: { uploadImage: {
customBrowseAndUpload(insertFn: any) { customBrowseAndUpload(insert: any) {
console.log(insertFn) fileType.value = 'image'
materialPickerRef.value?.showPopup(-1) 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[]) => { const selectChange = (fileUrl: string[]) => {
image.forEach((url) => { fileUrl.forEach((url) => {
insertImageFn(url) insertFn(url)
}) })
} }
@ -102,6 +109,9 @@ const handleCreated = (editor: any) => {
</script> </script>
<style lang="scss"> <style lang="scss">
.w-e-full-screen-container {
z-index: 999999;
}
.w-e-text-container [data-slate-editor] ul { .w-e-text-container [data-slate-editor] ul {
list-style: disc; list-style: disc;
} }