Browse Source

Add a monkey patch for the cash's `removeClass` to make it work with IE #768

pull/1035/head
Artur Arseniev 9 years ago
parent
commit
e0b7753261
  1. 4
      dist/grapes.js
  2. 6
      dist/grapes.min.js
  3. 2
      package-lock.json
  4. 2
      package.json
  5. 35
      src/utils/extender.js

4
dist/grapes.js

@ -23676,7 +23676,7 @@ module.exports = function () {
plugins: plugins, plugins: plugins,
// Will be replaced on build // Will be replaced on build
version: '0.14.7', version: '0.14.8',
/** /**
* Initializes an editor based on passed options * Initializes an editor based on passed options
@ -45162,7 +45162,7 @@ module.exports = Backbone.View.extend({
updateScript: function updateScript(view) { updateScript: function updateScript(view) {
if (!view.scriptContainer) { if (!view.scriptContainer) {
view.scriptContainer = $('<div>'); view.scriptContainer = $('<div>');
this.getJsContainer().append(view.scriptContainer.get(0)); this.getJsContainer().appendChild(view.scriptContainer.get(0));
} }
var model = view.model; var model = view.model;

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.7", "version": "0.14.8",
"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.7", "version": "0.14.8",
"author": "Artur Arseniev", "author": "Artur Arseniev",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"homepage": "http://grapesjs.com", "homepage": "http://grapesjs.com",

35
src/utils/extender.js

@ -1,4 +1,4 @@
import { isObject } from 'underscore'; import { isObject, isString, each, isUndefined } from 'underscore';
module.exports = ({ $, Backbone }) => { module.exports = ({ $, Backbone }) => {
if (Backbone) { if (Backbone) {
@ -177,11 +177,36 @@ module.exports = ({ $, Backbone }) => {
return this; return this;
}; };
(fn.remove = function() { // For SVGs in IE
return this.each(node => { (fn.removeClass = function(c) {
return node.parentNode && node.parentNode.removeChild(node); if (!arguments.length) {
}); return this.attr('class', '');
}
const classes = isString(c) && c.match(/\S+/g);
return classes
? this.each(function(el) {
each(classes, function(c) {
if (el.classList) {
el.classList.remove(c);
} else {
const val = el.className;
const bval = el.className.baseVal;
if (!isUndefined(bval)) {
val.baseVal = bval.replace(c, '');
} else {
el.className = val.replace(c, '');
}
}
});
})
: this;
}), }),
(fn.remove = function() {
return this.each(node => {
return node.parentNode && node.parentNode.removeChild(node);
});
}),
// For spectrum compatibility // For spectrum compatibility
(fn.bind = function(ev, h) { (fn.bind = function(ev, h) {
return this.on(ev, h); return this.on(ev, h);

Loading…
Cancel
Save