Notifications
Clear all

Printables - Copy/Paste bug?  

  RSS
shrap
(@shrap-2)
Eminent Member
Printables - Copy/Paste bug?

I was posting some models in Printables and I was copy-pasting the text I wrote into the text fields.

9 times out of ten, the copy-paste would paste twice, duplicating almost all my text.

I am pretty sure it's not my keyboard...

Posted : 13/09/2025 7:45 pm
shrap
(@shrap-2)
Eminent Member
Topic starter answered:
RE: Printables - Copy/Paste bug?

This also happens when you right click and use paste. It pastes twice instead of once.

Posted : 24/09/2025 6:23 pm
Geoff Steele
(@geoff-steele)
Eminent Member
RE: Printables - Copy/Paste bug?

Hi, I just tried this and I'm not seeing the same issue. Both methods worked as expected for me.

Posted : 25/09/2025 8:41 am
shrap
(@shrap-2)
Eminent Member
Topic starter answered:
RE: Printables - Copy/Paste bug?

I tried it on two computers. It happens on both. 2x paste.

If it matters, I am using Firefox.

I just did an additional test in Edge, and that works just fine.

Posted : 25/09/2025 6:35 pm
Geoff Steele
(@geoff-steele)
Eminent Member
RE: Printables - Copy/Paste bug?

that checks out as to why I probably wasn't seeing it - I was on chrome

Posted : 26/09/2025 12:54 am
cwohltat
(@cwohltat)
Member
RE:

I can confirm this happens for me as well on firefox.

Here is a solution / workaround from Claude AI that works on my computer when pasting to the JS console. Userscripts/Greasemonkey should work as well to make it permanent:

// Firefox Double-Paste Fix for CKEditor on Printables.com
// This fixes the bug where pasting text enters it twice in Firefox

(function() {
    'use strict';
    
    // Only apply fix in Firefox
    if (navigator.userAgent.toLowerCase().indexOf('firefox') === -1) {
        return;
    }
    
    // Wait for CKEditor to be ready
    function applyFix() {
        const ckEditor = document.querySelector('.ck-editor__editable');
        
        if (!ckEditor) {
            // CKEditor not loaded yet, try again
            setTimeout(applyFix, 500);
            return;
        }
        
        // Track if we've already processed this paste event
        let isProcessing = false;
        
        ckEditor.addEventListener('paste', function(e) {
            if (isProcessing) {
                // Already handling this paste, prevent duplicate
                e.stopImmediatePropagation();
                e.preventDefault();
                return;
            }
            
            // Mark as processing
            isProcessing = true;
            
            // Stop the event from propagating to other handlers
            e.stopImmediatePropagation();
            
            // Allow CKEditor's paste handler to process once
            const pasteEvent = new ClipboardEvent('paste', {
                clipboardData: e.clipboardData,
                bubbles: true,
                cancelable: true
            });
            
            // Dispatch the cleaned event
            setTimeout(() => {
                e.target.dispatchEvent(pasteEvent);
                // Reset flag after a short delay
                setTimeout(() => {
                    isProcessing = false;
                }, 100);
            }, 0);
            
        }, true); // Capture phase - intercepts before CKEditor
        
        console.log('Firefox CKEditor paste fix applied');
    }
    
    // Start applying the fix
    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', applyFix);
    } else {
        applyFix();
    }
})();

It also says it's possible to fix it in the source as follows:

ClassicEditor.create(element, {
    // ... other config
    typing: {
        // This helps prevent double paste in Firefox
        undoStep: 20
    }
})
.then(editor => {
    // Firefox-specific paste fix
    const editable = editor.editing.view.document;
    
    editable.on('paste', (evt, data) => {
        // Ensure preventDefault is called
        data.preventDefault();
    }, { priority: 'highest' });
})
.catch(error => {
    console.error(error);
});
This post was modified 5 days ago by cwohltat
Posted : 30/09/2025 10:46 am
cwohltat
(@cwohltat)
Member
RE: Printables - Copy/Paste bug?

Following Tampermonkey script works for me:

// ==UserScript==
// @name         Fix Printables double paste
// @namespace     http://tampermonkey.net/ 
// @version      2025-09-30
// @description  Fixes the bug where pasting text in CKEditor enters it twice in Firefox
// @author       You
// @match         https://www.printables.com/* 
// @match         https://printables.com/* 
// @icon          https://www.google.com/s2/favicons?sz=64&domain=printables.com 
// @grant        none
// @run-at       document-idle
// ==/UserScript==

// Firefox Double-Paste Fix for CKEditor on Printables.com
// This fixes the bug where pasting text enters it twice in Firefox

(function() {
    'use strict';

    // Only apply fix in Firefox
    if (navigator.userAgent.toLowerCase().indexOf('firefox') === -1) {
        return;
    }

    // Wait for CKEditor to be ready
    function applyFix() {
        const ckEditor = document.querySelector('.ck-editor__editable');

        if (!ckEditor) {
            // CKEditor not loaded yet, try again
            setTimeout(applyFix, 500);
            return;
        }

        // Track if we've already processed this paste event
        let isProcessing = false;

        ckEditor.addEventListener('paste', function(e) {
            if (isProcessing) {
                // Already handling this paste, prevent duplicate
                e.stopImmediatePropagation();
                e.preventDefault();
                return;
            }

            // Mark as processing
            isProcessing = true;

            // Stop the event from propagating to other handlers
            e.stopImmediatePropagation();

            // Allow CKEditor's paste handler to process once
            const pasteEvent = new ClipboardEvent('paste', {
                clipboardData: e.clipboardData,
                bubbles: true,
                cancelable: true
            });

            // Dispatch the cleaned event
            setTimeout(() => {
                e.target.dispatchEvent(pasteEvent);
                // Reset flag after a short delay
                setTimeout(() => {
                    isProcessing = false;
                }, 100);
            }, 0);

        }, true); // Capture phase - intercepts before CKEditor

        console.log('Firefox CKEditor paste fix applied');
    }

    // Start applying the fix
    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', applyFix);
    } else {
        applyFix();
    }
})();
Posted : 30/09/2025 11:08 am
Share: