eui
eui copied to clipboard
feat: [EuiMarkdownFormat]: Added Option/Props to Open Link in New Tab
Summary
Resolved #7919
We are Unable to Directly Config EuiMarkdownFormat to Open Link in Net Tab, which is essentially needed. Issue #7919
💚 CLA has been signed
@hsk11, I took over and extended your PR to apply to the generic getDefaultEuiMarkdownPlugins() function, as that is generally the API in which we want consumers to interact with our markdown plugins, rather than the components directly (which should have higher component-level concerns instead). This also enables EuiMarkdownEditor to benefit from this configuration and not just EuiMarkdownFormat (since they both accept the same plugins props).
The following setup will result in the outcome #7919 asks for:
const { processingPlugins } = getDefaultEuiMarkdownPlugins({
processingConfig: {
linkProps: { target: '_blank' },
},
});
<EuiMarkdownFormat processingPluginList={processingPlugins}>
[Opens in new tab](https://elastic.co)
</EuiMarkdownFormat>
:green_heart: Build Succeeded
- Buildkite Build
- Commit: 186393fd4e6747d526e269e4a8a62b718dcfe5b9
History
- :broken_heart: Build #2648 failed 39774fc48a85a1688542a602432bbb7ec2e67613
- :broken_heart: Build #2644 failed 170eda65582a139771682355632fb45e66a6308d
@hsk11, I took over and extended your PR to apply to the generic
getDefaultEuiMarkdownPlugins()function, as that is generally the API in which we want consumers to interact with our markdown plugins, rather than the components directly (which should have higher component-level concerns instead). This also enablesEuiMarkdownEditorto benefit from this configuration and not justEuiMarkdownFormat(since they both accept the same plugins props).The following setup will result in the outcome #7919 asks for:
const { processingPlugins } = getDefaultEuiMarkdownPlugins({ processingConfig: { linkProps: { target: '_blank' }, }, }); <EuiMarkdownFormat processingPluginList={processingPlugins}> [Opens in new tab](https://elastic.co) </EuiMarkdownFormat>
Thanks, Even I thought of Directly Editing there But did not changed it Because Wanted to make Sure i wont Break the getDefaultEuiMarkdownPlugins(), as some people might be using it the way you implemented it now. IMO it would be great if we also just allow to set linkTraget just by passing the prop in EuiMarkDownFormat component .