PBH
PBH

Reputation: 1078

Tinymce wiris math editor

I am using Wiris Editor as a plugin in TinyMCE. When I insert equation from Wiris Editor it displays it as an image in TinyMCE - I found this is embedded image but when I click the source tag to save the content it is the mathml format. I am unable to save the equation and searched almost everywhere but could not find a solution and I don't know why this is happening.

screenshot

Upvotes: 1

Views: 1180

Answers (1)

MD Alauddin Al-Amin
MD Alauddin Al-Amin

Reputation: 92

well.. you can not convert mathxml to HTML DOM Elements in a smoothly way. but you can make a trick to trace the code from the inspect element by the help of console.

wiris plugin used to render a iframe so you have to dig into the iframe document first.

    $(function(){

        // here "task_case_in_ifr" is the id for editor iframe div.
        var iframe = $("#task_case_in_ifr")[0];
        var iframeDocument = iframe.contentDocument 
        var iframeContent;
        if (iframeDocument) { 
            // "tinymce" is the id for parent div containing all equation in the div.
            iframeContent = iframeDocument.querySelectorAll('#tinymce');
        }

        var content = iframeContent[0].innerHTML    
        // save to database content variable.. 

        // then show this value from the database on load document in jquery
        // at first load it to the hidden element containing id.
        // eg. div id is "#t1"
        // fetch from the DOM by
        iframeContent[0].innerHTML = $("#t1").html();
    });

Upvotes: 1

Related Questions