diff --git a/plugins/setting-resources/src/components/ClassAttributesList.svelte b/plugins/setting-resources/src/components/ClassAttributesList.svelte index c871cab179..08ed8d19a2 100644 --- a/plugins/setting-resources/src/components/ClassAttributesList.svelte +++ b/plugins/setting-resources/src/components/ClassAttributesList.svelte @@ -99,13 +99,12 @@ async function showMenu (ev: MouseEvent, attribute: AnyAttribute, row: number): Promise { hovered = row const exist = (await client.findOne(attribute.attributeOf, { [attribute.name]: { $exists: true } })) !== undefined - const actions: Action[] = [ { label: presentation.string.Edit, icon: IconEdit, action: async () => { - dispatch('select', attribute._id) + dispatch('select', attribute) } } ] @@ -118,7 +117,7 @@ } }) } - const extra = await getContextActions(client, attribute, { mode: 'context' }) + const extra = await getContextActions(client, attribute, { mode: 'context' }, core.class.Attribute) actions.push( ...extra.map((it) => ({ label: it.label, diff --git a/plugins/setting-resources/src/components/CreateAttribute.svelte b/plugins/setting-resources/src/components/CreateAttribute.svelte index aafb28ebe3..55df7b4503 100644 --- a/plugins/setting-resources/src/components/CreateAttribute.svelte +++ b/plugins/setting-resources/src/components/CreateAttribute.svelte @@ -58,7 +58,7 @@ const data: Data = { attributeOf: _class, - name: name.trim().replace('/', '').replace(' ', '') + '_' + generateId(), + name: 'custom' + generateId(), label: getEmbeddedLabel(name), isCustom: true, type, diff --git a/plugins/setting-resources/src/components/typeEditors/ArrayEditor.svelte b/plugins/setting-resources/src/components/typeEditors/ArrayEditor.svelte index 8d66dc9579..ba204a913d 100644 --- a/plugins/setting-resources/src/components/typeEditors/ArrayEditor.svelte +++ b/plugins/setting-resources/src/components/typeEditors/ArrayEditor.svelte @@ -44,7 +44,8 @@ ) }) - let refClass: Ref | undefined = type !== undefined ? hierarchy.getClass(type.of._class)._id : undefined + let refClass: Ref | undefined = + type?.of?._class !== undefined ? hierarchy.getClass(type.of._class)._id : undefined $: selected = types.find((p) => p._id === refClass) diff --git a/plugins/view-resources/src/actions.ts b/plugins/view-resources/src/actions.ts index 54a2fffef6..d190b5dbc9 100644 --- a/plugins/view-resources/src/actions.ts +++ b/plugins/view-resources/src/actions.ts @@ -136,9 +136,10 @@ export async function getContextActions ( context: { mode: ViewContextType application?: Ref - } + }, + derived: Ref> = core.class.Doc ): Promise { - const result = await getActions(client, doc, undefined, context.mode) + const result = await getActions(client, doc, derived, context.mode) if (context.application !== undefined) { return result.filter((it) => it.context.application === context.application || it.context.application === undefined)