From 39d24672ddd696372e55e9b4566f322a322385a8 Mon Sep 17 00:00:00 2001 From: Faton Ramadani Date: Tue, 19 Sep 2023 09:10:17 +0200 Subject: [PATCH] fix(frontend): add missing key (#2299) * fix(frontend): add missing key * fix(frontend): add missing key --- .../editor/settingsPanel/StylePanel.svelte | 285 +++++++++--------- 1 file changed, 144 insertions(+), 141 deletions(-) diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/StylePanel.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/StylePanel.svelte index b94b631a8a..3e7b034804 100644 --- a/frontend/src/lib/components/apps/editor/settingsPanel/StylePanel.svelte +++ b/frontend/src/lib/components/apps/editor/settingsPanel/StylePanel.svelte @@ -113,164 +113,167 @@ }) -{#if component} -
- {#if !cssEditorOpen} - - {:else} -
- {/if} -
- {#if $enterpriseLicense !== undefined} +{#if component} + {#key component?.id} +
+ {#if !cssEditorOpen} + {:else} +
{/if} -
-
- - -
- ID - - {component?.id} - - - - You can customise the CSS and the classes of this component instance. Theses - customisations will only be applied to this component. - -
-
- -
- Global: {type ? ccomponents[type].name : ''} - - - You can customise the CSS and the classes of all components of this type. Theses - customisations will be applied to all components of this type. - -
-
- - - {#if component && component.customCss !== undefined} - {#each Object.keys(ccomponents[component.type].customCss ?? {}) as name} -
- app.set($app)} - shouldDisplayRight={hasStyleValue(component.customCss[name])} - on:right={() => { - copyLocalToGlobal(name, component?.customCss?.[name]) - tab = 'global' - }} - overridding={hasStyleValue($app.css?.[component.type]?.[name]) && - hasStyleValue(component.customCss[name])} - /> -
- {/each} +
+ {#if $enterpriseLicense !== undefined} + {/if} - - - {#if type} - {#each customCssByComponentType ?? [] as { id, forceStyle, forceClass }} -
- {#if $app.css && type && $app.css[type] && component?.customCss} - { - copyGlobalToLocal( - id, - component?.type ? $app?.css?.[component?.type]?.[id] : undefined - ) - tab = 'local' +
+
+ + + +
+ ID + + {component?.id} + + + + You can customise the CSS and the classes of this component instance. Theses + customisations will only be applied to this component. + +
+
+ +
+ Global: {type ? ccomponents[type].name : ''} + + + You can customise the CSS and the classes of all components of this type. Theses + customisations will be applied to all components of this type. + +
+
+ + + {#if component && component.customCss !== undefined} + {#each Object.keys(ccomponents[component.type].customCss ?? {}) as name} +
+ app.set($app)} + shouldDisplayRight={hasStyleValue(component.customCss[name])} + on:right={() => { + copyLocalToGlobal(name, component?.customCss?.[name]) + tab = 'global' }} - overriden={hasStyleValue(component.customCss[id])} - wmClass={getSelector(id)} + overridding={hasStyleValue($app.css?.[component.type]?.[name]) && + hasStyleValue(component.customCss[name])} /> - {/if} -
- {/each} - {/if} -
-
-
+
+ {/each} + {/if} + + + {#if type} + {#each customCssByComponentType ?? [] as { id, forceStyle, forceClass }} +
+ {#if $app.css && type && $app.css[type] && component?.customCss} + { + copyGlobalToLocal( + id, + component?.type ? $app?.css?.[component?.type]?.[id] : undefined + ) + tab = 'local' + }} + overriden={hasStyleValue(component.customCss[id])} + wmClass={getSelector(id)} + /> + {/if} +
+ {/each} + {/if} +
+ + - { - if (overrideGlobalCSS) { - overrideGlobalCSS() + { + if (overrideGlobalCSS) { + overrideGlobalCSS() + overrideGlobalCSS = undefined + } + + sendUserToast('Global CSS overridden') + }} + on:canceled={() => { overrideGlobalCSS = undefined - } + }} + > +
+ The global CSS for this component already exists. Do you want to override it? +
+
- sendUserToast('Global CSS overridden') - }} - on:canceled={() => { - overrideGlobalCSS = undefined - }} - > -
- The global CSS for this component already exists. Do you want to override it? -
-
+ { + if (overrideLocalCSS) { + overrideLocalCSS() + overrideLocalCSS = undefined + } - { - if (overrideLocalCSS) { - overrideLocalCSS() + sendUserToast('Local CSS overridden') + }} + on:canceled={() => { overrideLocalCSS = undefined - } - - sendUserToast('Local CSS overridden') - }} - on:canceled={() => { - overrideLocalCSS = undefined - }} - > -
- The local CSS for this component already exists. Do you want to override it? -
-
- + }} + > +
+ The local CSS for this component already exists. Do you want to override it? +
+
+ + {/key} {:else} Select a component to style it in this panel {/if}