|
|
|
@ -1,12 +1,14 @@ |
|
|
|
import Backbone from 'backbone'; |
|
|
|
import { View } from '../../common'; |
|
|
|
import { appendStyles } from '../../utils/mixins'; |
|
|
|
import EditorModel from '../model/Editor'; |
|
|
|
|
|
|
|
const $ = Backbone.$; |
|
|
|
|
|
|
|
export default class EditorView extends View { |
|
|
|
initialize() { |
|
|
|
const { model } = this; |
|
|
|
export default class EditorView extends View<EditorModel> { |
|
|
|
constructor(model: EditorModel) { |
|
|
|
super({model}) |
|
|
|
//const { model } = this;
|
|
|
|
const { Panels, UndoManager } = model.attributes; |
|
|
|
model.view = this; |
|
|
|
model.once('change:ready', () => { |
|
|
|
@ -22,15 +24,15 @@ export default class EditorView extends View { |
|
|
|
|
|
|
|
render() { |
|
|
|
const { $el, model } = this; |
|
|
|
const { Panels, Canvas, modules } = model.attributes; |
|
|
|
const conf = model.getConfig(); |
|
|
|
const pfx = conf.stylePrefix; |
|
|
|
const contEl = $(conf.el || `body ${conf.container}`); |
|
|
|
appendStyles(conf.cssIcons, { unique: 1, prepand: 1 }); |
|
|
|
const { Panels, Canvas } = model.attributes; |
|
|
|
const { config, modules } = model; |
|
|
|
const pfx = config.stylePrefix; |
|
|
|
const contEl = $(config.el || `body ${config.container}`); |
|
|
|
appendStyles(config.cssIcons, { unique: 1, prepand: 1 }); |
|
|
|
$el.empty(); |
|
|
|
|
|
|
|
if (conf.width) contEl.css('width', conf.width); |
|
|
|
if (conf.height) contEl.css('height', conf.height); |
|
|
|
if (config.width) contEl.css('width', config.width); |
|
|
|
if (config.height) contEl.css('height', config.height); |
|
|
|
|
|
|
|
$el.append(Canvas.render()); |
|
|
|
$el.append(Panels.render()); |