How do i use TinyMCE jQuery package and what is the difference with TinyMCE jQuery plugin

前端 未结 3 1999
清酒与你
清酒与你 2020-12-09 16:28

I\'ve seen this post What is the TinyMCE jQuery Package? which explains what the v4 TinyMCE jQuery package is but the post and the tinymce site only contain examples of v3.<

3条回答
  •  悲&欢浪女
    2020-12-09 17:16

    I ran into the same issue a few weeks back. You don't need to use tinymce as a jQuery plugin but the option is there if you would like to. The vast majority of the tinymce source code is in the tinymce.min.js file and the jQuery.tinymce.min file just contains the code that wraps the tinymce functionality into a jQuery plugin. Anyways, if you want to use it you'll need to require both.

    
    
    
    

    The only main difference as far as I know in terms of TinyMCE is the way the editor is initialised. If you're not using jQuery you'd initialise it something like this:

    tinymce.init({
        selector: 'textarea',
        theme: "modern"
        ...
    }) 
    

    Whereas when you're using it as a jQuery plugin you can use jQuery to initialise it and you get the added benefit of being able to chain additional jQuery goodness onto your initialisation method. As in:

    $('textarea').html('

    some dynamic content

    ').tinymce({ theme: "modern", ... })

    Other than that they're basically the same I think.

提交回复
热议问题