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

Add exitModalWidget function and string constants #8

Open
skolmer opened this issue Nov 2, 2020 · 0 comments
Open

Add exitModalWidget function and string constants #8

skolmer opened this issue Nov 2, 2020 · 0 comments

Comments

@skolmer
Copy link
Contributor

skolmer commented Nov 2, 2020

Is your feature request related to a problem? Please describe.
We have a cancel button in our modal that is basically doing the same as the "x" in the upper right corner of the modal. We want to use the same code that is running when the "x" is clicked to get the exact same result data in our CloseModalWidget event.

Describe the solution you'd like
Currently we just duplicated some logic and extended the WidgetApi with a function.

widgetApi.exitModalWidget = () => widgetApi.closeModalWidget({ "m.exited": true });

It would be nice if the exit function that is used by the "x" could be used instead. It would also be good to have constants for magic strings like m.exited.

Another small feature request is to have a function that basically does (widgetAction: WidgetApiToWidgetAction) => `action:${widgetAction}`; instead of writing code like this const actionButtonClicked = `action:${WidgetApiToWidgetAction.ButtonClicked}`; to get the correct event handler name as expected by the API.

If you are ok with this I could provide a PR.

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

No branches or pull requests

1 participant