This commit is contained in:
Vanessa 2022-06-10 00:54:53 +08:00
parent dd19b9bc44
commit 2ae388d2bb
9 changed files with 18 additions and 23 deletions

View file

@ -344,14 +344,14 @@ export const appearance = {
ipcRenderer.send(Constants.SIYUAN_CONFIG_CLOSE, data.closeButtonBehavior);
/// #endif
loadAssets(data);
const modeElement = document.getElementById("barThemeMode")
const modeElement = document.getElementById("barThemeMode");
if (modeElement) {
if (data.mode === 1) {
modeElement.classList.add("toolbar__item--active");
modeElement.setAttribute("aria-label", window.siyuan.languages.themeLight)
modeElement.setAttribute("aria-label", window.siyuan.languages.themeLight);
} else {
modeElement.classList.remove("toolbar__item--active");
modeElement.setAttribute("aria-label", window.siyuan.languages.themeDark)
modeElement.setAttribute("aria-label", window.siyuan.languages.themeDark);
}
}
}

View file

@ -552,7 +552,7 @@ export class Files extends Model {
targetElement.querySelector(".b3-list-item__toggle").classList.remove("fn__hidden");
const emojiElement = targetElement.querySelector(".b3-list-item__icon");
if (emojiElement.innerHTML === unicode2Emoji(Constants.SIYUAN_IMAGE_FILE)) {
emojiElement.innerHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FOLDER)
emojiElement.innerHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FOLDER);
}
if (targetElement.nextElementSibling && targetElement.nextElementSibling.tagName === "UL") {
targetElement.nextElementSibling.remove();

View file

@ -400,7 +400,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
} else if (window.siyuan.config.editor.displayNetImgMark) {
assetElement.querySelector(".protyle-action__drag").insertAdjacentHTML("afterend", '<span class="img__net"><svg><use xlink:href="#iconLanguage"></use></svg></span>');
}
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"))
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
updateTransaction(protyle, id, nodeElement.outerHTML, html);
html = nodeElement.outerHTML;
});
@ -419,7 +419,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
assetElement.style.maxWidth = (imgElement.clientWidth + 10) + "px";
});
inputElement.addEventListener("change", () => {
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"))
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
updateTransaction(protyle, id, nodeElement.outerHTML, html);
html = nodeElement.outerHTML;
});
@ -432,7 +432,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
inputElement.value = imgElement.getAttribute("alt") || "";
inputElement.addEventListener("change", (event) => {
imgElement.setAttribute("alt", (event.target as HTMLInputElement).value);
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"))
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
updateTransaction(protyle, id, nodeElement.outerHTML, html);
html = nodeElement.outerHTML;
});
@ -476,7 +476,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
click() {
writeText(protyle.lute.BlockDOM2Md(assetElement.outerHTML));
(assetElement as HTMLElement).outerHTML = "<wbr>";
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"))
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
updateTransaction(protyle, id, nodeElement.outerHTML, html);
focusByWbr(protyle.wysiwyg.element, range);
}
@ -487,7 +487,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
label: window.siyuan.languages.delete,
click: function () {
(assetElement as HTMLElement).outerHTML = "<wbr>";
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"))
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
updateTransaction(protyle, id, nodeElement.outerHTML, html);
focusByWbr(protyle.wysiwyg.element, range);
}
@ -498,7 +498,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
label: window.siyuan.languages.alignCenter,
accelerator: window.siyuan.config.keymap.editor.general.alignCenter.custom,
click() {
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"))
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
assetElement.style.display = "block";
updateTransaction(protyle, id, nodeElement.outerHTML, html);
}
@ -508,7 +508,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
label: window.siyuan.languages.alignLeft,
accelerator: window.siyuan.config.keymap.editor.general.alignLeft.custom,
click() {
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"))
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
assetElement.style.display = "";
updateTransaction(protyle, id, nodeElement.outerHTML, html);
}
@ -536,7 +536,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
rangeElement.parentElement.setAttribute("aria-label", `${rangeElement.value}%`);
});
rangeElement.addEventListener("change", () => {
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"))
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
updateTransaction(protyle, id, nodeElement.outerHTML, html);
window.siyuan.menus.menu.remove();
focusBlock(nodeElement);
@ -685,7 +685,7 @@ const genImageWidthMenu = (label: string, assetElement: HTMLElement, imgElement:
return {
label,
click() {
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"))
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
assetElement.style.width = label === window.siyuan.languages.default ? "" : label;
imgElement.style.width = label === window.siyuan.languages.default ? "" : "10000px";
assetElement.style.maxWidth = label === window.siyuan.languages.default ? (imgElement.clientWidth + 10) + "px" : "";

View file

@ -438,7 +438,7 @@ export class MobileFiles extends Model {
targetElement.querySelector(".b3-list-item__toggle").classList.remove("fn__hidden");
const emojiElement = targetElement.querySelector(".b3-list-item__icon");
if (emojiElement.innerHTML === unicode2Emoji(Constants.SIYUAN_IMAGE_FILE)) {
emojiElement.innerHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FOLDER)
emojiElement.innerHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FOLDER);
}
if (targetElement.nextElementSibling && targetElement.nextElementSibling.tagName === "UL") {
targetElement.nextElementSibling.remove();

View file

@ -1,9 +1,7 @@
import {
focusBlock,
focusByOffset,
focusByRange,
getEditorRange,
getSelectionOffset,
} from "../util/selection";
import {fetchPost} from "../../util/fetch";
import {replaceFileName, validateName} from "../../editor/rename";

View file

@ -9,7 +9,7 @@ import {Constants} from "../../constants";
import {onGet} from "../util/onGet";
export const commonHotkey = (protyle: IProtyle, event: KeyboardEvent) => {
const target = event.target as HTMLElement
const target = event.target as HTMLElement;
if (matchHotKey(window.siyuan.config.keymap.editor.general.copyHPath.custom, event)) {
fetchPost("/api/filetree/getHPathByID", {
id: protyle.block.rootID
@ -65,4 +65,4 @@ export const commonHotkey = (protyle: IProtyle, event: KeyboardEvent) => {
return true;
}
}
}
};

View file

@ -21,7 +21,6 @@ import {
isNotEditBlock,
} from "./getBlock";
import {matchHotKey} from "../util/hotKey";
import {fullscreen} from "../breadcrumb/action";
import {enter} from "./enter";
import {fixTable} from "../util/table";
import {phTransaction, transaction, turnsIntoTransaction, updateTransaction} from "./transaction";
@ -39,7 +38,6 @@ import {setPosition} from "../../util/setPosition";
import {removeEmbed} from "./removeEmbed";
import {openAttr} from "../../menus/commonMenuItem";
import {Constants} from "../../constants";
import {addLoading, setPadding} from "../ui/initUI";
import {preventScroll} from "../scroll/preventScroll";
import {bindMenuKeydown} from "../../menus/Menu";
import {fetchPost} from "../../util/fetch";

View file

@ -8,7 +8,6 @@ import {getDisplayName, getOpenNotebookCount, pathPosix} from "./pathName";
import {openFileById} from "../editor/util";
import {Constants} from "../constants";
import {isMobile} from "./functions";
import {openMobileFileById} from "../mobile/editor";
export const newFile = (notebookId?: string, currentPath?: string, open?: boolean) => {
if (getOpenNotebookCount() === 0) {

View file

@ -224,10 +224,10 @@ const initBar = () => {
}
if (barThemeModeElement.classList.contains("toolbar__item--active")) {
barThemeModeElement.classList.remove("toolbar__item--active");
barThemeModeElement.setAttribute("aria-label", window.siyuan.languages.themeDark)
barThemeModeElement.setAttribute("aria-label", window.siyuan.languages.themeDark);
} else {
barThemeModeElement.classList.add("toolbar__item--active");
barThemeModeElement.setAttribute("aria-label", window.siyuan.languages.themeLight)
barThemeModeElement.setAttribute("aria-label", window.siyuan.languages.themeLight);
}
barThemeModeElement.setAttribute("disabled", "disabled");
fetchPost("/api/system/setAppearanceMode", {