This commit is contained in:
min.jiang 2024-06-28 03:29:43 +08:00
parent af64b01d84
commit 5f64f26b42
2 changed files with 6 additions and 7 deletions

View File

@ -7,7 +7,8 @@
ref="editor" ref="editor"
v-html="content" v-html="content"
@blur="updateAction" @blur="updateAction"
@mouseup.stop="selectionChange" @mousedown.stop="selectionStart"
@mouseup.stop="selectionEnd"
/> />
<div v-if="!disabled" class="editor-control" :style="editorCtrlStyle"> <div v-if="!disabled" class="editor-control" :style="editorCtrlStyle">
<div v-for="(item, index) in iconList" :key="index" class="editor-item"> <div v-for="(item, index) in iconList" :key="index" class="editor-item">
@ -186,7 +187,10 @@ export default {
} }
}, },
methods: { methods: {
selectionChange(e) { selectionStart() {
this.$refs.editor.blur()
},
selectionEnd(e) {
const sel = window.getSelection() const sel = window.getSelection()
if (sel && sel.type === 'Range') { if (sel && sel.type === 'Range') {
// this.selectedRange = sel.getRangeAt(0) // this.selectedRange = sel.getRangeAt(0)
@ -307,11 +311,7 @@ export default {
updateAction($event) { updateAction($event) {
let html = $event.target.innerHTML || '' let html = $event.target.innerHTML || ''
//TODO: need to revise afte confirming the timeout approach is working
this.$emit('update:content', html) this.$emit('update:content', html)
// setTimeout(() => {
// this.$emit('update:content', html)
// })
} }
} }
} }

View File

@ -36,7 +36,6 @@ import {
import { signinActionEnum } from '@/types/index' import { signinActionEnum } from '@/types/index'
export default { export default {
components: {},
name: 'FrontDoor', name: 'FrontDoor',
props: {}, props: {},
data() { data() {