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

#3005 - Unable to 'undo' the paste action, if there is no reset to Select tool. #3137

Conversation

nanoblit
Copy link
Collaborator

@nanoblit nanoblit commented Aug 18, 2023

How the feature works? / How did you fix the issue?

(Screenshots, videos, or GIFs, if applicable)

Fix undoing paste when reset to select tool setting is off

Check list

  • unit-tests written
  • e2e-tests written
  • documentation updated
  • PR name follows the pattern #1234 – issue name
  • branch name doesn't contain '#'
  • PR is linked with the issue
  • base branch (master or release/xx) is correct
  • task status changed to "Code review"

@nanoblit nanoblit force-pushed the 3005-unable-to-undo-the-paste-action-if-there-is-no-reset-to-select-tool branch from bbe6698 to b90ed60 Compare August 22, 2023 07:00
@nanoblit nanoblit marked this pull request as ready for review August 22, 2023 08:33
@@ -535,9 +536,8 @@ class Editor implements KetcherEditor {

this.selection(null);

if (this._tool instanceof toolsMap.paste) {
this.event.change.dispatch();
Copy link
Collaborator

Choose a reason for hiding this comment

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

My proposal is not to remove the change event dispatch. FYI, it, most likely, doesn't affect our app code, but there can be subscribers in external application and with this we can break their apps

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

All right, I'll add it back. Thanks for the head up. :)

return;

if (this._tool instanceof PasteTool) {
this._tool.updatePreview();
Copy link
Contributor

Choose a reason for hiding this comment

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

could we at least unify logic, for ex. move updatePreview as empty method to Tool class and invoke this._tool.updatePreview() for all tools (remove if condition)? (implementation still be in PasteTool class)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did it like this, because I thought it was very specific to the paste tool, but your point makes sense too, I will change it.

if (this._tool instanceof toolsMap.paste) {
this.event.change.dispatch();
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

are you sure that it will not broke anything?
return; no longer needed here?

Copy link
Collaborator Author

@nanoblit nanoblit Aug 30, 2023

Choose a reason for hiding this comment

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

You are right. Changing that fixes the issue, but causes other edge cases. I need to do this differently.

@nanoblit
Copy link
Collaborator Author

nanoblit commented Sep 5, 2023

All tests passing. The failed test is passing locally:
Zrzut ekranu 2023-09-05 093105

@ilya-asiyuk-epam
Copy link
Contributor

Fixed in this PR - #4161

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.

Unable to 'undo' the paste action, if there is no reset to Select tool.
5 participants