• Resolved anonymized-14087207

    (@anonymized-14087207)


    Hi,

    I fixed the issue with the shortcode button in the visual editor for newer wordpress versions. I hope Will Zachmann could implement it in the next version 🙂

    There are other issues that come with the visual editor (TinyMCE) because the functions get updated sooner or later and break older plugins. I just focused on the issue with the shortcode insert button.

    Open the shortcode-exec-php-class.php in the plugin-folder and scroll to this js-part (about line 1189):

    $('#scep-tinymce-form').submit(function() {
        if (window.tinyMCE) {
            window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, '[' + $('#scep-tinymce-shortcode').val() + ']');
    	tinyMCEPopup.editor.execCommand('mceRepaint');
    	tinyMCEPopup.close();
        }
        return false;
    });

    Change it this way and save it:

    $('#scep-tinymce-form').submit(function() {
        if (window.tinyMCE) {
            if (tinyMCE.majorVersion>="4") {
                window.tinyMCE.execCommand('mceInsertContent', false, '[' + $('#scep-tinymce-shortcode').val() + ']');
            } else {
                window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, '[' + $('#scep-tinymce-shortcode').val() + ']');
            }
            tinyMCEPopup.editor.execCommand('mceRepaint');
    	tinyMCEPopup.close();
        }
        return false;
    });

    That’s all 😉

    https://wordpress.org/plugins/shortcode-exec-php/

Viewing 1 replies (of 1 total)
  • Plugin Contributor M66B

    (@m66b)

    Because of a holiday I am just seeing this message now.
    I will update the plugin today with this change.
    Thanks for fixing this!

Viewing 1 replies (of 1 total)

The topic ‘TinyMCE Shortcode button fix’ is closed to new replies.