mirror of https://github.com/artf/grapesjs.git
committed by
GitHub
8 changed files with 128 additions and 109 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,24 +1,28 @@ |
|||||
import { template } from 'underscore'; |
import html from 'utils/html'; |
||||
import Backbone from 'backbone'; |
import { View } from 'backbone'; |
||||
|
|
||||
export default Backbone.View.extend({ |
export default class EditorView extends View { |
||||
template: template(` |
template({ pfx, codeName, label }) { |
||||
<div class="<%= pfx %>editor" id="<%= pfx %><%= codeName %>"> |
return html` |
||||
<div id="<%= pfx %>title"><%= label %></div> |
<div class="${pfx}editor" id="${pfx}${codeName}"> |
||||
<div id="<%= pfx %>code"></div> |
<div id="${pfx}title">${label}</div> |
||||
</div>`), |
<div id="${pfx}code"></div> |
||||
|
</div> |
||||
|
`;
|
||||
|
} |
||||
|
|
||||
initialize(o) { |
initialize(o) { |
||||
this.config = o.config || {}; |
this.config = o.config || {}; |
||||
this.pfx = this.config.stylePrefix; |
this.pfx = this.config.stylePrefix; |
||||
}, |
} |
||||
|
|
||||
render() { |
render() { |
||||
var obj = this.model.toJSON(); |
const { model, pfx, $el } = this; |
||||
obj.pfx = this.pfx; |
const obj = model.toJSON(); |
||||
this.$el.html(this.template(obj)); |
obj.pfx = pfx; |
||||
this.$el.attr('class', this.pfx + 'editor-c'); |
$el.html(this.template(obj)); |
||||
this.$el.find('#' + this.pfx + 'code').append(this.model.get('input')); |
$el.attr('class', `${pfx}editor-c`); |
||||
|
$el.find(`#${pfx}code`).append(model.get('input')); |
||||
return this; |
return this; |
||||
} |
} |
||||
}); |
} |
||||
|
|||||
Loading…
Reference in new issue