xdan / jodit

Jodit - Best WYSIWYG Editor for You
https://xdsoft.net/jodit/
MIT License
1.71k stars 354 forks source link

Issues in IE 11 #265

Open newmangreen opened 5 years ago

newmangreen commented 5 years ago
  1. In IE 11, enter a text and change font size. Then change font again, second time it is not changing view.

It is OK with version 3.1.92: https://jsbin.com/jilawobora/1/edit?html,output Not working with version 3.2.46: https://jsbin.com/bibuqumume/1/edit?html,output

  1. When inserting image from local disk, it gives "Need URL for AJAX request" error message. It works in Firefox and Chrome. Here options:

    uploader: {
    url: "/MyURL.do",
         prepareData: function (formdata) {  
         formdata.append("Command", "MyCommand");
         var file = formdata.getAll("files[0]")[0];
         formdata.append("MyFileElement", file);
         return formdata;
    },
    headers: {"X-Requested-With": "XMLHttpRequest"}
    }
  2. (IE-Chrome-Firefox), header value is sent to server duplicate. With above uploader options, "X-Requested-With" header is sent as "XMLHttpRequest XMLHttpRequest".

  3. (Firefox) Ace editor is not initialized in code view and because of default style, code is not visible.

redking00 commented 4 years ago

It seems that IE is not compatible with Function.prototype.name. This lack renders isJoditObject function unable to recognize jodit's intances. This is the cause of some failures in IE. Another problem is the lack of Array.includes support. Both problems seem to be short-term fixable using polyfills, but it would be nice if they were included in the source code.

redking00 commented 4 years ago

I don´t know the reason but build/jodit.min.js is not just the minified version of build/jodit.js. May be is webpack discarding the polyfills? Anyway if you includes jodit.js instead jodit.min.js the polyfill are there and at least point 2 is fixed.

Opened an issue #305

xdan commented 4 years ago

@redking00 I checked build/jodit.min.js and it has polyfill for includes Array.prototype.includes||(Array.prototype.includes=function(e){return this.indexOf(e)>-1})} and since 3.2.61 isJoditObject does not use Function.prototype.name Is the problem still relevant?

redking00 commented 4 years ago

Sorry, using https://github.com/xdan/jodit/releases/latest, changed issue to outdated link on webpage

newmangreen commented 4 years ago

I tried "3.3.2" release. 1. Fixed 2. I included, jodit.css and jodit.js but following error is taken on server: File not found: jodit/es6-promise.map I find it from internet and added it but IE still gives "getAll is not supported" in following code:

    url: "blaurl",
    prepareData: function (formdata) {
        formdata.append("BlaBla", "Bla");
        var file = formdata.getAll("files[0]")[0];
        return formdata;
    },

This version also breaks Chrome image upload. When uploaded it just shows image name now.

{
  "success": true,
  "time": "2019-12-17 11:33:43.316",
  "data": {
    "baseurl": "SomeURL?FileID=",
    "path": "",
    "files": [
      "123"
    ],
    "messages": []
  }
}
This is shown in editor:
SomeURL?FileID=123

3. Still same. 4. Not checked yet.

xdan commented 4 years ago

Hi, @newmangreen 2)

File not found: jodit/es6-promise.map

Please, use jodit.min.css and jodit.min.js files

url: "blaurl",
  prepareData: function (formdata) {
      formdata.append("BlaBla", "Bla");
      var file = formdata.getAll("files[0]")[0];
      return formdata;
  },

What dow you want to do here? file variable does't use;

{
  "success": true,
  "time": "2019-12-17 11:33:43.316",
  "data": {
    "baseurl": "SomeURL?FileID=",
    "path": "",
    "files": [
      "123"
    ],
    "messages": []
  }
}

What server side script do you use?

  1. Show me full code please, how can i repeat it?
  2. Give me example page, please. Because here https://xdsoft.net/jodit/play.html?defaultMode=2 all works fine
newmangreen commented 4 years ago

Please, use jodit.min.css and jodit.min.js files

I tried these but same.

Here is my full init code:

var editor = new Jodit(domElement, {
    "height": height,
    showWordsCounter: false,
    showCharsCounter: false,
    showXPathInStatusbar: false,
    toolbarSticky: false,
    uploader: {
        url: "/MyServerURL",
        prepareData: function (formdata) {
            formdata.append("MyCmd", "SaveDocument");
            formdata.append("MyRTF", "true");
            var file = formdata.getAll("files[0]")[0];
            formdata.append("MyUploadDocuments", file);
            return formdata;
        },
        headers: {"X-Requested-With": "XMLHttpRequest"}
    }
});

In prepareData method, I wanted to include some more parameters in addition to uploaded image but getAll is not found in IE.

Your play.html link generates file uploader as following which is different than my configuration, please try to use prepareData to see the problem:

var editor = new Jodit("#editor", {
  "uploader": {
    "insertImageAsBase64URI": true
  }
});