elrte doesn't work with Internet Explorer 11 (IE11)

◇◆丶佛笑我妖孽 提交于 2019-12-13 11:14:02

问题


elrte doesn't work with Internet Explorer 11 (IE11)

Added by Hank Valery 18 days ago

Hi,

Microsoft is deploying IE11 with Windows Updates, so I tried out how it works with elrte. Unfortunately there are serious problems.

When you start typing, the text won't include on cursors position. It appears at the beginning of the editor, but seems to be outside the formatting body. After clicking "editor" you will recognize the typed in text isn't available.

Is there a solution to get IE work with elrte again? This problem didn't exist in IE8-IE10.

Thank you


回答1:


It's hard to be certain; I don't know the elRTC software at all.

However a very quick look around in the source code reveals that it uses browser detection to switch how certain features work in different browsers -- in particular, there are a number of references in the code to $.browser.msie, which is the jQuery browser detection property.

This is problematic for two reasons:

  • Firstly, the jQuery browser detection feature is deprecated: recent versions of jQuery don't even include the $.browser property by default. It is possible to get it back by using the jQuery migrate library, but not ideal; it's deprecated for a reason, so relying it isn't really good practice in the long term. The fact that elRTE is relying on deprecated features in jQuery may cause other problems for your code as new browser versions are released, and will also make it harder for you to upgrade to a newer jQuery version.

  • Secondly, IE11 made a number of changes which break a lot of existing browser detection scripts. I'm not sure about $.browser.msie, but the paragraph above means that it's likely that you're using a version of jQuery that was released before IE11 existed, which means there's not way it would know about those changes.

My advice is to do the following:

  1. Post a ticket on the github issue tracker for erLTE to report the issue to them. Also check for other tickets that might already have reported it. There may also be updates in the github code that haven't made it into a formal release yet which may address the issue.

  2. Grab the latest version of jQuery (v1.10.2 at the time of writing), and also the jQuery.migrate library. Use those instead of whatever version you're currently using. If you're lucky, the latest version of the migrate library may have been updated to correctly detect IE11, and if you're really lucky, that might resolve the issue without any further work. I can't guarantee it but it's worth a try.

  3. Another option you might want to consider is switching to an alternative tool. CKEditor and TinyMCE seem to be the most popular tools of this type at the moment, but there are quite a few other editors available. You might want to try them out.




回答2:


You can use the following META-Tag on the editor's page to ask IE to render the page as in IE 10:

<meta http-equiv="X-UA-Compatible" content="IE=10" />



回答3:


When you pushed Enter key, are the symptom that all input contents disappear?

It was first aid, but I could solved the probrem.

I tried "elRTE 1.3" ,"elFinder 2.1_n" .

  • Upgrade jquery & jquery UI I upgraded jquery 1.11.2 jquery.ui 1.10.1. when you use bootstrap3 and elFinder of a latest version, it would be able to be more happily.
  • Modify "elrte.full.js"

line 1:
  //<-- add start($.browser replica?)
  $.browser = { 
    msie: /Trident/i.test(navigator.userAgent) && !window.opera,
    msie11: /Trident/i.test(navigator.userAgent) && !/msie/i.test(navigator.userAgent) && !window.opera
  };
  //add end($.browser replica?)-->
line 1329?:
  .bind('keydown', function(e) {
line 1335?:
  ......
    if (self.dom.selfOrParent(n, /^PRE$/)) {
      self.selection.insertNode(self.doc.createTextNode("\r\n"));
      return false;
    } else if ($.browser.safari && e.shiftKey) {
      self.selection.insertNode(self.doc.createElement('br'));
      return false;
    }
    //<--add start(for IE11)
    else if( $.browser.msie11){
      self.selection.insertNode(self.doc.createElement('br'));
      return true;
    }
    //add end(for IE11) -->
  }

example.html

...
  <!-- jQuery 1.11.2 UI 1.10.1 -->
  <script type="text/javascript" src="../js/jquery-1.11.2.js"></script>
  <script src="../js/jquery-ui-1.10.1.custom.min.js" type="text/javascript" charset="utf-8"></script>
  <link rel="stylesheet" href="../css/ui-themes/smoothness/jquery-ui-1.10.1.custom.css" type="text/css" media="screen" title="no title" charset="utf-8">

  <!-- elRTE 1.3 -->
  <script src="../js/el/js/elrte.full.js" type="text/javascript" charset="utf-8"></script>
  <link rel="stylesheet" href="../js/el/css/elrte.min.css" type="text/css" media="screen" charset="utf-8">

  <!-- elFinder 2.1_n -->
  <link rel="stylesheet" type="text/css" href="../js/el/css/elfinder.min.css">
  <link rel="stylesheet" type="text/css" href="../js/el/css/theme.css">
  <script src="../js/el/js/elfinder.min.js"></script>

  <script type="text/javascript" charset="utf-8">
    $(function() {
      $('.wysiwyg').elrte({
        height   : 450,
        toolbar  : 'complete',
        cssfiles : ['css/elrte-inner.css'],
        fmOpen : function(callback) {
          $('<div/>').dialogelfinder({
            url : './el/connector.php',
            commandsOptions: {
              getfile : {
                oncomplete : 'close',
                onlyURL : true
              }
            },
            getFileCallback :callback
          });
        }
      });
    });
  </script>
  ...


来源:https://stackoverflow.com/questions/20347154/elrte-doesnt-work-with-internet-explorer-11-ie11

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!