This commit is contained in:
Vanessa 2023-11-20 12:28:20 +08:00
parent dc5551aea8
commit b8eec1bd34
10 changed files with 16 additions and 18 deletions

View file

@ -602,13 +602,13 @@ app.commandLine.appendSwitch("force_high_performance_gpu"); // Force using discr
writeLog("app is packaged [" + app.isPackaged + "], command line args [" + process.argv.join(", ") + "]");
let argStart = 1;
if (!app.isPackaged) {
argStart = 2
argStart = 2;
}
for (let i = argStart; i < process.argv.length; i++) {
let arg = process.argv[i];
if (arg.startsWith("--workspace=") || arg.startsWith("--port=") || arg.startsWith("siyuan://")) {
// 跳过内置参数
continue
continue;
}
app.commandLine.appendSwitch(arg);

View file

@ -78,7 +78,7 @@ export const initWindowEvent = (app: App) => {
return;
}
// 触摸屏背景和嵌入块按钮显示
const backgroundElement = hasClosestByClassName(target, "protyle-background")
const backgroundElement = hasClosestByClassName(target, "protyle-background");
if (backgroundElement) {
if (!globalTouchStart(event)) {
backgroundElement.classList.toggle("protyle-background--mobileshow");

View file

@ -15,7 +15,7 @@ import {hideTooltip} from "../../dialog/tooltip";
export const globalTouchStart = (event: TouchEvent) => {
// 文档背景位置调整
const target = event.target as HTMLElement;
const backgroundElement = hasClosestByClassName(target, "protyle-background")
const backgroundElement = hasClosestByClassName(target, "protyle-background");
if (backgroundElement && target.tagName === "IMG" && backgroundElement.firstElementChild.querySelector(".protyle-icons").classList.contains("fn__none")) {
const contentElement = hasClosestByClassName(target, "protyle-content", true);
if (!contentElement) {
@ -45,7 +45,7 @@ export const globalTouchStart = (event: TouchEvent) => {
return true;
}
return false;
}
};
export const globalTouchEnd = (event: TouchEvent, yDiff: number, time: number, app: App) => {
const target = event.target as HTMLElement;

View file

@ -657,7 +657,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {
}).element);
} else {
// https://github.com/siyuan-note/siyuan/issues/9630
const inlineElement = hasClosestByMatchTag(range.startContainer, "SPAN")
const inlineElement = hasClosestByMatchTag(range.startContainer, "SPAN");
if (inlineElement) {
const inlineTypes = protyle.toolbar.getCurrentType(range);
if (inlineTypes.includes("code") || inlineTypes.includes("kbd")) {

View file

@ -238,4 +238,4 @@ const unsplitWnd = (target: Wnd | Layout, layout: Layout, onlyWnd: boolean) => {
i--;
}
}
}
};

View file

@ -1,5 +1,5 @@
import {hasClosestByClassName} from "../util/hasClosest";
import {getRandom, isMobile, isTouchDevice} from "../../util/functions";
import {getRandom, isMobile} from "../../util/functions";
import {hideElements} from "../ui/hideElements";
import {uploadFiles} from "../upload";
import {fetchPost} from "../../util/fetch";

View file

@ -1,7 +1,6 @@
import {transaction} from "../../wysiwyg/transaction";
import {hasClosestBlock, hasClosestByClassName} from "../../util/hasClosest";
import {openMenuPanel} from "./openMenuPanel";
import {Menu} from "../../../plugin/Menu";
import {updateAttrViewCellAnimation} from "./action";
import {isNotCtrl} from "../../util/compatibility";
import {objEquals} from "../../../util/functions";
@ -300,13 +299,13 @@ const updateCellValue = (protyle: IProtyle, type: TAVCol, cellElements: HTMLElem
inputValue.content = parseFloat(inputValue.content as string);
inputValue.isNotEmpty = typeof inputValue.content === "number" && !isNaN(inputValue.content);
} else if (type === "checkbox") {
const useElement = item.querySelector("use")
inputValue.checked = useElement.getAttribute("xlink:href") === "#iconUncheck"
oldValue.checked = !inputValue.checked
useElement.setAttribute("xlink:href", inputValue.checked ? "#iconCheck" : "#iconUncheck")
const useElement = item.querySelector("use");
inputValue.checked = useElement.getAttribute("xlink:href") === "#iconUncheck";
oldValue.checked = !inputValue.checked;
useElement.setAttribute("xlink:href", inputValue.checked ? "#iconCheck" : "#iconUncheck");
} else {
inputValue.content = (avMaskElement.querySelector(".b3-text-field") as HTMLInputElement).value
oldValue.content = type === "block" ? item.firstElementChild.textContent.trim() : item.textContent.trim()
inputValue.content = (avMaskElement.querySelector(".b3-text-field") as HTMLInputElement).value;
oldValue.content = type === "block" ? item.firstElementChild.textContent.trim() : item.textContent.trim();
}
if (objEquals(inputValue, oldValue)) {
return;

View file

@ -2,7 +2,6 @@ import {setEditMode} from "../util/setEditMode";
import {scrollEvent} from "../scroll/event";
import {isMobile} from "../../util/functions";
import {Constants} from "../../constants";
import {hasClosestByAttribute, hasClosestByClassName} from "../util/hasClosest";
import {isMac} from "../util/compatibility";
import {setInlineStyle} from "../../util/assets";
import {fetchPost} from "../../util/fetch";

View file

@ -353,7 +353,7 @@ export const enter = (blockElement: HTMLElement, range: Range, protyle: IProtyle
removeEmptyNode(newElement);
return true;
}
const wbrElement = document.createElement("wbr")
const wbrElement = document.createElement("wbr");
range.insertNode(wbrElement);
const html = blockElement.outerHTML;
wbrElement.remove();

View file

@ -861,7 +861,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
return;
}
// https://github.com/siyuan-note/siyuan/issues/9690
const inlineElement = hasClosestByMatchTag(range.startContainer, "SPAN")
const inlineElement = hasClosestByMatchTag(range.startContainer, "SPAN");
if (position.start === 2 && inlineElement &&
getSelectionOffset(inlineElement, protyle.wysiwyg.element, range).start === 1 &&
inlineElement.textContent.startsWith(Constants.ZWSP)) {