This commit is contained in:
Vanessa 2023-01-07 11:51:08 +08:00
parent 182886a996
commit 17067c4d49
7 changed files with 15 additions and 15 deletions

View file

@ -167,7 +167,7 @@ export const initAnno = (file: string, element: HTMLElement, annoId: string, pdf
break; break;
} else if (type === "copy") { } else if (type === "copy") {
const id = rectElement.getAttribute("data-node-id"); const id = rectElement.getAttribute("data-node-id");
const text = rectElement.getAttribute("data-content") const text = rectElement.getAttribute("data-content");
if (rectElement.childElementCount === 1) { if (rectElement.childElementCount === 1) {
/// #if !BROWSER /// #if !BROWSER
const rect = rectElement.firstElementChild.getBoundingClientRect(); const rect = rectElement.firstElementChild.getBoundingClientRect();
@ -178,7 +178,7 @@ export const initAnno = (file: string, element: HTMLElement, annoId: string, pdf
height: Math.floor(rect.height) + 2 height: Math.floor(rect.height) + 2
}).then((image: NativeImage) => { }).then((image: NativeImage) => {
fetch(image.toDataURL()).then((response) => { fetch(image.toDataURL()).then((response) => {
return response.blob() return response.blob();
}).then((blob) => { }).then((blob) => {
const formData = new FormData(); const formData = new FormData();
const imageName = text + ".png"; const imageName = text + ".png";

View file

@ -1,5 +1,5 @@
/// #if !BROWSER /// #if !BROWSER
import {ipcRenderer, shell} from "electron"; import {shell} from "electron";
import * as path from "path"; import * as path from "path";
/// #endif /// #endif
import {Constants} from "../constants"; import {Constants} from "../constants";

View file

@ -263,7 +263,7 @@ export const bootSync = () => {
export const setTitle = (title: string) => { export const setTitle = (title: string) => {
const dragElement = document.getElementById("drag"); const dragElement = document.getElementById("drag");
const workspaceName = originalPath().basename(window.siyuan.config.system.workspaceDir) const workspaceName = originalPath().basename(window.siyuan.config.system.workspaceDir);
if (title === window.siyuan.languages.siyuanNote) { if (title === window.siyuan.languages.siyuanNote) {
const versionTitle = `${title} - ${workspaceName} - v${Constants.SIYUAN_VERSION}`; const versionTitle = `${title} - ${workspaceName} - v${Constants.SIYUAN_VERSION}`;
document.title = versionTitle; document.title = versionTitle;

View file

@ -109,7 +109,7 @@ const genWorkspace = (workspaceDirElement: Element) => {
}); });
workspaceDirElement.innerHTML = html; workspaceDirElement.innerHTML = html;
}); });
} };
export const popMenu = () => { export const popMenu = () => {
const modelElement = document.getElementById("model"); const modelElement = document.getElementById("model");
const modelMainElement = document.getElementById("modelMain"); const modelMainElement = document.getElementById("modelMain");
@ -493,14 +493,14 @@ ${accountHTML}
}, () => { }, () => {
exitSiYuan(); exitSiYuan();
}); });
}) });
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
break; break;
} }
target = target.parentElement; target = target.parentElement;
} }
}) });
modelMainElement.querySelector("#importData").addEventListener("change", (event: InputEvent & { target: HTMLInputElement }) => { modelMainElement.querySelector("#importData").addEventListener("change", (event: InputEvent & { target: HTMLInputElement }) => {
const formData = new FormData(); const formData = new FormData();
formData.append("file", event.target.files[0]); formData.append("file", event.target.files[0]);

View file

@ -126,7 +126,7 @@ export const initAssets = () => {
} }
updateMobileTheme(window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"); updateMobileTheme(window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", event => { window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", event => {
const OSTheme = event.matches ? "dark" : "light" const OSTheme = event.matches ? "dark" : "light";
updateMobileTheme(OSTheme); updateMobileTheme(OSTheme);
if (!window.siyuan.config.appearance.modeOS) { if (!window.siyuan.config.appearance.modeOS) {
return; return;

View file

@ -493,31 +493,31 @@ export const globalShortcut = () => {
if (matchHotKey("⌘=", event)) { if (matchHotKey("⌘=", event)) {
Constants.SIZE_ZOOM.find((item, index) => { Constants.SIZE_ZOOM.find((item, index) => {
if (item === window.siyuan.storage[Constants.LOCAL_ZOOM]) { if (item === window.siyuan.storage[Constants.LOCAL_ZOOM]) {
window.siyuan.storage[Constants.LOCAL_ZOOM] = Constants.SIZE_ZOOM[index + 1] || 3 window.siyuan.storage[Constants.LOCAL_ZOOM] = Constants.SIZE_ZOOM[index + 1] || 3;
webFrame.setZoomFactor(window.siyuan.storage[Constants.LOCAL_ZOOM]); webFrame.setZoomFactor(window.siyuan.storage[Constants.LOCAL_ZOOM]);
setStorageVal(Constants.LOCAL_ZOOM, window.siyuan.storage[Constants.LOCAL_ZOOM]); setStorageVal(Constants.LOCAL_ZOOM, window.siyuan.storage[Constants.LOCAL_ZOOM]);
return true; return true;
} }
}) });
event.preventDefault(); event.preventDefault();
return; return;
} }
if (matchHotKey("⌘0", event)) { if (matchHotKey("⌘0", event)) {
webFrame.setZoomFactor(1); webFrame.setZoomFactor(1);
window.siyuan.storage[Constants.LOCAL_ZOOM] = 1 window.siyuan.storage[Constants.LOCAL_ZOOM] = 1;
setStorageVal(Constants.LOCAL_ZOOM, 1) setStorageVal(Constants.LOCAL_ZOOM, 1);
event.preventDefault(); event.preventDefault();
return; return;
} }
if (matchHotKey("⌘-", event)) { if (matchHotKey("⌘-", event)) {
Constants.SIZE_ZOOM.find((item, index) => { Constants.SIZE_ZOOM.find((item, index) => {
if (item === window.siyuan.storage[Constants.LOCAL_ZOOM]) { if (item === window.siyuan.storage[Constants.LOCAL_ZOOM]) {
window.siyuan.storage[Constants.LOCAL_ZOOM] = Constants.SIZE_ZOOM[index - 1] || 0.25 window.siyuan.storage[Constants.LOCAL_ZOOM] = Constants.SIZE_ZOOM[index - 1] || 0.25;
webFrame.setZoomFactor(window.siyuan.storage[Constants.LOCAL_ZOOM]); webFrame.setZoomFactor(window.siyuan.storage[Constants.LOCAL_ZOOM]);
setStorageVal(Constants.LOCAL_ZOOM, window.siyuan.storage[Constants.LOCAL_ZOOM]); setStorageVal(Constants.LOCAL_ZOOM, window.siyuan.storage[Constants.LOCAL_ZOOM]);
return true; return true;
} }
}) });
event.preventDefault(); event.preventDefault();
return; return;
} }

View file

@ -371,7 +371,7 @@ const initWindow = () => {
document.body.classList.add("body--blur"); document.body.classList.add("body--blur");
}); });
ipcRenderer.on(Constants.SIYUAN_OPENURL, (event, url) => { ipcRenderer.on(Constants.SIYUAN_OPENURL, (event, url) => {
console.log(event, url) console.log(event, url);
if (!/^siyuan:\/\/blocks\/\d{14}-\w{7}/.test(url)) { if (!/^siyuan:\/\/blocks\/\d{14}-\w{7}/.test(url)) {
return; return;
} }