fix: context menu on resizable sidebar component not working due to breaking changes
This commit is contained in:
parent
d1518d1001
commit
82dc0fb0e3
1 changed files with 4 additions and 2 deletions
|
@ -21,7 +21,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { ContextMenuItem } from '~/types/interfaces';
|
import type { ContextMenuInterface, ContextMenuItem } from '~/types/interfaces';
|
||||||
|
|
||||||
const props = defineProps<{ width?: string, minWidth: string, maxWidth: string, borderSides: "all" | "top" | "right" | "bottom" | "left" | ("top" | "right" | "bottom" | "left")[], localStorageName?: string }>();
|
const props = defineProps<{ width?: string, minWidth: string, maxWidth: string, borderSides: "all" | "top" | "right" | "bottom" | "left" | ("top" | "right" | "bottom" | "left")[], localStorageName?: string }>();
|
||||||
|
|
||||||
|
@ -31,6 +31,8 @@ const resizableSidebar = ref<HTMLDivElement>();
|
||||||
const widthResizer = ref<HTMLDivElement>();
|
const widthResizer = ref<HTMLDivElement>();
|
||||||
const storedWidth = ref<number>();
|
const storedWidth = ref<number>();
|
||||||
|
|
||||||
|
const contextMenu = useState<ContextMenuInterface>("contextMenu");
|
||||||
|
|
||||||
const menuItems: ContextMenuItem[] = [
|
const menuItems: ContextMenuItem[] = [
|
||||||
{ name: "Reset", callback: () => { resizableSidebar.value!.style.width = props.width ?? props.minWidth } }
|
{ name: "Reset", callback: () => { resizableSidebar.value!.style.width = props.width ?? props.minWidth } }
|
||||||
]
|
]
|
||||||
|
@ -42,7 +44,7 @@ onMounted(() => {
|
||||||
widthResizer.value.addEventListener("pointerdown", (e) => {
|
widthResizer.value.addEventListener("pointerdown", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (e.button == 2) {
|
if (e.button == 2) {
|
||||||
createContextMenu(e, menuItems);
|
showContextMenu(e, contextMenu.value, menuItems);
|
||||||
return
|
return
|
||||||
};
|
};
|
||||||
document.body.style.cursor = "ew-resize";
|
document.body.style.cursor = "ew-resize";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue