Skip to content

Commit

Permalink
fix(settings/editor): rollback
Browse files Browse the repository at this point in the history
  • Loading branch information
nattallius committed Nov 14, 2022
1 parent ef17a6e commit 897d619
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/plugins/editor/editor.less
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
border-top: 1px solid @section-border;
}

.uip-root[editor-collapsed] & {
&.collapsed {
max-height: 0;

&-inner {
Expand Down
13 changes: 8 additions & 5 deletions src/plugins/editor/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,14 @@ export class UIPEditor extends UIPPlugin {
const attr = e.detail.attribute;
const value = e.detail.value;

if (attr === 'dark-theme') {
return this.setEditorConfig({
theme: value === null ?
UIPEditor.defaultOptions.theme : UIPEditor.themesMapping['uip-dark']
});
switch (attr) {
case 'dark-theme':
return this.setEditorConfig({theme: value === null ?
UIPEditor.defaultOptions.theme : UIPEditor.themesMapping['uip-dark']});
case 'editor-collapsed':
return this.classList.toggle('collapsed', value !== null);
default:
return;
}
}
}
4 changes: 2 additions & 2 deletions src/plugins/settings/settings.less
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
padding: 0 5px;
}

.uip-root[settings-collapsed] & {
&.collapsed {
max-width: 0;

&-inner {
Expand All @@ -51,7 +51,7 @@
.scrollbar-expanded();
}

.uip-root[settings-collapsed] & {
&.collapsed {
max-height: 0;
max-width: 100%;

Expand Down
6 changes: 6 additions & 0 deletions src/plugins/settings/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,10 @@ export class UIPSettings extends UIPPlugin {
protected _onRootStateChange(): void {
this.settings.forEach(setting => setting.updateFrom(this.model!));
}

@listen({event: 'uip:configchange', target: '::parent(.uip-root)'})
protected _onRootConfigChange(e: CustomEvent) {
if (e.detail.attribute !== 'settings-collapsed') return false;
this.classList.toggle('collapsed', e.detail.value !== null);
}
}

0 comments on commit 897d619

Please sign in to comment.