Commit 4fd80c9f authored by Paul Slaughter's avatar Paul Slaughter

Revert "Merge branch '329568-update-md-header-buttons' into 'master'"

This reverts merge request !67058
parent c3be0d38
<script> <script>
import { GlPopover, GlButton, GlTooltipDirective } from '@gitlab/ui'; import { GlPopover, GlButton, GlTooltipDirective, GlIcon } from '@gitlab/ui';
import $ from 'jquery'; import $ from 'jquery';
import { keysFor, BOLD_TEXT, ITALIC_TEXT, LINK_TEXT } from '~/behaviors/shortcuts/keybindings'; import { keysFor, BOLD_TEXT, ITALIC_TEXT, LINK_TEXT } from '~/behaviors/shortcuts/keybindings';
import { getSelectedFragment } from '~/lib/utils/common_utils'; import { getSelectedFragment } from '~/lib/utils/common_utils';
...@@ -10,6 +10,7 @@ import ToolbarButton from './toolbar_button.vue'; ...@@ -10,6 +10,7 @@ import ToolbarButton from './toolbar_button.vue';
export default { export default {
components: { components: {
ToolbarButton, ToolbarButton,
GlIcon,
GlPopover, GlPopover,
GlButton, GlButton,
}, },
...@@ -45,7 +46,6 @@ export default { ...@@ -45,7 +46,6 @@ export default {
data() { data() {
return { return {
tag: '> ', tag: '> ',
suggestPopoverVisible: false,
}; };
}, },
computed: { computed: {
...@@ -76,27 +76,15 @@ export default { ...@@ -76,27 +76,15 @@ export default {
return this.isMac ? '' : s__('KeyboardKey|Ctrl+'); return this.isMac ? '' : s__('KeyboardKey|Ctrl+');
}, },
}, },
watch: {
showSuggestPopover() {
this.updateSuggestPopoverVisibility();
},
},
mounted() { mounted() {
$(document).on('markdown-preview:show.vue', this.previewMarkdownTab); $(document).on('markdown-preview:show.vue', this.previewMarkdownTab);
$(document).on('markdown-preview:hide.vue', this.writeMarkdownTab); $(document).on('markdown-preview:hide.vue', this.writeMarkdownTab);
this.updateSuggestPopoverVisibility();
}, },
beforeDestroy() { beforeDestroy() {
$(document).off('markdown-preview:show.vue', this.previewMarkdownTab); $(document).off('markdown-preview:show.vue', this.previewMarkdownTab);
$(document).off('markdown-preview:hide.vue', this.writeMarkdownTab); $(document).off('markdown-preview:hide.vue', this.writeMarkdownTab);
}, },
methods: { methods: {
async updateSuggestPopoverVisibility() {
await this.$nextTick();
this.suggestPopoverVisible = this.showSuggestPopover && this.canSuggest;
},
isValid(form) { isValid(form) {
return ( return (
!form || !form ||
...@@ -165,6 +153,7 @@ export default { ...@@ -165,6 +153,7 @@ export default {
</button> </button>
</li> </li>
<li :class="{ active: !previewMarkdown }" class="md-header-toolbar"> <li :class="{ active: !previewMarkdown }" class="md-header-toolbar">
<div class="d-inline-block">
<toolbar-button <toolbar-button
tag="**" tag="**"
:button-title=" :button-title="
...@@ -188,6 +177,8 @@ export default { ...@@ -188,6 +177,8 @@ export default {
icon="quote" icon="quote"
@click="handleQuote" @click="handleQuote"
/> />
</div>
<div class="d-inline-block ml-md-2 ml-0">
<template v-if="canSuggest"> <template v-if="canSuggest">
<toolbar-button <toolbar-button
ref="suggestButton" ref="suggestButton"
...@@ -202,11 +193,11 @@ export default { ...@@ -202,11 +193,11 @@ export default {
@click="handleSuggestDismissed" @click="handleSuggestDismissed"
/> />
<gl-popover <gl-popover
v-if="suggestPopoverVisible" v-if="showSuggestPopover && $refs.suggestButton"
:target="$refs.suggestButton.$el" :target="$refs.suggestButton"
:css-classes="['diff-suggest-popover']" :css-classes="['diff-suggest-popover']"
placement="bottom" placement="bottom"
:show="suggestPopoverVisible" :show="showSuggestPopover"
> >
<strong>{{ __('New! Suggest changes directly') }}</strong> <strong>{{ __('New! Suggest changes directly') }}</strong>
<p class="mb-2"> <p class="mb-2">
...@@ -219,7 +210,7 @@ export default { ...@@ -219,7 +210,7 @@ export default {
<gl-button <gl-button
variant="info" variant="info"
category="primary" category="primary"
size="small" size="sm"
@click="handleSuggestDismissed" @click="handleSuggestDismissed"
> >
{{ __('Got it') }} {{ __('Got it') }}
...@@ -236,6 +227,8 @@ export default { ...@@ -236,6 +227,8 @@ export default {
:shortcuts="$options.shortcuts.link" :shortcuts="$options.shortcuts.link"
icon="link" icon="link"
/> />
</div>
<div class="d-inline-block ml-md-2 ml-0">
<toolbar-button <toolbar-button
:prepend="true" :prepend="true"
tag="- " tag="- "
...@@ -267,12 +260,20 @@ export default { ...@@ -267,12 +260,20 @@ export default {
:button-title="__('Add a table')" :button-title="__('Add a table')"
icon="table" icon="table"
/> />
<toolbar-button </div>
class="js-zen-enter" <div class="d-inline-block ml-md-2 ml-0">
:prepend="true" <button
:button-title="__('Go full screen')" v-gl-tooltip
icon="maximize" :aria-label="__('Go full screen')"
/> class="toolbar-btn toolbar-fullscreen-btn js-zen-enter"
data-container="body"
tabindex="-1"
:title="__('Go full screen')"
type="button"
>
<gl-icon name="maximize" />
</button>
</div>
</li> </li>
</ul> </ul>
</div> </div>
......
<script> <script>
import { GlTooltipDirective, GlButton } from '@gitlab/ui'; import { GlTooltipDirective, GlIcon } from '@gitlab/ui';
export default { export default {
components: { components: {
GlButton, GlIcon,
}, },
directives: { directives: {
GlTooltip: GlTooltipDirective, GlTooltip: GlTooltipDirective,
...@@ -19,8 +19,7 @@ export default { ...@@ -19,8 +19,7 @@ export default {
}, },
tag: { tag: {
type: String, type: String,
required: false, required: true,
default: '',
}, },
tagBlock: { tagBlock: {
type: String, type: String,
...@@ -72,7 +71,7 @@ export default { ...@@ -72,7 +71,7 @@ export default {
</script> </script>
<template> <template>
<gl-button <button
v-gl-tooltip v-gl-tooltip
:data-md-tag="tag" :data-md-tag="tag"
:data-md-cursor-offset="cursorOffset" :data-md-cursor-offset="cursorOffset"
...@@ -83,11 +82,11 @@ export default { ...@@ -83,11 +82,11 @@ export default {
:data-md-shortcuts="shortcutsString" :data-md-shortcuts="shortcutsString"
:title="buttonTitle" :title="buttonTitle"
:aria-label="buttonTitle" :aria-label="buttonTitle"
:icon="icon"
type="button" type="button"
category="tertiary"
class="toolbar-btn js-md" class="toolbar-btn js-md"
data-container="body" data-container="body"
@click="() => $emit('click')" @click="() => $emit('click')"
/> >
<gl-icon :name="icon" />
</button>
</template> </template>
...@@ -83,7 +83,6 @@ ...@@ -83,7 +83,6 @@
li.md-header-toolbar { li.md-header-toolbar {
margin-left: auto; margin-left: auto;
display: none; display: none;
padding-bottom: $gl-padding-8;
&.active { &.active {
display: block; display: block;
...@@ -92,9 +91,9 @@ ...@@ -92,9 +91,9 @@
flex: none; flex: none;
display: flex; display: flex;
justify-content: center; justify-content: center;
flex-wrap: wrap;
margin-top: $gl-padding-8;
width: 100%; width: 100%;
padding-top: $gl-padding-top;
padding-bottom: $gl-padding-top;
} }
} }
} }
...@@ -132,6 +131,36 @@ ...@@ -132,6 +131,36 @@
width: 100%; width: 100%;
} }
.toolbar-btn {
float: left;
padding: 0 7px;
background: transparent;
border: 0;
outline: 0;
svg {
width: 14px;
height: 14px;
vertical-align: middle;
fill: $gl-text-color-secondary;
}
&:hover,
&:focus {
svg {
fill: $blue-600;
}
}
}
.toolbar-fullscreen-btn {
margin-right: -5px;
@include media-breakpoint-down(xs) {
margin-right: 0;
}
}
.md-suggestion-diff { .md-suggestion-diff {
display: table !important; display: table !important;
border: 1px solid $border-color !important; border: 1px solid $border-color !important;
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
a, a,
button { button {
padding: $gl-padding-8; padding: $gl-padding-8;
padding-bottom: $gl-padding-8 + 1;
font-size: 14px; font-size: 14px;
line-height: 28px; line-height: 28px;
color: $gl-text-color-secondary; color: $gl-text-color-secondary;
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
.common-note-form { .common-note-form {
.md-area { .md-area {
padding: $gl-padding-8 $gl-padding; padding: $gl-padding-top $gl-padding;
border: 1px solid $border-color; border: 1px solid $border-color;
border-radius: $border-radius-base; border-radius: $border-radius-base;
transition: border-color ease-in-out 0.15s, transition: border-color ease-in-out 0.15s,
...@@ -323,7 +323,7 @@ table { ...@@ -323,7 +323,7 @@ table {
} }
.comment-toolbar { .comment-toolbar {
padding-top: $gl-padding-8; padding-top: $gl-padding-top;
color: $gl-text-color-secondary; color: $gl-text-color-secondary;
border-top: 1px solid $border-color; border-top: 1px solid $border-color;
} }
......
import { GlButton } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import ToolbarButton from '~/vue_shared/components/markdown/toolbar_button.vue'; import ToolbarButton from '~/vue_shared/components/markdown/toolbar_button.vue';
...@@ -26,7 +25,7 @@ describe('toolbar_button', () => { ...@@ -26,7 +25,7 @@ describe('toolbar_button', () => {
}); });
const getButtonShortcutsAttr = () => { const getButtonShortcutsAttr = () => {
return wrapper.find(GlButton).attributes('data-md-shortcuts'); return wrapper.find('button').attributes('data-md-shortcuts');
}; };
describe('keyboard shortcuts', () => { describe('keyboard shortcuts', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment