mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-09 22:14:29 +09:00
fix: prevent closing navigator when drag and drop on canvas (#4393)
Fixes https://github.com/webstudio-is/webstudio/issues/4158 none is confused with undefined value, replaced it with more explicit "auto".
This commit is contained in:
1 parent
4945c8ba8d
commit
5509d593b3
3 files changed
+8
-5
No files matched your search
@@ -113,7 +113,7 @@ export const { emitCommand, subscribeCommands } = createCommandsEmitter({
|
||||
name: "clickCanvas",
|
||||
handler: () => {
|
||||
$breakpointsMenuView.set(undefined);
|
||||
setActiveSidebarPanel(undefined);
|
||||
setActiveSidebarPanel("auto");
|
||||
},
|
||||
},
|
||||
|
||||
@@ -124,7 +124,7 @@ export const { emitCommand, subscribeCommands } = createCommandsEmitter({
|
||||
defaultHotkeys: ["meta+shift+p", "ctrl+shift+p"],
|
||||
handler: () => {
|
||||
$isPreviewMode.set($isPreviewMode.get() === false);
|
||||
setActiveSidebarPanel(undefined);
|
||||
setActiveSidebarPanel("auto");
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -100,7 +100,10 @@ export const $activeSidebarPanel = computed(
|
||||
}
|
||||
);
|
||||
|
||||
export const setActiveSidebarPanel = (nextPanel?: SidebarPanelName) => {
|
||||
/**
|
||||
* auto shows default panel when sidepanel is undocked and hides when docked
|
||||
*/
|
||||
export const setActiveSidebarPanel = (nextPanel: "auto" | SidebarPanelName) => {
|
||||
const currentPanel = $activeSidebarPanel.get();
|
||||
// - When navigator is open, user is trying to close the navigator.
|
||||
// - Navigator is closed, user is trying to close some other panel, and if navigator is undocked, it needs to be opened.
|
||||
@@ -114,7 +117,7 @@ export const setActiveSidebarPanel = (nextPanel?: SidebarPanelName) => {
|
||||
return;
|
||||
}
|
||||
}
|
||||
$activeSidebarPanel_.set(nextPanel);
|
||||
$activeSidebarPanel_.set(nextPanel === "auto" ? undefined : nextPanel);
|
||||
};
|
||||
|
||||
export const toggleActiveSidebarPanel = (panel: SidebarPanelName) => {
|
||||
|
||||
@@ -141,7 +141,7 @@ export const SidebarLeft = ({ publish }: SidebarLeftProps) => {
|
||||
const returnTabRef = useRef<SidebarPanelName | undefined>(undefined);
|
||||
|
||||
useSubscribe("dragEnd", () => {
|
||||
setActiveSidebarPanel("none");
|
||||
setActiveSidebarPanel("auto");
|
||||
});
|
||||
|
||||
useOnDropEffect(() => {
|
||||
|
||||
Reference in new issue
Block a user