TinyMCE:如何在前面添加“http://”到 URL(如果不存在)
如果在 TinyMCE 中使用插入链接添加 URL 时不存在,是否可以在 URL 前面添加“http://”?
Is there way to prepend 'http://' to URL if it's not there while adding URL with Insert Link in TinyMCE?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
为此,您需要复制tinymce插入链接插件,重命名它,向其中添加必要的代码(“http”-添加)并将其用作您自己的插件。
编辑:好的,这是一个示例(使用 jQuery):
For that you would need to copy the tinymce Insert Link plugin, rename it, add the necessary code to it (the "http"-Adding) and use it as your own plugin.
EDIT: Ok, here is an example (using jQuery):
我在 4.x 版本中也遇到了这个问题。我发现
link
插件支持提示用户添加协议的选项。但不幸的是,文档中没有提到它,它只记录在变更日志中,所以我想这是广泛未知的。I was facing this problem as well with version 4.x. I discovered that the
link
plugin supports an option that prompts the user to add the protocol. But unfortunately it's not mentioned in the documentation, it's only documented in the changelog so I would imagine this is widely unknown.我通过在tinymce insertLink.aspx 文件中使用“http://”预填充字段值来实现此目的。
值=“http://”
I have achieved this by prepopulating the field value with 'http://' in the tinymce insertLink.aspx file.
value="http://"
在 link.js 中,找到“if (!f.href.value)”,
添加一个“else”子句
** 请记住,您已经这样做了,以防您更新 tinymce 组件!
in link.js, find "if (!f.href.value)"
add an "else" clause
** remember that you did that in case you update your tinymce component!
我刚刚看到这个,它可能会有所帮助,版本 5:
link_assume_external_targets:[选项];
您可以使用选项“https”或“http”,并且它不应提示
https://www.tiny.cloud/docs/plugins/opensource/link/#link_assume_external_targets
i just saw this and it might help, version 5:
link_assume_external_targets: [option];
you can use the option "https" or "http" and it should not prompt
https://www.tiny.cloud/docs/plugins/opensource/link/#link_assume_external_targets