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

fix: don't mutate the bounded text if not updated when submitted #4543

Merged
merged 12 commits into from
Jan 11, 2022

Conversation

ad1992
Copy link
Member

@ad1992 ad1992 commented Jan 5, 2022

Attempt fix the "undo twice for first time when bounded text properties updated by selecting text explicitly" mentioned in #4537

Previous
Excalidraw (12)

Now

Excalidraw (13)

@vercel
Copy link

vercel bot commented Jan 5, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/excalidraw/excalidraw/86BfnGMynX2iq4KZKm6TTj1u6s6b
✅ Preview: https://excalidraw-git-aakansha-undo-excalidraw.vercel.app

@ad1992 ad1992 requested a review from dwelle January 5, 2022 10:53
src/element/newElement.ts Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
const updatedElement = Scene.getScene(element)!.getElement(
element.id,
) as ExcalidrawTextElement;
prevText = updatedElement.text;
Copy link
Member

@dwelle dwelle Jan 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't this assignment make the prevText variable always equivalent to updatedElement.text, removing the need to cache it at all?

@dwelle
Copy link
Member

dwelle commented Jan 10, 2022

I noticed a regression:

  1. Create a sticky note and write line long enough to wrap one the next line. Confirm.

  2. Edit again and delete the text, then write a single-line text. Confirm.

  3. The text is misaligned.

    excal-regr-sticky

@ad1992
Copy link
Member Author

ad1992 commented Jan 11, 2022

I noticed a regression:

  1. Create a sticky note and write line long enough to wrap one the next line. Confirm.
  2. Edit again and delete the text, then write a single-line text. Confirm.
  3. The text is misaligned.
    excal-regr-sticky

Good catch!. Updated the implementation to cache originalText and comparing with editor value instead. Added spec for this case. Should be fine now.

@ad1992 ad1992 requested a review from dwelle January 11, 2022 08:45
@dwelle
Copy link
Member

dwelle commented Jan 11, 2022

🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants