Only allow paste to tinyMCE text area under certain conditions

For Joomla! 4.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
JoPhi
Joomla! Apprentice
Joomla! Apprentice
Posts: 22
Joined: Fri Jun 03, 2022 10:33 am

Only allow paste to tinyMCE text area under certain conditions

Post by JoPhi » Thu Jun 30, 2022 5:39 am

Hey guys 'n gals,
with the help of Joomla and tinyMCE I do free German classes on the web. I noticed that users use copy and paste to bring in new articles ( = homework in my case). I want to forbid this under certain conditions/circumstances, primary to avoid that participants steal homework from other participants.

If the text is copied from an area where at least one of the the content's class elements contains "allow-copy-and-paste" I want to allow pasting to the tinyMCE textfield. And if none of the clipboard elements contains such a class, I want to deny the paste-function.

Is something like this anyhow possible?
I'm not that good in Javascript, but I think this'd be the way. I found a way to deny everything (and I think this way–instead of the clipboard content–just paste '' into the textarea).

If yes, could you please give me an advice where I can find information about a conditional paste and/or the necessary steps, or how I can search further?

Thanks so much,
JoPhi

Locked

Return to “Joomla! 4.x Coding”