我如何使用TinyMCE jQuery软件包以及TinyMCE jQuery插件有什么区别 [英] How do i use TinyMCE jQuery package and what is the difference with TinyMCE jQuery plugin

查看:176
本文介绍了我如何使用TinyMCE jQuery软件包以及TinyMCE jQuery插件有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看过这篇文章什么是TinyMCE jQuery软件包?其中说明了v4 TinyMCE jQuery包是什么,但帖子和tinymce网站仅包含v3的示例.

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.

当我下载第4版TinyMCE jQuery软件包时,没有tiny_mce.js.似乎有两个文件jquery.tinymce.min.js和tinymce.min.js.我已经读到,如果同时包含两个文件,则表示我使用的是完整的TinyMCE,而不是jQuery版本,但是如果仅包含jQuery文件,则对tinyMCE.init的调用将失败,并显示未定义tinyMCE".

When I download the v4 TinyMCE jQuery package there is no tiny_mce.js; there seems to be two files jquery.tinymce.min.js and tinymce.min.js. I've read that if I include both files then I am using full TinyMCE and not the jQuery version, but if I only include the jQuery file, my call to tinyMCE.init fails with "tinyMCE is not defined".

我真的很想从文档中弄清楚这一点,但是我试图进行搜索,但找不到关于jQuery版本的任何信息.

I'd really rather be figuring this out from the documentation, but I've tried to search it and can't find anything about the jQuery version.

关于这一点,任何人都可以解释一下TinyMCE jQuery插件是什么以及它与以上内容的关系吗?我认为这可能是我理解上的空白.

On a related point can anyone explain what the TinyMCE jQuery plugin is and how it relates to the above? I think that may be the gap in my understanding.

非常感谢

推荐答案

几周前,我遇到了同样的问题.您不需要将tinymce用作jQuery插件,但是如果您愿意,可以使用该选项. tinymce源代码的绝大多数都在tinymce.min.js文件中,而jQuery.tinymce.min文件仅包含将tinymce功能包装到jQuery插件中的代码.无论如何,如果要使用它,则需要同时使用它们.

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.

<script src="/js/jquery-1.10.2.js" type="text/javascript"></script>
<script src="/js/tinymce/tinymce.min.js" type="text/javascript"></script>
<script src="/js/tinymce/jquery.tinymce.min.js" type="text/javascript"></script>

就TinyMCE而言,据我所知,唯一的主要区别是编辑器的初始化方式.如果您不使用jQuery,则可以将其初始化如下:

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"
    ...
}) 

当您将其用作jQuery插件时,可以使用jQuery对其进行初始化,并且可以获得附加的好处,即能够将其他jQuery优点链接到您的初始化方法上.如:

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('<p>some dynamic content</p>').tinymce({
   theme: "modern",
   ...
})

除此之外,我认为它们基本相同.

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

这篇关于我如何使用TinyMCE jQuery软件包以及TinyMCE jQuery插件有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆