mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-20 02:50:58 +08:00
🎨 关闭闪卡后,光标恢复打开时候的位置
This commit is contained in:
parent
c68396a687
commit
b8acf4d0b6
@ -457,6 +457,10 @@ export const openCardByData = async (app: App, cardsData: ICardData, cardType: T
|
||||
if (exit) {
|
||||
return;
|
||||
}
|
||||
let lastRange: Range;
|
||||
if (getSelection().rangeCount > 0) {
|
||||
lastRange = getSelection().getRangeAt(0)
|
||||
}
|
||||
const dialog = new Dialog({
|
||||
positionId: Constants.DIALOG_OPENCARD,
|
||||
content: genCardHTML({id, cardType, cardsData, isTab: false}),
|
||||
@ -469,6 +473,9 @@ export const openCardByData = async (app: App, cardsData: ICardData, cardType: T
|
||||
window.siyuan.mobile.popEditor = null;
|
||||
}
|
||||
}
|
||||
if (lastRange) {
|
||||
focusByRange(lastRange)
|
||||
}
|
||||
}
|
||||
});
|
||||
(dialog.element.querySelector(".b3-dialog__scrim") as HTMLElement).style.backgroundColor = "var(--b3-theme-background)";
|
||||
|
Loading…
Reference in New Issue
Block a user