Merge with default

This commit is contained in:
Rene Pfeuffer
2020-02-13 15:59:28 +01:00
4 changed files with 553 additions and 578 deletions

View File

@@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## 2.0.0-rc3 - 2020-01-31
### Fixed
- Broken plugin order fixed
- MarkdownViewer in code section renders markdown properly
## 2.0.0-rc2 - 2020-01-29
### Added

View File

@@ -2,7 +2,6 @@ import React from "react";
import { withRouter, RouteComponentProps } from "react-router-dom";
// @ts-ignore
import Markdown from "react-markdown/with-html";
import styled from "styled-components";
import { binder } from "@scm-manager/ui-extensions";
import SyntaxHighlighter from "./SyntaxHighlighter";
import MarkdownHeadingRenderer from "./MarkdownHeadingRenderer";
@@ -15,35 +14,6 @@ type Props = RouteComponentProps & {
enableAnchorHeadings?: boolean;
};
const MarkdownWrapper = styled.div`
> .content {
> h1,
h2,
h3,
h4,
h5,
h6 {
margin: 0.5rem 0;
font-size: 0.9rem;
}
> h1 {
font-weight: 700;
}
> h2 {
font-weight: 600;
}
> h3,
h4,
h5,
h6 {
font-weight: 500;
}
& strong {
font-weight: 500;
}
}
`;
class MarkdownView extends React.Component<Props> {
static defaultProps: Partial<Props> = {
enableAnchorHeadings: false,
@@ -94,7 +64,7 @@ class MarkdownView extends React.Component<Props> {
}
return (
<MarkdownWrapper ref={el => (this.contentRef = el)}>
<div ref={el => (this.contentRef = el)}>
<Markdown
className="content"
skipHtml={skipHtml}
@@ -102,7 +72,7 @@ class MarkdownView extends React.Component<Props> {
source={content}
renderers={rendererList}
/>
</MarkdownWrapper>
</div>
);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,7 @@ import classNames from "classnames";
import styled from "styled-components";
// @ts-ignore
import { Decoration, getChangeKey, Hunk } from "react-diff-view";
import { Button, ButtonGroup } from "../buttons";
import { ButtonGroup } from "../buttons";
import Tag from "../Tag";
import Icon from "../Icon";
import { Change, ChangeEvent, DiffObjectProps, File, Hunk as HunkType } from "./DiffTypes";
@@ -72,6 +72,14 @@ class DiffFile extends React.Component<Props, State> {
};
}
componentDidUpdate(prevProps: Readonly<Props>, prevState: Readonly<State>, snapshot?: any): void {
if (this.props.defaultCollapse !== prevProps.defaultCollapse) {
this.setState({
collapsed: this.defaultCollapse()
});
}
}
defaultCollapse: () => boolean = () => {
const { defaultCollapse, file } = this.props;
if (typeof defaultCollapse === "boolean") {