UNPKG

grapesjs

Version:

Free and Open Source Web Builder Framework

39 lines (35 loc) 856 B
var TraitView = require('./TraitView'); var InputColor = require('domain_abstract/ui/InputColor'); module.exports = TraitView.extend({ /** * Returns input element * @return {HTMLElement} * @private */ getInputEl() { if (!this.$input) { var value = this.getModelValue(); var inputNumber = new InputColor({ target: this.config.em, contClass: this.ppfx + 'field-color', model: this.model, ppfx: this.ppfx }); this.input = inputNumber.render(); this.$input = this.input.colorEl; value = value || ''; this.model.set('value', value).trigger('change:value'); } return this.$input.get(0); }, /** * Renders input * @private * */ renderField() { if(!this.$input){ this.getInputEl(); this.$el.append(this.input.el); } }, });