mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-07 11:00:09 +08:00
🚨
This commit is contained in:
parent
1ac623ebb1
commit
d24f5ae3cf
@ -637,7 +637,7 @@ export const bazaar = {
|
|||||||
} else if (type === "plugin-enable") {
|
} else if (type === "plugin-enable") {
|
||||||
const itemElement = hasClosestByClassName(target, "b3-card");
|
const itemElement = hasClosestByClassName(target, "b3-card");
|
||||||
if (itemElement) {
|
if (itemElement) {
|
||||||
const enabled = (target as HTMLInputElement).checked
|
const enabled = (target as HTMLInputElement).checked;
|
||||||
fetchPost("/api/petal/setPetalEnabled", {
|
fetchPost("/api/petal/setPetalEnabled", {
|
||||||
packageName: dataObj.name,
|
packageName: dataObj.name,
|
||||||
enabled,
|
enabled,
|
||||||
|
@ -493,7 +493,7 @@ export const zoomOut = (protyle: IProtyle, id: string, focusId?: string, isPushB
|
|||||||
}
|
}
|
||||||
/// #if !MOBILE
|
/// #if !MOBILE
|
||||||
if (protyle.model) {
|
if (protyle.model) {
|
||||||
const allModels = getAllModels()
|
const allModels = getAllModels();
|
||||||
allModels.outline.forEach(item => {
|
allModels.outline.forEach(item => {
|
||||||
if (item.blockId === protyle.block.rootID) {
|
if (item.blockId === protyle.block.rootID) {
|
||||||
item.setCurrent(protyle.wysiwyg.element.querySelector(`[data-node-id="${focusId || id}"]`));
|
item.setCurrent(protyle.wysiwyg.element.querySelector(`[data-node-id="${focusId || id}"]`));
|
||||||
|
@ -7,27 +7,27 @@ export const uninstall = (app: App, name: string) => {
|
|||||||
app.plugins.find((plugin: Plugin, index) => {
|
app.plugins.find((plugin: Plugin, index) => {
|
||||||
if (plugin.name === name) {
|
if (plugin.name === name) {
|
||||||
// rm tab
|
// rm tab
|
||||||
const modelsKeys = Object.keys(plugin.models)
|
const modelsKeys = Object.keys(plugin.models);
|
||||||
getAllModels().custom.forEach(custom => {
|
getAllModels().custom.forEach(custom => {
|
||||||
if (modelsKeys.includes(custom.type)) {
|
if (modelsKeys.includes(custom.type)) {
|
||||||
custom.parent.parent.removeTab(custom.parent.id)
|
custom.parent.parent.removeTab(custom.parent.id);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
// rm topbar
|
// rm topbar
|
||||||
plugin.topBarIcons.forEach(item => {
|
plugin.topBarIcons.forEach(item => {
|
||||||
item.remove();
|
item.remove();
|
||||||
})
|
});
|
||||||
// rm dock
|
// rm dock
|
||||||
const docksKeys = Object.keys(plugin.docks)
|
const docksKeys = Object.keys(plugin.docks);
|
||||||
docksKeys.forEach(key => {
|
docksKeys.forEach(key => {
|
||||||
if (Object.keys(window.siyuan.layout.leftDock.data).includes(key)) {
|
if (Object.keys(window.siyuan.layout.leftDock.data).includes(key)) {
|
||||||
window.siyuan.layout.leftDock.remove(key)
|
window.siyuan.layout.leftDock.remove(key);
|
||||||
} else if (Object.keys(window.siyuan.layout.rightDock.data).includes(key)) {
|
} else if (Object.keys(window.siyuan.layout.rightDock.data).includes(key)) {
|
||||||
window.siyuan.layout.rightDock.remove(key)
|
window.siyuan.layout.rightDock.remove(key);
|
||||||
} else if (Object.keys(window.siyuan.layout.bottomDock.data).includes(key)) {
|
} else if (Object.keys(window.siyuan.layout.bottomDock.data).includes(key)) {
|
||||||
window.siyuan.layout.bottomDock.remove(key)
|
window.siyuan.layout.bottomDock.remove(key);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
exportLayout({
|
exportLayout({
|
||||||
reload: false,
|
reload: false,
|
||||||
onlyData: false,
|
onlyData: false,
|
||||||
@ -39,10 +39,10 @@ export const uninstall = (app: App, name: string) => {
|
|||||||
item.remove();
|
item.remove();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
// rm plugin
|
// rm plugin
|
||||||
app.plugins.splice(index, 1)
|
app.plugins.splice(index, 1);
|
||||||
return true
|
return true;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
@ -21,7 +21,6 @@ import {openFileById} from "../../editor/util";
|
|||||||
import {getCurrentWindow, systemPreferences} from "@electron/remote";
|
import {getCurrentWindow, systemPreferences} from "@electron/remote";
|
||||||
/// #endif
|
/// #endif
|
||||||
import {onGet} from "../util/onGet";
|
import {onGet} from "../util/onGet";
|
||||||
import {saveScroll} from "../scroll/saveScroll";
|
|
||||||
import {hideElements} from "../ui/hideElements";
|
import {hideElements} from "../ui/hideElements";
|
||||||
import {confirmDialog} from "../../dialog/confirmDialog";
|
import {confirmDialog} from "../../dialog/confirmDialog";
|
||||||
import {reloadProtyle} from "../util/reload";
|
import {reloadProtyle} from "../util/reload";
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {hasClosestBlock} from "../util/hasClosest";
|
import {hasClosestBlock} from "../util/hasClosest";
|
||||||
import {focusByOffset, getSelectionOffset} from "../util/selection";
|
import {getSelectionOffset} from "../util/selection";
|
||||||
import {fetchPost} from "../../util/fetch";
|
import {fetchPost} from "../../util/fetch";
|
||||||
import {onGet} from "../util/onGet";
|
import {onGet} from "../util/onGet";
|
||||||
import {Constants} from "../../constants";
|
import {Constants} from "../../constants";
|
||||||
@ -50,12 +50,12 @@ export const getDocByScroll = (options: {
|
|||||||
cb?: () => void
|
cb?: () => void
|
||||||
focus?: boolean
|
focus?: boolean
|
||||||
}) => {
|
}) => {
|
||||||
let actions: string[] = []
|
let actions: string[] = [];
|
||||||
if (options.mergedOptions) {
|
if (options.mergedOptions) {
|
||||||
actions = options.mergedOptions.action
|
actions = options.mergedOptions.action;
|
||||||
} else {
|
} else {
|
||||||
if (options.focus) {
|
if (options.focus) {
|
||||||
actions = [Constants.CB_GET_UNUNDO, Constants.CB_GET_FOCUS]
|
actions = [Constants.CB_GET_UNUNDO, Constants.CB_GET_FOCUS];
|
||||||
} else {
|
} else {
|
||||||
actions = [Constants.CB_GET_UNUNDO];
|
actions = [Constants.CB_GET_UNUNDO];
|
||||||
}
|
}
|
||||||
@ -70,7 +70,7 @@ export const getDocByScroll = (options: {
|
|||||||
}, response => {
|
}, response => {
|
||||||
onGet(response, options.protyle, actions, options.scrollAttr);
|
onGet(response, options.protyle, actions, options.scrollAttr);
|
||||||
if (options.cb) {
|
if (options.cb) {
|
||||||
options.cb()
|
options.cb();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ export const getDocByScroll = (options: {
|
|||||||
}, response => {
|
}, response => {
|
||||||
onGet(response, options.protyle, actions, options.scrollAttr);
|
onGet(response, options.protyle, actions, options.scrollAttr);
|
||||||
if (options.cb) {
|
if (options.cb) {
|
||||||
options.cb()
|
options.cb();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -360,4 +360,4 @@ const focusElement = (protyle: IProtyle, options: {
|
|||||||
}
|
}
|
||||||
/// #endif
|
/// #endif
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
@ -306,7 +306,7 @@ export const setKey = (isSync:boolean, cb?:() => void) => {
|
|||||||
dialog.element.querySelector(".b3-button--cancel").addEventListener("click", () => {
|
dialog.element.querySelector(".b3-button--cancel").addEventListener("click", () => {
|
||||||
dialog.destroy();
|
dialog.destroy();
|
||||||
});
|
});
|
||||||
const genBtnElement = dialog.element.querySelector("#initKeyByPW")
|
const genBtnElement = dialog.element.querySelector("#initKeyByPW");
|
||||||
dialog.element.querySelector(".b3-switch").addEventListener("change", function () {
|
dialog.element.querySelector(".b3-switch").addEventListener("change", function () {
|
||||||
if (this.checked) {
|
if (this.checked) {
|
||||||
genBtnElement.removeAttribute("disabled");
|
genBtnElement.removeAttribute("disabled");
|
||||||
@ -331,7 +331,7 @@ export const setKey = (isSync:boolean, cb?:() => void) => {
|
|||||||
fetchPost("/api/repo/initRepoKeyFromPassphrase", {pass: inputElements[0].value}, (response) => {
|
fetchPost("/api/repo/initRepoKeyFromPassphrase", {pass: inputElements[0].value}, (response) => {
|
||||||
window.siyuan.config.repo.key = response.data.key;
|
window.siyuan.config.repo.key = response.data.key;
|
||||||
if (cb) {
|
if (cb) {
|
||||||
cb()
|
cb();
|
||||||
}
|
}
|
||||||
if (isSync) {
|
if (isSync) {
|
||||||
setSync(response.data.key, dialog);
|
setSync(response.data.key, dialog);
|
||||||
|
@ -2,13 +2,12 @@ import {hasClosestBlock, hasClosestByAttribute} from "../protyle/util/hasClosest
|
|||||||
import {getContenteditableElement} from "../protyle/wysiwyg/getBlock";
|
import {getContenteditableElement} from "../protyle/wysiwyg/getBlock";
|
||||||
import {focusByOffset, focusByRange, getSelectionOffset} from "../protyle/util/selection";
|
import {focusByOffset, focusByRange, getSelectionOffset} from "../protyle/util/selection";
|
||||||
import {hideElements} from "../protyle/ui/hideElements";
|
import {hideElements} from "../protyle/ui/hideElements";
|
||||||
import {fetchPost, fetchSyncPost} from "./fetch";
|
import {fetchSyncPost} from "./fetch";
|
||||||
import {Constants} from "../constants";
|
import {Constants} from "../constants";
|
||||||
import {Wnd} from "../layout/Wnd";
|
import {Wnd} from "../layout/Wnd";
|
||||||
import {getInstanceById, getWndByLayout} from "../layout/util";
|
import {getInstanceById, getWndByLayout} from "../layout/util";
|
||||||
import {Tab} from "../layout/Tab";
|
import {Tab} from "../layout/Tab";
|
||||||
import {Editor} from "../editor";
|
import {Editor} from "../editor";
|
||||||
import {onGet} from "../protyle/util/onGet";
|
|
||||||
import {scrollCenter} from "./highlightById";
|
import {scrollCenter} from "./highlightById";
|
||||||
import {zoomOut} from "../menus/protyle";
|
import {zoomOut} from "../menus/protyle";
|
||||||
import {showMessage} from "../dialog/message";
|
import {showMessage} from "../dialog/message";
|
||||||
|
Loading…
Reference in New Issue
Block a user