2011-10-26 84 views
2

我工作過的文本編輯器中,有一個插件是爲了在頁面編輯器中添加頁眉和頁腳(基本上是一行表格)而創建的,其中一個業務規則是不要允許移動頁眉或頁腳(我的版本是3.3.8,但我在最後3.4.6測試過)。JQuery方法prepend在Internet Explorer中不起作用

我在basic_config.js中創建了一個方法,基本上在方法「ed.onChange.add(function(ed,l))」的內部調整頁眉或頁腳在用戶試圖將表移動到另一個地方,就像這樣:

  //find out the div of the header 
      var elm = tinyMCE.activeEditor.dom.get("testeHeader"); 

      //case the elm move of position... 
      if(elm != null) { 
       var txt = tinyMCE.activeEditor.dom.getOuterHTML(elm); 
       $(elm).remove(); 
       //relocates the header to the top does not works on IE8. 
       $('#editor1_ifr').contents().find('body').prepend(txt);** 
      } 

在它的工作的Firefox,但在Internet Explorer的德法預先準備失敗,沒有什麼happers

有這個原因的任何解決方案

感謝了一堆的?所有獲得幫助!

回答

0

這可能工作。試一試

var txt = tinyMCE.activeEditor.dom.getOuterHTML(elm); 
$(elm).remove(); 
//relocates the header to the top does not works on IE8. 
var ed = tinyMCE.activeEditor; 
var parent = ed.getBody(); 
parent.insertBefore($(txt).get(0), parent.childNodes[0]); 
+1

您的提示非常適合Firefox(我已經發現了幾種方式,所有的方式都在Firefox上工作),工作完美,但沒有發生在IE8上。而另一個發生是刪除指令,當我嘗試插入一些文本,但當我拖動標題並在編輯器上寫入內容時起作用。刪除指令失敗並且不會刪除。 在IE上設置權限有很多困難。不好意思的朋友,但我正在爲這個任務傳遞一個很大的折磨。 – ricardo

相關問題