mirror of
https://github.com/zadam/trilium.git
synced 2025-12-16 13:19:54 +01:00
feat(layout/note_actions): integrate geo map add button
This commit is contained in:
@@ -103,7 +103,7 @@ function SwitchSplitOrientationButton({ note, isReadOnly, isDefaultViewMode }: F
|
||||
|
||||
function ToggleReadOnlyButton({ note, viewType, isDefaultViewMode }: FloatingButtonContext) {
|
||||
const [ isReadOnly, setReadOnly ] = useNoteLabelBoolean(note, "readOnly");
|
||||
const isEnabled = ([ "mermaid", "mindMap", "canvas" ].includes(note.type) || viewType === "geoMap")
|
||||
const isEnabled = !isNewLayout && ([ "mermaid", "mindMap", "canvas" ].includes(note.type) || viewType === "geoMap")
|
||||
&& note.isContentAvailable() && isDefaultViewMode;
|
||||
|
||||
return isEnabled && <FloatingButton
|
||||
@@ -246,7 +246,7 @@ function RelationMapButtons({ note, isDefaultViewMode, triggerEvent }: FloatingB
|
||||
}
|
||||
|
||||
function GeoMapButtons({ triggerEvent, viewType, isReadOnly }: FloatingButtonContext) {
|
||||
const isEnabled = viewType === "geoMap" && !isReadOnly;
|
||||
const isEnabled = !isNewLayout && viewType === "geoMap" && !isReadOnly;
|
||||
return isEnabled && (
|
||||
<FloatingButton
|
||||
icon="bx bx-plus-circle"
|
||||
|
||||
@@ -42,7 +42,7 @@ export default function NoteActionsCustom(props: NoteActionsCustomProps) {
|
||||
const [ viewType ] = useNoteLabel(note, "viewType");
|
||||
const parentComponent = useContext(ParentComponent);
|
||||
const [ isReadOnly ] = useNoteLabelBoolean(note, "readOnly");
|
||||
const innerProps: NoteActionsCustomInnerProps | false = !!noteType && !!noteMime && !!parentComponent && {
|
||||
const innerProps: NoteActionsCustomInnerProps | false = !!noteType && noteMime !== undefined && !!parentComponent && {
|
||||
...props,
|
||||
noteType,
|
||||
noteMime,
|
||||
@@ -223,12 +223,21 @@ function OpenTriliumApiDocsButton({ noteMime }: NoteActionsCustomInnerProps) {
|
||||
/>;
|
||||
}
|
||||
|
||||
function AddChildButton({ parentComponent, noteType, ntxId }: NoteActionsCustomInnerProps) {
|
||||
const isEnabled = noteType === "relationMap";
|
||||
return isEnabled && <ActionButton
|
||||
function AddChildButton({ parentComponent, noteType, viewType, ntxId, isReadOnly }: NoteActionsCustomInnerProps) {
|
||||
if (noteType === "book" && viewType === "geoMap") {
|
||||
return <ActionButton
|
||||
icon="bx bx-plus-circle"
|
||||
text={t("geo-map.create-child-note-title")}
|
||||
onClick={() => parentComponent.triggerEvent("geoMapCreateChildNote", { ntxId })}
|
||||
disabled={isReadOnly}
|
||||
/>;
|
||||
} else if (noteType === "relationMap") {
|
||||
return <ActionButton
|
||||
icon="bx bx-folder-plus"
|
||||
text={t("relation_map_buttons.create_child_note_title")}
|
||||
onClick={() => parentComponent.triggerEvent("relationMapCreateChildNote", { ntxId })}
|
||||
disabled={isReadOnly}
|
||||
/>;
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
|
||||
Reference in New Issue
Block a user