9
<script>
    function TinyMceGetStatsLost(inst) {
        alert("The HTML is now:" + inst.getBody().innerHTML);            
    }


    tinymce.init({
        selector: "textarea",
        language: "ru",
        plugins: [
            "advlist autolink lists link charmap anchor",
            "searchreplace fullscreen",
            "insertdatetime paste"
        ],
        toolbar: "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link",
        onchange_callback : "TinyMceGetStatsLost"
    });
</script>

i use this code but callback not working. In console i do not see errors...

Tell me please why callback not work ?

1 Answers1

19

The onchange_callback setting (3.x branch) seems to have been removed in the 4.x branch of TinyMCE. You would need to use the setup option to include your external function. Example:

<script type="text/javascript">
tinymce.init({
    selector: "textarea",
    setup: function (ed) {
        ed.on("change", function () {
            TinyMceGetStatsLost(ed);
        })
    }
});
function TinyMceGetStatsLost(inst) {
    alert("The HTML is now:" + inst.getBody().innerHTML);           
}
</script>
Sam
  • 1,096
  • 11
  • 10