Skip to content

Commit

Permalink
Bump v0.14.15
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed May 5, 2018
1 parent 70281ce commit 08aa4ed
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 20 deletions.
94 changes: 79 additions & 15 deletions dist/grapes.js
Original file line number Diff line number Diff line change
Expand Up @@ -4329,6 +4329,20 @@ var Component = Backbone.Model.extend(_Styleable2.default).extend({
},


/**
* Replace a component with another one
* @param {String|Component} el Component or HTML string
* @return {Array|Component} New added component/s
* @private
*/
replaceWith: function replaceWith(el) {
var coll = this.collection;
var at = coll.indexOf(this);
coll.remove(this);
return coll.add(el, { at: at });
},


/**
* Emit changes for each updated attribute
*/
Expand Down Expand Up @@ -23645,7 +23659,7 @@ module.exports = function () {
plugins: plugins,

// Will be replaced on build
version: '0.14.10',
version: '0.14.15',

/**
* Initializes an editor based on passed options
Expand Down Expand Up @@ -24116,6 +24130,16 @@ module.exports = function (config) {
},


/**
* Return the count of changes made to the content and not yet stored.
* This count resets at any `store()`
* @return {number}
*/
getDirtyCount: function getDirtyCount() {
return em.getDirtyCount();
},


/**
* Update editor dimensions and refresh data useful for positioning of tools
*
Expand Down Expand Up @@ -24287,6 +24311,8 @@ module.exports = function (config) {
* * `storage:end:store` - After the store request
* * `storage:end:load` - After the load request
* * `storage:error` - On any error on storage request, passes the error as an argument
* * `storage:error:store` - Error on store request, passes the error as an argument
* * `storage:error:load` - Error on load request, passes the error as an argument
* ## Canvas
* * `canvas:dragenter` - When something is dragged inside the canvas, `DataTransfer` instance passed as an argument
* * `canvas:dragover` - When something is dragging on canvas, `DataTransfer` instance passed as an argument
Expand Down Expand Up @@ -25072,6 +25098,16 @@ module.exports = Backbone.Model.extend({
},


/**
* Return the count of changes made to the content and not yet stored.
* This count resets at any `store()`
* @return {number}
*/
getDirtyCount: function getDirtyCount() {
return this.get('changesCount');
},


/**
* Set/get data from the HTMLElement
* @param {HTMLElement} el
Expand Down Expand Up @@ -30299,6 +30335,7 @@ module.exports = function () {
var defaultStorages = {};
var eventStart = 'storage:start';
var eventEnd = 'storage:end';
var eventError = 'storage:error';

return {
/**
Expand Down Expand Up @@ -30400,15 +30437,17 @@ module.exports = function () {
* @return {this}
* @example
* storageManager.add('local2', {
* load: function(keys, clb) {
* load: function(keys, clb, clbErr) {
* var res = {};
* for (var i = 0, len = keys.length; i < len; i++){
* var v = localStorage.getItem(keys[i]);
* if(v) res[keys[i]] = v;
* }
* clb(res); // might be called inside some async method
* // In case of errors...
* // clbErr('Went something wrong');
* },
* store: function(data, clb) {
* store: function(data, clb, clbErr) {
* for(var key in data)
* localStorage.setItem(key, data[key]);
* clb(); // might be called inside some async method
Expand Down Expand Up @@ -30482,6 +30521,8 @@ module.exports = function () {
return st ? st.store(toStore, function (res) {
clb && clb(res);
_this.onEnd('store', res);
}, function (err) {
_this.onError('store', err);
}) : null;
},

Expand Down Expand Up @@ -30523,6 +30564,8 @@ module.exports = function () {

clb && clb(result);
_this2.onEnd('load', result);
}, function (err) {
_this2.onError('load', err);
});
} else {
clb && clb(result);
Expand Down Expand Up @@ -30575,6 +30618,19 @@ module.exports = function () {
},


/**
* On error callback
* @private
*/
onError: function onError(ctx, data) {
if (em) {
em.trigger(eventError, data);
ctx && em.trigger(eventError + ':' + ctx, data);
this.onEnd(ctx, data);
}
},


/**
* Check if autoload is possible
* @return {Boolean}
Expand Down Expand Up @@ -30765,12 +30821,17 @@ module.exports = __webpack_require__(0).Model.extend({
/**
* Triggered on request error
* @param {Object} err Error
* @param {Function} [clbErr] Error callback
* @private
*/
onError: function onError(err) {
var em = this.get('em');
console.error(err);
em && em.trigger('storage:error', err);
onError: function onError(err, clbErr) {
if (clbErr) {
clbErr(err);
} else {
var em = this.get('em');
console.error(err);
em && em.trigger('storage:error', err);
}
},


Expand All @@ -30789,32 +30850,35 @@ module.exports = __webpack_require__(0).Model.extend({
clb && clb(res);
em && em.trigger('storage:response', res);
},
store: function store(data, clb) {
store: function store(data, clb, clbErr) {
var body = {};

for (var key in data) {
body[key] = data[key];
}

this.request(this.get('urlStore'), { body: body }, clb);
this.request(this.get('urlStore'), { body: body }, clb, clbErr);
},
load: function load(keys, clb) {
this.request(this.get('urlLoad'), { method: 'get' }, clb);
load: function load(keys, clb, clbErr) {
this.request(this.get('urlLoad'), { method: 'get' }, clb, clbErr);
},


/**
* Execute remote request
* @param {string} url Url
* @param {Object} [opts={}] Options
* @param {[type]} [clb=null] Callback
* @param {Function} [clb=null] Callback
* @param {Function} [clbErr=null] Error callback
* @private
*/
request: function request(url) {
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

var _this = this;

var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var clb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
var clbErr = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;

var typeJson = this.get('contentTypeJson');
var headers = this.get('headers') || {};
Expand Down Expand Up @@ -30868,7 +30932,7 @@ module.exports = __webpack_require__(0).Model.extend({
}).then(function (text) {
return _this.onResponse(text, clb);
}).catch(function (err) {
return _this.onError(err);
return _this.onError(err, clbErr);
});
}
});
Expand Down Expand Up @@ -41012,7 +41076,7 @@ module.exports = Backbone.View.extend({
this.getAssetsEl().scrollTop = 0;

if (handleAdd) {
handleAdd(url);
handleAdd.bind(this)(url);
} else {
this.options.globalCollection.add(url, { at: 0 });
}
Expand Down
6 changes: 3 additions & 3 deletions dist/grapes.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "grapesjs",
"description": "Free and Open Source Web Builder Framework",
"version": "0.14.10",
"version": "0.14.15",
"author": "Artur Arseniev",
"license": "BSD-3-Clause",
"homepage": "http://grapesjs.com",
Expand Down

0 comments on commit 08aa4ed

Please sign in to comment.