mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 08:46:22 +02:00
feat(editor): add reserveToolbarSpace option to enhance toolbar visibility management
This commit is contained in:
parent
0381632bc2
commit
a1d3356bf5
5 changed files with 36 additions and 4 deletions
|
|
@ -9,12 +9,19 @@ import { FixedToolbarButtons } from "@/components/ui/fixed-toolbar-buttons";
|
|||
|
||||
function ConditionalFixedToolbar() {
|
||||
const readOnly = useEditorReadOnly();
|
||||
const { onSave, hasUnsavedChanges, canToggleMode } = useEditorSave();
|
||||
const { onSave, hasUnsavedChanges, canToggleMode, reserveToolbarSpace } = useEditorSave();
|
||||
|
||||
const hasVisibleControls =
|
||||
!readOnly || canToggleMode || (!!onSave && hasUnsavedChanges && !readOnly);
|
||||
|
||||
if (!hasVisibleControls) return null;
|
||||
if (!hasVisibleControls) {
|
||||
if (!reserveToolbarSpace) return null;
|
||||
return (
|
||||
<FixedToolbar className="pointer-events-none opacity-0">
|
||||
<div className="h-8 w-full" />
|
||||
</FixedToolbar>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<FixedToolbar>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue