Vanessa 2025-03-19 18:52:36 +08:00
parent 8bf263a871
commit f5a72edcfd
4 changed files with 15 additions and 0 deletions

View file

@ -31,6 +31,7 @@ import {hideAllElements} from "./protyle/ui/hideElements";
import {loadPlugins, reloadPlugin} from "./plugin/loader"; import {loadPlugins, reloadPlugin} from "./plugin/loader";
import "./assets/scss/base.scss"; import "./assets/scss/base.scss";
import {reloadEmoji} from "./emoji"; import {reloadEmoji} from "./emoji";
import {IOSPurchase} from "./util/iOSPurchase";
export class App { export class App {
public plugins: import("./plugin").Plugin[] = []; public plugins: import("./plugin").Plugin[] = [];
@ -208,4 +209,5 @@ window.openFileByURL = (openURL) => {
window.showKeyboardToolbar = () => { window.showKeyboardToolbar = () => {
// 防止 Pad 端报错 // 防止 Pad 端报错
}; };
window.IOSPurchase = IOSPurchase;
/// #endif /// #endif

View file

@ -28,6 +28,7 @@ import {isNotEditBlock} from "../protyle/wysiwyg/getBlock";
import {updateCardHV} from "../card/util"; import {updateCardHV} from "../card/util";
import {mobileKeydown} from "./util/keydown"; import {mobileKeydown} from "./util/keydown";
import {correctHotkey} from "../boot/globalEvent/commonHotkey"; import {correctHotkey} from "../boot/globalEvent/commonHotkey";
import {IOSPurchase} from "../util/iOSPurchase";
class App { class App {
public plugins: import("../plugin").Plugin[] = []; public plugins: import("../plugin").Plugin[] = [];
@ -162,6 +163,7 @@ window.reconnectWebSocket = () => {
window.siyuan.mobile.popEditor.protyle.ws.send("ping", {}); window.siyuan.mobile.popEditor.protyle.ws.send("ping", {});
}; };
window.goBack = goBack; window.goBack = goBack;
window.IOSPurchase = IOSPurchase;
window.showKeyboardToolbar = (height) => { window.showKeyboardToolbar = (height) => {
document.getElementById("keyboardToolbar").setAttribute("data-keyboardheight", (height ? height : window.outerHeight / 2 - 42).toString()); document.getElementById("keyboardToolbar").setAttribute("data-keyboardheight", (height ? height : window.outerHeight / 2 - 42).toString());
showKeyboardToolbar(); showKeyboardToolbar();

View file

@ -224,6 +224,8 @@ interface Window {
showKeyboardToolbar(height: number): void showKeyboardToolbar(height: number): void
IOSPurchase(data: string): void
hideKeyboardToolbar(): void hideKeyboardToolbar(): void
openFileByURL(URL: string): boolean openFileByURL(URL: string): boolean

View file

@ -0,0 +1,9 @@
export const IOSPurchase = (data:string) => {
/// #if MOBILE
document.querySelector("#modelMain").dispatchEvent(new CustomEvent("click", {
detail: document.querySelector("#modelMain #refresh")
}));
/// #else
document.querySelector('.config__tab-container[data-name="account"] #refresh').dispatchEvent(new Event("click"));
/// #endif
}