mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-21 17:10:12 +01:00
This commit is contained in:
parent
61573fa964
commit
93b5dd1ab8
8 changed files with 41 additions and 6 deletions
|
|
@ -187,7 +187,7 @@ export const goBack = async () => {
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
document.querySelector("#barForward").classList.remove("toolbar__item--disabled");
|
||||
if (!previousIsBack) {
|
||||
forwardStack.push(window.siyuan.backStack.pop());
|
||||
}
|
||||
|
|
@ -202,6 +202,9 @@ export const goBack = async () => {
|
|||
}
|
||||
}
|
||||
previousIsBack = true;
|
||||
if (window.siyuan.backStack.length === 0) {
|
||||
document.querySelector("#barBack").classList.add("toolbar__item--disabled");
|
||||
}
|
||||
};
|
||||
|
||||
export const goForward = async () => {
|
||||
|
|
@ -211,6 +214,7 @@ export const goForward = async () => {
|
|||
}
|
||||
return;
|
||||
}
|
||||
document.querySelector("#barBack").classList.remove("toolbar__item--disabled");
|
||||
if (previousIsBack) {
|
||||
window.siyuan.backStack.push(forwardStack.pop());
|
||||
}
|
||||
|
|
@ -226,6 +230,9 @@ export const goForward = async () => {
|
|||
}
|
||||
}
|
||||
previousIsBack = false;
|
||||
if (forwardStack.length === 0) {
|
||||
document.querySelector("#barForward").classList.add("toolbar__item--disabled");
|
||||
}
|
||||
};
|
||||
|
||||
export const pushBack = (protyle: IProtyle, range?: Range, blockElement?: Element) => {
|
||||
|
|
@ -257,6 +264,7 @@ export const pushBack = (protyle: IProtyle, range?: Range, blockElement?: Elemen
|
|||
window.siyuan.backStack.push(forwardStack.pop());
|
||||
}
|
||||
forwardStack = [];
|
||||
document.querySelector("#barForward").classList.add("toolbar__item--disabled");
|
||||
}
|
||||
window.siyuan.backStack.push({
|
||||
position,
|
||||
|
|
@ -269,5 +277,8 @@ export const pushBack = (protyle: IProtyle, range?: Range, blockElement?: Elemen
|
|||
}
|
||||
previousIsBack = false;
|
||||
}
|
||||
if (window.siyuan.backStack.length > 1) {
|
||||
document.querySelector("#barBack").classList.remove("toolbar__item--disabled");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue