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

Help Wanted: Recommend using openModal in webapp plugin development guide #1008

Open
mickmister opened this issue Feb 7, 2022 · 0 comments

Comments

@mickmister
Copy link
Contributor

mickmister commented Feb 7, 2022

Related ticket https://mattermost.atlassian.net/browse/MM-41610

This change should be placed in a new file in the webapp plugin development guide https://developers.mattermost.com/integrate/plugins/webapp


Proposed addition to Documentation

If a webapp plugin needs to open a modal for its own use, it should use the globally exposed window.openModal function. This is recommended because it allows the core webapp to properly handle the lifecycle of the component.

Here's an example of using this function:

this.props.actions.openModal({
    modalId: 'my-plugin-id_my-modal-id',
    dialogType: MyModal,
    dialogProps: {
        someComponentProp: 'some value'.
    },
});
  • Replace my-plugin-id, my-modal-id, with appropriate values.
  • dialogType should be a React component implemented by the plugin. This is the component that will be instantiated when openModal is called.
  • The component will receive the dialogProps object as React props.
@cwarnermm cwarnermm changed the title Recommend using openModal in webapp plugin development guide Help Wanted: Recommend using openModal in webapp plugin development guide Feb 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants