feat(client): プラグインを無効にできるように
This commit is contained in:
parent
6b8354ccbf
commit
595ad04ddb
5 changed files with 45 additions and 5 deletions
|
@ -14,9 +14,9 @@ export function createAiScriptEnv(vm, opts) {
|
|||
text: text.value,
|
||||
});
|
||||
}),
|
||||
'Mk:confirm': values.FN_NATIVE(async ([title, text]) => {
|
||||
'Mk:confirm': values.FN_NATIVE(async ([title, text, type]) => {
|
||||
const confirm = await vm.$root.dialog({
|
||||
type: 'warning',
|
||||
type: type ? type.value : 'question',
|
||||
showCancelButton: true,
|
||||
title: title.value,
|
||||
text: text.value,
|
||||
|
@ -44,12 +44,13 @@ export function createAiScriptEnv(vm, opts) {
|
|||
|
||||
export function createPluginEnv(vm, opts) {
|
||||
const config = new Map();
|
||||
for (const [k, v] of Object.entries(opts.plugin.config)) {
|
||||
for (const [k, v] of Object.entries(opts.plugin.config || {})) {
|
||||
config.set(k, jsToVal(opts.plugin.configData[k] || v.default));
|
||||
}
|
||||
|
||||
return {
|
||||
...createAiScriptEnv(vm, { ...opts, token: opts.plugin.token }),
|
||||
//#region Deprecated
|
||||
'Mk:register_post_form_action': values.FN_NATIVE(([title, handler]) => {
|
||||
vm.$store.commit('registerPostFormAction', { pluginId: opts.plugin.id, title: title.value, handler });
|
||||
}),
|
||||
|
@ -59,6 +60,16 @@ export function createPluginEnv(vm, opts) {
|
|||
'Mk:register_note_action': values.FN_NATIVE(([title, handler]) => {
|
||||
vm.$store.commit('registerNoteAction', { pluginId: opts.plugin.id, title: title.value, handler });
|
||||
}),
|
||||
//#endregion
|
||||
'Plugin:register_post_form_action': values.FN_NATIVE(([title, handler]) => {
|
||||
vm.$store.commit('registerPostFormAction', { pluginId: opts.plugin.id, title: title.value, handler });
|
||||
}),
|
||||
'Plugin:register_user_action': values.FN_NATIVE(([title, handler]) => {
|
||||
vm.$store.commit('registerUserAction', { pluginId: opts.plugin.id, title: title.value, handler });
|
||||
}),
|
||||
'Plugin:register_note_action': values.FN_NATIVE(([title, handler]) => {
|
||||
vm.$store.commit('registerNoteAction', { pluginId: opts.plugin.id, title: title.value, handler });
|
||||
}),
|
||||
'Plugin:config': values.OBJ(config),
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue