2013年4月9日 星期二

CLEditor的Paste as text 在IE無法執行問題

在Google 網上論壇查到一個解法∼
https://groups.google.com/forum/?fromgroups=#!topic/cleditor/mTLtCq-KEes

In version 1.3.0, unminified, change lines 714 - 715 from:

    if (ie && command.toLowerCase() == "inserthtml")
      getRange(editor).pasteHTML(value);

to:

    if (ie && command.toLowerCase() == "inserthtml"){
      /*
      Despite having access to pasteHTML, IE8 will produce an 'unspecified error'
      if it is invoked. The only way to detect this bug is via try catch.
      */
      try{
        getRange(editor).pasteHTML(value);
      }
      catch(e){
        // An empty document needs selection beforehand
        if(/^\s*$/.test(editor.doc.body.innerText)){
          editor.doc.execCommand('selectAll',false, null);
        }

        // execCommand is the standard method for contentEditable elements
        editor.doc.execCommand("Paste", 0, value || null);
      }
    }


將修改後的Script備份如.附件

--
待事以直 是謂君子

沒有留言: