mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-08 05:32:33 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
2d47cb3684
24 changed files with 1191 additions and 796 deletions
|
|
@ -771,7 +771,7 @@ type="checkbox">
|
|||
app.plugins.find((item: Plugin) => {
|
||||
if (item.name === dataObj.name) {
|
||||
reloadPlugin(app, {
|
||||
upsertCodePlugins: [dataObj.name],
|
||||
reloadPlugins: [dataObj.name],
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -537,14 +537,14 @@ export const setTitle = (title: string) => {
|
|||
};
|
||||
|
||||
export const downloadProgress = (data: { id: string, percent: number }) => {
|
||||
const bazzarSideElement = document.querySelector("#configBazaarReadme .item__side");
|
||||
if (!bazzarSideElement) {
|
||||
const bazaarSideElement = document.querySelector("#configBazaarReadme .item__side");
|
||||
if (!bazaarSideElement) {
|
||||
return;
|
||||
}
|
||||
if (data.id !== JSON.parse(bazzarSideElement.getAttribute("data-obj")).repoURL) {
|
||||
if (data.id !== JSON.parse(bazaarSideElement.getAttribute("data-obj")).repoURL) {
|
||||
return;
|
||||
}
|
||||
const btnElement = bazzarSideElement.querySelector('[data-type="install"]') as HTMLElement;
|
||||
const btnElement = bazaarSideElement.querySelector('[data-type="install"]') as HTMLElement;
|
||||
if (btnElement) {
|
||||
if (data.percent >= 1) {
|
||||
btnElement.parentElement.classList.add("fn__none");
|
||||
|
|
|
|||
|
|
@ -26,8 +26,12 @@ export const onMessage = (app: App, data: IWebSocketData) => {
|
|||
break;
|
||||
case "sendDeviceNotification":
|
||||
if (window.JSAndroid.sendNotification) {
|
||||
window.JSAndroid.sendNotification(data.data.title, data.data.body, data.data.delayInSeconds);
|
||||
window.JSAndroid.sendNotification(data.data.channel, data.data.title, data.data.body, data.data.delayInSeconds);
|
||||
}
|
||||
if (window.JSHarmony.sendNotification) {
|
||||
window.JSHarmony.sendNotification(data.data.channel, data.data.title, data.data.body, data.data.delayInSeconds);
|
||||
}
|
||||
|
||||
break;
|
||||
case "backgroundtask":
|
||||
if (!document.querySelector("#keyboardToolbar").classList.contains("fn__none") ||
|
||||
|
|
|
|||
|
|
@ -223,12 +223,12 @@ export const afterLoadPlugin = (plugin: Plugin) => {
|
|||
};
|
||||
|
||||
export const reloadPlugin = async (app: App, data: {
|
||||
upsertCodePlugins?: string[],
|
||||
upsertDataPlugins?: string[],
|
||||
unloadPlugins?: string[],
|
||||
uninstallPlugins?: string[],
|
||||
uninstallPlugins?: string[], // 插件卸载
|
||||
unloadPlugins?: string[], // 插件禁用
|
||||
reloadPlugins?: string[], // 插件启用,或插件代码变更
|
||||
dataChangePlugins?: string[], // 插件存储数据变更
|
||||
} = {}) => {
|
||||
const {upsertCodePlugins = [], upsertDataPlugins = [], unloadPlugins = [], uninstallPlugins = []} = data;
|
||||
const {uninstallPlugins = [], unloadPlugins = [], reloadPlugins = [], dataChangePlugins = []} = data;
|
||||
// 禁用
|
||||
unloadPlugins.forEach((item) => {
|
||||
uninstall(app, item, true);
|
||||
|
|
@ -237,12 +237,12 @@ export const reloadPlugin = async (app: App, data: {
|
|||
uninstallPlugins.forEach((item) => {
|
||||
uninstall(app, item, false);
|
||||
});
|
||||
upsertCodePlugins.forEach((item) => {
|
||||
reloadPlugins.forEach((item) => {
|
||||
uninstall(app, item, true);
|
||||
});
|
||||
loadPlugins(app, upsertCodePlugins, false).then(() => {
|
||||
loadPlugins(app, reloadPlugins, false).then(() => {
|
||||
app.plugins.forEach(item => {
|
||||
if (upsertCodePlugins.includes(item.name)) {
|
||||
if (reloadPlugins.includes(item.name)) {
|
||||
afterLoadPlugin(item);
|
||||
getAllEditor().forEach(editor => {
|
||||
editor.protyle.toolbar.update(editor.protyle);
|
||||
|
|
@ -251,7 +251,7 @@ export const reloadPlugin = async (app: App, data: {
|
|||
});
|
||||
});
|
||||
app.plugins.forEach(item => {
|
||||
if (upsertDataPlugins.includes(item.name)) {
|
||||
if (dataChangePlugins.includes(item.name)) {
|
||||
try {
|
||||
item.onDataChanged();
|
||||
} catch (e) {
|
||||
|
|
|
|||
3
app/src/types/index.d.ts
vendored
3
app/src/types/index.d.ts
vendored
|
|
@ -255,7 +255,7 @@ interface Window {
|
|||
getScreenWidthPx(): number
|
||||
exit(): void
|
||||
setWebViewFocusable(enable: boolean): void
|
||||
sendNotification(title: string, body: string, delayInSeconds: number): void
|
||||
sendNotification(channel: string, title: string, body: string, delayInSeconds: number): void
|
||||
};
|
||||
JSHarmony: {
|
||||
showKeyboard(): void
|
||||
|
|
@ -274,6 +274,7 @@ interface Window {
|
|||
getScreenWidthPx(): number
|
||||
exit(): void
|
||||
setWebViewFocusable(enable: boolean): void
|
||||
sendNotification(channel: string, title: string, body: string, delayInSeconds: number): void
|
||||
};
|
||||
|
||||
Protyle: import("../protyle/method").default;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue