mirror of
https://github.com/pipipi-pikachu/PPTist.git
synced 2025-04-15 02:20:00 +08:00
perf: 默认的文本占位文字在首次获取光标后移除
This commit is contained in:
parent
9e4945d3ea
commit
e58095cfe7
@ -149,12 +149,6 @@ export default defineComponent({
|
||||
// 聚焦时取消全局快捷键事件
|
||||
// 输入文字时同步数据到vuex
|
||||
// 点击鼠标和键盘时同步富文本状态到工具栏
|
||||
const handleFocus = () => {
|
||||
store.commit(MutationTypes.SET_DISABLE_HOTKEYS_STATE, true)
|
||||
}
|
||||
const handleBlur = () => {
|
||||
store.commit(MutationTypes.SET_DISABLE_HOTKEYS_STATE, false)
|
||||
}
|
||||
const handleInput = debounce(function() {
|
||||
store.commit(MutationTypes.UPDATE_ELEMENT, {
|
||||
id: props.elementInfo.id,
|
||||
@ -163,6 +157,18 @@ export default defineComponent({
|
||||
addHistorySnapshot()
|
||||
}, 300, { trailing: true })
|
||||
|
||||
const handleFocus = () => {
|
||||
if (props.elementInfo.content === '请输入内容') {
|
||||
editorView.dom.innerHTML = ''
|
||||
handleInput()
|
||||
}
|
||||
store.commit(MutationTypes.SET_DISABLE_HOTKEYS_STATE, true)
|
||||
}
|
||||
|
||||
const handleBlur = () => {
|
||||
store.commit(MutationTypes.SET_DISABLE_HOTKEYS_STATE, false)
|
||||
}
|
||||
|
||||
const handleClick = debounce(function() {
|
||||
const attr = getTextAttrs(editorView)
|
||||
emitter.emit(EmitterEvents.UPDATE_TEXT_STATE, attr)
|
||||
|
Loading…
x
Reference in New Issue
Block a user