Vanessa 2022-10-19 11:13:28 +08:00
parent 61573fa964
commit 93b5dd1ab8
8 changed files with 41 additions and 6 deletions

View file

@ -1,4 +1,6 @@
{
"goForward": "Go forward",
"goBack": "Go back",
"docNameAndContent": "Doc Name and Content",
"breadcrumb": "Breadcrumb",
"embedBlockBreadcrumb": "Embed Block Breadcrumb",

View file

@ -1,4 +1,6 @@
{
"goForward": "Ir hacia adelante",
"goBack": "Ir hacia atrás",
"docNameAndContent": "Nombre y contenido del documento",
"miga de pan": "Miga de pan",
"embedBlockBreadcrumb": "Incrustar migas de pan de bloque",

View file

@ -1,4 +1,6 @@
{
"goForward": "Suivant",
"goBack": "Retour",
"docNameAndContent": "Nom et contenu du document",
"fil d'Ariane": "Fil d'Ariane",
"embedBlockBreadcrumb": "Intégrer le fil d'Ariane du bloc",

View file

@ -1,4 +1,6 @@
{
"goForward": "前進",
"goBack": "後退",
"docNameAndContent": "文檔名和內容",
"breadcrumb": "麵包屑",
"embedBlockBreadcrumb": "嵌入塊麵包屑",

View file

@ -1,4 +1,6 @@
{
"goForward": "前进",
"goBack": "后退",
"docNameAndContent": "文档名和内容",
"breadcrumb": "面包屑",
"embedBlockBreadcrumb": "嵌入块面包屑",

View file

@ -201,7 +201,7 @@ progressLoading: 400
background-color: transparent;
border: 0;
&:hover,
&:not(.toolbar__item--disabled):hover,
&--active {
color: var(--b3-theme-on-background);
background-color: var(--b3-theme-background-light);
@ -212,9 +212,8 @@ progressLoading: 400
width: 14px;
}
&--disabled,
&--disabled:hover {
color: var(--b3-theme-surface-lighter);
&--disabled {
opacity: .54;
cursor: not-allowed;
}

View file

@ -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");
}
}
};

View file

@ -27,6 +27,7 @@ import {syncGuide} from "../sync/syncGuide";
import {showMessage} from "../dialog/message";
import {replaceLocalPath} from "../editor/rename";
import {editor} from "../config/editor";
import {goBack, goForward} from "./backForward";
const matchKeymap = (keymap: Record<string, IKeymapItem>, key1: "general" | "editor", key2?: "general" | "insert" | "heading" | "list" | "table") => {
if (key1 === "general") {
@ -170,6 +171,12 @@ const initBar = () => {
<div id="barDailyNote" data-menu="true" aria-label="${window.siyuan.languages.dailyNote} ${updateHotkeyTip(window.siyuan.config.keymap.general.dailyNote.custom)}" class="toolbar__item b3-tooltips b3-tooltips__se${window.siyuan.config.readonly ? " fn__none" : ""}">
<svg><use xlink:href="#iconCalendar"></use></svg>
</div>
<button id="barBack" data-menu="true" class="toolbar__item toolbar__item--disabled b3-tooltips b3-tooltips__se" aria-label="${window.siyuan.languages.goBack} ${updateHotkeyTip(window.siyuan.config.keymap.general.goBack.custom)}">
<svg><use xlink:href="#iconLeft"></use></svg>
</button>
<button id="barForward" data-menu="true" class="toolbar__item toolbar__item--disabled b3-tooltips b3-tooltips__se" aria-label="${window.siyuan.languages.goForward} ${updateHotkeyTip(window.siyuan.config.keymap.general.goForward.custom)}">
<svg><use xlink:href="#iconRight"></use></svg>
</button>
<div class="fn__flex-1 fn__ellipsis" id="drag"><span class="fn__none">使 Development version, please backup before use</span></div>
<div id="barSearch" class="toolbar__item b3-tooltips b3-tooltips__sw" aria-label="${window.siyuan.languages.globalSearch} ${updateHotkeyTip(window.siyuan.config.keymap.general.globalSearch.custom)}">
<svg><use xlink:href="#iconSearch"></use></svg>
@ -187,7 +194,15 @@ const initBar = () => {
document.querySelector(".toolbar").addEventListener("click", (event: MouseEvent) => {
let target = event.target as HTMLElement;
while (!target.classList.contains("toolbar")) {
if (target.id === "barSync") {
if (target.id === "barBack") {
goBack();
event.stopPropagation();
break;
} else if (target.id === "barForward") {
goForward();
event.stopPropagation();
break;
}else if (target.id === "barSync") {
syncGuide(target);
event.stopPropagation();
break;