Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(layout/note_actions): integrate execute script button
Elian Doran906fe4f8daa5
diff --git a/apps/client/src/widgets/FloatingButtonsDefinitions.tsx b/apps/client/src/widgets/FloatingButtonsDefinitions.tsxindex 644e87f5e0..496532c06b 100644--- a/apps/client/src/widgets/FloatingButtonsDefinitions.tsx+++ b/apps/client/src/widgets/FloatingButtonsDefinitions.tsx@@ -173,7 +173,7 @@ function ShowHighlightsListWidgetButton({ note, noteContext, isDefaultViewMode }}function RunActiveNoteButton({ note }: FloatingButtonContext) {- const isEnabled = note.mime.startsWith("application/javascript") || note.mime === "text/x-sqlite;schema=trilium";+ const isEnabled = !isNewLayout && (note.mime.startsWith("application/javascript") || note.mime === "text/x-sqlite;schema=trilium");return isEnabled && <FloatingButtonicon="bx bx-play"text={t("code_buttons.execute_button_title")}diff --git a/apps/client/src/widgets/ribbon/NoteActionsCustom.tsx b/apps/client/src/widgets/ribbon/NoteActionsCustom.tsxindex 8e0a34cd09..d4f96b2d2f 100644--- a/apps/client/src/widgets/ribbon/NoteActionsCustom.tsx+++ b/apps/client/src/widgets/ribbon/NoteActionsCustom.tsx@@ -49,6 +49,7 @@ export default function NoteActionsCustom(props: NoteActionsCustomProps) {return (innerProps &&<div className="note-actions-custom">+ <RunActiveNoteButton {...innerProps } /><SwitchSplitOrientationButton {...innerProps} /><ToggleReadOnlyButton {...innerProps} /><RefreshButton {...innerProps} />@@ -174,3 +175,12 @@ function ToggleReadOnlyButton({ note, viewType, isDefaultViewMode }: NoteActionsonClick={() => setReadOnly(!isReadOnly)}/>;}++function RunActiveNoteButton({ note }: NoteActionsCustomInnerProps) {+ const isEnabled = note.mime.startsWith("application/javascript") || note.mime === "text/x-sqlite;schema=trilium";+ return isEnabled && <ActionButton+ icon="bx bx-play"+ text={t("code_buttons.execute_button_title")}+ triggerCommand="runActiveNote"+ />;+}