mirror of
https://github.com/zadam/trilium.git
synced 2025-12-16 21:29:56 +01:00
refactor(layout): handle note actions differently
This commit is contained in:
@@ -85,11 +85,11 @@ export default class DesktopLayout {
|
|||||||
.child(<NoteIconWidget />)
|
.child(<NoteIconWidget />)
|
||||||
.child(<NoteTitleWidget />)
|
.child(<NoteTitleWidget />)
|
||||||
.optChild(isNewLayout, <NoteBadges />)
|
.optChild(isNewLayout, <NoteBadges />)
|
||||||
.optChild(!isNewLayout, <SpacerWidget baseSize={0} growthFactor={1} />)
|
.child(<SpacerWidget baseSize={0} growthFactor={1} />)
|
||||||
.child(<MovePaneButton direction="left" />)
|
.optChild(!isNewLayout, <MovePaneButton direction="left" />)
|
||||||
.child(<MovePaneButton direction="right" />)
|
.optChild(!isNewLayout, <MovePaneButton direction="right" />)
|
||||||
.child(<ClosePaneButton />)
|
.optChild(!isNewLayout, <ClosePaneButton />)
|
||||||
.child(<CreatePaneButton />)
|
.optChild(!isNewLayout, <CreatePaneButton />)
|
||||||
.optChild(isNewLayout, <NoteActions />);
|
.optChild(isNewLayout, <NoteActions />);
|
||||||
|
|
||||||
const rootContainer = new RootContainer(true)
|
const rootContainer = new RootContainer(true)
|
||||||
|
|||||||
@@ -6,19 +6,22 @@ import NoteContext from "../../components/note_context";
|
|||||||
import FNote from "../../entities/fnote";
|
import FNote from "../../entities/fnote";
|
||||||
import branches from "../../services/branches";
|
import branches from "../../services/branches";
|
||||||
import dialog from "../../services/dialog";
|
import dialog from "../../services/dialog";
|
||||||
|
import { isExperimentalFeatureEnabled } from "../../services/experimental_features";
|
||||||
import { t } from "../../services/i18n";
|
import { t } from "../../services/i18n";
|
||||||
|
import protected_session from "../../services/protected_session";
|
||||||
import server from "../../services/server";
|
import server from "../../services/server";
|
||||||
import toast from "../../services/toast";
|
import toast from "../../services/toast";
|
||||||
import { isElectron as getIsElectron, isMac as getIsMac } from "../../services/utils";
|
import { isElectron as getIsElectron, isMac as getIsMac } from "../../services/utils";
|
||||||
import ws from "../../services/ws";
|
import ws from "../../services/ws";
|
||||||
|
import ClosePaneButton from "../buttons/close_pane_button";
|
||||||
|
import CreatePaneButton from "../buttons/create_pane_button";
|
||||||
|
import MovePaneButton from "../buttons/move_pane_button";
|
||||||
import ActionButton from "../react/ActionButton";
|
import ActionButton from "../react/ActionButton";
|
||||||
import Dropdown from "../react/Dropdown";
|
import Dropdown from "../react/Dropdown";
|
||||||
import { FormDropdownDivider, FormDropdownSubmenu, FormListHeader, FormListItem, FormListToggleableItem } from "../react/FormList";
|
import { FormDropdownDivider, FormDropdownSubmenu, FormListHeader, FormListItem, FormListToggleableItem } from "../react/FormList";
|
||||||
import { useIsNoteReadOnly, useNoteContext, useNoteLabel, useNoteLabelBoolean, useNoteProperty, useTriliumOption } from "../react/hooks";
|
import { useIsNoteReadOnly, useNoteContext, useNoteLabel, useNoteLabelBoolean, useNoteProperty, useTriliumOption } from "../react/hooks";
|
||||||
import { ParentComponent } from "../react/react_utils";
|
import { ParentComponent } from "../react/react_utils";
|
||||||
import { isExperimentalFeatureEnabled } from "../../services/experimental_features";
|
|
||||||
import { NoteTypeDropdownContent, useNoteBookmarkState, useShareState } from "./BasicPropertiesTab";
|
import { NoteTypeDropdownContent, useNoteBookmarkState, useShareState } from "./BasicPropertiesTab";
|
||||||
import protected_session from "../../services/protected_session";
|
|
||||||
|
|
||||||
const isNewLayout = isExperimentalFeatureEnabled("new-layout");
|
const isNewLayout = isExperimentalFeatureEnabled("new-layout");
|
||||||
|
|
||||||
@@ -26,6 +29,10 @@ export default function NoteActions() {
|
|||||||
const { note, noteContext } = useNoteContext();
|
const { note, noteContext } = useNoteContext();
|
||||||
return (
|
return (
|
||||||
<div className="ribbon-button-container" style={{ contain: "none" }}>
|
<div className="ribbon-button-container" style={{ contain: "none" }}>
|
||||||
|
<MovePaneButton direction="left" />
|
||||||
|
<MovePaneButton direction="right" />
|
||||||
|
<ClosePaneButton />
|
||||||
|
<CreatePaneButton />
|
||||||
{note && !isNewLayout && <RevisionsButton note={note} />}
|
{note && !isNewLayout && <RevisionsButton note={note} />}
|
||||||
{note && note.type !== "launcher" && <NoteContextMenu note={note as FNote} noteContext={noteContext} />}
|
{note && note.type !== "launcher" && <NoteContextMenu note={note as FNote} noteContext={noteContext} />}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user