This commit is contained in:
Vanessa 2023-01-16 00:00:53 +08:00
parent 968bcd433e
commit 62cf6411a0
7 changed files with 14 additions and 15 deletions

View file

@ -99,9 +99,9 @@ const hidePopover = (event: MouseEvent & { target: HTMLElement, path: HTMLElemen
if (!popoverTargetElement) {
// 移动到弹窗的 loading 元素上,但经过 settimeout 后 loading 已经被移除了
// https://ld246.com/article/1673596577519/comment/1673767749885#comments
let targetElement = event.target
let targetElement = event.target;
if (!targetElement.parentElement) {
targetElement = event.path[1]
targetElement = event.path[1];
}
const blockElement = hasClosestByClassName(targetElement, "block__popover", true);
const maxEditLevels: { [key: string]: number } = {oid: 0};

View file

@ -282,10 +282,10 @@ export const setTitle = (title: string, protyle?: IProtyle) => {
} else {
title = title || "Untitled";
if (protyle && protyle.disabled) {
title = `[${window.siyuan.languages.editReadonly}] ${title}`
title = `[${window.siyuan.languages.editReadonly}] ${title}`;
}
if (protyle && protyle.block.showAll) {
title = `[${window.siyuan.languages.enter}] ${title}`
title = `[${window.siyuan.languages.enter}] ${title}`;
}
document.title = `${title} - ${workspaceName} - ${window.siyuan.languages.siyuanNote} v${Constants.SIYUAN_VERSION}`;
dragElement.textContent = title;
@ -298,10 +298,10 @@ export const updateTitle = (readonly?: boolean, zoomIn?: boolean) => {
if (typeof readonly === "boolean") {
if (readonly) {
if (title.indexOf(window.siyuan.languages.editReadonly) === -1) {
setTitle(`[${window.siyuan.languages.editReadonly}] ${title}`)
setTitle(`[${window.siyuan.languages.editReadonly}] ${title}`);
}
} else {
setTitle(title.replace(`[${window.siyuan.languages.editReadonly}] `, ""))
setTitle(title.replace(`[${window.siyuan.languages.editReadonly}] `, ""));
}
}
if (typeof zoomIn === "boolean") {
@ -310,10 +310,10 @@ export const updateTitle = (readonly?: boolean, zoomIn?: boolean) => {
setTitle(`[${window.siyuan.languages.enter}] ${title}`);
}
} else {
setTitle(title.replace(`[${window.siyuan.languages.enter}] `, ""))
setTitle(title.replace(`[${window.siyuan.languages.enter}] `, ""));
}
}
}
};
export const downloadProgress = (data: { id: string, percent: number }) => {
const bazzarElement = document.getElementById("configBazaarReadme");

View file

@ -111,4 +111,4 @@ export const renameTag = (labelName: string) => {
btnsElement[1].addEventListener("click", () => {
fetchPost("/api/tag/renameTag", {oldLabel: labelName, newLabel: inputElement.value});
});
}
};

View file

@ -10,7 +10,6 @@ import {getCurrentWindow} from "@electron/remote";
/// #endif
/// #endif
import {isBrowser} from "../util/functions";
import {lockScreen} from "../dialog/processSystem";
export const initStatus = () => {
/// #if !MOBILE

View file

@ -457,8 +457,8 @@ export const resizeTabs = () => {
}
// 保持光标位置不变 https://ld246.com/article/1673704873983/comment/1673765814595#comments
if (!item.element.classList.contains("fn__none") && item.editor.protyle.toolbar.range) {
const protyleRect = item.editor.protyle.element.getBoundingClientRect()
const rangeRect = item.editor.protyle.toolbar.range.getBoundingClientRect()
const protyleRect = item.editor.protyle.element.getBoundingClientRect();
const rangeRect = item.editor.protyle.toolbar.range.getBoundingClientRect();
if (protyleRect.top + 30 > rangeRect.top || protyleRect.bottom < rangeRect.bottom) {
item.editor.protyle.toolbar.range.startContainer.parentElement.scrollIntoView(protyleRect.top > rangeRect.top);
}

View file

@ -968,7 +968,7 @@ export const tagMenu = (protyle: IProtyle, tagElement: HTMLElement) => {
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.rename,
click() {
renameTag(tagElement.textContent.replace(Constants.ZWSP, ""))
renameTag(tagElement.textContent.replace(Constants.ZWSP, ""));
}
}).element);
window.siyuan.menus.menu.append(new MenuItem({

View file

@ -35,7 +35,7 @@ export const workspaceMenu = (rect: DOMRect) => {
}
}).element);
}
const dockMenu: IMenu[] = []
const dockMenu: IMenu[] = [];
getAllDocks().forEach(item => {
dockMenu.push({
icon: item.icon,
@ -66,7 +66,7 @@ export const workspaceMenu = (rect: DOMRect) => {
}
openWorkspace(localPath.filePaths[0]);
}
}]
}];
workspaceSubMenu.push({type: "separator"});
response.data.forEach((item: IWorkspace) => {
workspaceSubMenu.push(workspaceItem(item) as IMenu);