From 8141f4d29b490d86ea43d00a9b1e7b083e984a8a Mon Sep 17 00:00:00 2001 From: spacedragon Date: Wed, 20 Mar 2019 11:48:14 +0800 Subject: [PATCH] [Code] fix reference panel layout problems --- .../public/components/codeblock/codeblock.tsx | 1 + .../public/components/diff_page/diff.scss | 6 ++-- .../code/public/components/diff_page/diff.tsx | 2 +- .../components/editor/references_panel.scss | 7 +++++ .../components/editor/references_panel.tsx | 30 +++++++++---------- .../code/public/components/main/content.tsx | 4 ++- .../code/public/components/main/main.scss | 4 +-- .../code/public/components/main/main.tsx | 1 + .../code/public/monaco/monaco_helper.ts | 1 + 9 files changed, 35 insertions(+), 21 deletions(-) diff --git a/x-pack/plugins/code/public/components/codeblock/codeblock.tsx b/x-pack/plugins/code/public/components/codeblock/codeblock.tsx index 5f3a721d45e592b..4fa4f2b3fe0c33f 100644 --- a/x-pack/plugins/code/public/components/codeblock/codeblock.tsx +++ b/x-pack/plugins/code/public/components/codeblock/codeblock.tsx @@ -52,6 +52,7 @@ export class CodeBlock extends React.PureComponent { selectionHighlight: false, renderLineHighlight: 'none', renderIndentGuides: false, + automaticLayout: false, }); this.ed.onMouseDown((e: editor.IEditorMouseEvent) => { if ( diff --git a/x-pack/plugins/code/public/components/diff_page/diff.scss b/x-pack/plugins/code/public/components/diff_page/diff.scss index 66aa5693b39171d..c402660599f5773 100644 --- a/x-pack/plugins/code/public/components/diff_page/diff.scss +++ b/x-pack/plugins/code/public/components/diff_page/diff.scss @@ -1,9 +1,11 @@ -button.euiAccordion__button > div:first-child { + + +.diff > button.euiAccordion__button > div:first-child { flex-direction: row-reverse; padding: $euiSize $euiSizeS; } -button.euiAccordion__button { +.diff > button.euiAccordion__button { &:hover { text-decoration: none; } diff --git a/x-pack/plugins/code/public/components/diff_page/diff.tsx b/x-pack/plugins/code/public/components/diff_page/diff.tsx index f766fb65dcceee9..ab8424a739660eb 100644 --- a/x-pack/plugins/code/public/components/diff_page/diff.tsx +++ b/x-pack/plugins/code/public/components/diff_page/diff.tsx @@ -191,7 +191,7 @@ export class DiffPage extends React.Component { )); return ( -
+
{ const body = this.props.isLoading ? : this.renderGroupByRepo(); const styles: any = {}; const expanded = this.state.expanded; - if (expanded) { - styles.position = 'absolute'; - styles.bottom = 0; - styles.right = 0; - if (this.node) { - const parent = this.node.parentNode as Element; - styles.width = parent.clientWidth; - styles.height = parent.clientHeight - 75; - styles.maxHeight = styles.height; - styles.zIndex = 1000; - } - } return ( - + {

{this.props.title}

- +
{body}
); @@ -103,12 +96,19 @@ export class ReferencesPanel extends React.Component { } private renderReferenceRepo({ repo, files }: GroupedRepoReferences) { + const [_, org, name] = repo.split('/'); + const buttonContent = ( + + {org}/{name} + + ); + return ( diff --git a/x-pack/plugins/code/public/components/main/content.tsx b/x-pack/plugins/code/public/components/main/content.tsx index 031873a1c4d9216..16facac8ef8add3 100644 --- a/x-pack/plugins/code/public/components/main/content.tsx +++ b/x-pack/plugins/code/public/components/main/content.tsx @@ -54,6 +54,7 @@ const EditorBlameContainer = styled.div` display: flex; flex-direction: row; flex-grow: 1; + max-height: calc(100% - 97px); `; const DirectoryViewContainer = styled.div` @@ -69,7 +70,8 @@ const Root = styled.div` flex-grow: 1; display: flex; flex-direction: column; - overflow: hidden; + height: 100%; + width: calc(100% - 256px); `; interface Props extends RouteComponentProps { diff --git a/x-pack/plugins/code/public/components/main/main.scss b/x-pack/plugins/code/public/components/main/main.scss index d99a20c0b5298a0..d5a32bb108b0678 100644 --- a/x-pack/plugins/code/public/components/main/main.scss +++ b/x-pack/plugins/code/public/components/main/main.scss @@ -1,6 +1,6 @@ .code-editor-container { - height: 100%; - overflow: auto; + overflow: hidden; + flex-grow: 1; } .code-auto-overflow { diff --git a/x-pack/plugins/code/public/components/main/main.tsx b/x-pack/plugins/code/public/components/main/main.tsx index 388535ac36ef30c..39db12e441823dd 100644 --- a/x-pack/plugins/code/public/components/main/main.tsx +++ b/x-pack/plugins/code/public/components/main/main.tsx @@ -28,6 +28,7 @@ const Container = styled.div` display: flex; flex-direction: row; flex-grow: 1; + height: 100%; `; interface Props extends RouteComponentProps { diff --git a/x-pack/plugins/code/public/monaco/monaco_helper.ts b/x-pack/plugins/code/public/monaco/monaco_helper.ts index ae1d271218f574b..d5884e98998c670 100644 --- a/x-pack/plugins/code/public/monaco/monaco_helper.ts +++ b/x-pack/plugins/code/public/monaco/monaco_helper.ts @@ -62,6 +62,7 @@ export class MonacoHelper { folding: true, scrollBeyondLastLine: false, renderIndentGuides: false, + automaticLayout: false, }, { textModelService: new TextModelResolverService(monaco),