Browse Source

Add log option to the main config object

pull/1518/head
Artur Arseniev 7 years ago
parent
commit
2c44334490
  1. 5
      src/editor/config/config.js
  2. 8
      src/editor/model/Editor.js

5
src/editor/config/config.js

@ -30,6 +30,11 @@ module.exports = {
// Width for the editor container
width: '100%',
// Type of logs to print with the logger (by default is used the devtool console).
// Available by default: debug, info, warning, error
// You can use `false` to disable all of them or `true` to print all of them
log: ['warning', 'error'],
// By default Grapes injects base CSS into the canvas. For example, it sets body margin to 0
// and sets a default background color of white. This CSS is desired in most cases.
// use this property if you wish to overwrite the base CSS to your own CSS. This is most

8
src/editor/model/Editor.js

@ -60,6 +60,7 @@ module.exports = Backbone.Model.extend({
this.set('toLoad', []);
this.set('storables', []);
const el = c.el;
const log = c.log;
if (el && c.fromElement) this.config.components = el.innerHTML;
this.attrsOrig = el
@ -74,6 +75,13 @@ module.exports = Backbone.Model.extend({
this.on('change:componentHovered', this.componentHovered, this);
this.on('change:changesCount', this.updateChanges, this);
if (log === true) {
this.listenTo(this, 'log:debug', console.log);
this.listenTo(this, 'log:info', console.info);
this.listenTo(this, 'log:warning', console.warn);
this.listenTo(this, 'log:error', console.error);
}
// Deprecations
[{ from: 'change:selectedComponent', to: 'component:toggled' }].forEach(
event => {

Loading…
Cancel
Save