Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

refactor: patched preview plugin, minor fixes #62

Merged
merged 1 commit into from
May 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/core/root.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {bind} from '@exadel/esl';
import {ESLBaseElement} from '@exadel/esl/modules/esl-base-element/core';
import {EventUtils} from '@exadel/esl/modules/esl-utils/dom/events';

Expand Down Expand Up @@ -27,6 +28,7 @@ export class UIPRoot extends ESLBaseElement {
this.removeEventListener('request:change', this._onStateChange);
}

@bind
protected _onStateChange(e: CustomEvent) {
this._state = e.detail.markup;
const detail = Object.assign({
Expand Down
1 change: 1 addition & 0 deletions src/preview/preview.less
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ uip-preview {
height: max-content;
width: max-content;
max-width: 100%;

.uip-preview-inner {
display: block;
height: 100vh;
Expand Down
16 changes: 11 additions & 5 deletions src/preview/preview.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
import {memoize} from '@exadel/esl';
import {bind} from '@exadel/esl/modules/esl-utils/decorators/bind';
import {UIPPlugin} from '../core/plugin';

export class UIPPreview extends UIPPlugin {
static is = 'uip-preview';

@memoize()
get $inner() {
const $inner = document.createElement('div');
$inner.classList.add('uip-preview-inner');
return $inner;
}

@bind
protected handleChange(e: CustomEvent): void {
const {markup} = e.detail;
const $inner = document.createElement('div');
$inner.classList.add('uip-preview-inner');
$inner.innerHTML = markup;
this.innerHTML = $inner.outerHTML;
this.$inner.innerHTML = markup;
this.innerHTML = '';
this.appendChild(this.$inner);
}
}

1 change: 1 addition & 0 deletions src/settings/setting/bool-setting/bool-setting.less
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ uip-bool-setting {

input {
margin-left: 3px;
width: 100%;
}
}

Expand Down