TinyMCE do not auto convert a URL into a link on Paste
When I paste a URL into a TinyMCE editor it converts the text into a link.
So http://vime开发者_StackOverflow中文版o.com/18150336
would be come <a href="http://vimeo.com/18150336">http://vimeo.com/18150336</a>
. I would like to keep the plain text. Is their a way to configure TinyMCE to keep the link as plain text.
I do not want to strip out tags as adding a hyperlinks should be an option on the toolbar. It should just not happen by default.
You can use the paste plugin and the setting paste_preprocessing
in order to keep the plain text. You might need to check inside the function specified using paste_preprocessing
if you got a link or not.
It's been 5 years, So I'm probably using a newer version of TinyMCE, anyway this solution worked for me, Just add this option:
paste_preprocess: function(plugin, args) {
args.content += ' ';
}
So when you initialize the tinymce, it should be something like this:
tinymce.init({
selector: "textarea", // change this value according to your HTML
plugins: "paste",
paste_preprocess: function(plugin, args) {
args.content += ' ';
}
});
This is the page of documentation for TinyMCE V4
It is the TinyMCE plugin autolink
which is responsible for automatically creating links on paste. (And write).
https://www.tiny.cloud/docs/plugins/opensource/autolink/
精彩评论