Browse Source

Merge branch 'dev' into multi-frame

pull/2524/head
Artur Arseniev 6 years ago
parent
commit
ce0a03435f
  1. 68
      dist/grapes.js
  2. 8
      dist/grapes.min.js
  3. 2
      dist/grapes.min.js.map
  4. 2
      package-lock.json
  5. 2
      package.json
  6. 44
      src/style_manager/view/PropertyView.js

68
dist/grapes.js

@ -32626,13 +32626,14 @@ var compProt = _ComponentView__WEBPACK_IMPORTED_MODULE_2__["default"].prototype;
}
e && e.stopPropagation && e.stopPropagation();
var rte = this.rte;
var rte = this.rte,
em = this.em;
if (rte) {
try {
this.activeRte = rte.enable(this, this.activeRte);
} catch (err) {
console.error(err);
em.logError(err);
}
}
@ -32649,14 +32650,15 @@ var compProt = _ComponentView__WEBPACK_IMPORTED_MODULE_2__["default"].prototype;
disableEditing: function disableEditing() {
var model = this.model,
rte = this.rte,
activeRte = this.activeRte;
activeRte = this.activeRte,
em = this.em;
var editable = model.get('editable');
if (rte && editable) {
try {
rte.disable(this, activeRte);
} catch (err) {
console.error(err);
em.logError(err);
}
this.syncContent();
@ -32715,6 +32717,7 @@ var compProt = _ComponentView__WEBPACK_IMPORTED_MODULE_2__["default"].prototype;
return model.is(type);
}) || textable;
model.set(_objectSpread({
_innertext: !selectable,
editable: selectable && model.get('editable'),
selectable: selectable,
hoverable: selectable,
@ -33015,7 +33018,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
this.attr = model.get('attributes');
this.classe = this.attr.class || [];
this.listenTo(model, 'change:style', this.updateStyle);
this.listenTo(model, 'change:attributes', this.renderAttributes);
this.listenTo(model, 'change:attributes change:_innertext', this.renderAttributes);
this.listenTo(model, 'change:highlightable', this.updateHighlight);
this.listenTo(model, 'change:status', this.updateStatus);
this.listenTo(model, 'change:script', this.reset);
@ -33196,11 +33199,17 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
* @private
* */
updateStyle: function updateStyle() {
var em = this.em;
var model = this.model;
var model = this.model,
em = this.em,
el = this.el;
if (em && em.getConfig('avoidInlineStyle')) {
this.el.id = model.getId();
if (model.get('_innertext')) {
el.removeAttribute('id');
} else {
el.id = model.getId();
}
var style = model.getStyle();
!Object(underscore__WEBPACK_IMPORTED_MODULE_2__["isEmpty"])(style) && model.setStyle(style);
} else {
@ -33253,12 +33262,13 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
var _model$attributes = model.attributes,
highlightable = _model$attributes.highlightable,
textable = _model$attributes.textable,
type = _model$attributes.type;
type = _model$attributes.type,
_innertext = _model$attributes._innertext;
var draggableComponents = config.draggableComponents;
var defaultAttr = _objectSpread({
'data-gjs-type': type || 'default'
}, draggableComponents ? {
}, draggableComponents && !_innertext ? {
draggable: true
} : {}, {}, highlightable ? {
'data-highlightable': 1
@ -36944,7 +36954,7 @@ var defaultConfig = {
editors: editors,
plugins: plugins,
// Will be replaced on build
version: '0.15.11',
version: '0.15.13',
/**
* Initialize the editor with passed options
@ -46694,6 +46704,7 @@ var clearProp = 'data-clear-style';
this.listenTo(model, 'targetUpdated', this.targetUpdated);
this.listenTo(model, 'change:visible', this.updateVisibility);
this.listenTo(model, 'change:status', this.updateStatus);
this.listenTo(model, 'change:name change:className change:full', this.render);
var init = this.init && this.init.bind(this);
init && init();
},
@ -46865,12 +46876,40 @@ var clearProp = 'data-clear-style';
status: status,
targetValue: targetValue,
defaultValue: defaultValue,
computedValue: computedValue
computedValue: computedValue,
value: value
};
em.trigger('styleManager:change', this, property, value, data);
em.trigger("styleManager:change:".concat(property), this, value, data);
this._emitUpdate(data);
}
},
_emitUpdate: function _emitUpdate() {
var addData = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var em = this.em,
model = this.model;
if (!em) return;
var property = model.get('property');
var data = _objectSpread({}, this._getEventData(), {}, addData);
var id = data.id;
em.trigger('style:update', data);
em.trigger("style:update:".concat(property), data);
property !== id && em.trigger("style:update:".concat(id), data);
},
_getEventData: function _getEventData() {
var model = this.model;
return {
propertyView: this,
targets: this.getTargets(),
value: model.getFullValue(),
property: model,
id: model.get('id'),
name: model.get('property')
};
},
checkVisibility: function checkVisibility() {
var result = 1; // Check if need to hide the property
@ -47009,6 +47048,8 @@ var clearProp = 'data-clear-style';
em.trigger('component:styleUpdate', component, prop);
em.trigger("component:styleUpdate:".concat(prop), component);
}
this._emitUpdate();
},
/**
@ -47175,9 +47216,10 @@ var clearProp = 'data-clear-style';
var el = this.el;
var property = model.get('property');
var full = model.get('full');
var cls = model.get('className') || '';
var className = "".concat(pfx, "property");
el.innerHTML = this.template(model);
el.className = "".concat(className, " ").concat(pfx).concat(model.get('type'), " ").concat(className, "__").concat(property);
el.className = "".concat(className, " ").concat(pfx).concat(model.get('type'), " ").concat(className, "__").concat(property, " ").concat(cls).trim();
el.className += full ? " ".concat(className, "--full") : '';
this.updateStatus();
var onRender = this.onRender && this.onRender.bind(this);

8
dist/grapes.min.js

File diff suppressed because one or more lines are too long

2
dist/grapes.min.js.map

File diff suppressed because one or more lines are too long

2
package-lock.json

@ -1,6 +1,6 @@
{
"name": "grapesjs",
"version": "0.15.11",
"version": "0.15.13",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

2
package.json

@ -1,7 +1,7 @@
{
"name": "grapesjs",
"description": "Free and Open Source Web Builder Framework",
"version": "0.15.11",
"version": "0.15.13",
"author": "Artur Arseniev",
"license": "BSD-3-Clause",
"homepage": "http://grapesjs.com",

44
src/style_manager/view/PropertyView.js

@ -90,6 +90,11 @@ export default Backbone.View.extend({
this.listenTo(model, 'targetUpdated', this.targetUpdated);
this.listenTo(model, 'change:visible', this.updateVisibility);
this.listenTo(model, 'change:status', this.updateStatus);
this.listenTo(
model,
'change:name change:className change:full',
this.render
);
const init = this.init && this.init.bind(this);
init && init();
@ -253,12 +258,44 @@ export default Backbone.View.extend({
model.setValue(value, 0, { fromTarget: 1, ...opts });
if (em) {
const data = { status, targetValue, defaultValue, computedValue };
const data = {
status,
targetValue,
defaultValue,
computedValue,
value
};
em.trigger('styleManager:change', this, property, value, data);
em.trigger(`styleManager:change:${property}`, this, value, data);
this._emitUpdate(data);
}
},
_emitUpdate(addData = {}) {
const { em, model } = this;
if (!em) return;
const property = model.get('property');
const data = { ...this._getEventData(), ...addData };
const { id } = data;
em.trigger('style:update', data);
em.trigger(`style:update:${property}`, data);
property !== id && em.trigger(`style:update:${id}`, data);
},
_getEventData() {
const { model } = this;
return {
propertyView: this,
targets: this.getTargets(),
value: model.getFullValue(),
property: model,
id: model.get('id'),
name: model.get('property')
};
},
checkVisibility() {
var result = 1;
@ -395,6 +432,8 @@ export default Backbone.View.extend({
em.trigger('component:styleUpdate', component, prop);
em.trigger(`component:styleUpdate:${prop}`, component);
}
this._emitUpdate();
},
/**
@ -570,11 +609,12 @@ export default Backbone.View.extend({
const el = this.el;
const property = model.get('property');
const full = model.get('full');
const cls = model.get('className') || '';
const className = `${pfx}property`;
el.innerHTML = this.template(model);
el.className = `${className} ${pfx}${model.get(
'type'
)} ${className}__${property}`;
)} ${className}__${property} ${cls}`.trim();
el.className += full ? ` ${className}--full` : '';
this.updateStatus();

Loading…
Cancel
Save