2021-06-29 14:36:40 +00:00
|
|
|
<template>
|
|
|
|
<div class="context-menu">
|
|
|
|
<woot-button
|
2021-12-01 05:03:18 +00:00
|
|
|
icon="more-vertical"
|
2021-06-29 14:36:40 +00:00
|
|
|
class="button--delete-message"
|
|
|
|
color-scheme="secondary"
|
2021-07-09 05:23:28 +00:00
|
|
|
variant="link"
|
2021-06-29 14:36:40 +00:00
|
|
|
@click="handleContextMenuClick"
|
|
|
|
/>
|
|
|
|
<div
|
|
|
|
v-if="isOpen"
|
|
|
|
v-on-clickaway="handleContextMenuClick"
|
|
|
|
class="dropdown-pane dropdown-pane--open"
|
|
|
|
:class="`dropdown-pane--${menuPosition}`"
|
|
|
|
>
|
|
|
|
<woot-dropdown-menu>
|
|
|
|
<woot-dropdown-item v-if="showCopy">
|
|
|
|
<woot-button
|
|
|
|
variant="clear"
|
|
|
|
size="small"
|
2021-12-01 05:03:18 +00:00
|
|
|
icon="clipboard"
|
|
|
|
icon-size="16"
|
2021-06-29 14:36:40 +00:00
|
|
|
@click="handleCopy"
|
|
|
|
>
|
|
|
|
{{ $t('CONVERSATION.CONTEXT_MENU.COPY') }}
|
|
|
|
</woot-button>
|
|
|
|
</woot-dropdown-item>
|
|
|
|
<woot-dropdown-item>
|
|
|
|
<woot-button
|
|
|
|
variant="clear"
|
|
|
|
color-scheme="alert"
|
|
|
|
size="small"
|
2021-12-01 05:03:18 +00:00
|
|
|
icon="delete"
|
|
|
|
icon-size="16"
|
2021-06-29 14:36:40 +00:00
|
|
|
@click="handleDelete"
|
|
|
|
>
|
|
|
|
{{ $t('CONVERSATION.CONTEXT_MENU.DELETE') }}
|
|
|
|
</woot-button>
|
|
|
|
</woot-dropdown-item>
|
|
|
|
</woot-dropdown-menu>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import { mixin as clickaway } from 'vue-clickaway';
|
|
|
|
|
|
|
|
import WootDropdownItem from 'shared/components/ui/dropdown/DropdownItem';
|
|
|
|
import WootDropdownMenu from 'shared/components/ui/dropdown/DropdownMenu';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
WootDropdownMenu,
|
|
|
|
WootDropdownItem,
|
|
|
|
},
|
|
|
|
mixins: [clickaway],
|
|
|
|
props: {
|
|
|
|
isOpen: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
showCopy: {
|
|
|
|
type: Boolean,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
menuPosition: {
|
|
|
|
type: String,
|
|
|
|
default: 'left',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
handleContextMenuClick() {
|
|
|
|
this.$emit('toggle', !this.isOpen);
|
|
|
|
},
|
|
|
|
handleCopy() {
|
|
|
|
this.$emit('copy');
|
|
|
|
},
|
|
|
|
handleDelete() {
|
|
|
|
this.$emit('delete');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
/* TDOD: Remove once MenuComponent supports postions */
|
|
|
|
.dropdown-pane {
|
2021-07-09 05:23:28 +00:00
|
|
|
bottom: var(--space-medium);
|
2021-06-29 14:36:40 +00:00
|
|
|
}
|
|
|
|
.dropdown-pane--left {
|
|
|
|
right: var(--space-small);
|
|
|
|
}
|
|
|
|
.dropdown-pane--right {
|
|
|
|
left: var(--space-small);
|
|
|
|
}
|
|
|
|
</style>
|