diff --git a/src/asset_manager/index.js b/src/asset_manager/index.js index 217b881b81..2e723bb5ff 100644 --- a/src/asset_manager/index.js +++ b/src/asset_manager/index.js @@ -202,30 +202,23 @@ module.exports = () => { }, /** - * Load data from the passed object, if the object is empty will try to fetch them - * autonomously from the storage manager. - * The fetched data will be added to the collection + * Load data from the passed object. + * The fetched data will be added to the collection. * @param {Object} data Object of data to load * @return {Object} Loaded assets * @example - * var assets = assetManager.load(); - * // The format below will be used by the editor model - * // to load automatically all the stuff * var assets = assetManager.load({ * assets: [...] * }) * */ - load(data) { - var d = data || ''; - var name = this.storageKey; - if(!d && c.stm) - d = c.stm.load(name); - var assets = d[name] || []; + load(data = {}) { + const name = this.storageKey; + let assets = data[name] || []; if (typeof assets == 'string') { try { - assets = JSON.parse(d[name]); + assets = JSON.parse(data[name]); } catch(err) {} } diff --git a/src/editor/model/Editor.js b/src/editor/model/Editor.js index 7b9cdc531f..0f0ecd1135 100644 --- a/src/editor/model/Editor.js +++ b/src/editor/model/Editor.js @@ -496,7 +496,6 @@ module.exports = Backbone.Model.extend({ */ load(clb = null) { this.getCacheLoad(1, (res) => { - console.log('LOADED in em.load', res); this.get('storables').forEach(module => module.load(res)); clb && clb(res); }); diff --git a/src/parser/model/ParserCss.js b/src/parser/model/ParserCss.js index 015593084d..f19d26ab57 100644 --- a/src/parser/model/ParserCss.js +++ b/src/parser/model/ParserCss.js @@ -74,6 +74,7 @@ module.exports = config => ({ var style = {}; for (var j = 0, len2 = stl.length; j < len2; j++) { var propName = stl[j]; + //console.log('Style', stl, propName, ': ', stl.getPropertyValue(propName)); var important = stl.getPropertyPriority(propName); style[propName] = stl[propName] + (important ? ' !' + important : ''); diff --git a/test/specs/asset_manager/index.js b/test/specs/asset_manager/index.js index 8a48f468d6..fca6f73b64 100644 --- a/test/specs/asset_manager/index.js +++ b/test/specs/asset_manager/index.js @@ -106,7 +106,7 @@ describe('Asset Manager', () => { obj.add(imgObj); obj.store(); obj.remove(imgObj.src); - obj.load(); + obj.load({assets: storage['gjs-assets']}); var asset = obj.get(imgObj.src); expect(asset.get('width')).toEqual(imgObj.width); expect(asset.get('height')).toEqual(imgObj.height); diff --git a/test/specs/grapesjs/index.js b/test/specs/grapesjs/index.js index 8f4861036c..fa394a9299 100644 --- a/test/specs/grapesjs/index.js +++ b/test/specs/grapesjs/index.js @@ -151,8 +151,9 @@ describe('GrapesJS', () => { var editor = obj.init(config); editor.setComponents(htmlString); editor.store(); - var data = editor.load(); - expect(data.html).toEqual(htmlString); + editor.load((data) => { + expect(data.html).toEqual(htmlString); + }); }); it('Execute plugins with custom options', () => { diff --git a/test/specs/storage_manager/index.js b/test/specs/storage_manager/index.js index fd246c3381..ec75dd0087 100644 --- a/test/specs/storage_manager/index.js +++ b/test/specs/storage_manager/index.js @@ -60,7 +60,9 @@ describe('Storage Manager', () => { }); it('Load do not execute if empty', () => { - expect(obj.load(['item'])).toEqual({}); + obj.load(['item'], (res) => { + expect(res).toEqual({}); + }); }); it('Load default storages ', () => { @@ -106,9 +108,10 @@ describe('Storage Manager', () => { data2[id + 'item2'] = 'testData2'; obj.store(data); - var load = obj.load(['item', 'item2']); - expect(storeValue).toEqual(data2); - expect(load).toEqual(data); + obj.load(['item', 'item2'], (res) => { + expect(storeValue).toEqual(data2); + expect(res).toEqual(data); + }); }); }); diff --git a/webpack.config.js b/webpack.config.js index e30f8b3a52..391a1d5019 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,5 +1,3 @@ -//webpack --display-reasons -//Remove jquery https://github.com/webpack/webpack/issues/1275 var webpack = require('webpack'); var pkg = require('./package.json'); var env = process.env.WEBPACK_ENV;