mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
This commit is contained in:
parent
ea589fef7b
commit
7e114a6671
6 changed files with 21 additions and 16 deletions
|
|
@ -129,7 +129,7 @@ export class BlockPanel {
|
||||||
target = target.parentElement;
|
target = target.parentElement;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
/// if !MOBILE
|
/// #if !MOBILE
|
||||||
moveResize(this.element, (type: string) => {
|
moveResize(this.element, (type: string) => {
|
||||||
if (type !== "move") {
|
if (type !== "move") {
|
||||||
this.editors.forEach(item => {
|
this.editors.forEach(item => {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import {genUUID} from "../util/genID";
|
import {genUUID} from "../util/genID";
|
||||||
/// if !MOBILE
|
/// #if !MOBILE
|
||||||
import {moveResize} from "./moveResize";
|
import {moveResize} from "./moveResize";
|
||||||
/// #endif
|
/// #endif
|
||||||
import {isMobile} from "../util/functions";
|
import {isMobile} from "../util/functions";
|
||||||
|
|
@ -59,7 +59,7 @@ export class Dialog {
|
||||||
this.element.classList.add("b3-dialog--open");
|
this.element.classList.add("b3-dialog--open");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/// if !MOBILE
|
/// #if !MOBILE
|
||||||
moveResize(this.element.querySelector(".b3-dialog__container"));
|
moveResize(this.element.querySelector(".b3-dialog__container"));
|
||||||
/// #endif
|
/// #endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ import {getSearch} from "../util/functions";
|
||||||
import {initRightMenu} from "./menu";
|
import {initRightMenu} from "./menu";
|
||||||
import {openChangelog} from "../boot/openChangelog";
|
import {openChangelog} from "../boot/openChangelog";
|
||||||
import {registerServiceWorker} from "../util/serviceWorker";
|
import {registerServiceWorker} from "../util/serviceWorker";
|
||||||
import {loadPlugins} from "../plugin/loader";
|
import {afterLoadPlugin, loadPlugins} from "../plugin/loader";
|
||||||
|
|
||||||
class App {
|
class App {
|
||||||
public plugins: import("../plugin").Plugin[] = [];
|
public plugins: import("../plugin").Plugin[] = [];
|
||||||
|
|
@ -81,6 +81,9 @@ class App {
|
||||||
initFramework(this);
|
initFramework(this);
|
||||||
initRightMenu(this);
|
initRightMenu(this);
|
||||||
openChangelog();
|
openChangelog();
|
||||||
|
this.plugins.forEach(item => {
|
||||||
|
afterLoadPlugin(item);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,7 @@ export class Plugin {
|
||||||
const iconElement = document.createElement("div");
|
const iconElement = document.createElement("div");
|
||||||
if (isMobile()) {
|
if (isMobile()) {
|
||||||
iconElement.className = "b3-menu__item";
|
iconElement.className = "b3-menu__item";
|
||||||
|
iconElement.setAttribute("data-menu", "true");
|
||||||
iconElement.innerHTML = (options.icon.startsWith("icon") ? `<svg class="b3-menu__icon"><use xlink:href="#${options.icon}"></use></svg>` : options.icon) +
|
iconElement.innerHTML = (options.icon.startsWith("icon") ? `<svg class="b3-menu__icon"><use xlink:href="#${options.icon}"></use></svg>` : options.icon) +
|
||||||
`<span class="b3-menu__label">${options.title}</span>`;
|
`<span class="b3-menu__label">${options.title}</span>`;
|
||||||
iconElement.addEventListener("click", options.callback);
|
iconElement.addEventListener("click", options.callback);
|
||||||
|
|
|
||||||
|
|
@ -104,19 +104,20 @@ export const afterLoadPlugin = (plugin: Plugin) => {
|
||||||
console.error(`plugin ${plugin.name} onLayoutReady error:`, e);
|
console.error(`plugin ${plugin.name} onLayoutReady error:`, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isWindow() || isMobile()) {
|
||||||
|
plugin.topBarIcons.forEach(element => {
|
||||||
|
if (isMobile()) {
|
||||||
|
document.querySelector("#menuAbout").after(element);
|
||||||
|
} else if (!isWindow()) {
|
||||||
|
document.querySelector("#" + (element.getAttribute("data-position") === "right" ? "barSearch" : "drag")).before(element);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
if (isWindow()) {
|
if (isWindow()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.topBarIcons.forEach(element => {
|
/// #if !MOBILE
|
||||||
if (isMobile()) {
|
|
||||||
document.querySelector("#menuAbout").after(element);
|
|
||||||
} else if (!isWindow()) {
|
|
||||||
document.querySelector("#" + (element.getAttribute("data-position") === "right" ? "barSearch" : "drag")).before(element);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/// if !MOBILE
|
|
||||||
window.siyuan.config.uiLayout.left.data.forEach((dockItem: IDockTab[], index: number) => {
|
window.siyuan.config.uiLayout.left.data.forEach((dockItem: IDockTab[], index: number) => {
|
||||||
updateDock(dockItem, index, plugin, "Left");
|
updateDock(dockItem, index, plugin, "Left");
|
||||||
});
|
});
|
||||||
|
|
@ -157,5 +158,5 @@ export const afterLoadPlugin = (plugin: Plugin) => {
|
||||||
}], dock.config.position === "RightBottom" ? 1 : 0, dock.config.index);
|
}], dock.config.position === "RightBottom" ? 1 : 0, dock.config.index);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
/// endif
|
/// #endif
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ import {blockRender} from "../markdown/blockRender";
|
||||||
/// #if !BROWSER
|
/// #if !BROWSER
|
||||||
import {openBy} from "../../editor/util";
|
import {openBy} from "../../editor/util";
|
||||||
/// #endif
|
/// #endif
|
||||||
/// if !MOBILE
|
/// #if !MOBILE
|
||||||
import {moveResize} from "../../dialog/moveResize";
|
import {moveResize} from "../../dialog/moveResize";
|
||||||
/// #endif
|
/// #endif
|
||||||
import {fetchPost} from "../../util/fetch";
|
import {fetchPost} from "../../util/fetch";
|
||||||
|
|
@ -1013,7 +1013,7 @@ export class Toolbar {
|
||||||
});
|
});
|
||||||
}, Constants.TIMEOUT_LOAD);
|
}, Constants.TIMEOUT_LOAD);
|
||||||
};
|
};
|
||||||
/// if !MOBILE
|
/// #if !MOBILE
|
||||||
moveResize(this.subElement, () => {
|
moveResize(this.subElement, () => {
|
||||||
const pinElement = headerElement.querySelector('[data-type="pin"]');
|
const pinElement = headerElement.querySelector('[data-type="pin"]');
|
||||||
pinElement.classList.add("block__icon--active");
|
pinElement.classList.add("block__icon--active");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue