How to desactivate right click in tinyMCE?

How to desactivate right click in tinyMCE?

by dag bro -
Number of replies: 3

Hello,

I work with tinyMCE 3.5.1.1 on Moodle 2.3.2 and I would like to know haw to desactivate the plugin of right click in the tinymce window. 
It send me an error message when I want to cut/copy/paste something and says that it si not compatible with the browser (Firefox, Chrome or Safari) and that I haver to use the keyboard shortcuts. I'm ok for that but some users do not even know this shortcuts and prefer copy and paste with the right click.

Do you have an idea how to desactivate this right click menu of tinymce and have basic right click menu of the system?

Thank you for your help.

Regards,

Average of ratings: -
In reply to dag bro

Re: How to desactivate right click in tinyMCE?

by Paul Vasilauskis -

This is in Modle 2.4, it may or may not be the same or similar for your version.

From your Moodle directory go to the file /lib/editor/tinymce/lib.php

Search for the line:  (single quotes included)

'searchreplace,paste,directionality,fullscreen,nonbreaking,contextmenu,' .

 

delete "contextmenu," (don't forget the comma) so the line now reads:

'searchreplace,paste,directionality,fullscreen,nonbreaking,' .

Save it.

That should do it.

Our Moodle is on an Intranet with no outside Internet access causing the tinyMCE spell checkers to not work. I was very happy when Moodle 2.4 let you turn off spell checking. With it turned off the browser's spell checker would mark the word as bad but if you right clicked you got the tinyMCE menu. You could CTRL and right click but that's not intuitive.

Hope this helps.

 

PS: be sure that line still ends with a period character after the single quote. That's the concatenate character in php. (kinda like a + sign for strings)

Average of ratings: Useful (1)
In reply to Paul Vasilauskis

Re: How to desactivate right click in tinyMCE?

by dag bro -

Yes! Thank you very much for your help, it works!

In reply to Paul Vasilauskis

Re: How to desactivate right click in tinyMCE?

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Note, in more recent versions of Moodle, you may be able to do this using the "Custom configuration" option on Admin -> Plugins -> Text editors -> TinyMCE HTML editor -> General settings.

However, the only way to know what you can change is probably to look in https://github.com/moodle/moodle/blob/master/lib/editor/tinymce/lib.php#L119, and if you make a mistake here, you can probably break the editor completely.

To change take out the context menu, you probably need

{"plugins" => "lists,table,style,layer,advhr,advlink,emotions,inlinepopups,searchreplace,paste,directionality,fullscreen,nonbreaking,insertdatetime,save,iespell,preview,print,noneditable,visualchars,xhtmlxtras,template,pagebreak"}