javascript 如何在tinymce中添加多个插件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23854160/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 01:41:38  来源:igfitidea点击:

How to add multiple plugin in tinymce?

javascripttinymce

提问by Alimon Karim

I have tried this simple code for try tinyMCE.It is working fine.Here the problem is when I am trying to add multiple plugin it is not working.Here I have used tinymce CDN.Here is the code

我已经尝试了这个简单的代码来尝试 tinyMCE。它工作正常。这里的问题是当我尝试添加多个插件时它不起作用。这里我使用了 tinymce CDN。这是代码

<!DOCTYPE html>
<html>
<head>
<script src="http://tinymce.cachefly.net/4.0/tinymce.min.js"></script>

<script>
        tinymce.init({selector:'textarea',
        plugins: "code",
        plugins: "image"
        });
</script>


</head>
<body>
        <textarea></textarea>
</body>
</html>

Here code plugin is working but image plugin not working.If I remove code plugin than image plugin working.How can I apply both plugin?

这里代码插件正在工作,但图像插件不起作用。如果我删除代码插件而不是图像插件工作。如何同时应用这两个插件?

回答by dmullings

You are specifying the plugins property twice. It should only be there once and then multiple plugins should be specified in that property. According to the documentation you need to be using a comma or space separated string, or an array of strings. Try this below:

您指定了 plugins 属性两次。它应该只存在一次,然后应该在该属性中指定多个插件。根据文档,您需要使用逗号或空格分隔的字符串或字符串数​​组。试试这个:

<script>
        tinymce.init({selector:'textarea',
        plugins: "code image"
        });
</script>

https://www.tinymce.com/docs/configure/integration-and-setup/#plugins

https://www.tinymce.com/docs/configure/integration-and-setup/#plugins

回答by Devguru

You only need to separate the plugins with a space. in your case, it would be:

您只需要用空格分隔插件。在您的情况下,它将是:

<script>
    tinymce.init({selector:'textarea',
    plugins: "code image",
    });