Browse Source

Bump v0.14.15

pull/1042/merge v0.14.15
Artur Arseniev 9 years ago
parent
commit
08aa4ed739
  1. 94
      dist/grapes.js
  2. 6
      dist/grapes.min.js
  3. 2
      package-lock.json
  4. 2
      package.json

94
dist/grapes.js

@ -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 * Emit changes for each updated attribute
*/ */
@ -23645,7 +23659,7 @@ module.exports = function () {
plugins: plugins, plugins: plugins,
// Will be replaced on build // Will be replaced on build
version: '0.14.10', version: '0.14.15',
/** /**
* Initializes an editor based on passed options * Initializes an editor based on passed options
@ -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 * Update editor dimensions and refresh data useful for positioning of tools
* *
@ -24287,6 +24311,8 @@ module.exports = function (config) {
* * `storage:end:store` - After the store request * * `storage:end:store` - After the store request
* * `storage:end:load` - After the load request * * `storage:end:load` - After the load request
* * `storage:error` - On any error on storage request, passes the error as an argument * * `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
* * `canvas:dragenter` - When something is dragged inside the canvas, `DataTransfer` instance passed as an argument * * `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 * * `canvas:dragover` - When something is dragging on canvas, `DataTransfer` instance passed as an argument
@ -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 * Set/get data from the HTMLElement
* @param {HTMLElement} el * @param {HTMLElement} el
@ -30299,6 +30335,7 @@ module.exports = function () {
var defaultStorages = {}; var defaultStorages = {};
var eventStart = 'storage:start'; var eventStart = 'storage:start';
var eventEnd = 'storage:end'; var eventEnd = 'storage:end';
var eventError = 'storage:error';
return { return {
/** /**
@ -30400,15 +30437,17 @@ module.exports = function () {
* @return {this} * @return {this}
* @example * @example
* storageManager.add('local2', { * storageManager.add('local2', {
* load: function(keys, clb) { * load: function(keys, clb, clbErr) {
* var res = {}; * var res = {};
* for (var i = 0, len = keys.length; i < len; i++){ * for (var i = 0, len = keys.length; i < len; i++){
* var v = localStorage.getItem(keys[i]); * var v = localStorage.getItem(keys[i]);
* if(v) res[keys[i]] = v; * if(v) res[keys[i]] = v;
* } * }
* clb(res); // might be called inside some async method * 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) * for(var key in data)
* localStorage.setItem(key, data[key]); * localStorage.setItem(key, data[key]);
* clb(); // might be called inside some async method * clb(); // might be called inside some async method
@ -30482,6 +30521,8 @@ module.exports = function () {
return st ? st.store(toStore, function (res) { return st ? st.store(toStore, function (res) {
clb && clb(res); clb && clb(res);
_this.onEnd('store', res); _this.onEnd('store', res);
}, function (err) {
_this.onError('store', err);
}) : null; }) : null;
}, },
@ -30523,6 +30564,8 @@ module.exports = function () {
clb && clb(result); clb && clb(result);
_this2.onEnd('load', result); _this2.onEnd('load', result);
}, function (err) {
_this2.onError('load', err);
}); });
} else { } else {
clb && clb(result); clb && clb(result);
@ -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 * Check if autoload is possible
* @return {Boolean} * @return {Boolean}
@ -30765,12 +30821,17 @@ module.exports = __webpack_require__(0).Model.extend({
/** /**
* Triggered on request error * Triggered on request error
* @param {Object} err Error * @param {Object} err Error
* @param {Function} [clbErr] Error callback
* @private * @private
*/ */
onError: function onError(err) { onError: function onError(err, clbErr) {
var em = this.get('em'); if (clbErr) {
console.error(err); clbErr(err);
em && em.trigger('storage:error', err); } else {
var em = this.get('em');
console.error(err);
em && em.trigger('storage:error', err);
}
}, },
@ -30789,17 +30850,17 @@ module.exports = __webpack_require__(0).Model.extend({
clb && clb(res); clb && clb(res);
em && em.trigger('storage:response', res); em && em.trigger('storage:response', res);
}, },
store: function store(data, clb) { store: function store(data, clb, clbErr) {
var body = {}; var body = {};
for (var key in data) { for (var key in data) {
body[key] = data[key]; 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) { load: function load(keys, clb, clbErr) {
this.request(this.get('urlLoad'), { method: 'get' }, clb); this.request(this.get('urlLoad'), { method: 'get' }, clb, clbErr);
}, },
@ -30807,14 +30868,17 @@ module.exports = __webpack_require__(0).Model.extend({
* Execute remote request * Execute remote request
* @param {string} url Url * @param {string} url Url
* @param {Object} [opts={}] Options * @param {Object} [opts={}] Options
* @param {[type]} [clb=null] Callback * @param {Function} [clb=null] Callback
* @param {Function} [clbErr=null] Error callback
* @private * @private
*/ */
request: function request(url) { request: function request(url) {
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var _this = this; 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 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 typeJson = this.get('contentTypeJson');
var headers = this.get('headers') || {}; var headers = this.get('headers') || {};
@ -30868,7 +30932,7 @@ module.exports = __webpack_require__(0).Model.extend({
}).then(function (text) { }).then(function (text) {
return _this.onResponse(text, clb); return _this.onResponse(text, clb);
}).catch(function (err) { }).catch(function (err) {
return _this.onError(err); return _this.onError(err, clbErr);
}); });
} }
}); });
@ -41012,7 +41076,7 @@ module.exports = Backbone.View.extend({
this.getAssetsEl().scrollTop = 0; this.getAssetsEl().scrollTop = 0;
if (handleAdd) { if (handleAdd) {
handleAdd(url); handleAdd.bind(this)(url);
} else { } else {
this.options.globalCollection.add(url, { at: 0 }); this.options.globalCollection.add(url, { at: 0 });
} }

6
dist/grapes.min.js

File diff suppressed because one or more lines are too long

2
package-lock.json

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

2
package.json

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

Loading…
Cancel
Save