mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-29 02:46:25 +02:00
refactor: update FixedToolbarButtons to conditionally render save button based on read-only state, and adjust dropdown menu styles for better usability
This commit is contained in:
parent
df3f724caf
commit
6af251a108
3 changed files with 21 additions and 19 deletions
|
|
@ -101,14 +101,19 @@ export function FixedToolbarButtons() {
|
||||||
<LinkToolbarButton />
|
<LinkToolbarButton />
|
||||||
</ToolbarGroup>
|
</ToolbarGroup>
|
||||||
|
|
||||||
{/* Save button — appears when in editing mode with unsaved changes */}
|
</>
|
||||||
{onSave && hasUnsavedChanges && (
|
)}
|
||||||
|
|
||||||
|
<div className="grow" />
|
||||||
|
|
||||||
|
{/* Save button — only in edit mode with unsaved changes */}
|
||||||
|
{!readOnly && onSave && hasUnsavedChanges && (
|
||||||
<ToolbarGroup>
|
<ToolbarGroup>
|
||||||
<ToolbarButton
|
<ToolbarButton
|
||||||
tooltip={isSaving ? 'Saving...' : 'Save (⌘+S)'}
|
tooltip={isSaving ? 'Saving...' : 'Save (⌘+S)'}
|
||||||
onClick={onSave}
|
onClick={onSave}
|
||||||
disabled={isSaving}
|
disabled={isSaving}
|
||||||
className="text-white"
|
className="bg-primary text-primary-foreground hover:bg-primary/90"
|
||||||
>
|
>
|
||||||
{isSaving ? (
|
{isSaving ? (
|
||||||
<Spinner size="xs" />
|
<Spinner size="xs" />
|
||||||
|
|
@ -118,11 +123,8 @@ export function FixedToolbarButtons() {
|
||||||
</ToolbarButton>
|
</ToolbarButton>
|
||||||
</ToolbarGroup>
|
</ToolbarGroup>
|
||||||
)}
|
)}
|
||||||
</>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<div className="grow" />
|
|
||||||
|
|
||||||
|
{/* Mode toggle */}
|
||||||
{canToggleMode && (
|
{canToggleMode && (
|
||||||
<ToolbarGroup>
|
<ToolbarGroup>
|
||||||
<ModeToolbarButton />
|
<ModeToolbarButton />
|
||||||
|
|
|
||||||
|
|
@ -195,7 +195,7 @@ export function InsertToolbarButton(props: DropdownMenuProps) {
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
|
|
||||||
<DropdownMenuContent
|
<DropdownMenuContent
|
||||||
className="flex max-h-[500px] min-w-0 flex-col overflow-y-auto"
|
className="flex max-h-[300px] min-w-0 flex-col overflow-y-scroll"
|
||||||
align="start"
|
align="start"
|
||||||
>
|
>
|
||||||
{groups.map(({ group, items }) => (
|
{groups.map(({ group, items }) => (
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,7 @@ export function TurnIntoToolbarButton(props: DropdownMenuProps) {
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
|
|
||||||
<DropdownMenuContent
|
<DropdownMenuContent
|
||||||
className="ignore-click-outside/toolbar min-w-0"
|
className="ignore-click-outside/toolbar min-w-0 max-h-[350px] overflow-y-scroll"
|
||||||
onCloseAutoFocus={(e) => {
|
onCloseAutoFocus={(e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
editor.tf.focus();
|
editor.tf.focus();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue