GrapesJS does not work in IE11
GrapesJS does not work in IE11 as many of the JS function are not supported (e.g. remove().. , "`", blob.map..
Can you show me exactly what kind of errors do you have?
-
content: `<di
3.

This is when I use IE 11 when items are dragged into the Canvas or using filestack. MS Edge it is ok. (JavaScript ECMA compatibility differences)
thanks @altalker unfortunately, I'm not able to check those issues right now but hope to do so soon
Actually have dnd broken on Edge as well. Just doesn't work
hey @nicksav can you post please your errors
I am facing the same problem when using GrapesJs on IE11. Even http://grapesjs.com/demo.html is not working fine. I am getting these errors:
when I drag the components/blocks to the canvas(even before I drop them).
I think it's clear that we have to add some polyfill for those methods, but at the moment, it's just not my priority (can't even test them properly), so... PRs are welcome
@altalker wich Windows version are you using?
I added polyfill for these methods and now it is working fine on IE too. Here is the code I added for 'assign' method in the .js file I am using:
if (typeof Object.assign != 'function') { Object.defineProperty(Object, "assign", { value: function assign(target, varArgs) { 'use strict'; if (target == null) { throw new TypeError('Cannot convert undefined or null to object'); } var to = Object(target); for (var index = 1; index < arguments.length; index++) { var nextSource = arguments[index]; if (nextSource != null) { for (var nextKey in nextSource) { if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { to[nextKey] = nextSource[nextKey]; } } } } return to; }, writable: true, configurable: true }); }
and here is the code I added before the use of 'matches' function in grapes.min.js:
if (!object.matches) object.matches = object.msMatchesSelector || object.webkitMatchesSelector;
As IE does not support these methods so before using matches function in grapes.min.js, we are going to check if any object.matches method exists. If not then define object.matches with object.msMatchesSelector(this is supported by IE instead of matches).
@artf I can change babel presets with env preset. It should work with appropriate configuration. Or we can add babel-polyfill to this configuration
Can anybody try the latest version (the demo is updated too) and report if you get errors in console?
@artf Can you please help me out. It is not working for me also. I have tried the demo , it is not working as well. @umangpasricha if you have working copy of js which works in IE11 can you please send me?
Yes, GrapesJS editor is working fine on Firefox, Chrome. IE11 and safari at my end. The changes I made in my code are: In index file, I added the following code:
if (typeof Object.assign != 'function') { Object.defineProperty(Object, "assign", { value: function assign(target, varArgs) { 'use strict'; if (target == null) { throw new TypeError('Cannot convert undefined or null to object'); } var to = Object(target); for (var index = 1; index < arguments.length; index++) { var nextSource = arguments[index]; if (nextSource != null) { for (var nextKey in nextSource) { if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) { to[nextKey] = nextSource[nextKey]; } } } } return to; }, writable: true, configurable: true }); }
Then I made some changes in the grapes.min.js file. Here I am attaching this file as .txt: grapesminjs.txt
@vishal5033 do you see any error in console? @umangpasricha what about the current demo (v0.12.25) in IE11? Can you tell me if you see any error
@artf Yes I am getting the same error:
Object doesn't support property or method 'assign'
To resolve this I added the same code(mentioned above) in index.php file at my end.
@ateshuseyin seems like babel-preset-env doesn't work as expected 🤔 or I'm missing something?
@artf I'm busy next 2 days but I will be look at as soon as possible
I m getting this error when I am running grapesjs with MJML in IE11 SCRIPT5007: Unable to get property 'plugins' of undefined or null reference File: grapesjs-mjml.min.js, Line: 61790, Column: 1 I made the changes given by umangpasricha mentioned above. but still not working. I am using the grapesJS latest version 0.12.30 and latest grapesmjml version 0.0.26 Please help me out to resolve this issue asap. Thanks.
I fond the problem. I forgot to add babel-polyfill into project. So new js features was undefined in old browsers like Object.assign. fixed and sended a pull request #515.
So, are there any one who will test with IE. I am a mac user also. You can test by http://grapesjs-ie-polyfill.surge.sh/