fckeditorX no right click or ctrl+v script

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
User avatar
manuel
Power Poster
Power Poster
Posts: 354
Joined: Fri Nov 30, 2007 9:15 am

fckeditorX no right click or ctrl+v script

Post by manuel »

Dear All,

Because some people can forget you told them NOT to paste directly from word to the wysiwyg editor, I would like to add a javascript to the fckeditor wysiwyg iframe that blocks these functions.

What is blocked exactly?
- users can't paste using Ctrl+V
- users can't reach the right click menu the regular way, they need to click both mouse buttons simultaneously.

HTML example:

Code: Select all

<__html>
<head>
<__script__ language="JavaScript1.1"> 
    function noCopyMouse(e) {
        var isRight = (e.button) ? (e.button == 2) : (e.which == 3);
        
        if(isRight) {
            alert('please don't paste from word! If you need to access the right mouse menu for a different task, just click your left and right mouse button simultaneously and the menu will appear');
			return false;
        }
        return true;
    }

    function noCopyKey(e) {
        var forbiddenKeys = new Array('v');
        var keyCode = (e.keyCode) ? e.keyCode : e.which;
        var isCtrl;

        if(window.event)
            isCtrl = e.ctrlKey
        else
            isCtrl = (window.Event) ? ((e.modifiers & Event.CTRL_MASK) == Event.CTRL_MASK) : false;
    
        if(isCtrl) {
            for(i = 0; i < forbiddenKeys.length; i++) {
                if(forbiddenKeys[i] == String.fromCharCode(keyCode).toLowerCase()) {
                    alert('Please don't paste directly from word!');
                    return false;
                }
            }
        }
        return true;
    }
</__script>
</head>
</__body>
<input type="text" onmousedown="noCopyMouse(event);" onkeydown="noCopyKey(event);">
<__body>
</__html>
I've tried entering the code in the following pages but didn't succeed in affecting the inner iframe that contains the actual content... I did get the script to work when a user clicks the field around the content (the field that contains the different icons, styles, etc for your content).

/admin/editcontent.php
/modules/FCKeditorX/FCKeditor/editor/fckeditor.html
/modules/FCKeditorX/FCKeditor/editor/fckeditor.original.html
and a couple more....

Has anybody got an idea as to where I can find the <input type="hidden" id="content_en" name="content_en" ..... tag?
I believe this is the one to enter the onmousedown code in but I can't find it...

Greetings,
Manuel
Do you like your open source cms? Buy from the CMSMS partners || Donate
christiaans
Power Poster
Power Poster
Posts: 300
Joined: Tue Mar 04, 2008 10:37 am

Re: fckeditorX no right click or ctrl+v script

Post by christiaans »

In FCK (newest CMSms version obviously), isn't there a popup window, if you try to paste directly from Word? At least in my case, it pops up and says: "it seems you want to paste something directly from MS Word.....", and lets me choose to delete the styling and so on.

In TinyMCE however, it does NOT have that function I reckon.
anivision
Forum Members
Forum Members
Posts: 33
Joined: Mon Feb 25, 2008 2:54 pm

Re: fckeditorX no right click or ctrl+v script

Post by anivision »

But then the question is how to use this kind of script in TinyMCE to prevent pasting directly from word.
Post Reply

Return to “Modules/Add-Ons”