How can I implement TinyMCE with Require.js?

后端 未结 3 1655
青春惊慌失措
青春惊慌失措 2020-12-30 08:59

I am currently passing in the TinyMCE source as a dependency, and then calling tinyMCE.init({}); but it is not initializing TinyMCE. When I console.log TinyMCE, it retur

3条回答
  •  攒了一身酷
    2020-12-30 09:19

    Had the same problem. My solution was to use TinyMCE jQuery plugin instead of TinyMCE directly. This way it works fine.

    define(['jquery', 'tiny_mce/jquery.tinymce'], function ($) {
        $('textarea').tinymce({
            script_url : 'js/tiny_mce/tiny_mce.js',
            theme : 'advanced',
            theme_advanced_buttons1 : 'fontselect,fontsizeselect,forecolor,bold,italic,underline,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,removeformat,indent,outdent,numlist,bullist,copy,paste,link',
            theme_advanced_buttons2 : '',
            theme_advanced_buttons3 : '',
            theme_advanced_toolbar_location : 'top',
            theme_advanced_toolbar_align : 'left'
       });
    });
    

提交回复
热议问题