Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:rotating_light:

Vanessa3e57c2155d20
diff --git a/app/src/mobile/util/keyboardToolbar.ts b/app/src/mobile/util/keyboardToolbar.ts
index c9691f23f5..049f366ded 100644
--- a/app/src/mobile/util/keyboardToolbar.ts
+++ b/app/src/mobile/util/keyboardToolbar.ts
@@ -625,7 +625,7 @@ export const initKeyboardToolbar = () => {
}
// appearance
if (["clear", "style2", "style4", "color", "backgroundColor", "fontSize", "style1"].includes(type)) {
- const nodeElements = getFontNodeElements(protyle)
+ const nodeElements = getFontNodeElements(protyle);
if (type === "style1") {
fontEvent(protyle, nodeElements, type, buttonElement.firstElementChild.style.backgroundColor + Constants.ZWSP + buttonElement.firstElementChild.style.color);
} else if (type === "fontSize") {
diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts
index b720d39288..8d0b2d66f6 100644
--- a/app/src/protyle/gutter/index.ts
+++ b/app/src/protyle/gutter/index.ts
@@ -426,6 +426,19 @@ export class Gutter {
};
}
+ private showMobileAppearance(protyle: IProtyle) {
+ const toolbarElement = document.getElementById("keyboardToolbar");
+ const dynamicElements = toolbarElement.querySelectorAll("#keyboardToolbar .keyboard__dynamic");
+ dynamicElements[0].classList.add("fn__none");
+ dynamicElements[1].classList.remove("fn__none");
+ toolbarElement.querySelector('.keyboard__action[data-type="text"]').classList.add("protyle-toolbar__item--current");
+ toolbarElement.querySelector('.keyboard__action[data-type="done"] use').setAttribute("xlink:href", "#iconCloseRound");
+ const oldScrollTop = protyle.contentElement.scrollTop;
+ renderTextMenu(protyle, toolbarElement);
+ showKeyboardToolbarUtil(oldScrollTop);
+ toolbarElement.classList.remove("fn__none");
+ }
+
public renderMultipleMenu(protyle: IProtyle, selectsElement: Element[]) {
let isList = false;
let isContinue = false;
@@ -680,17 +693,9 @@ export class Gutter {
label: window.siyuan.languages.appearance,
icon: "iconFont",
accelerator: window.siyuan.config.keymap.editor.insert.appearance.custom,
- click() {
+ click: () => {
/// #if MOBILE
- const toolbarElement = document.getElementById("keyboardToolbar");
- const dynamicElements = toolbarElement.querySelectorAll("#keyboardToolbar .keyboard__dynamic");
- dynamicElements[0].classList.add("fn__none");
- dynamicElements[1].classList.remove("fn__none");
- toolbarElement.querySelector('.keyboard__action[data-type="text"]').classList.add("protyle-toolbar__item--current");
- toolbarElement.querySelector('.keyboard__action[data-type="done"] use').setAttribute("xlink:href", "#iconCloseRound");
- const oldScrollTop = protyle.contentElement.scrollTop;
- renderTextMenu(protyle, toolbarElement);
- showKeyboardToolbarUtil(oldScrollTop);
+ this.showMobileAppearance(protyle);
/// #else
protyle.toolbar.element.classList.add("fn__none");
protyle.toolbar.subElement.innerHTML = "";
@@ -754,7 +759,7 @@ export class Gutter {
public renderMenu(protyle: IProtyle, buttonElement: Element) {
if (!buttonElement) {
- return
+ return;
}
hideElements(["util", "toolbar", "hint"], protyle);
window.siyuan.menus.menu.remove();
@@ -1501,17 +1506,9 @@ export class Gutter {
label: window.siyuan.languages.appearance,
icon: "iconFont",
accelerator: window.siyuan.config.keymap.editor.insert.appearance.custom,
- click() {
+ click: () => {
/// #if MOBILE
- const toolbarElement = document.getElementById("keyboardToolbar");
- const dynamicElements = toolbarElement.querySelectorAll("#keyboardToolbar .keyboard__dynamic");
- dynamicElements[0].classList.add("fn__none");
- dynamicElements[1].classList.remove("fn__none");
- toolbarElement.querySelector('.keyboard__action[data-type="text"]').classList.add("protyle-toolbar__item--current");
- toolbarElement.querySelector('.keyboard__action[data-type="done"] use').setAttribute("xlink:href", "#iconCloseRound");
- const oldScrollTop = protyle.contentElement.scrollTop;
- renderTextMenu(protyle, toolbarElement);
- showKeyboardToolbarUtil(oldScrollTop);
+ this.showMobileAppearance(protyle);
/// #else
protyle.toolbar.element.classList.add("fn__none");
protyle.toolbar.subElement.innerHTML = "";
diff --git a/app/src/protyle/render/util.ts b/app/src/protyle/render/util.ts
index 120d560299..d1168ddf73 100644
--- a/app/src/protyle/render/util.ts
+++ b/app/src/protyle/render/util.ts
@@ -2,5 +2,5 @@ export const genIconHTML = () => {
return `<div class="protyle-icons">
<span aria-label="${window.siyuan.languages.edit}" class="b3-tooltips__nw b3-tooltips protyle-icon protyle-icon--first protyle-action__edit"><svg><use xlink:href="#iconEdit"></use></svg></span>
<span aria-label="${window.siyuan.languages.more}" class="b3-tooltips__nw b3-tooltips protyle-icon protyle-action__menu protyle-icon--last"><svg><use xlink:href="#iconMore"></use></svg></span>
-</div>`
-}
+</div>`;
+};
diff --git a/app/src/protyle/toolbar/Font.ts b/app/src/protyle/toolbar/Font.ts
index f84ce4dd70..8840aaf5be 100644
--- a/app/src/protyle/toolbar/Font.ts
+++ b/app/src/protyle/toolbar/Font.ts
@@ -421,4 +421,4 @@ export const getFontNodeElements = (protyle: IProtyle) => {
}
}
return nodeElements;
-}
+};
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index b96b160d58..4978e53f48 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -2007,7 +2007,7 @@ export class WYSIWYG {
if (protyle.options.render.breadcrumb) {
setTimeout(() => {
protyle.breadcrumb.render(protyle);
- }, Constants.TIMEOUT_TRANSITION)
+ }, Constants.TIMEOUT_TRANSITION);
}
} else if (lastEditElement) {
range.selectNodeContents(lastEditElement);
diff --git a/app/src/search/util.ts b/app/src/search/util.ts
index e8fda46336..79c7860207 100644
--- a/app/src/search/util.ts
+++ b/app/src/search/util.ts
@@ -41,7 +41,7 @@ const toggleReplaceHistory = (replaceHistoryElement: Element, historyElement: El
replaceHistoryElement.classList.add("fn__none");
}
historyElement.classList.add("fn__none");
-}
+};
const toggleSearchHistory = (historyElement: Element, replaceHistoryElement: Element, searchInputElement: HTMLInputElement) => {
if (historyElement.classList.contains("fn__none")) {
@@ -64,7 +64,7 @@ const toggleSearchHistory = (historyElement: Element, replaceHistoryElement: Ele
historyElement.classList.add("fn__none");
}
replaceHistoryElement.classList.add("fn__none");
-}
+};
const saveKeyList = (type: "keys" | "replaceKeys", value: string) => {
let list: string[] = window.siyuan.storage[Constants.LOCAL_SEARCHKEYS][type];
@@ -609,12 +609,12 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo
event.preventDefault();
break;
} else if (target.id === "searchHistoryBtn") {
- toggleSearchHistory(historyElement, replaceHistoryElement, searchInputElement)
+ toggleSearchHistory(historyElement, replaceHistoryElement, searchInputElement);
event.stopPropagation();
event.preventDefault();
return;
} else if (target.id === "replaceHistoryBtn") {
- toggleReplaceHistory(replaceHistoryElement, historyElement, replaceInputElement)
+ toggleReplaceHistory(replaceHistoryElement, historyElement, replaceInputElement);
event.stopPropagation();
event.preventDefault();
return;
@@ -756,7 +756,7 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo
return;
}
const focusIsNew = currentList.getAttribute("data-type") === "search-new";
- const isHistory = !historyElement.classList.contains("fn__none")
+ const isHistory = !historyElement.classList.contains("fn__none");
if (event.key === "Enter") {
if (!isHistory) {
if (focusIsNew) {
@@ -779,7 +779,7 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo
searchInputElement.value = historyElement.querySelector(".b3-list-item--focus").textContent.trim();
config.page = 1;
inputTimeout = inputEvent(element, config, inputTimeout, edit);
- toggleSearchHistory(historyElement, replaceHistoryElement, searchInputElement)
+ toggleSearchHistory(historyElement, replaceHistoryElement, searchInputElement);
}
event.preventDefault();
}
@@ -789,7 +789,7 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo
}
if (isHistory) {
if (event.key === "Escape") {
- toggleSearchHistory(historyElement, replaceHistoryElement, searchInputElement)
+ toggleSearchHistory(historyElement, replaceHistoryElement, searchInputElement);
} else {
upDownHint(historyElement, event);
}
@@ -860,7 +860,7 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo
if (event.isComposing) {
return;
}
- const isHistory = !replaceHistoryElement.classList.contains("fn__none")
+ const isHistory = !replaceHistoryElement.classList.contains("fn__none");
if (event.key === "Enter") {
if (isHistory) {
replaceInputElement.value = replaceHistoryElement.querySelector(".b3-list-item--focus").textContent.trim();
@@ -876,7 +876,7 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo
}
if (isHistory) {
if (event.key === "Escape") {
- toggleReplaceHistory(replaceHistoryElement, historyElement, replaceInputElement)
+ toggleReplaceHistory(replaceHistoryElement, historyElement, replaceInputElement);
} else {
upDownHint(replaceHistoryElement, event);
}