2016-11-23 4 views
0

인라인 모드가 설정된 TinyMCE 플러그인을 사용합니다. 내가하고 싶은 것은 편집자가 닫힌 후에 편집 된 영역의 내용을 얻는 것입니다. 이것은 내가 지금 가지고있는 것입니다 :TinyMCE 인라인 모드 : 편집기에서 편집 영역의 내용을 닫습니다.

tinymce.init({ 
    selector: '.editable', 
    plugins: "link", 
    inline: true, 
    init_instance_callback: function (editor) { 
     editor.on('GetContent', function (e) { 
     console.log(e.content); 
     }); 
    } 
    }); 

그러나이 것은 아무것도 기록하지 않습니다. 어떤 아이디어?

답변

0

당신이이 blur 이벤트 (https://www.tinymce.com/docs/advanced/events/#blur)를 발사 ... 당신이 당신의 TinyMCE에 구성이를 캡처 할 수 있습니다 편집기를 떠날 때마다 :

tinymce.init({ 
    selector: '#my_div", 
    ... 
    setup: function (editor) { 
     editor.on('blur', function (e) { 
      console.log('Editor was blurred!'); 
      // Do what you want when the editor is blurred here 
      console.log(editor.getContent()); //get the content from the editor 
     }); 
    } 
});