diff --git a/src/commands/view/ExportTemplate.ts b/src/commands/view/ExportTemplate.ts index 42bf2aad2..d8272b822 100644 --- a/src/commands/view/ExportTemplate.ts +++ b/src/commands/view/ExportTemplate.ts @@ -1,8 +1,14 @@ import { CommandObject } from './CommandAbstract'; +import { EditorParam } from '../../editor'; import { $ } from '../../common'; +interface ExportTemplateRunOptions { + optsHtml?: EditorParam<'getHtml', 0>; + optsCss?: EditorParam<'getCss', 0>; +} + export default { - run(editor, sender) { + run(editor, sender, opts: ExportTemplateRunOptions = {}) { sender && sender.set && sender.set('active', 0); const config = editor.getConfig(); const modal = editor.Modal; @@ -26,8 +32,8 @@ export default { }) .getModel() .once('change:open', () => editor.stopCommand(`${this.id}`)); - this.htmlEditor.setContent(editor.getHtml()); - this.cssEditor.setContent(editor.getCss()); + this.htmlEditor.setContent(editor.getHtml(opts.optsHtml)); + this.cssEditor.setContent(editor.getCss(opts.optsCss)); }, stop(editor) { diff --git a/src/editor/index.ts b/src/editor/index.ts index 65f38ca7f..24eec7862 100644 --- a/src/editor/index.ts +++ b/src/editor/index.ts @@ -118,6 +118,8 @@ type EditorConfigType = EditorConfig & { pStylePrefix?: string }; type EditorModelParam = Parameters[N]; +export type EditorParam = Parameters[N]; + export default class Editor implements IBaseModule { editorView?: EditorView; editor: EditorModel;