debian-mirror-gitlab/app/assets/javascripts/vue_shared/components/markdown/toolbar.vue

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

147 lines
4.2 KiB
Vue
Raw Normal View History

2017-09-10 17:25:29 +05:30
<script>
2020-06-23 00:09:42 +05:30
import { GlButton, GlLink, GlLoadingIcon, GlSprintf, GlIcon } from '@gitlab/ui';
2023-03-17 16:20:25 +05:30
import EditorModeDropdown from './editor_mode_dropdown.vue';
2018-12-05 23:21:45 +05:30
2018-12-13 13:39:08 +05:30
export default {
components: {
2020-06-23 00:09:42 +05:30
GlButton,
2018-12-13 13:39:08 +05:30
GlLink,
2020-04-08 14:13:33 +05:30
GlLoadingIcon,
2020-06-23 00:09:42 +05:30
GlSprintf,
GlIcon,
2023-03-17 16:20:25 +05:30
EditorModeDropdown,
2018-12-13 13:39:08 +05:30
},
props: {
markdownDocsPath: {
type: String,
required: true,
2018-12-05 23:21:45 +05:30
},
2018-12-13 13:39:08 +05:30
quickActionsDocsPath: {
type: String,
required: false,
default: '',
2018-03-17 18:26:18 +05:30
},
2018-12-13 13:39:08 +05:30
canAttachFile: {
type: Boolean,
required: false,
default: true,
2017-09-10 17:25:29 +05:30
},
2022-07-16 23:28:13 +05:30
showCommentToolBar: {
type: Boolean,
required: false,
default: true,
},
2023-03-17 16:20:25 +05:30
showContentEditorSwitcher: {
type: Boolean,
required: false,
default: false,
},
2018-12-13 13:39:08 +05:30
},
computed: {
hasQuickActionsDocsPath() {
return this.quickActionsDocsPath !== '';
},
},
2023-03-17 16:20:25 +05:30
methods: {
handleEditorModeChanged(mode) {
if (mode === 'richText') {
this.$emit('enableContentEditor');
}
},
},
2018-12-13 13:39:08 +05:30
};
2017-09-10 17:25:29 +05:30
</script>
<template>
2022-07-16 23:28:13 +05:30
<div v-if="showCommentToolBar" class="comment-toolbar clearfix">
2017-09-10 17:25:29 +05:30
<div class="toolbar-text">
2018-03-17 18:26:18 +05:30
<template v-if="!hasQuickActionsDocsPath && markdownDocsPath">
2022-07-16 23:28:13 +05:30
<gl-sprintf
:message="
s__('MarkdownToolbar|Supports %{markdownDocsLinkStart}Markdown%{markdownDocsLinkEnd}')
"
>
<template #markdownDocsLink="{ content }">
<gl-link :href="markdownDocsPath" target="_blank">{{ content }}</gl-link>
</template>
</gl-sprintf>
2018-03-17 18:26:18 +05:30
</template>
<template v-if="hasQuickActionsDocsPath && markdownDocsPath">
2020-06-23 00:09:42 +05:30
<gl-sprintf
:message="
2022-07-16 23:28:13 +05:30
s__(
'NoteToolbar|Supports %{markdownDocsLinkStart}Markdown%{markdownDocsLinkEnd}. For %{quickActionsDocsLinkStart}quick actions%{quickActionsDocsLinkEnd}, type %{keyboardStart}/%{keyboardEnd}.',
2020-06-23 00:09:42 +05:30
)
"
>
2021-03-08 18:12:59 +05:30
<template #markdownDocsLink="{ content }">
2020-06-23 00:09:42 +05:30
<gl-link :href="markdownDocsPath" target="_blank">{{ content }}</gl-link>
</template>
2022-07-16 23:28:13 +05:30
<template #keyboard="{ content }">
<kbd>{{ content }}</kbd>
</template>
2021-03-08 18:12:59 +05:30
<template #quickActionsDocsLink="{ content }">
2020-06-23 00:09:42 +05:30
<gl-link :href="quickActionsDocsPath" target="_blank">{{ content }}</gl-link>
</template>
</gl-sprintf>
2018-03-17 18:26:18 +05:30
</template>
2017-09-10 17:25:29 +05:30
</div>
2022-10-11 01:57:18 +05:30
<span v-if="canAttachFile" class="uploading-container gl-line-height-32">
2018-03-17 18:26:18 +05:30
<span class="uploading-progress-container hide">
2022-08-27 11:52:29 +05:30
<gl-icon name="paperclip" />
2019-09-04 21:01:54 +05:30
<span class="attaching-file-message"></span>
2020-06-23 00:09:42 +05:30
<!-- eslint-disable-next-line @gitlab/vue-require-i18n-strings -->
2019-09-04 21:01:54 +05:30
<span class="uploading-progress">0%</span>
2021-09-30 23:02:18 +05:30
<gl-loading-icon size="sm" inline />
2018-03-17 18:26:18 +05:30
</span>
<span class="uploading-error-container hide">
<span class="uploading-error-icon">
2022-08-27 11:52:29 +05:30
<gl-icon name="paperclip" />
2018-03-17 18:26:18 +05:30
</span>
<span class="uploading-error-message"></span>
2020-06-23 00:09:42 +05:30
<gl-sprintf
:message="
__(
2021-01-29 00:20:46 +05:30
'%{retryButtonStart}Try again%{retryButtonEnd} or %{newFileButtonStart}attach a new file%{newFileButtonEnd}.',
2020-06-23 00:09:42 +05:30
)
"
>
2021-03-08 18:12:59 +05:30
<template #retryButton="{ content }">
2021-01-29 00:20:46 +05:30
<gl-button
variant="link"
category="primary"
class="retry-uploading-link gl-vertical-align-baseline"
>
{{ content }}
</gl-button>
2020-06-23 00:09:42 +05:30
</template>
2021-03-08 18:12:59 +05:30
<template #newFileButton="{ content }">
2021-01-29 00:20:46 +05:30
<gl-button
variant="link"
category="primary"
class="markdown-selector attach-new-file gl-vertical-align-baseline"
>
{{ content }}
</gl-button>
2020-06-23 00:09:42 +05:30
</template>
</gl-sprintf>
2018-03-17 18:26:18 +05:30
</span>
2021-01-29 00:20:46 +05:30
<gl-button
variant="link"
category="primary"
class="button-cancel-uploading-files gl-vertical-align-baseline hide"
>
2019-09-30 21:07:59 +05:30
{{ __('Cancel') }}
2020-06-23 00:09:42 +05:30
</gl-button>
2018-03-17 18:26:18 +05:30
</span>
2023-03-17 16:20:25 +05:30
<editor-mode-dropdown
v-if="showContentEditorSwitcher"
size="small"
class="gl-float-right gl-line-height-28 gl-display-block"
value="markdown"
@input="handleEditorModeChanged"
/>
2017-09-10 17:25:29 +05:30
</div>
</template>