2012-10-26 2 views
2

asp.net 앱에서 TinyMCE를 사용하고 서버의 텍스트 영역 내용을 설정하고 있습니다. 문제는 페이지가로드 되 자마자 편집자가 초기화 될 때까지 잠시 동안 텍스트 영역에 원시 HTML이 표시된다는 것입니다. 나는 display : none을 textareas에 설정 한 다음, onnit 루틴의 각 텍스트 영역에서 .next(). show()를 호출했다. 편집자가 될 필요가있는 크기가 아님을 제외하고는 (아마도 기본 편집자 초기화시 텍스트 영역이 숨겨져 있습니까?)편집기가 초기화 될 때까지 TinyMCE 내용 숨기기

다른 사람들이이 문제를 어떻게 해결합니까?

var content = $('textarea_id').html(); 
$('textarea_id').html(''); 

tinyMCE.init({ 
    ... 
    setup : function(ed) { 
    ed.onInit.add(function(ed, evt) { 
      ed.setContent(content); 
     }); 
    }, 
    ... 

}); 

답변

0

당신은 다음 빈 설정, 텍스트 영역의 내용을 저장하고 편집기가 초기화있어 후 TinyMCE에 컨텐츠를 재설정 할 수 다음과 같이 :

//Before loading, hide textarea element using visibility='hidden' so that the space the element takes will be maintained 
document.querySelector('.editor').style.visibility = 'hidden'; 

tinyMCE.init({ 
    editor_selector: "editor", 
    setup: function (ed) { 
     ed.onInit.add(function (ed, evt) { 
      //show the element again now that the editor is loaded. 
      document.querySelector('.editor').style.visibility = 'visible'; 
     }); 
    } 
}); 
0

난 그냥이 질문을 가로 질러 와서 내 솔루션을 떠나기로 결심 :

감사

관련 문제