Skip to content

Commit 3f8a894

Browse files
committed
feat: add new command that runs after mjml import is finished
1 parent 0bb3703 commit 3f8a894

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/command-import-mjml.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export default (editor, opt = {}) => {
1313
editor.DomComponents.getWrapper().set('content', '');
1414
editor.setComponents(code.trim());
1515
editor.Modal.close();
16+
editor.runCommand('mjml-import:change');
1617
};
1718

1819
// Init code viewer

src/commands.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ export default (editor, opt = {}) => {
77
const exportName = opt.overwriteExport ? 'export-template' : 'mjml-export';
88

99
cmd.add('mjml-import', importCommand(editor, opt));
10+
cmd.add('mjml-import:change', {
11+
run() {
12+
const code = editor.getHtml();
13+
return code.trim();
14+
}
15+
});
1016
cmd.add(exportName, exportCommand(editor, opt));
1117

1218
cmd.add(opt.cmdTglImages, tglImagesCommand(opt));

0 commit comments

Comments
 (0)