diff --git a/app/src/mobile/menu/index.ts b/app/src/mobile/menu/index.ts
index d65636676..1b06fa8f3 100644
--- a/app/src/mobile/menu/index.ts
+++ b/app/src/mobile/menu/index.ts
@@ -40,8 +40,8 @@ export const initRightMenu = () => {
`;
const isHuawei = () => {
- return 0 < window.siyuan.config.system.osPlatform.toLowerCase().indexOf("huawei")
- }
+ return 0 < window.siyuan.config.system.osPlatform.toLowerCase().indexOf("huawei");
+ };
if (isHuawei()) {
// Access to the OpenAI API is no longer supported on Huawei devices https://github.com/siyuan-note/siyuan/issues/8192
aiHTML = "";
diff --git a/app/src/plugin/API.ts b/app/src/plugin/API.ts
index dcf1b8506..2a5194500 100644
--- a/app/src/plugin/API.ts
+++ b/app/src/plugin/API.ts
@@ -4,23 +4,24 @@ import {showMessage} from "../dialog/message";
import {Dialog} from "../dialog";
import {MenuItem} from "../menus/Menu";
import {Menu as SiyuanMenu} from "../menus/Menu";
+import {fetchGet, fetchPost, fetchSyncPost} from "../util/fetch";
export class Menu {
private menu: SiyuanMenu;
- private isOpen: boolean
+ private isOpen: boolean;
constructor(id?: string, closeCB?: () => void) {
this.menu = window.siyuan.menus.menu;
this.isOpen = false;
if (id) {
- const dataName = this.menu.element.getAttribute('data-name');
+ const dataName = this.menu.element.getAttribute("data-name");
if (dataName && dataName === id) {
- this.isOpen = true
+ this.isOpen = true;
}
}
this.menu.remove();
if (!this.isOpen) {
- this.menu.element.setAttribute('data-name', id);
+ this.menu.element.setAttribute("data-name", id);
this.menu.removeCB = closeCB;
}
}
@@ -42,7 +43,7 @@ export class Menu {
if (this.isOpen) {
return;
}
- this.addItem({type: 'separator'});
+ this.addItem({type: "separator"});
}
open(options: { x: number, y: number, h?: number, w?: number, isLeft: false }) {
@@ -65,9 +66,12 @@ export class Menu {
}
export const API = {
- Plugin: Plugin,
confirm: confirmDialog,
showMessage,
+ fetchPost,
+ fetchSyncPost,
+ fetchGet,
+ Plugin: Plugin,
Dialog,
Menu,
};
diff --git a/app/src/protyle/util/selection.ts b/app/src/protyle/util/selection.ts
index 4033490af..07e5703e4 100644
--- a/app/src/protyle/util/selection.ts
+++ b/app/src/protyle/util/selection.ts
@@ -128,13 +128,13 @@ export const selectAll = (protyle: IProtyle, nodeElement: Element, range: Range)
// https://github.com/siyuan-note/siyuan/issues/8196
export const getRangeByPoint = (x: number, y: number) => {
const range = document.caretRangeFromPoint(x, y);
- const imgElement = hasClosestByAttribute(range.startContainer, "data-type", "img")
+ const imgElement = hasClosestByAttribute(range.startContainer, "data-type", "img");
if (imgElement) {
range.setStart(imgElement.nextSibling, 0);
range.collapse();
}
return range;
-}
+};
export const getEditorRange = (element: Element) => {
let range: Range;