froala / wysiwyg-editor

The next generation Javascript WYSIWYG HTML Editor.
https://www.froala.com/wysiwyg-editor
Other
5.28k stars 673 forks source link

IE 11: Object doesn't support property or method 'includes' (when switching to code view, fix included) #3659

Open jmiserez opened 5 years ago

jmiserez commented 5 years ago
Expected behavior.

Froala should not crash on IE 11.

Actual behavior.

String.includes is not defined in IE: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes

The code in question is at line 20923: if (editor.codeBeautifier && !html.includes('fr-embedly')) {

which means Froala throws an exception:

[ERROR] Unexpected error: Object doesn't support property or method 'includes'
TypeError: Object doesn't support property or method 'includes'
   at _showHTML (http://localhost:8082/res/froala/froala_editor.pkgd.js:20923:7)
   at toggle (http://localhost:8082/res/froala/froala_editor.pkgd.js:21012:9)
   at callback (http://localhost:8082/res/froala/froala_editor.pkgd.js:21124:7)
   at exec (http://localhost:8082/res/froala/froala_editor.pkgd.js:2530:11)
   at exec (http://localhost:8082/res/froala/froala_editor.pkgd.js:13053:7)
   at _commandButtonClick (http://localhost:8082/res/froala/froala_editor.pkgd.js:13061:7)
   at click (http://localhost:8082/res/froala/froala_editor.pkgd.js:13093:11)
   at _click (http://localhost:8082/res/froala/froala_editor.pkgd.js:13103:7)
   at _buttonMouseUp (http://localhost:8082/res/froala/froala_editor.pkgd.js:1942:9)
   at Anonymous function (http://localhost:8082/res/froala/froala_editor.pkgd.js:1974:11)

Fix The fix is to change the code as follows: if (editor.codeBeautifier && html.indexOf('fr-embedly') >= 0) {

Steps to reproduce the problem.

Switch to code view on IE 11, with some content loaded.

Editor version.

3.0.5

OS.

Windows 10 Enterprise 1903 18362.329

Browser.

IE 11 (11.295.18362.0, Update version 11.0.140)

jmiserez commented 5 years ago

@casualuser Any reason this is not tagged as a bug like the other issues? It is in fact a simple bug.

JaxonWright commented 4 years ago

This also happens when changing Paragraph Format while all plugins are enabled. It appears that the plugins.js file is using .includes in a lot of places. For all of these places, fixing it for IE would be the same thing as described in OP.

This is easily replicable here: https://www.froala.com/wysiwyg-editor/examples/full-featured

JaxonWright commented 4 years ago

If you want to, you can add this polyfill to your code to make IE11 support String.includes(). That way you do not need to wait for Froala to fix the problem.

polamayster commented 3 years ago

If you want to, you can add this polyfill to your code to make IE11 support String.includes(). That way you do not need to wait for Froala to fix the problem.

Is there at least approximate/rough estimate when the bug will be fixed?

JaxonWright commented 3 years ago

If you want to, you can add this polyfill to your code to make IE11 support String.includes(). That way you do not need to wait for Froala to fix the problem.

Is there at least approximate/rough estimate when the bug will be fixed?

I wish! I am not a developer of Froala 😄