fix(editor): 切换会话时清空引用数据而非保留
修改编辑器行为,在切换会话时主动清空引用数据而不是保留之前的引用。这避免了不同会话间引用数据的混淆问题。
This commit is contained in:
parent
14d69d40d3
commit
a405a3bd90
@ -739,8 +739,7 @@ function onEditorChange() {
|
|||||||
function loadEditorDraftText() {
|
function loadEditorDraftText() {
|
||||||
if (!editor.value) return
|
if (!editor.value) return
|
||||||
|
|
||||||
// 保存当前引用数据
|
// 切换会话时清空引用数据,不保存当前引用数据
|
||||||
const currentQuoteData = quoteData.value
|
|
||||||
quoteData.value = null
|
quoteData.value = null
|
||||||
|
|
||||||
// 从缓存中加载编辑器草稿
|
// 从缓存中加载编辑器草稿
|
||||||
@ -761,11 +760,6 @@ function loadEditorDraftText() {
|
|||||||
editor.value.commands.clearContent(true) // 没有草稿则清空编辑器
|
editor.value.commands.clearContent(true) // 没有草稿则清空编辑器
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果有当前引用数据,优先使用它
|
|
||||||
if (currentQuoteData) {
|
|
||||||
quoteData.value = currentQuoteData
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置光标位置到末尾
|
// 设置光标位置到末尾
|
||||||
editor.value.commands.focus('end')
|
editor.value.commands.focus('end')
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user