Skip to content

Commit

Permalink
fix(config): fix teleport to top level with downward offset, fix #248
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Dec 11, 2023
1 parent e6c1813 commit dd5d5f8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion plugins/config/client/components/tree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ function handleCollapse(data: Tree, target: Node, instance) {
function handleDrop(source: Node, target: Node, position: 'before' | 'after' | 'inner', event: DragEvent) {
const parent = position === 'inner' ? target : target.parent
const index = parent.childNodes.findIndex(node => node.data.path === source.data.path)
let index = parent.childNodes.findIndex(node => node.data.path === source.data.path)
if (!parent.data.path) index -= 1 // global config
send('manager/teleport', source.data.parent?.path ?? '', source.data.id, parent.data.path, index)
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/config/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@koishijs/plugin-config",
"description": "Manage your bots and plugins with console",
"version": "2.5.2",
"version": "2.5.3",
"main": "lib/node/index.js",
"types": "lib/index.d.ts",
"exports": {
Expand Down
4 changes: 3 additions & 1 deletion plugins/config/src/shared/writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ export class ConfigWriter extends DataService<Context.Config> {
const [name] = key.split(':', 1)
if (key.slice(name.length + 1) === ident) return [config, key]
if (name === 'group' || name === '~group') {
return this.resolveConfig(ident, config[key])
try {
return this.resolveConfig(ident, config[key])
} catch {}
}
}
throw new Error('plugin not found')
Expand Down

0 comments on commit dd5d5f8

Please sign in to comment.