Browse Source

TS ExportTemplate

ts-style-manager
Artur Arseniev 4 years ago
parent
commit
e75f187448
  1. 9
      src/commands/view/ExportTemplate.ts
  2. 4
      src/editor/index.ts

9
src/commands/view/ExportTemplate.js → src/commands/view/ExportTemplate.ts

@ -1,8 +1,9 @@
import Backbone from 'backbone';
import { CustomCommand } from './CommandAbstract';
const $ = Backbone.$;
export default {
run(editor, sender, opts = {}) {
run(editor, sender) {
sender && sender.set && sender.set('active', 0);
const config = editor.getConfig();
const modal = editor.Modal;
@ -25,7 +26,7 @@ export default {
content: this.$editors,
})
.getModel()
.once('change:open', () => editor.stopCommand(this.id));
.once('change:open', () => editor.stopCommand(`${this.id}`));
this.htmlEditor.setContent(editor.getHtml());
this.cssEditor.setContent(editor.getCss());
},
@ -35,7 +36,7 @@ export default {
modal && modal.close();
},
buildEditor(codeName, theme, label) {
buildEditor(codeName: string, theme: string, label: string) {
const input = document.createElement('textarea');
!this.codeMirror && (this.codeMirror = this.cm.getViewer('CodeMirror'));
@ -55,4 +56,4 @@ export default {
return { el, $el };
},
};
} as CustomCommand<{}, { [k: string]: any }>;

4
src/editor/index.ts

@ -215,7 +215,7 @@ export default class EditorModule implements IBaseModule<EditorConfig> {
* @param {Boolean} [opts.cleanId=false] Remove unnecessary IDs (eg. those created automatically)
* @returns {string} HTML string
*/
getHtml(opts: any) {
getHtml(opts?: any) {
return this.em.getHtml(opts);
}
@ -229,7 +229,7 @@ export default class EditorModule implements IBaseModule<EditorConfig> {
* @param {Boolean} [opts.keepUnusedStyles=false] Force keep all defined rules. Toggle on in case output looks different inside/outside of the editor.
* @returns {String|Array<CssRule>} CSS string or array of CssRules
*/
getCss(opts: any) {
getCss(opts?: any) {
return this.em.getCss(opts);
}

Loading…
Cancel
Save