UNPKG

@blinkk/editor

Version:

Structured content editor with live previews.

41 lines 1.43 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PreviewPart = void 0; const _1 = require("."); const selective_edit_1 = require("@blinkk/selective-edit"); const frame_1 = require("./preview/frame"); const toolbar_1 = require("./preview/toolbar"); class PreviewPart extends _1.BasePart { constructor(config) { super(); this.config = config; this.parts = { frame: new frame_1.PreviewFramePart({ state: this.config.state, storage: this.config.storage, }), toolbar: new toolbar_1.PreviewToolbarPart({ state: this.config.state, storage: this.config.storage, }), }; } classesForPart() { return { le__part__preview: true, 'le__part__preview--device_mode': (this.parts.toolbar.isDeviceMode || false) && Boolean(this.parts.toolbar.device), }; } get isExpanded() { return this.parts.toolbar.isExpanded || false; } template(editor) { return selective_edit_1.html `<div class=${selective_edit_1.classMap(this.classesForPart())}> ${this.parts.toolbar.template(editor)} ${this.parts.frame.template(editor, this.parts.toolbar.device, this.parts.toolbar.isRotated)} </div>`; } } exports.PreviewPart = PreviewPart; //# sourceMappingURL=preview.js.map