Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random bug when undoing #242

Open
2 of 3 tasks
Jean-PhilippeD opened this issue Jan 7, 2024 · 7 comments
Open
2 of 3 tasks

Random bug when undoing #242

Jean-PhilippeD opened this issue Jan 7, 2024 · 7 comments
Labels
🐞 Bug Something isn't working ⛑ Needs triage Someone is checking 📍 Work in progress Current work in progress

Comments

@Jean-PhilippeD
Copy link

Jean-PhilippeD commented Jan 7, 2024

Precheck

  • Do a quick search and make sure the bug has not been reported yet.
  • Please disclose security vulnerabilities privately at [email protected].
  • Finally, be nice and have fun!.

Description

I use undo (and dragDrop which doesn't work by the way) and when I want to rollback some text with ctrl+Z sometimes it's working fine, sometimes it does erase whole blocks, append new empty block at the beginning, duplicates some other blocks...

I have no idea what's happening...

Environment

  • Editor.js version: 2.28.2
  • Plugins you use with their versions: editorjs-undo: 2.0.26
  • Device, Browser, OS: Windows + Bravebrowser even Firefox

Current behavior

Here is the behavior :

bug-undo

I initialize editorJs like this :

editorRef.current = new EditorJS({
    holder: 'editorjs-container',
    autofocus: false,
    onReady: () => {
          const editor = editorRef.current;
          const undo = new Undo({ editor });
          undo.initialize(props.defaultValue);
    },
    tools: editorTools,
    data: props.defaultValue,
    readOnly: props.readOnly
});

Expected behavior

Undo to works fine :)

@ARH3
Copy link

ARH3 commented Apr 21, 2024

Hello I am having this same issue as well. It makes the plugin effectively unusable in practice. Would really appreciate if someone can work on this one. Thank you!!

@juliandsg0222 juliandsg0222 self-assigned this Apr 23, 2024
@juliandsg0222 juliandsg0222 added the 📍 Work in progress Current work in progress label Apr 23, 2024
@juliandsg0222
Copy link
Member

Hello @Jean-PhilippeD, thanks for reporting the issue, we were checking and now with version 2.0.27 it is not occurring, please try with the latest version and let us know if it works for you.

@n2-freevas
Copy link

Hello @juliandsg0222 .
I have the same problem as @Jean-PhilippeD.

editorJS.current = new EditorJS({
        holder: "something",
        data: defaultBlock,
        ...
        onReady() {
          if (!!editorJS.current) {
            new Undo({
              editor: editorJS.current,
              maxLength: 20,
              config: {
                debounceTimer: 100,
                shortcuts: {
                  undo: 'CMD+Z',
                  redo: 'CMD+SHIFT+Z',
                },
              },
            });
            ...
          }
        },
     〜〜
     <div id="something"/>

**If Undo is performed immediately after the block data is mounted with the default value (defaultBlock), all block data will be lost.
A subsequent Redo will restore the original data.

It seems to me that this could be avoided by determining if this is not the initial state before attempting to perform Undo, can this be fixed?**

@juliandsg0222
Copy link
Member

Hello @n2-freevas, thanks for the report, could you tell us which versions of editorjs and editorjs-undo you are using?

@ARH3
Copy link

ARH3 commented Apr 26, 2024

Hi @juliandsg0222 I continue to have the same issue on 2.0.27. Here is a loom video where I walk through the issue.

@n2-freevas
Copy link

@juliandsg0222
I've been using 2.0.27

@keliumJU
Copy link

Hello everyone 👋 @n2-freevas, @ARH3, @Jean-PhilippeD, We are currently working to fix these issues, at the moment to fix the problem of @ARH3 you can try preserving blank space in a paragraph, this problem had arisen a long time ago, you can check the discussion here codex-team/editor.js#1868 (comment)

@juliandsg0222 juliandsg0222 removed their assignment Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 Bug Something isn't working ⛑ Needs triage Someone is checking 📍 Work in progress Current work in progress
Projects
None yet
Development

No branches or pull requests

5 participants