feat(layout/note_actions): integrate save to note button

This commit is contained in:
Elian Doran
2025-12-15 08:24:59 +02:00
parent 906fe4f8da
commit cb0efe25f5
2 changed files with 27 additions and 12 deletions

View File

@@ -7,6 +7,7 @@ import FNote from "../../entities/fnote";
import { t } from "../../services/i18n";
import { downloadFileNote, openNoteExternally } from "../../services/open";
import { ViewTypeOptions } from "../collections/interface";
import { buildSaveSqlToNoteHandler } from "../FloatingButtonsDefinitions";
import ActionButton from "../react/ActionButton";
import { FormFileUploadActionButton } from "../react/FormFileUpload";
import { useNoteLabel, useNoteLabelBoolean, useNoteProperty, useTriliumOption } from "../react/hooks";
@@ -52,6 +53,7 @@ export default function NoteActionsCustom(props: NoteActionsCustomProps) {
<RunActiveNoteButton {...innerProps } />
<SwitchSplitOrientationButton {...innerProps} />
<ToggleReadOnlyButton {...innerProps} />
<SaveToNoteButton {...innerProps} />
<RefreshButton {...innerProps} />
<CopyReferenceToClipboardButton {...innerProps} />
<NoteActionsCustomInner {...innerProps} />
@@ -184,3 +186,12 @@ function RunActiveNoteButton({ note }: NoteActionsCustomInnerProps) {
triggerCommand="runActiveNote"
/>;
}
function SaveToNoteButton({ note }: NoteActionsCustomInnerProps) {
const isEnabled = note.mime === "text/x-sqlite;schema=trilium" && note.isHiddenCompletely();
return isEnabled && <ActionButton
icon="bx bx-save"
text={t("code_buttons.save_to_note_button_title")}
onClick={buildSaveSqlToNoteHandler(note)}
/>;
}