Browse Source

Up ExportTemplate

pull/5176/head
Artur Arseniev 3 years ago
parent
commit
534f269dfd
  1. 13
      src/commands/view/ExportTemplate.ts

13
src/commands/view/ExportTemplate.ts

@ -1,6 +1,6 @@
import { CommandObject } from './CommandAbstract'; import { CommandObject } from './CommandAbstract';
import { EditorParam } from '../../editor'; import { EditorParam } from '../../editor';
import { $ } from '../../common'; import { createEl } from '../../utils/dom';
interface ExportTemplateRunOptions { interface ExportTemplateRunOptions {
optsHtml?: EditorParam<'getHtml', 0>; optsHtml?: EditorParam<'getHtml', 0>;
@ -15,20 +15,21 @@ export default {
const pfx = config.stylePrefix; const pfx = config.stylePrefix;
this.cm = editor.CodeManager || null; this.cm = editor.CodeManager || null;
if (!this.$editors) { if (!this.editors) {
const oHtmlEd = this.buildEditor('htmlmixed', 'hopscotch', 'HTML'); const oHtmlEd = this.buildEditor('htmlmixed', 'hopscotch', 'HTML');
const oCsslEd = this.buildEditor('css', 'hopscotch', 'CSS'); const oCsslEd = this.buildEditor('css', 'hopscotch', 'CSS');
this.htmlEditor = oHtmlEd.model; this.htmlEditor = oHtmlEd.model;
this.cssEditor = oCsslEd.model; this.cssEditor = oCsslEd.model;
const $editors = $(`<div class="${pfx}export-dl"></div>`); const editors = createEl('div', { class: `${pfx}export-dl` });
$editors.append(oHtmlEd.el).append(oCsslEd.el); editors.appendChild(oHtmlEd.el);
this.$editors = $editors; editors.appendChild(oCsslEd.el);
this.editors = editors;
} }
modal modal
.open({ .open({
title: config.textViewCode, title: config.textViewCode,
content: this.$editors, content: this.editors,
}) })
.getModel() .getModel()
.once('change:open', () => editor.stopCommand(`${this.id}`)); .once('change:open', () => editor.stopCommand(`${this.id}`));

Loading…
Cancel
Save