简体   繁体   English

如何设置TinyMCE提及插件?

[英]How to setup the TinyMCE mention plugin?

I am trying to get the mention plugin to work with TinyMCE. 我正在尝试使提及插件与TinyMCE一起使用。 The problem is: whenever I enable the plugin, I get the dreaded "tinymce is not defined" error. 问题是:每当启用插件时,都会出现可怕的“未定义Tinymce”错误。 I think it may be loading the plugin "too soon", but I don't know how to delay the plugin load until TinyMCE is fully loaded. 我认为可能是“太早”加载了插件,但是我不知道如何在TinyMCE完全加载之前延迟插件的加载。

Here's how I have the the init() configured: 这是我配置init()的方式:

    $(document).ready(function(e) {
    tinymce.init({
        selector:'textarea.update',
        menubar:false,
        toolbar:"undo redo | bold italic | bullist numlist | link unlink",
        width:'100%',
        plugins: "link,mention",
        mentions:
        {
            source: [
                { name: "Michael" },
                { name: "Erica" },
                { name: "Sloan" }
                ]
        }           
    });
});

The Text area is <textarea class="update"></textarea> 文本区域是<textarea class="update"></textarea>

If I remove the mention option and the "mention" from the plugins list, it works fine. 如果我从插件列表中删除提及选项和“提及”,则可以正常工作。 As soon as I put the plugin back into the "on" mode, it breaks. 一旦我将插件放回“开启”模式,它就会中断。

How do I fix this? 我该如何解决?

The problem (as leakim571 so astutely pointed out) was that I was using CacheFly instead of hosting my own copy. 问题(如leakim571所指出的那样)是我正在使用CacheFly而不是托管自己的副本。 When I got rid of the cachefly reference, downloaded the whole tinymce package, and put the mention plugin in that package, everything started to work perfectly. 当我摆脱了cachefly参考资料之后,下载了整个tinymce软件包,并将提及插件放入该软件包中,一切都开始正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM