mirror of
https://github.com/zadam/trilium.git
synced 2025-11-26 02:24:23 +01:00
feat(popup_editor): hide some unwanted floating buttons
Some checks are pending
Checks / main (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
Dev / Test development (push) Waiting to run
Dev / Build Docker image (push) Blocked by required conditions
Dev / Check Docker build (Dockerfile) (push) Blocked by required conditions
Dev / Check Docker build (Dockerfile.alpine) (push) Blocked by required conditions
/ Check Docker build (Dockerfile) (push) Waiting to run
/ Check Docker build (Dockerfile.alpine) (push) Waiting to run
/ Build Docker images (Dockerfile, ubuntu-24.04-arm, linux/arm64) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.alpine, ubuntu-latest, linux/amd64) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.legacy, ubuntu-24.04-arm, linux/arm/v7) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.legacy, ubuntu-24.04-arm, linux/arm/v8) (push) Blocked by required conditions
/ Merge manifest lists (push) Blocked by required conditions
playwright / E2E tests on linux-arm64 (push) Waiting to run
playwright / E2E tests on linux-x64 (push) Waiting to run
Some checks are pending
Checks / main (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run
CodeQL Advanced / Analyze (javascript-typescript) (push) Waiting to run
Dev / Test development (push) Waiting to run
Dev / Build Docker image (push) Blocked by required conditions
Dev / Check Docker build (Dockerfile) (push) Blocked by required conditions
Dev / Check Docker build (Dockerfile.alpine) (push) Blocked by required conditions
/ Check Docker build (Dockerfile) (push) Waiting to run
/ Check Docker build (Dockerfile.alpine) (push) Waiting to run
/ Build Docker images (Dockerfile, ubuntu-24.04-arm, linux/arm64) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.alpine, ubuntu-latest, linux/amd64) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.legacy, ubuntu-24.04-arm, linux/arm/v7) (push) Blocked by required conditions
/ Build Docker images (Dockerfile.legacy, ubuntu-24.04-arm, linux/arm/v8) (push) Blocked by required conditions
/ Merge manifest lists (push) Blocked by required conditions
playwright / E2E tests on linux-arm64 (push) Waiting to run
playwright / E2E tests on linux-x64 (push) Waiting to run
This commit is contained in:
parent
015d70afb6
commit
15c088ec21
@ -64,7 +64,15 @@ export const MOBILE_FLOATING_BUTTONS: FloatingButtonsList = [
|
|||||||
RelationMapButtons,
|
RelationMapButtons,
|
||||||
ExportImageButtons,
|
ExportImageButtons,
|
||||||
Backlinks
|
Backlinks
|
||||||
]
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Floating buttons that should be hidden in popup editor (Quick edit).
|
||||||
|
*/
|
||||||
|
export const POPUP_HIDDEN_FLOATING_BUTTONS: FloatingButtonsList = [
|
||||||
|
InAppHelpButton,
|
||||||
|
ToggleReadOnlyButton
|
||||||
|
];
|
||||||
|
|
||||||
function RefreshBackendLogButton({ note, parentComponent, noteContext, isDefaultViewMode }: FloatingButtonContext) {
|
function RefreshBackendLogButton({ note, parentComponent, noteContext, isDefaultViewMode }: FloatingButtonContext) {
|
||||||
const isEnabled = (note.noteId === "_backendLog" || note.type === "render") && isDefaultViewMode;
|
const isEnabled = (note.noteId === "_backendLog" || note.type === "render") && isDefaultViewMode;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { useContext, useEffect, useRef, useState } from "preact/hooks";
|
import { useContext, useEffect, useMemo, useRef, useState } from "preact/hooks";
|
||||||
import Modal from "../react/Modal";
|
import Modal from "../react/Modal";
|
||||||
import "./PopupEditor.css";
|
import "./PopupEditor.css";
|
||||||
import { useNoteContext, useTriliumEvent } from "../react/hooks";
|
import { useNoteContext, useTriliumEvent } from "../react/hooks";
|
||||||
@ -13,13 +13,18 @@ import StandaloneRibbonAdapter from "../ribbon/components/StandaloneRibbonAdapte
|
|||||||
import FormattingToolbar from "../ribbon/FormattingToolbar";
|
import FormattingToolbar from "../ribbon/FormattingToolbar";
|
||||||
import PromotedAttributes from "../PromotedAttributes";
|
import PromotedAttributes from "../PromotedAttributes";
|
||||||
import FloatingButtons from "../FloatingButtons";
|
import FloatingButtons from "../FloatingButtons";
|
||||||
import { DESKTOP_FLOATING_BUTTONS, MOBILE_FLOATING_BUTTONS } from "../FloatingButtonsDefinitions";
|
import { DESKTOP_FLOATING_BUTTONS, MOBILE_FLOATING_BUTTONS, POPUP_HIDDEN_FLOATING_BUTTONS } from "../FloatingButtonsDefinitions";
|
||||||
import utils from "../../services/utils";
|
import utils from "../../services/utils";
|
||||||
|
|
||||||
export default function PopupEditor() {
|
export default function PopupEditor() {
|
||||||
const [ shown, setShown ] = useState(false);
|
const [ shown, setShown ] = useState(false);
|
||||||
const parentComponent = useContext(ParentComponent);
|
const parentComponent = useContext(ParentComponent);
|
||||||
const [ noteContext, setNoteContext ] = useState(new NoteContext("_popup-editor"));
|
const [ noteContext, setNoteContext ] = useState(new NoteContext("_popup-editor"));
|
||||||
|
const isMobile = utils.isMobile();
|
||||||
|
const items = useMemo(() => {
|
||||||
|
const baseItems = isMobile ? MOBILE_FLOATING_BUTTONS : DESKTOP_FLOATING_BUTTONS;
|
||||||
|
return baseItems.filter(item => !POPUP_HIDDEN_FLOATING_BUTTONS.includes(item));
|
||||||
|
}, [ isMobile ]);
|
||||||
|
|
||||||
useTriliumEvent("openInPopup", async ({ noteIdOrPath }) => {
|
useTriliumEvent("openInPopup", async ({ noteIdOrPath }) => {
|
||||||
const noteContext = new NoteContext("_popup-editor");
|
const noteContext = new NoteContext("_popup-editor");
|
||||||
@ -54,7 +59,7 @@ export default function PopupEditor() {
|
|||||||
>
|
>
|
||||||
<PromotedAttributes />
|
<PromotedAttributes />
|
||||||
<StandaloneRibbonAdapter component={FormattingToolbar} />
|
<StandaloneRibbonAdapter component={FormattingToolbar} />
|
||||||
<FloatingButtons items={utils.isMobile() ? MOBILE_FLOATING_BUTTONS : DESKTOP_FLOATING_BUTTONS} />
|
<FloatingButtons items={items} />
|
||||||
<NoteDetail />
|
<NoteDetail />
|
||||||
<NoteList media="screen" displayOnlyCollections />
|
<NoteList media="screen" displayOnlyCollections />
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user