Plugin Directory

Changeset 3736541


Ignore:
Timestamp:
10/09/2026 11:46:18 AM (10 days ago)
Author:
rbplugins
Message:

2.0.2 - Fix copy paste protection no longer blocks form fields

Location:
disable-right-click-rb
Files:
27 added
4 edited

Legend:

Unmodified
Added
Removed
  • disable-right-click-rb/trunk/assets/js/rb-admin-settings.js

    r3735578 r3736541  
    7575                + '.status.ok{color:#146c2e;}'
    7676                + '.status.err{color:#b3261e;}'
     77                + '.status.dirty{color:#8a5a00;}'
    7778                + '.field{display:flex;flex-direction:column;gap:4px;margin-bottom:12px;}'
    7879                + '.field label{font-size:12px;color:#49454f;font-weight:500;}'
    … …  
    522523                                peSaveBtn.disabled = false;
    523524                                if ( res && res.success ) {
    524                                         peStatus.classList.add( 'ok' );
    525                                         peStatus.textContent = s.saved;
     525                                        markSaved( 'pro' );
    526526                                } else {
    527527                                        peStatus.classList.add( 'err' );
    … …  
    546546        }
    547547        advancedPanel.appendChild( proExtrasWrap );
     548
     549        // ---- Unsaved changes and the "saved" status ----
     550        // Three separate saves: the base options (Protection + Advanced), the PRO
     551        // fine-grained options and the watermark. Each remembers unsaved edits.
     552        var dirty = {};
     553        function statusesOf( section ) {
     554                return ( { base: [ protectionStatus, advStatus ], pro: [ peStatus ], wm: [ wmStatus ] } )[ section ] || [];
     555        }
     556        function sectionOf( node ) {
     557                if ( watermarkPanel.contains( node ) ) { return 'wm'; }
     558                if ( proExtrasWrap.contains( node ) ) { return 'pro'; }
     559                return card.contains( node ) ? 'base' : null;
     560        }
     561        function markDirty( section ) {
     562                dirty[ section ] = true;
     563                statusesOf( section ).forEach( function ( el ) {
     564                        clearTimeout( el.fadeTimer );
     565                        el.className = 'status dirty';
     566                        el.textContent = s.unsaved;
     567                } );
     568        }
     569        // "Settings saved." fades after a few seconds; errors stay until the next save
     570        function markSaved( section ) {
     571                delete dirty[ section ];
     572                statusesOf( section ).forEach( function ( el ) {
     573                        clearTimeout( el.fadeTimer );
     574                        el.className = 'status ok';
     575                        el.textContent = s.saved;
     576                        el.fadeTimer = setTimeout( function () {
     577                                el.className = 'status';
     578                                el.textContent = '';
     579                        }, 3000 );
     580                } );
     581        }
    548582
    549583        // ---- Shared save (both tabs write the full options row) ----
    … …  
    571605                        btn.disabled = false;
    572606                        if ( res && res.success ) {
    573                                 statusEl.classList.add( 'ok' );
    574                                 statusEl.textContent = s.saved;
     607                                markSaved( 'base' );
    575608                        } else {
    576609                                statusEl.classList.add( 'err' );
    … …  
    679712                                wmLogoPreview.style.display = 'block';
    680713                                wmLogoBtn.textContent = s.watermarkChangeLogo;
     714                                markDirty( 'wm' );
    681715                        } );
    682716                        frame.open();
    … …  
    731765                                wmSaveBtn.disabled = false;
    732766                                if ( res && res.success ) {
    733                                         wmStatus.classList.add( 'ok' );
    734                                         wmStatus.textContent = s.saved;
     767                                        markSaved( 'wm' );
    735768                                } else {
    736769                                        wmStatus.classList.add( 'err' );
    … …  
    782815        var FAQ_ITEMS = [
    783816                { q: 'Will this actually stop someone copying my content?', a: 'No client-side technique can fully prevent it — anyone can still view page source, use a reader-mode browser extension, or take a screenshot. This deters casual copying, not a determined person.' },
    784                 { q: 'Why is "Copy, cut, paste" blocking my contact form?', a: 'That option blocks Ctrl/⌘+C/X/V/A everywhere on the page, including inside input fields. Turn it off on pages with forms, or exempt the roles that need to fill them in.' },
     817                { q: 'Will "Copy, cut, paste" break my contact form?', a: 'No. The shortcuts are blocked on the page content only: inside input fields, text areas and editable areas visitors can still type, select, copy and paste as usual.' },
    785818                { q: 'Can I protect only my blog posts but leave pages alone?', a: 'Yes — switch "Where" to "Only on selected content types" and tick just Posts.' },
    786819                { q: 'Does the "Advanced" tab really block F12 / DevTools?', a: 'Not reliably — browsers reserve those shortcuts and some can\'t be intercepted at all. Treat it as a mild deterrent and a visible message, not a security measure.' },
    … …  
    876909        } );
    877910
     911        // any edit in a section marks it unsaved; leaving the page then asks first
     912        [ 'input', 'change' ].forEach( function ( type ) {
     913                layout.addEventListener( type, function ( e ) {
     914                        var section = sectionOf( e.target );
     915                        if ( section ) { markDirty( section ); }
     916                } );
     917        } );
     918        window.addEventListener( 'beforeunload', function ( e ) {
     919                if ( Object.keys( dirty ).length ) {
     920                        e.preventDefault();
     921                        e.returnValue = '';
     922                }
     923        } );
     924
    878925        showHelp( 'opt_context_menu' );
    879926
  • disable-right-click-rb/trunk/class_rb_disable_right_click.php

    r3735578 r3736541  
    218218                        . 'function allowed(e){if(!f.allowSelectors||!f.allowSelectors.length||!e||!e.target||!e.target.closest)return false;'
    219219                        . 'for(var i=0;i<f.allowSelectors.length;i++){try{if(e.target.closest(f.allowSelectors[i]))return true;}catch(_){}}return false;}'
     220                        // form fields stay usable: typing, selecting, pasting a password, the field's own menu
     221                        . 'function field(e){var t=e&&e.target;return !!(t&&(t.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)));}'
    220222                        . 'function block(e){if(allowed(e))return true;if(e&&e.preventDefault)e.preventDefault();notify();return false;}'
    221223                        . 'function notify(){if(!f.showMessage)return;if(window.__rbDrcMsgAt&&(Date.now()-window.__rbDrcMsgAt)<1500)return;window.__rbDrcMsgAt=Date.now();var m=document.createElement("div");'
    … …  
    225227                        . 'document.body.appendChild(m);requestAnimationFrame(function(){m.style.opacity="1";});'
    226228                        . 'setTimeout(function(){m.style.opacity="0";setTimeout(function(){m.remove();},200);},1800);}'
    227                         . 'if(f.contextMenu){document.addEventListener("contextmenu",block);}'
    228                         . 'if(f.selection){document.addEventListener("selectstart",block);'
    229                         . 'var st=document.createElement("style");st.textContent="html{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}";document.head.appendChild(st);}'
     229                        . 'if(f.contextMenu){document.addEventListener("contextmenu",function(e){if(!field(e))block(e);});}'
     230                        . 'if(f.selection){document.addEventListener("selectstart",function(e){if(!field(e))block(e);});'
     231                        . 'var st=document.createElement("style");st.textContent="html{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}'
     232                        . 'input,textarea,[contenteditable],[contenteditable] *{-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;user-select:text;}";document.head.appendChild(st);}'
    230233                        . 'if(f.drag){document.addEventListener("dragstart",block);}'
    231234                        . 'document.addEventListener("keydown",function(e){'
    232235                        . 'var k=(e.key||"").toLowerCase();var ctrl=e.ctrlKey||e.metaKey;'
    233                         . 'if(f.copy&&ctrl&&(k==="c"||k==="x"||k==="v"||k==="a")){block(e);return;}'
     236                        . 'if(f.copy&&ctrl&&(k==="c"||k==="x"||k==="v"||k==="a")&&!field(e)){block(e);return;}'
    234237                        . 'if(f.viewSource){'
    235238                        . 'if(k==="f12"){block(e);return;}'
    … …  
    434437                        'save'               => __( 'Save changes', 'disable-right-click-rb' ),
    435438                        'saved'              => __( 'Settings saved.', 'disable-right-click-rb' ),
     439                        'unsaved'            => __( 'Unsaved changes', 'disable-right-click-rb' ),
    436440                        'error'              => __( 'Could not save settings. Please try again.', 'disable-right-click-rb' ),
    437441                        'tabProtection'      => __( 'Protection', 'disable-right-click-rb' ),
    … …  
    508512                        'opt_context_menu' => __( 'Stops the right-click menu, so visitors can\'t use "Save image as", "Copy", or "Inspect" from it. Doesn\'t stop keyboard shortcuts on its own.', 'disable-right-click-rb' ),
    509513                        'opt_selection'    => __( 'Prevents selecting/highlighting text with the mouse. Determined visitors can still view page source or use browser reader tools — no client-side technique fully prevents copying.', 'disable-right-click-rb' ),
    510                         'opt_copy'         => __( 'Blocks the Ctrl/⌘+C, X, V and A keyboard shortcuts anywhere on the page, including inside text fields — so avoid turning this on for pages with forms or comment boxes.', 'disable-right-click-rb' ),
     514                        'opt_copy'         => __( 'Blocks the Ctrl/⌘+C, X, V and A keyboard shortcuts on the page. Form fields are left alone, so visitors can still paste into contact forms, comment boxes and login fields.', 'disable-right-click-rb' ),
    511515                        'opt_drag'         => __( 'Stops images being dragged onto the desktop or into another window. Doesn\'t affect right-click "Save image as" — combine with the context-menu option for that.', 'disable-right-click-rb' ),
    512516                        'scope_selected'   => __( 'Protection only applies on single pages of the content types you tick below. Archives, search results and the homepage stay unprotected.', 'disable-right-click-rb' ),
  • disable-right-click-rb/trunk/disable-right-click-rb.php

    r3735578 r3736541  
    44Plugin URI: https://rbplugins.com/wordpress-plugins/disable-right-click-rb/
    55Description: Protects your content from being copied — right click, text selection, copy/paste, image dragging and view-source shortcuts, with per-content-type scope and role exceptions.
    6 Version: 2.0.1
     6Version: 2.0.2
    77Author: rbPlugins
    88Author URI: https://profiles.wordpress.org/rbplugins/
    … …  
    1616}
    1717
    18 define( 'RB_DISABLE_RIGHT_CLICK_VERSION', '2.0.1' );
     18define( 'RB_DISABLE_RIGHT_CLICK_VERSION', '2.0.2' );
    1919define( 'RB_DISABLE_RIGHT_CLICK_PATH', plugin_dir_path( __FILE__ ) );
    2020define( 'RB_DISABLE_RIGHT_CLICK_URL', plugin_dir_url( __FILE__ ) );
  • disable-right-click-rb/trunk/readme.txt

    r3735578 r3736541  
    55Tested up to: 7.1
    66Requires PHP: 7.4
    7 Stable tag: 2.0.1
     7Stable tag: 2.0.2
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    1818
    1919📖 [Plugin Overview](https://rbplugins.com/wordpress-plugins/disable-right-click-rb/) | 📚 [Documentation](https://rbplugins.com/docs/disable-right-click-rb/) | 💎 [Pricing & PRO](https://rbplugins.com/wordpress-plugins/disable-right-click-rb/#pricing)
     20
     21https://youtu.be/O1_dsh8faEU
    2022
    2123🔒 **Why protect your content?**
    … …  
    9597= Is the "Block copy/cut/paste" option safe to use on pages with forms? =
    9698
    97 That option blocks Ctrl/⌘+C, X, V and A anywhere on the page, including inside input fields — so avoid enabling it on pages with contact forms or comment boxes, or exempt the roles that need to fill them in.
     99Yes. Since version 2.0.2 the copy, cut, paste and select-all shortcuts are blocked on the page content only: inside input fields, text areas and editable areas visitors can still type, select, copy and paste — so contact forms, comment boxes, checkout and login fields keep working. Right-click and text selection protection leave form fields alone in the same way.
    98100
    99101= Does this plugin slow down my site? =
    … …  
    111113== Screenshots ==
    112114
    113 1. Protection tab — choose what to block, where, and who's exempt
    114 2. Advanced tab — view-source blocking and DevTools detection
    115 3. PRO — watermark tab (locked without the add-on, full controls with it)
    116 4. PRO promo card on the settings screen
     1151. Protection tab — choose what to block (right click, text selection, copy shortcuts, image dragging), where protection applies, and which roles are exempt.
     1162. What visitors see — a short notice of your own when they try to right-click or drag a photo.
     1173. Advanced tab — view-source shortcut blocking and a DevTools indicator, with the PRO controls previewed in place.
     1184. PRO — image watermarking: your text or logo as a CSS overlay or embedded into the image file, with exclusions.
     1195. PRO — watermarked photos on the site, while exempt roles keep seeing the originals.
     1206. PRO — fine-grained control: precision scope, Opposite Mode, element allowlist and DevTools reaction.
    117121
    118122== Changelog ==
     123
     124= 2.0.2 =
     125* Fixed: form fields stay usable — visitors can type, select, copy and paste in input fields, text areas and editable areas (contact forms, comments, checkout, login) while the page content stays protected
     126* Settings screen: edits are marked "Unsaved changes", "Settings saved." fades after a few seconds, and leaving the page with unsaved changes asks first
    119127
    120128= 2.0.1 =
    … …  
    171179== Upgrade Notice ==
    172180
    173 = 2.0.1 =
    174 Settings screen polish: PRO options are previewed in place, fixed links to the plugin page and pricing.
     181= 2.0.2 =
     182Copy and paste protection no longer blocks form fields: contact forms, comments and login fields keep working.
Note: See TracChangeset for help on using the changeset viewer.