From 3e74985203ca6c70ef83dad9529f11d3e8a529d7 Mon Sep 17 00:00:00 2001 From: Konstantin Schaper Date: Tue, 15 Nov 2022 18:37:03 +0100 Subject: [PATCH] Remove forced word break from markdown view (#2142) In `751343f` we forced words to wrap in a variety of places in the SCM-Manager to prevent unintentional overflow breaking the layout. This was also added to the markdown view which had implications for tables in these views including long headers that would now break in a not so pretty fashion. After investigating potential implications and checking other usages of the markdown view, we removed the problematic class again in this particular instance as it was seemingly not serving any positive purpose and removing it had no negative impact. --- .../changelog/markdown_table_header_wrap.yaml | 2 ++ .../src/__snapshots__/storyshots.test.ts.snap | 22 +++++++++--------- .../src/markdown/LazyMarkdownView.tsx | 23 +++++++++++-------- 3 files changed, 27 insertions(+), 20 deletions(-) create mode 100644 gradle/changelog/markdown_table_header_wrap.yaml diff --git a/gradle/changelog/markdown_table_header_wrap.yaml b/gradle/changelog/markdown_table_header_wrap.yaml new file mode 100644 index 0000000000..813c4eaef8 --- /dev/null +++ b/gradle/changelog/markdown_table_header_wrap.yaml @@ -0,0 +1,2 @@ +- type: fixed + description: Remove forced word break from markdown view ([#2142](https://github.com/scm-manager/scm-manager/pull/2142)) diff --git a/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap b/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap index c05a43d3d9..71144befea 100644 --- a/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap +++ b/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap @@ -4895,7 +4895,7 @@ exports[`Storyshots MarkdownView Code without Lang 1`] = ` className="MarkdownViewstories__Spacing-sc-1lofakk-0 isVeYs" >

@@ -4964,7 +4964,7 @@ exports[`Storyshots MarkdownView Commit Links 1`] = ` className="MarkdownViewstories__Spacing-sc-1lofakk-0 isVeYs" >

{ ); }; +const HorizontalScrollDiv = styled.div` + overflow-x: auto; +`; + class LazyMarkdownView extends React.Component { static contextType = BinderContext; static defaultProps: Partial = { enableAnchorHeadings: false, - skipHtml: false + skipHtml: false, }; constructor(props: Props) { super(props); this.state = { - contentRef: null + contentRef: null, }; } @@ -150,7 +155,7 @@ class LazyMarkdownView extends React.Component { basePath, permalink, t, - mdastPlugins = [] + mdastPlugins = [], } = this.props; const rendererFactory = this.context.getExtension("markdown-renderer-factory"); @@ -207,27 +212,27 @@ class LazyMarkdownView extends React.Component { sanitize, merge(gh, { attributes: { - code: ["className"] // Allow className for code elements, this is necessary to extract the code language + code: ["className"], // Allow className for code elements, this is necessary to extract the code language }, clobberPrefix: "", // Do not prefix user-provided ids and class names, protocols: { - href: Object.keys(protocolLinkRendererExtensions) - } + href: Object.keys(protocolLinkRendererExtensions), + }, }) ) .use(rehype2react, { createElement: React.createElement, passNode: true, - components: createComponentList(remarkRendererList, { permalink }) + components: createComponentList(remarkRendererList, { permalink }), }); const renderedMarkdown: any = processor.processSync(content).result; return ( -
this.setState({ contentRef: el })} className="content is-word-break"> + this.setState({ contentRef: el })} className="content"> {renderedMarkdown} -
+
); }