mirror of
https://github.com/zadam/trilium.git
synced 2025-12-16 05:09:54 +01:00
feat(layout/note_actions): integrate in-app help button
This commit is contained in:
@@ -308,7 +308,7 @@ function ExportImageButtons({ note, triggerEvent, isDefaultViewMode }: FloatingB
|
|||||||
|
|
||||||
function InAppHelpButton({ note }: FloatingButtonContext) {
|
function InAppHelpButton({ note }: FloatingButtonContext) {
|
||||||
const helpUrl = getHelpUrlForNote(note);
|
const helpUrl = getHelpUrlForNote(note);
|
||||||
const isEnabled = !!helpUrl && (!isNewLayout || (note?.type !== "book"));
|
const isEnabled = !!helpUrl && !isNewLayout;
|
||||||
|
|
||||||
return isEnabled && (
|
return isEnabled && (
|
||||||
<FloatingButton
|
<FloatingButton
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import Component from "../../components/component";
|
|||||||
import NoteContext from "../../components/note_context";
|
import NoteContext from "../../components/note_context";
|
||||||
import FNote from "../../entities/fnote";
|
import FNote from "../../entities/fnote";
|
||||||
import { t } from "../../services/i18n";
|
import { t } from "../../services/i18n";
|
||||||
|
import { getHelpUrlForNote } from "../../services/in_app_help";
|
||||||
import { downloadFileNote, openNoteExternally } from "../../services/open";
|
import { downloadFileNote, openNoteExternally } from "../../services/open";
|
||||||
import { openInAppHelpFromUrl } from "../../services/utils";
|
import { openInAppHelpFromUrl } from "../../services/utils";
|
||||||
import { ViewTypeOptions } from "../collections/interface";
|
import { ViewTypeOptions } from "../collections/interface";
|
||||||
@@ -62,6 +63,7 @@ export default function NoteActionsCustom(props: NoteActionsCustomProps) {
|
|||||||
<SaveToNoteButton {...innerProps} />
|
<SaveToNoteButton {...innerProps} />
|
||||||
<RefreshButton {...innerProps} />
|
<RefreshButton {...innerProps} />
|
||||||
<CopyReferenceToClipboardButton {...innerProps} />
|
<CopyReferenceToClipboardButton {...innerProps} />
|
||||||
|
<InAppHelpButton {...innerProps} />
|
||||||
<NoteActionsCustomInner {...innerProps} />
|
<NoteActionsCustomInner {...innerProps} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -223,6 +225,19 @@ function OpenTriliumApiDocsButton({ noteMime }: NoteActionsCustomInnerProps) {
|
|||||||
/>;
|
/>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function InAppHelpButton({ note, noteType }: NoteActionsCustomInnerProps) {
|
||||||
|
const helpUrl = getHelpUrlForNote(note);
|
||||||
|
const isEnabled = !!helpUrl && (noteType !== "book");
|
||||||
|
|
||||||
|
return isEnabled && (
|
||||||
|
<ActionButton
|
||||||
|
icon="bx bx-help-circle"
|
||||||
|
text={t("help-button.title")}
|
||||||
|
onClick={() => helpUrl && openInAppHelpFromUrl(helpUrl)}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function AddChildButton({ parentComponent, noteType, viewType, ntxId, isReadOnly }: NoteActionsCustomInnerProps) {
|
function AddChildButton({ parentComponent, noteType, viewType, ntxId, isReadOnly }: NoteActionsCustomInnerProps) {
|
||||||
if (noteType === "book" && viewType === "geoMap") {
|
if (noteType === "book" && viewType === "geoMap") {
|
||||||
return <ActionButton
|
return <ActionButton
|
||||||
|
|||||||
Reference in New Issue
Block a user