Merge branch 'main' into fix/old-messages-loading
This commit is contained in:
commit
076fda9e8c
1 changed files with 10 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div ref="resizableSidebar" class="resizable-sidebar"
|
<div ref="resizableSidebar" class="resizable-sidebar"
|
||||||
:style="{
|
:style="{
|
||||||
'width': storedWidth ? `${storedWidth}px` : props.width,
|
'width': storedWidth ? storedWidth : props.width,
|
||||||
'min-width': props.minWidth,
|
'min-width': props.minWidth,
|
||||||
'max-width': props.maxWidth,
|
'max-width': props.maxWidth,
|
||||||
'border': props.borderSides == 'all' ? borderStyling : undefined,
|
'border': props.borderSides == 'all' ? borderStyling : undefined,
|
||||||
|
@ -29,10 +29,16 @@ const borderStyling = ".1rem solid var(--padding-color)";
|
||||||
|
|
||||||
const resizableSidebar = ref<HTMLDivElement>();
|
const resizableSidebar = ref<HTMLDivElement>();
|
||||||
const widthResizer = ref<HTMLDivElement>();
|
const widthResizer = ref<HTMLDivElement>();
|
||||||
const storedWidth = ref<number>();
|
const storedWidth = ref<string>();
|
||||||
|
|
||||||
const menuItems: ContextMenuItem[] = [
|
const menuItems: ContextMenuItem[] = [
|
||||||
{ name: "Reset", callback: () => { resizableSidebar.value!.style.width = props.width ?? props.minWidth } }
|
{ name: "Reset", callback: () => {
|
||||||
|
const defaultWidth = props.width ?? props.minWidth;
|
||||||
|
resizableSidebar.value!.style.width = defaultWidth;
|
||||||
|
if (props.localStorageName) {
|
||||||
|
localStorage.setItem(props.localStorageName, defaultWidth);
|
||||||
|
}
|
||||||
|
} }
|
||||||
]
|
]
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
@ -88,7 +94,7 @@ function loadStoredWidth() {
|
||||||
if (props.localStorageName) {
|
if (props.localStorageName) {
|
||||||
const storedWidthValue = localStorage.getItem(props.localStorageName);
|
const storedWidthValue = localStorage.getItem(props.localStorageName);
|
||||||
if (storedWidthValue) {
|
if (storedWidthValue) {
|
||||||
storedWidth.value = parseInt(storedWidthValue) || undefined;
|
storedWidth.value = storedWidthValue;
|
||||||
console.log("[res] loaded stored width");
|
console.log("[res] loaded stored width");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue