feat: handle setting of default context menu state variable only in app.vue
This commit is contained in:
parent
ce57b8e7db
commit
f1eda2da75
3 changed files with 3 additions and 7 deletions
|
@ -15,7 +15,7 @@ import type { ContextMenuInterface, GuildMemberResponse } from '~/types/interfac
|
||||||
|
|
||||||
const { getDisplayName } = useProfile()
|
const { getDisplayName } = useProfile()
|
||||||
|
|
||||||
const contextMenu = useState<ContextMenuInterface>("contextMenu", () => ({ show: false, pointerX: 0, pointerY: 0, items: [] }));
|
const contextMenu = useState<ContextMenuInterface>("contextMenu");
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
member: GuildMemberResponse
|
member: GuildMemberResponse
|
||||||
|
|
|
@ -76,7 +76,7 @@ const route = useRoute();
|
||||||
|
|
||||||
const props = defineProps<MessageProps>();
|
const props = defineProps<MessageProps>();
|
||||||
|
|
||||||
const contextMenu = useState<ContextMenuInterface>("contextMenu", () => ({ show: false, pointerX: 0, pointerY: 0, items: [] }));
|
const contextMenu = useState<ContextMenuInterface>("contextMenu");
|
||||||
|
|
||||||
const messageElement = ref<HTMLDivElement>();
|
const messageElement = ref<HTMLDivElement>();
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div ref="resizableSidebar" class="resizable-sidebar"
|
<div ref="resizableSidebar" class="resizable-sidebar" @contextmenu="showContextMenu($event, contextMenu, menuItems)"
|
||||||
:style="{
|
:style="{
|
||||||
'width': storedWidth ? storedWidth : props.width,
|
'width': storedWidth ? storedWidth : props.width,
|
||||||
'min-width': props.minWidth,
|
'min-width': props.minWidth,
|
||||||
|
@ -49,10 +49,6 @@ onMounted(() => {
|
||||||
if (resizableSidebar.value && widthResizer.value) {
|
if (resizableSidebar.value && widthResizer.value) {
|
||||||
widthResizer.value.addEventListener("pointerdown", (e) => {
|
widthResizer.value.addEventListener("pointerdown", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (e.button == 2) {
|
|
||||||
showContextMenu(e, contextMenu.value, menuItems);
|
|
||||||
return
|
|
||||||
};
|
|
||||||
document.body.style.cursor = "ew-resize";
|
document.body.style.cursor = "ew-resize";
|
||||||
function handleMove(pointer: PointerEvent) {
|
function handleMove(pointer: PointerEvent) {
|
||||||
if (resizableSidebar.value) {
|
if (resizableSidebar.value) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue