Skip to content

[EuiMarkdownEditor] Add footer visibility toggle and toolbar right slot to MarkdownEditor #8889

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

mbondyra
Copy link
Contributor

@mbondyra mbondyra commented Jul 21, 2025

Summary

Resolves #8865

Adds two new props to EuiMarkdownEditor to support the Dashboard Markdown visualization use case:

  • footerProps.visibility — allows consumers to hide the editor footer entirely.
  • toolbarProps.right — allows replacing the default preview/editor switch with a custom node on the right side of the toolbar.

These changes make it easier to control the editor layout in custom contexts while keeping the default behavior intact.

Exposes EuiMarkdownHelpButton - in Kibana, we want to display it on the right top corner.

Checklist

  • Backwards compatible
  • Defaults remain unchanged
  • Tests added
  • Storybook updated

Screenshots

Impact to users

Defaults remain unchanged

QA

Remove or strikethrough items that do not apply to your PR.

General checklist

  • Browser QA
    • Checked in both light and dark modes
    • Checked in both MacOS and Windows high contrast modes
    • Checked in mobile
    • Checked in Chrome, Safari, Edge, and Firefox
    • Checked for accessibility including keyboard-only and screenreader modes
  • Docs site QA
  • Code quality checklist
  • Release checklist
    • A changelog entry exists and is marked appropriately.
    • If applicable, added the breaking change issue label (and filled out the breaking change checklist)
  • Designer checklist
    • If applicable, file an issue to update EUI's Figma library with any corresponding UI changes. (This is an internal repo, if you are external to Elastic, ask a maintainer to submit this request)

@mbondyra mbondyra requested a review from a team as a code owner July 21, 2025 21:21
@mbondyra mbondyra force-pushed the support_toolbar_props branch from 9697307 to c6d3221 Compare July 21, 2025 21:26
@mbondyra mbondyra force-pushed the support_toolbar_props branch from c6d3221 to b50e21c Compare July 21, 2025 21:36
onClickPreview: MouseEventHandler<HTMLButtonElement>;
readOnly?: boolean;
}) => {
return isPreviewing ? (
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is a standalone component now and the variants use the same component, we could simplify this to use a single EuiButtonEmpty with conditional props. Something like this:

return (
    <EuiButtonEmpty
      data-test-subj={
        isPreviewing
          ? "markdown_editor_edit_button"
          : "markdown_editor_preview_button"
      }
      iconType={isPreviewing ? "code" : "eye"}
      color="text"
      size="s"
      onClick={onClickPreview}
      isDisabled={readOnly}
    >
      {isPreviewing ? (
        <EuiI18n token="euiMarkdownEditorToolbar.editor" default="Editor" />
      ) : (
        <EuiI18n
          token="euiMarkdownEditorToolbar.previewMarkdown"
          default="Preview"
        />
      )}
    </EuiButtonEmpty>
  );

Copy link
Contributor

Choose a reason for hiding this comment

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

We're missing the data-test-subj now after the update. Let's revert it, because if that attribute was used anywhere it might break tests.

@mbondyra
Copy link
Contributor Author

@mgadewoll Thanks for a lightspeed review! I think I've addressed all your comments and added the storybook and website example as discussed offline. Not sure about the i18ntokens.json file changes - let me know if that's something I should revert, it was caused by the commit prehooks.

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @mbondyra

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

cc @mbondyra

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] — Allow external control of viewMode for Markdown editor and allow not displaying editor/preview button
3 participants