mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 17:40:13 +01:00
This commit is contained in:
parent
fdf9f0d9e4
commit
1ac623ebb1
5 changed files with 79 additions and 17 deletions
|
|
@ -15,6 +15,7 @@ import {hasClosestByAttribute, hasClosestByClassName} from "../protyle/util/hasC
|
|||
import {Plugin} from "../plugin";
|
||||
import {App} from "../index";
|
||||
import {escapeAttr} from "../util/escape";
|
||||
import {uninstall} from "../plugin/uninstall";
|
||||
|
||||
export const bazaar = {
|
||||
element: undefined as Element,
|
||||
|
|
@ -571,12 +572,7 @@ export const bazaar = {
|
|||
this._genMyHTML(bazaarType, app);
|
||||
bazaar._onBazaar(response, bazaarType, ["themes", "icons"].includes(bazaarType));
|
||||
if (bazaarType === "plugins") {
|
||||
// TODO destroy plugin
|
||||
exportLayout({
|
||||
reload: true,
|
||||
onlyData: false,
|
||||
errorExit: false,
|
||||
});
|
||||
uninstall(app, packageName);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -641,16 +637,20 @@ export const bazaar = {
|
|||
} else if (type === "plugin-enable") {
|
||||
const itemElement = hasClosestByClassName(target, "b3-card");
|
||||
if (itemElement) {
|
||||
const enabled = (target as HTMLInputElement).checked
|
||||
fetchPost("/api/petal/setPetalEnabled", {
|
||||
packageName: dataObj.name,
|
||||
enabled: (target as HTMLInputElement).checked
|
||||
enabled,
|
||||
}, () => {
|
||||
// TODO destroy plugin
|
||||
exportLayout({
|
||||
reload: true,
|
||||
onlyData: false,
|
||||
errorExit: false,
|
||||
});
|
||||
if (enabled) {
|
||||
exportLayout({
|
||||
reload: true,
|
||||
onlyData: false,
|
||||
errorExit: false,
|
||||
});
|
||||
} else {
|
||||
uninstall(app, dataObj.name);
|
||||
}
|
||||
});
|
||||
}
|
||||
event.stopPropagation();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue