mirror of
https://github.com/zadam/trilium.git
synced 2025-12-20 23:29:55 +01:00
feat(note_actions): group development options
This commit is contained in:
@@ -13,7 +13,7 @@ import { isElectron as getIsElectron, isMac as getIsMac } from "../../services/u
|
||||
import ws from "../../services/ws";
|
||||
import ActionButton from "../react/ActionButton";
|
||||
import Dropdown from "../react/Dropdown";
|
||||
import { FormDropdownDivider, FormListHeader, FormListItem } from "../react/FormList";
|
||||
import { FormDropdownDivider, FormDropdownSubmenu, FormListItem } from "../react/FormList";
|
||||
import { useIsNoteReadOnly, useNoteContext, useNoteLabel, useNoteProperty, useTriliumOption } from "../react/hooks";
|
||||
import { ParentComponent } from "../react/react_utils";
|
||||
import { isExperimentalFeatureEnabled } from "../../services/experimental_features";
|
||||
@@ -114,23 +114,22 @@ function NoteContextMenu({ note, noteContext }: { note: FNote, noteContext?: Not
|
||||
|
||||
function DevelopmentActions({ note, noteContext }: { note: FNote, noteContext?: NoteContext }) {
|
||||
return (
|
||||
<>
|
||||
<FormListHeader text="Development-only Actions" />
|
||||
<FormDropdownSubmenu title="Development Actions" icon="bx bx-wrench" dropStart>
|
||||
<FormListItem
|
||||
icon="bx bx-printer"
|
||||
onClick={() => window.open(`/?print=#root/${note.noteId}`, "_blank")}
|
||||
>Open print page</FormListItem>
|
||||
{note.type === "text" && (
|
||||
<FormListItem
|
||||
icon="bx bx-error"
|
||||
onClick={() => {
|
||||
noteContext?.getTextEditor(editor => {
|
||||
editor.editing.view.change(() => {
|
||||
throw new Error("Editor crashed.");
|
||||
});
|
||||
<FormListItem
|
||||
icon="bx bx-error"
|
||||
disabled={note.type !== "text"}
|
||||
onClick={() => {
|
||||
noteContext?.getTextEditor(editor => {
|
||||
editor.editing.view.change(() => {
|
||||
throw new Error("Editor crashed.");
|
||||
});
|
||||
}}>Crash editor</FormListItem>)}
|
||||
</>
|
||||
});
|
||||
}}>Crash editor</FormListItem>
|
||||
</FormDropdownSubmenu>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user