This commit is contained in:
Vanessa 2023-10-24 10:42:04 +08:00
parent ae35acbb35
commit 621babd29d
9 changed files with 11 additions and 12 deletions

View file

@ -178,12 +178,12 @@ const saveUI = () => {
onlyData: false, onlyData: false,
errorExit: false errorExit: false
}); });
} };
export const unbindSaveUI = () => { export const unbindSaveUI = () => {
window.removeEventListener("beforeunload", saveUI); window.removeEventListener("beforeunload", saveUI);
window.removeEventListener("pagehide", saveUI); window.removeEventListener("pagehide", saveUI);
} };
export const initWindow = async (app: App) => { export const initWindow = async (app: App) => {
/// #if !BROWSER /// #if !BROWSER

View file

@ -209,7 +209,7 @@ export const bindCardEvent = (options: {
fullscreen(options.element.querySelector(".card__main"), fullscreen(options.element.querySelector(".card__main"),
options.element.querySelector('[data-type="fullscreen"]')); options.element.querySelector('[data-type="fullscreen"]'));
resize(editor.protyle); resize(editor.protyle);
window.siyuan.storage[Constants.LOCAL_FLASHCARD].fullscreen = !window.siyuan.storage[Constants.LOCAL_FLASHCARD].fullscreen window.siyuan.storage[Constants.LOCAL_FLASHCARD].fullscreen = !window.siyuan.storage[Constants.LOCAL_FLASHCARD].fullscreen;
setStorageVal(Constants.LOCAL_FLASHCARD, window.siyuan.storage[Constants.LOCAL_FLASHCARD]); setStorageVal(Constants.LOCAL_FLASHCARD, window.siyuan.storage[Constants.LOCAL_FLASHCARD]);
event.stopPropagation(); event.stopPropagation();
event.preventDefault(); event.preventDefault();

View file

@ -932,7 +932,7 @@ export const bazaar = {
event.preventDefault(); event.preventDefault();
return; return;
} }
}) });
}); });
bazaar.element.querySelectorAll(".b3-select").forEach((selectElement: HTMLSelectElement) => { bazaar.element.querySelectorAll(".b3-select").forEach((selectElement: HTMLSelectElement) => {

View file

@ -380,7 +380,7 @@ export const keymap = {
if (keys[1] === "heading") { if (keys[1] === "heading") {
keys[1] = "headings"; keys[1] = "headings";
} }
let hasConflict = false let hasConflict = false;
if (["⌘", "⇧", "⌥", "⌃"].includes(keymapStr.substr(keymapStr.length - 1, 1)) || if (["⌘", "⇧", "⌥", "⌃"].includes(keymapStr.substr(keymapStr.length - 1, 1)) ||
["⌘A", "⌘X", "⌘C", "⌘V", "⌘-", "⌘=", "⌘0", "⇧⌘V", "⌘/", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⇧⌘⇥", "⌃⇥", "⌘⇥", "⌃⌘⇥", "⇧⌘→", "⇧⌘←", "⌘Home", "⌘End", "⇧↩", "↩", "PageUp", "PageDown", "⌫", "⌦"].includes(keymapStr)) { ["⌘A", "⌘X", "⌘C", "⌘V", "⌘-", "⌘=", "⌘0", "⇧⌘V", "⌘/", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⇧⌘⇥", "⌃⇥", "⌘⇥", "⌃⌘⇥", "⇧⌘→", "⇧⌘←", "⌘Home", "⌘End", "⇧↩", "↩", "PageUp", "PageDown", "⌫", "⌦"].includes(keymapStr)) {
showMessage(`${window.siyuan.languages.invalid} [${adoptKeymapStr}]`); showMessage(`${window.siyuan.languages.invalid} [${adoptKeymapStr}]`);

View file

@ -29,7 +29,7 @@ export const loadPlugins = async (app: App) => {
loadPluginJS(app, item); loadPluginJS(app, item);
css += item.css || "" + "\n"; css += item.css || "" + "\n";
}); });
const pluginsStyle = document.getElementById("pluginsStyle") const pluginsStyle = document.getElementById("pluginsStyle");
if (pluginsStyle) { if (pluginsStyle) {
pluginsStyle.innerHTML = css; pluginsStyle.innerHTML = css;
} else { } else {

View file

@ -55,7 +55,7 @@ export class Gutter {
this.element.setAttribute("data-position", "right"); this.element.setAttribute("data-position", "right");
this.element.addEventListener("dragstart", (event: DragEvent & { target: HTMLElement }) => { this.element.addEventListener("dragstart", (event: DragEvent & { target: HTMLElement }) => {
hideTooltip(); hideTooltip();
const buttonElement = event.target.parentElement const buttonElement = event.target.parentElement;
let selectIds: string[] = [buttonElement.getAttribute("data-node-id")]; let selectIds: string[] = [buttonElement.getAttribute("data-node-id")];
const selectElements = protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"); const selectElements = protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select");
if (selectElements.length > 0) { if (selectElements.length > 0) {
@ -1846,7 +1846,7 @@ export class Gutter {
const buttonHTML = `<button data-type="${type}" data-subtype="${nodeElement.getAttribute("data-subtype")}" data-node-id="${nodeElement.getAttribute("data-node-id")}"> const buttonHTML = `<button data-type="${type}" data-subtype="${nodeElement.getAttribute("data-subtype")}" data-node-id="${nodeElement.getAttribute("data-node-id")}">
<svg><use xlink:href="#${getIconByType(type, nodeElement.getAttribute("data-subtype"))}"></use></svg> <svg><use xlink:href="#${getIconByType(type, nodeElement.getAttribute("data-subtype"))}"></use></svg>
<span ${protyle.disabled ? "" : 'draggable="true"'}></span> <span ${protyle.disabled ? "" : 'draggable="true"'}></span>
</button>` </button>`;
if (isShow) { if (isShow) {
html = buttonHTML + html; html = buttonHTML + html;
} }

View file

@ -68,7 +68,6 @@ import {getSavePath} from "../../util/newFile";
import {escapeHtml} from "../../util/escape"; import {escapeHtml} from "../../util/escape";
import {insertHTML} from "../util/insertHTML"; import {insertHTML} from "../util/insertHTML";
import {removeSearchMark} from "../toolbar/util"; import {removeSearchMark} from "../toolbar/util";
import {copyPNG} from "../../menus/util";
import {avKeydown} from "../render/av/keydown"; import {avKeydown} from "../render/av/keydown";
import {resizeAV} from "../util/resize"; import {resizeAV} from "../util/resize";

View file

@ -3,7 +3,7 @@ import {getAllModels} from "../layout/getAll";
import * as path from "path"; import * as path from "path";
/// #endif /// #endif
import {Constants} from "../constants"; import {Constants} from "../constants";
import {escapeAriaLabel, escapeAttr, escapeGreat, escapeHtml} from "../util/escape"; import {escapeAriaLabel, escapeGreat, escapeHtml} from "../util/escape";
import {fetchPost} from "../util/fetch"; import {fetchPost} from "../util/fetch";
import {openFile, openFileById} from "../editor/util"; import {openFile, openFileById} from "../editor/util";
import {showMessage} from "../dialog/message"; import {showMessage} from "../dialog/message";
@ -1353,7 +1353,7 @@ const getAttr =(block:IBlock) => {
attrHTML += `<span class="b3-list-item__meta fn__flex" style="max-width: 30%"><svg class="b3-list-item__hinticon"><use xlink:href="#iconM"></use></svg><span class="b3-list-item__hinttext">${block.memo}</span></span>`; attrHTML += `<span class="b3-list-item__meta fn__flex" style="max-width: 30%"><svg class="b3-list-item__hinticon"><use xlink:href="#iconM"></use></svg><span class="b3-list-item__hinttext">${block.memo}</span></span>`;
} }
return attrHTML; return attrHTML;
} };
const onSearch = (data: IBlock[], edit: Protyle, element: Element, config: ISearchOption) => { const onSearch = (data: IBlock[], edit: Protyle, element: Element, config: ISearchOption) => {
let resultHTML = ""; let resultHTML = "";

View file

@ -225,7 +225,7 @@ export const setInlineStyle = (set = true) => {
style += "\n.b3-menu .b3-menu__action {opacity: 0.68;}"; style += "\n.b3-menu .b3-menu__action {opacity: 0.68;}";
} }
if (set) { if (set) {
const siyuanStyle = document.getElementById("siyuanStyle") const siyuanStyle = document.getElementById("siyuanStyle");
if (siyuanStyle) { if (siyuanStyle) {
siyuanStyle.innerHTML = style; siyuanStyle.innerHTML = style;
} else { } else {