• Hi,

    TinyMCE is displayed correctly in LeanDash Question. But I want to add the TinyMCE editor to the answers text area too. Is this possible?

    Thank you

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi egymido,

    I did it by using Wiris MathType for WordPress.

    https://docs.wiris.com/en/mathtype/mathtype_web/apps/wordpress

    You also need to initialise wp.editor on answer pages. Using png file instead of svg.

    https://codex.www.ads-software.com/Javascript_Reference/wp.editor

    Thread Starter egymido

    (@egymido)

    thank you renemailloux for your answer. I already installed the MathType for WordPress.

    Now, would you please send me the code to initialise wp.editor on answer fields?

    thank you for your time and help

    First, you need to add these code to function.php

    /* Describe what the code snippet does so you can remember later on */
    add_action('wp_head', 'enable_tiny_mce_wiris');
    
    function enable_tiny_mce_wiris()
    {
    ?>
      <script src="<?php echo get_option('home'); ?>/wp-includes/js/tinymce/plugins/tiny_mce_wiris/integration/WIRISplugins.js?viewer=image" type="text / javascript"> </script>
    <?php
    };
    
    ?>

    Then add this line in PHP for the quizz page. I use shortcode for my part.

    wp_enqueue_editor();

    Finaly add js to initialize the editor.

    /* This is your custom Javascript */
    
    (function ($) {
        $(window).load(function () {
            wp.editor.getDefaultSettings;
            var settings = {
                tinymce: {
                    selector: 'textarea',
                    plugins: 'tiny_mce_wiris',
                    toolbar1: 'bold,italic,strikethrough,bullist,numlist,blockquote,hr,alignleft,aligncenter,alignright,image,wp_more,tiny_mce_wiris_formulaEditor,fullscreen,',
                    setup: function (editor) {
                        editor.on('change', function () {
                            editor.save();
                        });
                    },
                },
            };
            $("textarea.wpProQuiz_questionEssay").each(function (index, element) {
                wp.editor.initialize($(element).attr("id"), settings);
            });         
        });
    
    })(jQuery);

    Best regards

    Thread Starter egymido

    (@egymido)

    @renemailloux Thank you for taking from your time to help me ?? I will try this now and will tell you the results. thank you so much

    Best regards

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Adding TinyMCE to Learndash Question answers’ is closed to new replies.