This commit is contained in:
Vanessa 2023-01-16 22:54:07 +08:00
parent ca6e82a549
commit 235f8f8a6a
9 changed files with 13 additions and 20 deletions

View file

@ -16,11 +16,11 @@ export const editor = {
}
window.siyuan.config.editor.readOnly = readOnly;
if (readOnly) {
target.classList.add("toolbar__item--active")
target.classList.add("toolbar__item--active");
target.setAttribute("aria-label", `${window.siyuan.languages.use} ${window.siyuan.languages.editMode} ${updateHotkeyTip(window.siyuan.config.keymap.general.editMode.custom)}`);
target.querySelector("use").setAttribute("xlink:href", "#iconPreview");
} else {
target.classList.remove("toolbar__item--active")
target.classList.remove("toolbar__item--active");
target.setAttribute("aria-label", `${window.siyuan.languages.use} ${window.siyuan.languages.editReadonly} ${updateHotkeyTip(window.siyuan.config.keymap.general.editMode.custom)}`);
target.querySelector("use").setAttribute("xlink:href", "#iconEdit");
}

View file

@ -272,7 +272,7 @@ export const bootSync = () => {
});
};
export const setTitle = (title: string, protyle?: IProtyle) => {
export const setTitle = (title: string) => {
const dragElement = document.getElementById("drag");
const workspaceName = getWorkspaceName();
if (title === window.siyuan.languages.siyuanNote) {

View file

@ -4,8 +4,6 @@ import {Graph} from "./Graph";
import {Outline} from "./Outline";
import {switchWnd} from "../util";
import {Backlink} from "./Backlink";
import {Dialog} from "../../dialog";
import {fetchPost} from "../../util/fetch";
export const openBacklink = (protyle: IProtyle) => {
const backlink = getAllModels().backlink.find(item => {

View file

@ -9,7 +9,6 @@ import {mountHelp} from "../util/mount";
import {getCurrentWindow} from "@electron/remote";
/// #endif
/// #endif
import {isBrowser} from "../util/functions";
import {MenuItem} from "../menus/Menu";
export const initStatus = () => {
@ -117,7 +116,7 @@ export const initStatus = () => {
window.open("https://github.com/siyuan-note/siyuan");
}
}).element);
const rect = target.getBoundingClientRect()
const rect = target.getBoundingClientRect();
window.siyuan.menus.menu.popup({x: rect.right, y: rect.bottom, h: rect.height}, true);
event.stopPropagation();
break;

View file

@ -299,7 +299,7 @@ export const JSONToLayout = (isStart: boolean) => {
});
}
// https://github.com/siyuan-note/siyuan/pull/7086
const openId = getSearch("id", window.location.href)
const openId = getSearch("id", window.location.href);
if (openId) {
openFileById({
id: getSearch("id", window.location.href),

View file

@ -466,13 +466,13 @@ export const zoomOut = (protyle: IProtyle, id: string, focusId?: string, isPushB
pushBack();
}
} else {
const exitFocusElement = protyle.breadcrumb.element.parentElement.querySelector('[data-type="exit-focus"]')
const exitFocusElement = protyle.breadcrumb.element.parentElement.querySelector('[data-type="exit-focus"]');
if (id === protyle.block.rootID) {
exitFocusElement.classList.add("fn__none")
exitFocusElement.nextElementSibling.classList.add("fn__none")
exitFocusElement.classList.add("fn__none");
exitFocusElement.nextElementSibling.classList.add("fn__none");
} else {
exitFocusElement.classList.remove("fn__none")
exitFocusElement.nextElementSibling.classList.remove("fn__none")
exitFocusElement.classList.remove("fn__none");
exitFocusElement.nextElementSibling.classList.remove("fn__none");
}
}
fetchPost("/api/filetree/getDoc", {

View file

@ -19,7 +19,6 @@ import {MobileBookmarks} from "./MobileBookmarks";
import {MobileTags} from "./MobileTags";
import {hideKeyboardToolbar, initKeyboardToolbar} from "./showKeyboardToolbar";
import {getSearch} from "../../util/functions";
import {openFileById} from "../../editor/util";
export const initFramework = () => {
setInlineStyle();

View file

@ -35,7 +35,7 @@ export class Breadcrumb {
constructor(protyle: IProtyle) {
const element = document.createElement("div");
element.className = "protyle-breadcrumb";
const isFocus = protyle.options.action.includes(Constants.CB_GET_ALL)
const isFocus = protyle.options.action.includes(Constants.CB_GET_ALL);
let html = `<div class="protyle-breadcrumb__bar"></div>
<span class="protyle-breadcrumb__space"></span>
<button class="block__icon block__icon--show ft__smaller fn__flex-center${isFocus ? "" : " fn__none"}" style="line-height: 14px" data-type="exit-focus">${window.siyuan.languages.exitFocus}</button>
@ -71,7 +71,7 @@ export class Breadcrumb {
} else if (target.getAttribute("data-type") === "exit-focus") {
zoomOut(protyle, protyle.block.rootID);
event.preventDefault();
break
break;
} else if (target.getAttribute("data-type") === "context") {
if (target.classList.contains("block__icon--active")) {
fetchPost("/api/filetree/getDoc", {

View file

@ -1,5 +1,5 @@
import {openSearch} from "../search/spread";
import {exportLayout, getInstanceById, JSONToLayout, resetLayout, resizeDrag, resizeTabs} from "../layout/util";
import {exportLayout, JSONToLayout, resetLayout, resizeDrag, resizeTabs} from "../layout/util";
import {hotKey2Electron, setStorageVal, updateHotkeyTip} from "../protyle/util/compatibility";
/// #if !BROWSER
import {dialog, getCurrentWindow} from "@electron/remote";
@ -28,9 +28,6 @@ import {editor} from "../config/editor";
import {goBack, goForward} from "./backForward";
import {replaceLocalPath} from "../editor/rename";
import {workspaceMenu} from "../menus/workspace";
import {Tab} from "../layout/Tab";
import {Editor} from "../editor";
import {zoomOut} from "../menus/protyle";
import { getWorkspaceName } from "./noRelyPCFunction";
const matchKeymap = (keymap: Record<string, IKeymapItem>, key1: "general" | "editor", key2?: "general" | "insert" | "heading" | "list" | "table") => {