mirror of
https://github.com/zadam/trilium.git
synced 2025-11-21 08:04:24 +01:00
client/note color picker: refactor
This commit is contained in:
parent
1de9f715fa
commit
b0476c7017
@ -1,4 +1,4 @@
|
||||
import "./NoteColorPickerMenuItem.css";
|
||||
import "./NoteColorPicker.css";
|
||||
import { t } from "../../services/i18n";
|
||||
import { useCallback, useEffect, useRef, useState} from "preact/hooks";
|
||||
import {ComponentChildren} from "preact";
|
||||
@ -1,4 +1,4 @@
|
||||
import NoteColorPickerMenuItem from "./custom-items/NoteColorPickerMenuItem.jsx";
|
||||
import NoteColorPicker from "./custom-items/NoteColorPicker.jsx";
|
||||
import treeService from "../services/tree.js";
|
||||
import froca from "../services/froca.js";
|
||||
import clipboard from "../services/clipboard.js";
|
||||
@ -264,7 +264,7 @@ export default class TreeContextMenu implements SelectMenuItemEventListener<Tree
|
||||
kind: "custom",
|
||||
componentFn: () => {
|
||||
if (notOptionsOrHelp && selectedNotes.length === 1) {
|
||||
return NoteColorPickerMenuItem({note});
|
||||
return NoteColorPicker({note});
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import FNote from "../../../entities/fnote";
|
||||
import NoteColorPickerMenuItem from "../../../menus/custom-items/NoteColorPickerMenuItem";
|
||||
import NoteColorPicker from "../../../menus/custom-items/NoteColorPicker";
|
||||
import contextMenu, { ContextMenuEvent } from "../../../menus/context_menu";
|
||||
import link_context_menu from "../../../menus/link_context_menu";
|
||||
import attributes from "../../../services/attributes";
|
||||
@ -78,7 +78,7 @@ export function openNoteContextMenu(api: Api, event: ContextMenuEvent, note: FNo
|
||||
{ kind: "separator" },
|
||||
{
|
||||
kind: "custom",
|
||||
componentFn: () => NoteColorPickerMenuItem({note})
|
||||
componentFn: () => NoteColorPicker({note})
|
||||
}
|
||||
],
|
||||
selectMenuItemHandler: ({ command }) => link_context_menu.handleLinkContextMenuItem(command, note.noteId),
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import NoteColorPickerMenuItem from "../../../menus/custom-items/NoteColorPickerMenuItem";
|
||||
import NoteColorPicker from "../../../menus/custom-items/NoteColorPicker";
|
||||
import FNote from "../../../entities/fnote";
|
||||
import contextMenu, { ContextMenuEvent } from "../../../menus/context_menu";
|
||||
import link_context_menu from "../../../menus/link_context_menu";
|
||||
@ -40,7 +40,7 @@ export function openCalendarContextMenu(e: ContextMenuEvent, noteId: string, par
|
||||
{ kind: "separator" },
|
||||
{
|
||||
kind: "custom",
|
||||
componentFn: () => NoteColorPickerMenuItem({note: noteId})
|
||||
componentFn: () => NoteColorPicker({note: noteId})
|
||||
}
|
||||
],
|
||||
selectMenuItemHandler: ({ command }) => link_context_menu.handleLinkContextMenuItem(command, noteId),
|
||||
|
||||
@ -2,7 +2,7 @@ import type { LatLng, LeafletMouseEvent } from "leaflet";
|
||||
import appContext, { type CommandMappings } from "../../../components/app_context.js";
|
||||
import contextMenu, { type MenuItem } from "../../../menus/context_menu.js";
|
||||
import linkContextMenu from "../../../menus/link_context_menu.js";
|
||||
import NoteColorPickerMenuItem from "../../../menus/custom-items/NoteColorPickerMenuItem.jsx";
|
||||
import NoteColorPicker from "../../../menus/custom-items/NoteColorPicker.jsx";
|
||||
import { t } from "../../../services/i18n.js";
|
||||
import { createNewNote } from "./api.js";
|
||||
import { copyTextWithToast } from "../../../services/clipboard_ext.js";
|
||||
@ -23,7 +23,7 @@ export default function openContextMenu(noteId: string, e: LeafletMouseEvent, is
|
||||
{ kind: "separator"},
|
||||
{
|
||||
kind: "custom",
|
||||
componentFn: () => NoteColorPickerMenuItem({note: noteId})
|
||||
componentFn: () => NoteColorPicker({note: noteId})
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@ import link_context_menu from "../../../menus/link_context_menu.js";
|
||||
import froca from "../../../services/froca.js";
|
||||
import branches from "../../../services/branches.js";
|
||||
import Component from "../../../components/component.js";
|
||||
import NoteColorPickerMenuItem from "../../../menus/custom-items/NoteColorPickerMenuItem.jsx";
|
||||
import NoteColorPicker from "../../../menus/custom-items/NoteColorPicker.jsx";
|
||||
import { RefObject } from "preact";
|
||||
|
||||
export function useContextMenu(parentNote: FNote, parentComponent: Component | null | undefined, tabulator: RefObject<Tabulator>): Partial<EventCallBackMethods> {
|
||||
@ -224,7 +224,7 @@ export function showRowContextMenu(parentComponent: Component, e: MouseEvent, ro
|
||||
{ kind: "separator"},
|
||||
{
|
||||
kind: "custom",
|
||||
componentFn: () => NoteColorPickerMenuItem({note: rowData.noteId})
|
||||
componentFn: () => NoteColorPicker({note: rowData.noteId})
|
||||
}
|
||||
],
|
||||
selectMenuItemHandler: ({ command }) => link_context_menu.handleLinkContextMenuItem(command, rowData.noteId),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user