Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamically loading TinyMCE - wrong plugin, theme paths

When I add the script tag <script src="../Scripts/tinymce.min.js"></script> to my page, TinyMCE loads fine - with plugins and theme referencing the .min versions. However, when I remove the script tag and try loading it with jQuery, it's referencing the non-minified version, as noted in the console log. I'm using TinyMCE v4.1.7 (2014-11-27)

        $.getScript('http://localhost:52417/Scripts/tinymce.min.js', function () {
            window.tinymce.dom.Event.domLoaded = true;
            tinymce.baseURL = 'http://localhost:52417/Scripts';
            tinymce.init({
                selector: '#announcementText',
                plugins: ['link image'],
                toolbar: 'undo redo | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist | outdent indent | link image',
                menubar: false,
                statusbar: false
            });
        });

GET http://localhost:52417/Scripts/themes/modern/theme.js 404 (Not Found) GET http://localhost:52417/Scripts/plugins/link/plugin.js 404 (Not Found) GET http://localhost:52417/Scripts/plugins/image/plugin.js 404 (Not Found)

The domLoaded and baseURL lines were found from other examples on SO, and didn't make a difference. How can I get it to reference the correct path to the theme and plugins?

like image 787
InbetweenWeekends Avatar asked Nov 29 '22 14:11

InbetweenWeekends


1 Answers

Add tinymce.suffix = '.min'; before invoking tinymce.init()

like image 123
Dima L. Avatar answered Dec 05 '22 13:12

Dima L.