Commit ddfb409c authored by tyyin lan's avatar tyyin lan

chore(首页富文本): 写作模式热键开启调整

parent cf865453
......@@ -59,12 +59,23 @@ const uploadImageInfo = computed(() => {
: { url: '', id: '' }
})
const onQuillTextChange = debounce((delta: Delta) => {
const question = quillContentExtractor(delta)
const onQuillTextChange = debounce(
() => {
// const question = quillContentExtractor(delta)
const question = quillInst.value?.getText().trim()
if (question === '@') {
quillInst.value?.deleteText(0, question.length + 1)
showSceneList.value = true
quillInst.value?.blur()
}
questionContentDraft.value = question.trim()
questionContentDraft.value = question || ''
questionContent.value = questionContentDraft.value
}, 100)
},
300,
{ trailing: true, leading: true },
)
watch(
() => currentSceneConfig.value,
......@@ -118,14 +129,6 @@ watchEffect(() => {
quillInst.value.on('composition-end', () => {
if (quillInst.value) {
quillInst.value.root.dataset.placeholder = quillInst.value.options.placeholder
const text = quillInst.value.getText().trim()
if (text === '@') {
quillInst.value.deleteText(0, text.length + 1)
showSceneList.value = true
quillInst.value.blur()
}
}
})
......@@ -162,11 +165,15 @@ function initQuill() {
handleQuestionSubmit()
}
},
at: () => {
showSceneList.value = true
// at: () => {
// const text = quillInst.value?.getText().trim()
quillInst.value?.blur()
},
// if (text === '@') {
// showSceneList.value = true
// quillInst.value?.blur()
// }
// },
},
}),
)
......
......@@ -23,15 +23,15 @@ export function getQuillOptions(config: ConfigInterface): QuillOptions {
}
},
},
'@': {
key: '@',
shiftKey: true,
handler: function (range: any, context: any) {
if (config.keyboardCallback.at) {
config.keyboardCallback.at((this as any).quill as Quill, range, context)
}
},
},
// '@': {
// key: '@',
// shiftKey: true,
// handler: function (range: any, context: any) {
// if (config.keyboardCallback.at) {
// config.keyboardCallback.at((this as any).quill as Quill, range, context)
// }
// },
// },
// tab: {
// key: 'Tab',
// handler: function () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment