Skip to content

Pasting with keyboard shortcut deletes all the content of the classic block #64771

Closed

Description

@Kerfred

Description

Since WP 6.6.1, when I paste a text using the keyboard shortcut COMMAND + v on Mac in the post content that uses a classic block, it deletes the whole content.

Here is a video that shows the issue: https://www.awesomescreenshot.com/video/30790475?key=7e50f467f28e2fce0be54c409b1a75fc

The issue doesn’t happen when I paste the text using the mouse (right click + Paste). It happens only when doing it with the keyboard.

Step-by-step reproduction instructions

  1. Edit a post containing a classic block
  2. Copy a text from outside WordPress
  3. Paste this text inside the post content using the keyboard shortcut COMMAND + v (or CTRL + v on PC)

Screenshots, screen recording, code snippet

https://www.awesomescreenshot.com/video/30790475?key=7e50f467f28e2fce0be54c409b1a75fc

Environment info

WordPress 6.6.1
Gutenberg 19.0.0 (or even with the default Gutenberg installed in WordPress)
Chrome 127.0
Mac OS 14.6.1

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Activity

  1. added
    [Type] BugAn existing feature does not function as intended
    on Aug 24, 2024
  2. t-hamano commented on Aug 24, 2024

    @t-hamano
    Contributor

    Thanks for the report. I was able to reproduce the issue. And this problem certainly seems to have first appeared in WP6.6.

    There are two conditions to reproduce this issue:

    • The editor is not an iframe, i.e. custom fields are enabled, etc. If the editor is not an iframe, the Classic Block is modal and this issue cannot be reproduced.
    • Copy text from outside WordPress.
  3. t-hamano commented on Aug 26, 2024

    @t-hamano
    Contributor

    I have determined that this issue was caused by #54543.

  4. Kerfred commented on Nov 13, 2024

    @Kerfred
    Author

    WordPress 6.7 has been released. And this issue is still not fixed.
    This is very annoying to not be able to use the CTRL+v shortcut during the post edition.

    Does anyone know when this will be fixed?

  5. lgseo commented on Dec 6, 2024

    @lgseo

    WordPress 6.7 has been released. And this issue is still not fixed. This is very annoying to not be able to use the CTRL+v shortcut during the post edition.

    Does anyone know when this will be fixed?

    The same problems happens on me. How to fix it? It's really annoying. when I want to past some product parameters in table with classic block.

  6. lgseo commented on Dec 9, 2024

    @lgseo

    I have determined that this issue was caused by #54543.

    Could you tell me how to fix it?? It seems a big confusion for me. I can not paste any content from outsite wordpress into classic block.

  7. t-hamano commented on Dec 10, 2024

    @t-hamano
    Contributor

    @ellatrix

    Do you know anything about this issue? Here are steps and a video to reproduce the issue:

    • To make the editor work as a non-iframe editor:
      • Activate CoBlocks, which contains version v2 of the blocks.
      • Insert a Classic block into the post editor and enter some content.
    • Copy some text from outside WordPress.
    • Paste the text inside the Classic block.
    • All content inside the Classic block will disappear.
    f9c60f7ebc2f2bdc47424f3f541bba27.mp4
  8. lgseo commented on Dec 11, 2024

    @lgseo

    @ellatrix

    Do you know anything about this issue? Here are steps and a video to reproduce the issue:

    • To make the editor work as a non-iframe editor:

      • Activate CoBlocks, which contains version v2 of the blocks.
      • Insert a Classic block into the post editor and enter some content.
    • Copy some text from outside WordPress.

    • Paste the text inside the Classic block.

    • All content inside the Classic block will disappear.

    f9c60f7ebc2f2bdc47424f3f541bba27.mp4

    The Problem is mainly caused by block editor bugs. The latest wordpress seems not have this problem. but if the latest version is upgraded from older version. the problem stays. Actually, I have a solution to it. but I can not upload my files here. The only way is that I can tell you the key matter is in
    ./wp-includes/js/dist/block-editor.js
    you can comment out the code part as below:

    if (isFullySelected) {
       // replaceBlocks(selectedBlockClientIds, blocks, blocks.length - 1, -1);
      event.preventDefault();
      return;
    }
    

    then minify the the file to block-editor.min.js
    That is all my solution to the problem. hope it helps.

  9. Kerfred commented on Dec 11, 2024

    @Kerfred
    Author

    @lgseo Great. Your workaround solution works great. Thank you
    I hope there will be a definitive fix in the next version. I have raised this annoying bug more than 3 months ago and nothing was done.

  10. lgseo commented on Dec 11, 2024

    @lgseo

    @lgseo Great. Your workaround solution works great. Thank you I hope there will be a definitive fix in the next version. I have raised this annoying bug more than 3 months ago and nothing was done.

    Nobody help us, so just save by myself.It makes me crazy. thanks to my poor coding ability

  11. Kerfred commented on Feb 11, 2025

    @Kerfred
    Author

    This bug still happens in WordPress 6.7.2.
    It is very annoying that we have to reapply the workaround each time WordPress releases a new version.

    Does anyone take this bug into account???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Block] ClassicAffects the Classic Editor Block[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions