diff --git a/src/plugins/links/public/components/dashboard_link/dashboard_link_component.tsx b/src/plugins/links/public/components/dashboard_link/dashboard_link_component.tsx index 07126009bc31..54cbddd824a3 100644 --- a/src/plugins/links/public/components/dashboard_link/dashboard_link_component.tsx +++ b/src/plugins/links/public/components/dashboard_link/dashboard_link_component.tsx @@ -171,6 +171,7 @@ export const DashboardLinkComponent = ({ linkCurrent: link.destination === parentDashboardId, dashboardLinkError: Boolean(link.error), 'dashboardLinkError--noLabel': !link.label, + overflowTextWrap: link.overflow === 'textWrap', })} label={linkLabel} external={link.options?.openInNewTab} diff --git a/src/plugins/links/public/components/editor/links_editor.scss b/src/plugins/links/public/components/editor/links_editor.scss index c33b95350df9..9a96bda2575f 100644 --- a/src/plugins/links/public/components/editor/links_editor.scss +++ b/src/plugins/links/public/components/editor/links_editor.scss @@ -78,3 +78,9 @@ .linksDroppableLinksArea { margin: 0 (-$euiSizeXS); } + +// Add classname logic for the wrap text +&.overflowTextWrap span:first-child { + white-space: normal !important; + overflow: auto !important; +} diff --git a/src/plugins/links/public/components/editor/links_editor.tsx b/src/plugins/links/public/components/editor/links_editor.tsx index 8fa33fd4ebca..3b0cd051ed4e 100644 --- a/src/plugins/links/public/components/editor/links_editor.tsx +++ b/src/plugins/links/public/components/editor/links_editor.tsx @@ -91,6 +91,21 @@ const LinksEditor = ({ const [isSaving, setIsSaving] = useState(false); const [orderedLinks, setOrderedLinks] = useState([]); const [saveByReference, setSaveByReference] = useState(isByReference); + const [toggleOverflowIdSelected, setToggleOverflowIdSelected] = useState('textEllipsis'); + const toggleButtonsOverflow = [ + { + id: 'textEllipsis', + label: LinksStrings.editor.linkEditor.getOverflowEllipsis(), + }, + { + id: 'textWrap', + label: LinksStrings.editor.linkEditor.getOverflowTextWrap(), + }, + ]; + + const onChangeOverflow = (optionId: React.SetStateAction) => { + setToggleOverflowIdSelected(optionId); + }; const isEditingExisting = initialLinks || isByReference; @@ -195,6 +210,15 @@ const LinksEditor = ({ legend={LinksStrings.editor.panelEditor.getLayoutSettingsLegend()} /> + + onChangeOverflow(id)} + buttonSize="compressed" + /> + {/* Needs to be surrounded by a div rather than a fragment so the EuiFormRow can respond to the focus of the inner elements */} @@ -289,6 +313,13 @@ const LinksEditor = ({ disabled={hasZeroLinks} data-test-subj={'links--panelEditor--saveBtn'} onClick={async () => { + setOrderedLinks( + orderedLinks.map((link) => { + return toggleOverflowIdSelected === 'textWrap' + ? { ...link, overflow: 'textWrap' } + : { ...link, overflow: 'ellipsis' }; + }) + ); if (saveByReference) { setIsSaving(true); onSaveToLibrary(orderedLinks, currentLayout) diff --git a/src/plugins/links/public/components/links_component.scss b/src/plugins/links/public/components/links_component.scss index ecd801492b9e..6dcab0bb3be0 100644 --- a/src/plugins/links/public/components/links_component.scss +++ b/src/plugins/links/public/components/links_component.scss @@ -15,11 +15,24 @@ &.linkCurrent { border-radius: 0; - .euiListGroupItem__text { + &.euiListGroupItem__text { cursor: default; color: $euiColorPrimary; } } + + &.overflowTextWrap span:first-child { + white-space: normal !important; + overflow: auto !important; + overflow-wrap: anywhere !important; + text-overflow: unset !important; + } + + &.overflowTextEllipsis { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } } .verticalLayoutWrapper { diff --git a/src/plugins/links/public/components/links_strings.ts b/src/plugins/links/public/components/links_strings.ts index 73d0eddf94b8..98191316e5dd 100644 --- a/src/plugins/links/public/components/links_strings.ts +++ b/src/plugins/links/public/components/links_strings.ts @@ -135,6 +135,18 @@ export const LinksStrings = { i18n.translate('links.linkEditor.linkOptionsLabel', { defaultMessage: 'Options', }), + getOverflowLegend: () => + i18n.translate('links.linkEditor.overflowLegend', { + defaultMessage: 'Text Overflow', + }), + getOverflowTextWrap: () => + i18n.translate('links.linkEditor.overflowTextWrap', { + defaultMessage: 'Wrap text', + }), + getOverflowEllipsis: () => + i18n.translate('links.linkEditor.overflowEllipsis', { + defaultMessage: 'Ellipsis', + }), }, }, }; diff --git a/src/plugins/links/public/types.ts b/src/plugins/links/public/types.ts index df3eb7fc2b51..2662d6cafcf3 100644 --- a/src/plugins/links/public/types.ts +++ b/src/plugins/links/public/types.ts @@ -69,6 +69,7 @@ export type ResolvedLink = Link & { label?: string; description?: string; error?: Error; + overflow?: 'ellipsis' | 'textWrap'; }; export interface DashboardItem { diff --git a/src/plugins/ui_actions_enhanced/public/drilldowns/url_drilldown/components/url_drilldown_collect_config/i18n.ts b/src/plugins/ui_actions_enhanced/public/drilldowns/url_drilldown/components/url_drilldown_collect_config/i18n.ts index d357897c3239..c4aee591ff83 100644 --- a/src/plugins/ui_actions_enhanced/public/drilldowns/url_drilldown/components/url_drilldown_collect_config/i18n.ts +++ b/src/plugins/ui_actions_enhanced/public/drilldowns/url_drilldown/components/url_drilldown_collect_config/i18n.ts @@ -83,3 +83,24 @@ export const txtUrlTemplateEncodeDescription = i18n.translate( defaultMessage: 'If enabled, URL will be escaped using percent encoding', } ); + +export const txtUrlTemplateOverflow = i18n.translate( + 'uiActionsEnhanced.drilldowns.urlDrilldownCollectConfig.overflow', + { + defaultMessage: 'Text Overflow', + } +); + +export const txtUrlTemplateOverflowTextWrap = i18n.translate( + 'uiActionsEnhanced.drilldowns.urlDrilldownCollectConfig.overflowTextWrap', + { + defaultMessage: 'Wrap text', + } +); + +export const txtUrlTemplateOverflowEllipsis = i18n.translate( + 'uiActionsEnhanced.drilldowns.urlDrilldownCollectConfig.overflowEllipsis', + { + defaultMessage: 'Ellipsis', + } +);