diff --git a/plugins/view-resources/src/components/EditDoc.svelte b/plugins/view-resources/src/components/EditDoc.svelte index 1399aabdb7..8a59a46544 100644 --- a/plugins/view-resources/src/components/EditDoc.svelte +++ b/plugins/view-resources/src/components/EditDoc.svelte @@ -93,7 +93,9 @@ return filterKeys(keys, ignoreKeys) } - function updateKeys (ignoreKeys: string[]): void { + let ignoreKeys: string[] = [] + + function updateKeys (): void { const filtredKeys = getFiltredKeys( selectedClass ?? object._class, ignoreKeys, @@ -122,15 +124,21 @@ return editorMixin.editor } + let mainEditor: AnyComponent + + $: if (object) getEditorOrDefault(selectedClass, object._class) + async function getEditorOrDefault ( _class: Ref> | undefined, defaultClass: Ref> - ): Promise { - const editor = _class !== undefined ? await getEditor(_class) : undefined - if (editor !== undefined) { - return editor + ): Promise { + console.log('get editor or default') + let editor = _class !== undefined ? await getEditor(_class) : undefined + if (editor === undefined) { + editor = await getEditor(defaultClass) } - return getEditor(defaultClass) + mainEditor = editor + updateKeys() } async function getCollectionEditor (key: KeyedAttribute): Promise { @@ -218,19 +226,20 @@ {/await}
- {#await getEditorOrDefault(selectedClass, object._class) then is} + {#if mainEditor} { - updateKeys(ev.detail.ignoreKeys) + ignoreKeys = ev.detail.ignoreKeys + updateKeys() }} on:click={(ev) => { fullSize = true rightSection = ev.detail.presenter }} /> - {/await} + {/if}
{#if mixins.length > 0}