如何禁用url在ckeditor插件

how to disable the url in ckeditor plugin?

本文关键字:ckeditor 插件 url 何禁用      更新时间:2023-09-26

我使用CKEditor插件的文本区域。

我不希望文本中有任何url。我不知道如何识别文本是否包含任何url或超链接。有什么办法可以做到吗?例如,我的代码如下:

text = "hi <br> this is something about <br> www.google.com. such a good web site. <br> <a href='www.google.com'>click</a> to go <br>";

我需要在上面的代码中识别url和href

如果您想禁用CKEditor中的链接,请使用最新的4.1。x构建并利用高级内容过滤器(ACF)。

你可以通过在配置中指定config.removePlugins = 'link'来删除链接插件,或者限制config.allowedContent不接受<a>标签(参见ACF配置指南)。

这将通知你的编辑器链接是不需要的,它们将在编辑器的输出中被删除。