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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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