HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Disallow html when pasting in rich editor
labastro
New
Hello!
After several hours of research, I come to ask you if it is possible to accept only plain text when someone pastes content from web pages (for example, disable links). If yes, how to proceed?
Thanks for your help.
0
Comments
You can set you editor to text only that way nothing but text can be pasted in..
Thank you for your answer.
But I would like to keep text formatting tools (bold, italics, etc.).
I tried snippets like this, but it does not work:
https://gist.github.com/cesarfigueroa/27d332384cad45217168
The Rich Editor is using quill under the hood. Maybe that helps searching for an answer...
Yes, the module concerned is certainly this one (rich-editor/src/scripts/quill/ClipboardModule.ts) but I did not find where it is configured in Vanilla.
I don't know much about JS, I'm only interested on learning something. Does that look promising for you? https://github.com/vanilla/vanilla/search?q=pastehandler&unscoped_q=pastehandler
Beyond that, I'd say quill is created here without any chance to take influence on the options: https://github.com/vanilla/vanilla/blob/master/plugins/rich-editor/src/scripts/editor/EditorContent.tsx#L63-L74
Thank you R_J for your help. I think it's too complicated for me. 🤨