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

feat: allow onEscapeButton remapping #356

Closed

Conversation

saif-ellafi
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

Allows remapping the Escape Button behavior from MainEditorConfigs defining onEscapeButton
The naming of the function could be better, feel free to improve, if you accept this PR.

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Currently we can only toggle ESC on and off, but this is difficult since it needs to rebuild the editor or refresh the configurations. This custom behavior allows user space take care of what to do, for example whether to call closeEditor or doneEditing

Issue Number: #354

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Copy link
Owner

@hm21 hm21 left a comment

Choose a reason for hiding this comment

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

Hey Saif,

Thanks for your PR! Overall, I think it's a good idea to add a callback for this, but I have two points of feedback:

  1. I believe we should not remove enableEscapeButton, as it still provides a simple way for users to disable the escape button. Removing it could be confusing since users would need to set an empty callback instead. Additionally, removing it would introduce a breaking change, as this feature has already been released. To be honest, I’d prefer not to bump the version directly to 9.x.x for such a minor change.
  2. I would prefer to add this callback inside callbacks instead of configs.

Since this change is quite simple, I’ve gone ahead and copied your code into mainEditorCallbacks and will release the update later today.

Best regards

@hm21 hm21 closed this Feb 12, 2025
@saif-ellafi
Copy link
Contributor Author

saif-ellafi commented Feb 12, 2025

Thanks, wow such terrible from my end I didn't even think of such Points and been working on this for months.

I guess because my single point of truth is not the code rather the image state, and for the callbacks, should have known :) -- No excuses

Been testing this and works flawless!

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.

2 participants