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

[EuiMarkdownEditor] Added popover to display help syntax text when no custom plugins are available #5147

Merged

Conversation

elizabetdev
Copy link
Contributor

@elizabetdev elizabetdev commented Sep 7, 2021

Summary

Closes #5127.

  • This PR adds a popover to display help syntax text when no custom plugins are available.
  • Adds an easier way to unregister plugins (thanks to @chandlerprall).
  • Adds documentation to show how we can unregister plugins.

Design

If we're not showing syntax for plugins, we display the help syntax in a popover. No need to have a modal just with a link to the GitHub Flavored Markdown page.

md-no-plugin@2x

The Markdown button was not displaying correctly on hover.

helper-btn@2x

New docs section

As per my comment on #5127 (comment). I think it isn't easy to know how to unregister plugins. For me, it makes sense to have a section in our docs to show how to do it. So I created the following section on #/editors-syntax/markdown-editor#unregistering-plugins.

Screenshot 2021-09-14 at 13 38 27

Checklist

  • Check against all themes for compatibility in both light and dark modes
  • [ ] Checked in mobile
  • Checked in Chrome, Safari, Edge, and Firefox
  • [ ] Props have proper autodocs and playground toggles
  • Added documentation
  • [ ] Checked Code Sandbox works for the any docs examples
  • Added or updated jest tests
  • [ ] Checked for breaking changes and labeled appropriately
  • [ ] Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5147/

@chandlerprall
Copy link
Contributor

I think it isn't easy to know how to unregister plugins. For me, it makes sense to have a section in our docs to show how to do it

🚀 great example idea; I've created a PR against your branch with an easier way to disable the tooltip plugin (and we can extend it with any other complete plugins in the future)

@elizabetdev elizabetdev changed the title [EuiMarkdownEditor] Added popover to display help syntax text when no plugins are available [EuiMarkdownEditor] Added popover to display help syntax text when no custom plugins are available Sep 8, 2021
@elizabetdev elizabetdev marked this pull request as ready for review September 8, 2021 17:00
@elizabetdev
Copy link
Contributor Author

@chandlerprall the CI is always failling 🤷🏽 with:

15:25:16 Generating typescript definitions file
15:25:16 eui.d.ts(11728,29): error TS2307: Cannot find module 'unified/types/ts3.4/' or its corresponding type declarations.
15:26:16 eui.d.ts(11729,34): error TS2307: Cannot find module 'unified/types/ts3.4/' or its corresponding type declarations.
15:26:16 eui.d.ts(11729,377): error TS2307: Cannot find module 'unified/types/ts3.4/' or its corresponding type declarations.
15:26:16 child_process.js:669
15:26:16     throw err;

@elizabetdev elizabetdev requested a review from cchaos September 10, 2021 14:39
@thompsongl
Copy link
Contributor

👉 elizabetdev#24 will fix the CI failure

@elizabetdev
Copy link
Contributor Author

Thanks @thompsongl! 😄

@elizabetdev
Copy link
Contributor Author

jenkins test this

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5147/

@cchaos cchaos requested a review from thompsongl September 13, 2021 15:09
Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

I like the simplicity of just showing the popover when there's not much more context than just pointing to GH markdown docs. 💯

The component fixes mostly LGTM (with a few fixes mentioned), but most of my comments revolve around the docs to try to make it clearer / get straight to the point.

CHANGELOG.md Show resolved Hide resolved
{isAstShowing ? 'Hide editor AST' : 'Show editor AST'}
</EuiButton>
</div>
{isAstShowing && <EuiCodeBlock language="json">{ast}</EuiCodeBlock>}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be in a follow up PR:

Because this continues to be added to every examples, and I can understand the nicety to it, I start worrying that it actually looks like it comes with the component. Can we rethink a way to render this. Like maybe look at how the Page examples are wrapped in a custom component but only renders what it needed for the consumer.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll follow up on this. 👍🏽

src/components/markdown_editor/markdown_editor_footer.tsx Outdated Show resolved Hide resolved
src/components/markdown_editor/markdown_editor_footer.tsx Outdated Show resolved Hide resolved
elizabetdev and others added 2 commits September 13, 2021 18:11
Co-authored-by: Caroline Horn <549577+cchaos@users.noreply.github.com>
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5147/

@elizabetdev elizabetdev changed the title [EuiMarkdownEditor] Added popover to display help syntax text when no custom plugins are available [EuiMarkdownEditor] Added tooltip to display help syntax text when no custom plugins are available Sep 14, 2021
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5147/

@elizabetdev
Copy link
Contributor Author

@cchaos I finished the changes based on your review:

  • No more HTML code.
  • I wrapped the markdown button with a tooltip.
  • Updated the markdown button to size "S" and updated the upload button to match the same size.
  • Simplified the example and removed unnecessary code like upload button, errors, and show editor AST.

@elizabetdev elizabetdev requested a review from cchaos September 14, 2021 14:11
thompsongl
thompsongl previously approved these changes Sep 14, 2021
Copy link
Contributor

@thompsongl thompsongl left a comment

Choose a reason for hiding this comment

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

Thanks, @miukimiu!

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5147/

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5147/

@thompsongl thompsongl self-requested a review September 20, 2021 15:53
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5147/

@elizabetdev elizabetdev force-pushed the md-editor-syntax-help-no-plugins-ui branch from 4c767b9 to 92dadbc Compare September 21, 2021 19:18
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5147/

@elizabetdev elizabetdev changed the title [EuiMarkdownEditor] Added tooltip to display help syntax text when no custom plugins are available [EuiMarkdownEditor] Added popover to display help syntax text when no custom plugins are available Sep 22, 2021
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5147/

@elizabetdev
Copy link
Contributor Author

@cchaos and @thompsongl these are the new changes:

  • The popover is back when no plugins are available. For this scenario, I'm using the button title with "Syntax help" instead of a tooltip so it doesn't conflict with the open popover.
  • Linking the "GitHub flavored markdown" to https://guides.github.com/features/mastering-markdown/. The other page we were linking before was too complex and we were not supporting a lot of things. @cchaos we talked about linking to https://www.markdownguide.org/ instead but I came to the conclusion that we're following more the GitHub flavored markdown. We support emojis, task lists, and strikethrough.

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

👍 The UI looks great. But I did find a possible edge case where if there are plugins but none of the plugins actually have helpText.

src/components/markdown_editor/markdown_editor_footer.tsx Outdated Show resolved Hide resolved
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5147/

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

👍 Double-checked the different examples with the new logic. LGTM!

Rebase and CL update needed.

@elizabetdev
Copy link
Contributor Author

elizabetdev commented Sep 22, 2021

Rebase and CL update needed.

Thanks, @cchaos! I confirmed and it's updated and rebased.
@thompsongl I'm merging it because I reverted the code to what it was when you approved.

@elizabetdev elizabetdev merged commit 3ec8cff into elastic:master Sep 22, 2021
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.

[EuiMarkdownEditor] Enhancement request: Smarter UI when no plugins present
5 participants