-
Notifications
You must be signed in to change notification settings - Fork 856
[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
base: main
Are you sure you want to change the base?
Conversation
9697307
to
c6d3221
Compare
c6d3221
to
b50e21c
Compare
packages/eui/src/components/markdown_editor/markdown_editor.tsx
Outdated
Show resolved
Hide resolved
packages/eui/src/components/markdown_editor/markdown_editor.tsx
Outdated
Show resolved
Hide resolved
packages/eui/src/components/markdown_editor/markdown_editor_toolbar.tsx
Outdated
Show resolved
Hide resolved
onClickPreview: MouseEventHandler<HTMLButtonElement>; | ||
readOnly?: boolean; | ||
}) => { | ||
return isPreviewing ? ( |
There was a problem hiding this comment.
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>
);
There was a problem hiding this comment.
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.
packages/eui/src/components/markdown_editor/markdown_editor.tsx
Outdated
Show resolved
Hide resolved
packages/eui/src/components/markdown_editor/markdown_editor.tsx
Outdated
Show resolved
Hide resolved
@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. |
packages/website/docs/components/editors-and-syntax/markdown/editor.mdx
Outdated
Show resolved
Hide resolved
💚 Build SucceededHistory
cc @mbondyra |
💚 Build Succeeded
History
cc @mbondyra |
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
Screenshots
Impact to users
Defaults remain unchanged
QA
Remove or strikethrough items that do not apply to your PR.
General checklist
@default
if default values are missing) and playground toggles