🐛 rm mobile custom tab

This commit is contained in:
Vanessa 2023-05-10 16:11:02 +08:00
parent f8ec38e416
commit 72764ddb6e
3 changed files with 22 additions and 4 deletions

View file

@ -86,5 +86,5 @@ export const openBookmarkMenu = (element: HTMLElement, event: MouseEvent, bookma
} }
window.siyuan.menus.menu.element.setAttribute("data-name", "bookmarkMenu"); window.siyuan.menus.menu.element.setAttribute("data-name", "bookmarkMenu");
window.siyuan.menus.menu.element.style.zIndex = "221"; // 移动端被右侧栏遮挡 window.siyuan.menus.menu.element.style.zIndex = "221"; // 移动端被右侧栏遮挡
window.siyuan.menus.menu.popup({x: event.clientX - 11, y: event.clientY + 11, h: 22}); window.siyuan.menus.menu.popup({x: event.clientX - 11, y: event.clientY + 11, h: 22, w: 12});
}; };

View file

@ -6,8 +6,9 @@ import {MenuItem} from "../menus/Menu";
import {Menu as SiyuanMenu} from "../menus/Menu"; import {Menu as SiyuanMenu} from "../menus/Menu";
import {fetchGet, fetchPost, fetchSyncPost} from "../util/fetch"; import {fetchGet, fetchPost, fetchSyncPost} from "../util/fetch";
import {isMobile} from "../util/functions"; import {isMobile} from "../util/functions";
import {Custom} from "../layout/dock/Custom"; /// #if !MOBILE
import {openFile} from "../editor/util"; import {openFile} from "../editor/util";
/// #endif
export class Menu { export class Menu {
private menu: SiyuanMenu; private menu: SiyuanMenu;
@ -69,6 +70,15 @@ export class Menu {
} }
} }
let openTab;
/// #if MOBILE
openTab = () => {
// TODO: Mobile
}
/// #else
openTab = openFile;
/// #endif
export const API = { export const API = {
confirm: confirmDialog, confirm: confirmDialog,
showMessage, showMessage,
@ -76,7 +86,7 @@ export const API = {
fetchSyncPost, fetchSyncPost,
fetchGet, fetchGet,
isMobile, isMobile,
openTab: openFile, openTab,
Plugin, Plugin,
Dialog, Dialog,
Menu, Menu,

View file

@ -2,7 +2,9 @@ import {App} from "../index";
import {EventBus} from "./EventBus"; import {EventBus} from "./EventBus";
import {fetchPost} from "../util/fetch"; import {fetchPost} from "../util/fetch";
import {isMobile, isWindow} from "../util/functions"; import {isMobile, isWindow} from "../util/functions";
/// #if !MOBILE
import {Custom} from "../layout/dock/Custom"; import {Custom} from "../layout/dock/Custom";
/// #endif
import {Tab} from "../layout/Tab"; import {Tab} from "../layout/Tab";
export class Plugin { export class Plugin {
@ -10,7 +12,11 @@ export class Plugin {
public eventBus: EventBus; public eventBus: EventBus;
public data: any; public data: any;
public name: string; public name: string;
public models: { [key: string]: (options: { tab: Tab, data: any }) => Custom } = {}; public models: {
/// #if !MOBILE
[key: string]: (options: { tab: Tab, data: any }) => Custom
/// #endif
} = {};
constructor(options: { constructor(options: {
app: App, app: App,
@ -100,6 +106,7 @@ export class Plugin {
update?: () => void, update?: () => void,
init: () => void init: () => void
}) { }) {
/// #if !MOBILE
const type2 = this.name + options.type; const type2 = this.name + options.type;
this.models[type2] = (arg: { data: any, tab: Tab }) => new Custom({ this.models[type2] = (arg: { data: any, tab: Tab }) => new Custom({
tab: arg.tab, tab: arg.tab,
@ -111,5 +118,6 @@ export class Plugin {
update: options.update, update: options.update,
}); });
return this.models[type2]; return this.models[type2];
/// #endif
} }
} }