mirror of
https://github.com/zadam/trilium.git
synced 2026-03-13 15:40:22 +01:00
Compare commits
1 Commits
main
...
renovate/h
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cafcdf838f |
@@ -381,10 +381,6 @@ class NoteContext extends Component implements EventListener<"entitiesReloaded">
|
|||||||
|
|
||||||
// Collections must always display a note list, even if no children.
|
// Collections must always display a note list, even if no children.
|
||||||
if (note.type === "book") {
|
if (note.type === "book") {
|
||||||
if (note.isProtected && !protectedSessionHolder.isProtectedSessionAvailable()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const viewType = note.getLabelValue("viewType") ?? "grid";
|
const viewType = note.getLabelValue("viewType") ?? "grid";
|
||||||
if (!["list", "grid"].includes(viewType)) {
|
if (!["list", "grid"].includes(viewType)) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -110,12 +110,7 @@ function processNoteChange(loadResults: LoadResults, ec: EntityChange) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only register as a content change if the protection status didn't change.
|
if (ec.componentId) {
|
||||||
// When isProtected changes, the blobId change is a side effect of re-encryption,
|
|
||||||
// not a content edit. Registering it as content would cause the tree's content-only
|
|
||||||
// filter to incorrectly skip the note update (since both changes share the same
|
|
||||||
// componentId).
|
|
||||||
if (ec.componentId && note.isProtected === (ec.entity as FNoteRow).isProtected) {
|
|
||||||
loadResults.addNoteContent(note.noteId, ec.componentId);
|
loadResults.addNoteContent(note.noteId, ec.componentId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,15 @@
|
|||||||
import type { CKTextEditor } from "@triliumnext/ckeditor5";
|
|
||||||
import { AttributeRow } from "@triliumnext/commons";
|
|
||||||
|
|
||||||
import appContext from "../components/app_context.js";
|
import appContext from "../components/app_context.js";
|
||||||
import type FBranch from "../entities/fbranch.js";
|
|
||||||
import type FNote from "../entities/fnote.js";
|
|
||||||
import type { ChooseNoteTypeResponse } from "../widgets/dialogs/note_type_chooser.js";
|
|
||||||
import froca from "./froca.js";
|
|
||||||
import { t } from "./i18n.js";
|
|
||||||
import protectedSessionHolder from "./protected_session_holder.js";
|
import protectedSessionHolder from "./protected_session_holder.js";
|
||||||
import server from "./server.js";
|
import server from "./server.js";
|
||||||
import toastService from "./toast.js";
|
|
||||||
import treeService from "./tree.js";
|
|
||||||
import ws from "./ws.js";
|
import ws from "./ws.js";
|
||||||
|
import froca from "./froca.js";
|
||||||
|
import treeService from "./tree.js";
|
||||||
|
import toastService from "./toast.js";
|
||||||
|
import { t } from "./i18n.js";
|
||||||
|
import type FNote from "../entities/fnote.js";
|
||||||
|
import type FBranch from "../entities/fbranch.js";
|
||||||
|
import type { ChooseNoteTypeResponse } from "../widgets/dialogs/note_type_chooser.js";
|
||||||
|
import type { CKTextEditor } from "@triliumnext/ckeditor5";
|
||||||
|
|
||||||
export interface CreateNoteOpts {
|
export interface CreateNoteOpts {
|
||||||
isProtected?: boolean;
|
isProtected?: boolean;
|
||||||
@@ -26,8 +24,6 @@ export interface CreateNoteOpts {
|
|||||||
target?: string;
|
target?: string;
|
||||||
targetBranchId?: string;
|
targetBranchId?: string;
|
||||||
textEditor?: CKTextEditor;
|
textEditor?: CKTextEditor;
|
||||||
/** Attributes to be set on the note. These are set atomically on note creation, so entity changes are not sent for attributes defined here. */
|
|
||||||
attributes?: Omit<AttributeRow, "noteId" | "attributeId">[];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Response {
|
interface Response {
|
||||||
@@ -41,7 +37,7 @@ interface DuplicateResponse {
|
|||||||
note: FNote;
|
note: FNote;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function createNote(parentNotePath: string | undefined, options: CreateNoteOpts = {}, componentId?: string) {
|
async function createNote(parentNotePath: string | undefined, options: CreateNoteOpts = {}) {
|
||||||
options = Object.assign(
|
options = Object.assign(
|
||||||
{
|
{
|
||||||
activate: true,
|
activate: true,
|
||||||
@@ -81,9 +77,8 @@ async function createNote(parentNotePath: string | undefined, options: CreateNot
|
|||||||
isProtected: options.isProtected,
|
isProtected: options.isProtected,
|
||||||
type: options.type,
|
type: options.type,
|
||||||
mime: options.mime,
|
mime: options.mime,
|
||||||
templateNoteId: options.templateNoteId,
|
templateNoteId: options.templateNoteId
|
||||||
attributes: options.attributes
|
});
|
||||||
}, componentId);
|
|
||||||
|
|
||||||
if (options.saveSelection) {
|
if (options.saveSelection) {
|
||||||
// we remove the selection only after it was saved to server to make sure we don't lose anything
|
// we remove the selection only after it was saved to server to make sure we don't lose anything
|
||||||
@@ -145,9 +140,10 @@ function parseSelectedHtml(selectedHtml: string) {
|
|||||||
const content = selectedHtml.replace(dom[0].outerHTML, "");
|
const content = selectedHtml.replace(dom[0].outerHTML, "");
|
||||||
|
|
||||||
return [title, content];
|
return [title, content];
|
||||||
}
|
} else {
|
||||||
return [null, selectedHtml];
|
return [null, selectedHtml];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function duplicateSubtree(noteId: string, parentNotePath: string) {
|
async function duplicateSubtree(noteId: string, parentNotePath: string) {
|
||||||
const parentNoteId = treeService.getNoteIdFromUrl(parentNotePath);
|
const parentNoteId = treeService.getNoteIdFromUrl(parentNotePath);
|
||||||
|
|||||||
@@ -2198,12 +2198,5 @@
|
|||||||
},
|
},
|
||||||
"setup_form": {
|
"setup_form": {
|
||||||
"more_info": "Para saber más"
|
"more_info": "Para saber más"
|
||||||
},
|
|
||||||
"media": {
|
|
||||||
"play": "Reproducir (Espacio)",
|
|
||||||
"pause": "Pausa (Espacio)",
|
|
||||||
"back-10s": "Retroceder 10s (tecla de flecha izquierda)",
|
|
||||||
"forward-30s": "Adelantar 30s",
|
|
||||||
"mute": "Silenciar (M)"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2168,24 +2168,5 @@
|
|||||||
},
|
},
|
||||||
"setup_form": {
|
"setup_form": {
|
||||||
"more_info": "さらに詳しく"
|
"more_info": "さらに詳しく"
|
||||||
},
|
|
||||||
"media": {
|
|
||||||
"play": "再生 (スペース)",
|
|
||||||
"pause": "一時停止 (スペース)",
|
|
||||||
"back-10s": "10 秒戻る (左矢印キー)",
|
|
||||||
"forward-30s": "30 秒進む",
|
|
||||||
"mute": "ミュート (M)",
|
|
||||||
"unmute": "ミュート解除 (M)",
|
|
||||||
"playback-speed": "再生速度",
|
|
||||||
"loop": "ループ",
|
|
||||||
"disable-loop": "ループを解除",
|
|
||||||
"rotate": "回転",
|
|
||||||
"picture-in-picture": "ピクチャーインピクチャー",
|
|
||||||
"exit-picture-in-picture": "ピクチャーインピクチャーを終了",
|
|
||||||
"fullscreen": "全画面表示 (F)",
|
|
||||||
"exit-fullscreen": "全画面表示を終了",
|
|
||||||
"unsupported-format": "このファイル形式ではメディアプレビューはご利用いただけません:\n{{mime}}",
|
|
||||||
"zoom-to-fit": "ズームして全体を表示",
|
|
||||||
"zoom-reset": "ズーム設定をリセット"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { BulkAction } from "@triliumnext/commons";
|
import { BulkAction } from "@triliumnext/commons";
|
||||||
|
import { BoardViewData } from ".";
|
||||||
import appContext from "../../../components/app_context";
|
import appContext from "../../../components/app_context";
|
||||||
import FNote from "../../../entities/fnote";
|
import FNote from "../../../entities/fnote";
|
||||||
import attributes from "../../../services/attributes";
|
import attributes from "../../../services/attributes";
|
||||||
@@ -9,7 +9,6 @@ import froca from "../../../services/froca";
|
|||||||
import { t } from "../../../services/i18n";
|
import { t } from "../../../services/i18n";
|
||||||
import note_create from "../../../services/note_create";
|
import note_create from "../../../services/note_create";
|
||||||
import server from "../../../services/server";
|
import server from "../../../services/server";
|
||||||
import { BoardViewData } from ".";
|
|
||||||
import { ColumnMap } from "./data";
|
import { ColumnMap } from "./data";
|
||||||
|
|
||||||
export default class BoardApi {
|
export default class BoardApi {
|
||||||
@@ -36,11 +35,13 @@ export default class BoardApi {
|
|||||||
|
|
||||||
async createNewItem(column: string, title: string) {
|
async createNewItem(column: string, title: string) {
|
||||||
try {
|
try {
|
||||||
|
// Get the parent note path
|
||||||
|
const parentNotePath = this.parentNote.noteId;
|
||||||
|
|
||||||
// Create a new note as a child of the parent note
|
// Create a new note as a child of the parent note
|
||||||
const { note: newNote, branch: newBranch } = await note_create.createNote(this.parentNote.noteId, {
|
const { note: newNote, branch: newBranch } = await note_create.createNote(parentNotePath, {
|
||||||
activate: false,
|
activate: false,
|
||||||
title,
|
title
|
||||||
isProtected: this.parentNote.isProtected
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (newNote && newBranch) {
|
if (newNote && newBranch) {
|
||||||
@@ -86,7 +87,7 @@ export default class BoardApi {
|
|||||||
|
|
||||||
const action: BulkAction = this.isRelationMode
|
const action: BulkAction = this.isRelationMode
|
||||||
? { name: "deleteRelation", relationName: this.statusAttribute }
|
? { name: "deleteRelation", relationName: this.statusAttribute }
|
||||||
: { name: "deleteLabel", labelName: this.statusAttribute };
|
: { name: "deleteLabel", labelName: this.statusAttribute }
|
||||||
await executeBulkActions(noteIds, [ action ]);
|
await executeBulkActions(noteIds, [ action ]);
|
||||||
this.viewConfig.columns = (this.viewConfig.columns ?? []).filter(col => col.value !== column);
|
this.viewConfig.columns = (this.viewConfig.columns ?? []).filter(col => col.value !== column);
|
||||||
this.saveConfig(this.viewConfig);
|
this.saveConfig(this.viewConfig);
|
||||||
@@ -98,7 +99,7 @@ export default class BoardApi {
|
|||||||
// Change the value in the notes.
|
// Change the value in the notes.
|
||||||
const action: BulkAction = this.isRelationMode
|
const action: BulkAction = this.isRelationMode
|
||||||
? { name: "updateRelationTarget", relationName: this.statusAttribute, targetNoteId: newValue }
|
? { name: "updateRelationTarget", relationName: this.statusAttribute, targetNoteId: newValue }
|
||||||
: { name: "updateLabelValue", labelName: this.statusAttribute, labelValue: newValue };
|
: { name: "updateLabelValue", labelName: this.statusAttribute, labelValue: newValue }
|
||||||
await executeBulkActions(noteIds, [ action ]);
|
await executeBulkActions(noteIds, [ action ]);
|
||||||
|
|
||||||
// Rename the column in the persisted data.
|
// Rename the column in the persisted data.
|
||||||
@@ -178,9 +179,10 @@ export default class BoardApi {
|
|||||||
if (!note) return;
|
if (!note) return;
|
||||||
if (this.isRelationMode) {
|
if (this.isRelationMode) {
|
||||||
return attributes.removeOwnedRelationByName(note, this.statusAttribute);
|
return attributes.removeOwnedRelationByName(note, this.statusAttribute);
|
||||||
}
|
} else {
|
||||||
return attributes.removeOwnedLabelByName(note, this.statusAttribute);
|
return attributes.removeOwnedLabelByName(note, this.statusAttribute);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async moveWithinBoard(noteId: string, sourceBranchId: string, sourceIndex: number, targetIndex: number, sourceColumn: string, targetColumn: string) {
|
async moveWithinBoard(noteId: string, sourceBranchId: string, sourceIndex: number, targetIndex: number, sourceColumn: string, targetColumn: string) {
|
||||||
const targetItems = this.byColumn?.get(targetColumn) ?? [];
|
const targetItems = this.byColumn?.get(targetColumn) ?? [];
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { AttributeRow } from "@triliumnext/commons";
|
import { AttributeRow, CreateChildrenResponse } from "@triliumnext/commons";
|
||||||
|
|
||||||
import FNote from "../../../entities/fnote";
|
import FNote from "../../../entities/fnote";
|
||||||
import { setAttribute, setLabel } from "../../../services/attributes";
|
import { setAttribute, setLabel } from "../../../services/attributes";
|
||||||
import note_create from "../../../services/note_create";
|
import server from "../../../services/server";
|
||||||
|
|
||||||
interface NewEventOpts {
|
interface NewEventOpts {
|
||||||
title: string;
|
title: string;
|
||||||
@@ -51,13 +51,11 @@ export async function newEvent(parentNote: FNote, { title, startDate, endDate, s
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the note.
|
// Create the note.
|
||||||
await note_create.createNote(parentNote.noteId, {
|
await server.post<CreateChildrenResponse>(`notes/${parentNote.noteId}/children?target=into`, {
|
||||||
title,
|
title,
|
||||||
isProtected: parentNote.isProtected,
|
|
||||||
content: "",
|
content: "",
|
||||||
type: "text",
|
type: "text",
|
||||||
attributes,
|
attributes
|
||||||
activate: false
|
|
||||||
}, componentId);
|
}, componentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import type { LatLng, LeafletMouseEvent } from "leaflet";
|
import type { LatLng, LeafletMouseEvent } from "leaflet";
|
||||||
|
import { LOCATION_ATTRIBUTE } from ".";
|
||||||
import FNote from "../../../entities/fnote";
|
|
||||||
import attributes from "../../../services/attributes";
|
import attributes from "../../../services/attributes";
|
||||||
import { prompt } from "../../../services/dialog";
|
import { prompt } from "../../../services/dialog";
|
||||||
|
import server from "../../../services/server";
|
||||||
import { t } from "../../../services/i18n";
|
import { t } from "../../../services/i18n";
|
||||||
import note_create from "../../../services/note_create";
|
import { CreateChildrenResponse } from "@triliumnext/commons";
|
||||||
import { LOCATION_ATTRIBUTE } from ".";
|
|
||||||
|
|
||||||
const CHILD_NOTE_ICON = "bx bx-pin";
|
const CHILD_NOTE_ICON = "bx bx-pin";
|
||||||
|
|
||||||
@@ -14,20 +13,16 @@ export async function moveMarker(noteId: string, latLng: LatLng | null) {
|
|||||||
await attributes.setLabel(noteId, LOCATION_ATTRIBUTE, value);
|
await attributes.setLabel(noteId, LOCATION_ATTRIBUTE, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function createNewNote(parentNote: FNote, e: LeafletMouseEvent) {
|
export async function createNewNote(noteId: string, e: LeafletMouseEvent) {
|
||||||
const title = await prompt({ message: t("relation_map.enter_title_of_new_note"), defaultValue: t("relation_map.default_new_note_title") });
|
const title = await prompt({ message: t("relation_map.enter_title_of_new_note"), defaultValue: t("relation_map.default_new_note_title") });
|
||||||
|
|
||||||
if (title?.trim()) {
|
if (title?.trim()) {
|
||||||
await note_create.createNote(parentNote.noteId, {
|
const { note } = await server.post<CreateChildrenResponse>(`notes/${noteId}/children?target=into`, {
|
||||||
title,
|
title,
|
||||||
content: "",
|
content: "",
|
||||||
type: "text",
|
type: "text"
|
||||||
activate: false,
|
|
||||||
isProtected: parentNote.isProtected,
|
|
||||||
attributes: [
|
|
||||||
{ type: "label", name: LOCATION_ATTRIBUTE, value: [e.latlng.lat, e.latlng.lng].join(",") },
|
|
||||||
{ type: "label", name: "iconClass", value: CHILD_NOTE_ICON }
|
|
||||||
]
|
|
||||||
});
|
});
|
||||||
|
attributes.setLabel(note.noteId, "iconClass", CHILD_NOTE_ICON);
|
||||||
|
moveMarker(note.noteId, e.latlng);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
import type { LatLng, LeafletMouseEvent } from "leaflet";
|
import type { LatLng, LeafletMouseEvent } from "leaflet";
|
||||||
|
|
||||||
import appContext, { type CommandMappings } from "../../../components/app_context.js";
|
import appContext, { type CommandMappings } from "../../../components/app_context.js";
|
||||||
import FNote from "../../../entities/fnote.js";
|
|
||||||
import contextMenu, { type MenuItem } from "../../../menus/context_menu.js";
|
import contextMenu, { type MenuItem } from "../../../menus/context_menu.js";
|
||||||
import NoteColorPicker from "../../../menus/custom-items/NoteColorPicker.jsx";
|
|
||||||
import linkContextMenu from "../../../menus/link_context_menu.js";
|
import linkContextMenu from "../../../menus/link_context_menu.js";
|
||||||
import { copyTextWithToast } from "../../../services/clipboard_ext.js";
|
import NoteColorPicker from "../../../menus/custom-items/NoteColorPicker.jsx";
|
||||||
import { t } from "../../../services/i18n.js";
|
import { t } from "../../../services/i18n.js";
|
||||||
import link from "../../../services/link.js";
|
|
||||||
import { createNewNote } from "./api.js";
|
import { createNewNote } from "./api.js";
|
||||||
|
import { copyTextWithToast } from "../../../services/clipboard_ext.js";
|
||||||
|
import link from "../../../services/link.js";
|
||||||
|
|
||||||
export default function openContextMenu(noteId: string, e: LeafletMouseEvent, isEditable: boolean) {
|
export default function openContextMenu(noteId: string, e: LeafletMouseEvent, isEditable: boolean) {
|
||||||
let items: MenuItem<keyof CommandMappings>[] = [
|
let items: MenuItem<keyof CommandMappings>[] = [
|
||||||
@@ -46,7 +44,7 @@ export default function openContextMenu(noteId: string, e: LeafletMouseEvent, is
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function openMapContextMenu(note: FNote, e: LeafletMouseEvent, isEditable: boolean) {
|
export function openMapContextMenu(noteId: string, e: LeafletMouseEvent, isEditable: boolean) {
|
||||||
let items: MenuItem<keyof CommandMappings>[] = [
|
let items: MenuItem<keyof CommandMappings>[] = [
|
||||||
...buildGeoLocationItem(e)
|
...buildGeoLocationItem(e)
|
||||||
];
|
];
|
||||||
@@ -57,10 +55,10 @@ export function openMapContextMenu(note: FNote, e: LeafletMouseEvent, isEditable
|
|||||||
{ kind: "separator" },
|
{ kind: "separator" },
|
||||||
{
|
{
|
||||||
title: t("geo-map-context.add-note"),
|
title: t("geo-map-context.add-note"),
|
||||||
handler: () => createNewNote(note, e),
|
handler: () => createNewNote(noteId, e),
|
||||||
uiIcon: "bx bx-plus"
|
uiIcon: "bx bx-plus"
|
||||||
}
|
}
|
||||||
];
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
contextMenu.show({
|
contextMenu.show({
|
||||||
|
|||||||
@@ -93,14 +93,14 @@ export default function GeoView({ note, noteIds, viewConfig, saveConfig }: ViewM
|
|||||||
const onClick = useCallback(async (e: LeafletMouseEvent) => {
|
const onClick = useCallback(async (e: LeafletMouseEvent) => {
|
||||||
if (state === State.NewNote) {
|
if (state === State.NewNote) {
|
||||||
toast.closePersistent("geo-new-note");
|
toast.closePersistent("geo-new-note");
|
||||||
await createNewNote(note, e);
|
await createNewNote(note.noteId, e);
|
||||||
setState(State.Normal);
|
setState(State.Normal);
|
||||||
}
|
}
|
||||||
}, [ note, state ]);
|
}, [ state ]);
|
||||||
|
|
||||||
const onContextMenu = useCallback((e: LeafletMouseEvent) => {
|
const onContextMenu = useCallback((e: LeafletMouseEvent) => {
|
||||||
openMapContextMenu(note, e, !isReadOnly);
|
openMapContextMenu(note.noteId, e, !isReadOnly);
|
||||||
}, [ note, isReadOnly ]);
|
}, [ note.noteId, isReadOnly ]);
|
||||||
|
|
||||||
// Dragging
|
// Dragging
|
||||||
const containerRef = useRef<HTMLDivElement>(null);
|
const containerRef = useRef<HTMLDivElement>(null);
|
||||||
|
|||||||
@@ -18,14 +18,14 @@ import useRowTableEditing from "./row_editing";
|
|||||||
import { TableData } from "./rows";
|
import { TableData } from "./rows";
|
||||||
import Tabulator from "./tabulator";
|
import Tabulator from "./tabulator";
|
||||||
|
|
||||||
export default function TableView({ note, noteIds, viewConfig, saveConfig }: ViewModeProps<TableConfig>) {
|
export default function TableView({ note, noteIds, notePath, viewConfig, saveConfig }: ViewModeProps<TableConfig>) {
|
||||||
const tabulatorRef = useRef<VanillaTabulator>(null);
|
const tabulatorRef = useRef<VanillaTabulator>(null);
|
||||||
const parentComponent = useContext(ParentComponent);
|
const parentComponent = useContext(ParentComponent);
|
||||||
|
|
||||||
const [ attributeDetailWidgetEl, attributeDetailWidget ] = useLegacyWidget(() => new AttributeDetailWidget().contentSized());
|
const [ attributeDetailWidgetEl, attributeDetailWidget ] = useLegacyWidget(() => new AttributeDetailWidget().contentSized());
|
||||||
const contextMenuEvents = useContextMenu(note, parentComponent, tabulatorRef);
|
const contextMenuEvents = useContextMenu(note, parentComponent, tabulatorRef);
|
||||||
const persistenceProps = usePersistence(viewConfig, saveConfig);
|
const persistenceProps = usePersistence(viewConfig, saveConfig);
|
||||||
const rowEditingEvents = useRowTableEditing(tabulatorRef, attributeDetailWidget, note);
|
const rowEditingEvents = useRowTableEditing(tabulatorRef, attributeDetailWidget, notePath);
|
||||||
const { newAttributePosition, resetNewAttributePosition } = useColTableEditing(tabulatorRef, attributeDetailWidget, note);
|
const { newAttributePosition, resetNewAttributePosition } = useColTableEditing(tabulatorRef, attributeDetailWidget, note);
|
||||||
const { columnDefs, rowData, movableRows, hasChildren } = useData(note, noteIds, viewConfig, newAttributePosition, resetNewAttributePosition);
|
const { columnDefs, rowData, movableRows, hasChildren } = useData(note, noteIds, viewConfig, newAttributePosition, resetNewAttributePosition);
|
||||||
const dataTreeProps = useMemo<Options>(() => {
|
const dataTreeProps = useMemo<Options>(() => {
|
||||||
|
|||||||
@@ -1,27 +1,24 @@
|
|||||||
import { RefObject } from "preact";
|
|
||||||
import { EventCallBackMethods, RowComponent, Tabulator } from "tabulator-tables";
|
import { EventCallBackMethods, RowComponent, Tabulator } from "tabulator-tables";
|
||||||
|
|
||||||
import { CommandListenerData } from "../../../components/app_context";
|
import { CommandListenerData } from "../../../components/app_context";
|
||||||
import FNote from "../../../entities/fnote";
|
|
||||||
import { setAttribute, setLabel } from "../../../services/attributes";
|
|
||||||
import branches from "../../../services/branches";
|
|
||||||
import froca from "../../../services/froca";
|
|
||||||
import note_create, { CreateNoteOpts } from "../../../services/note_create";
|
import note_create, { CreateNoteOpts } from "../../../services/note_create";
|
||||||
import server from "../../../services/server";
|
|
||||||
import AttributeDetailWidget from "../../attribute_widgets/attribute_detail";
|
|
||||||
import { useLegacyImperativeHandlers } from "../../react/hooks";
|
import { useLegacyImperativeHandlers } from "../../react/hooks";
|
||||||
|
import { RefObject } from "preact";
|
||||||
|
import { setAttribute, setLabel } from "../../../services/attributes";
|
||||||
|
import froca from "../../../services/froca";
|
||||||
|
import server from "../../../services/server";
|
||||||
|
import branches from "../../../services/branches";
|
||||||
|
import AttributeDetailWidget from "../../attribute_widgets/attribute_detail";
|
||||||
|
|
||||||
export default function useRowTableEditing(api: RefObject<Tabulator>, attributeDetailWidget: AttributeDetailWidget, parentNote: FNote): Partial<EventCallBackMethods> {
|
export default function useRowTableEditing(api: RefObject<Tabulator>, attributeDetailWidget: AttributeDetailWidget, parentNotePath: string): Partial<EventCallBackMethods> {
|
||||||
// Adding new rows
|
// Adding new rows
|
||||||
useLegacyImperativeHandlers({
|
useLegacyImperativeHandlers({
|
||||||
addNewRowCommand({ customOpts, parentNotePath: customNotePath }: CommandListenerData<"addNewRow">) {
|
addNewRowCommand({ customOpts, parentNotePath: customNotePath }: CommandListenerData<"addNewRow">) {
|
||||||
const notePath = customNotePath ?? parentNote.noteId;
|
const notePath = customNotePath ?? parentNotePath;
|
||||||
if (notePath) {
|
if (notePath) {
|
||||||
const opts: CreateNoteOpts = {
|
const opts: CreateNoteOpts = {
|
||||||
activate: false,
|
activate: false,
|
||||||
isProtected: parentNote.isProtected,
|
|
||||||
...customOpts
|
...customOpts
|
||||||
};
|
}
|
||||||
note_create.createNote(notePath, opts).then(({ branch }) => {
|
note_create.createNote(notePath, opts).then(({ branch }) => {
|
||||||
if (branch) {
|
if (branch) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -29,7 +26,7 @@ export default function useRowTableEditing(api: RefObject<Tabulator>, attributeD
|
|||||||
focusOnBranch(api.current, branch?.branchId);
|
focusOnBranch(api.current, branch?.branchId);
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -94,14 +91,14 @@ function focusOnBranch(api: Tabulator, branchId: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function findRowDataById(rows: RowComponent[], branchId: string): RowComponent | null {
|
function findRowDataById(rows: RowComponent[], branchId: string): RowComponent | null {
|
||||||
for (const row of rows) {
|
for (let row of rows) {
|
||||||
const item = row.getIndex() as string;
|
const item = row.getIndex() as string;
|
||||||
|
|
||||||
if (item === branchId) {
|
if (item === branchId) {
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
|
||||||
const found = findRowDataById(row.getTreeChildren(), branchId);
|
let found = findRowDataById(row.getTreeChildren(), branchId);
|
||||||
if (found) return found;
|
if (found) return found;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
"colors": "1.4.0",
|
"colors": "1.4.0",
|
||||||
"diff": "8.0.3",
|
"diff": "8.0.3",
|
||||||
"sqlite": "5.1.1",
|
"sqlite": "5.1.1",
|
||||||
"sqlite3": "6.0.1"
|
"sqlite3": "5.1.7"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "tsx src/compare.ts",
|
"dev": "tsx src/compare.ts",
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
"@triliumnext/commons": "workspace:*",
|
"@triliumnext/commons": "workspace:*",
|
||||||
"@triliumnext/server": "workspace:*",
|
"@triliumnext/server": "workspace:*",
|
||||||
"copy-webpack-plugin": "14.0.0",
|
"copy-webpack-plugin": "14.0.0",
|
||||||
"electron": "40.8.1",
|
"electron": "40.8.0",
|
||||||
"@electron-forge/cli": "7.11.1",
|
"@electron-forge/cli": "7.11.1",
|
||||||
"@electron-forge/maker-deb": "7.11.1",
|
"@electron-forge/maker-deb": "7.11.1",
|
||||||
"@electron-forge/maker-dmg": "7.11.1",
|
"@electron-forge/maker-dmg": "7.11.1",
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
"@triliumnext/desktop": "workspace:*",
|
"@triliumnext/desktop": "workspace:*",
|
||||||
"@types/fs-extra": "11.0.4",
|
"@types/fs-extra": "11.0.4",
|
||||||
"copy-webpack-plugin": "14.0.0",
|
"copy-webpack-plugin": "14.0.0",
|
||||||
"electron": "40.8.1",
|
"electron": "40.8.0",
|
||||||
"fs-extra": "11.3.4"
|
"fs-extra": "11.3.4"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -82,7 +82,7 @@
|
|||||||
"debounce": "3.0.0",
|
"debounce": "3.0.0",
|
||||||
"debug": "4.4.3",
|
"debug": "4.4.3",
|
||||||
"ejs": "5.0.1",
|
"ejs": "5.0.1",
|
||||||
"electron": "40.8.1",
|
"electron": "40.8.0",
|
||||||
"electron-debug": "4.1.0",
|
"electron-debug": "4.1.0",
|
||||||
"electron-window-state": "5.0.3",
|
"electron-window-state": "5.0.3",
|
||||||
"escape-html": "1.0.3",
|
"escape-html": "1.0.3",
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
"html": "1.0.0",
|
"html": "1.0.0",
|
||||||
"html2plaintext": "2.1.4",
|
"html2plaintext": "2.1.4",
|
||||||
"http-proxy-agent": "7.0.2",
|
"http-proxy-agent": "7.0.2",
|
||||||
"https-proxy-agent": "7.0.6",
|
"https-proxy-agent": "8.0.0",
|
||||||
"i18next": "25.8.17",
|
"i18next": "25.8.17",
|
||||||
"i18next-fs-backend": "2.6.1",
|
"i18next-fs-backend": "2.6.1",
|
||||||
"image-type": "6.0.0",
|
"image-type": "6.0.0",
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
"typescript": "5.9.3",
|
"typescript": "5.9.3",
|
||||||
"user-agent-data-types": "0.4.2",
|
"user-agent-data-types": "0.4.2",
|
||||||
"vite": "7.3.1",
|
"vite": "7.3.1",
|
||||||
"vitest": "4.1.0"
|
"vitest": "4.0.18"
|
||||||
},
|
},
|
||||||
"eslintConfig": {
|
"eslintConfig": {
|
||||||
"extends": "preact"
|
"extends": "preact"
|
||||||
|
|||||||
@@ -51,9 +51,9 @@
|
|||||||
"@types/express": "5.0.6",
|
"@types/express": "5.0.6",
|
||||||
"@types/js-yaml": "4.0.9",
|
"@types/js-yaml": "4.0.9",
|
||||||
"@types/node": "24.12.0",
|
"@types/node": "24.12.0",
|
||||||
"@vitest/browser-webdriverio": "4.1.0",
|
"@vitest/browser-webdriverio": "4.0.18",
|
||||||
"@vitest/coverage-v8": "4.1.0",
|
"@vitest/coverage-v8": "4.0.18",
|
||||||
"@vitest/ui": "4.1.0",
|
"@vitest/ui": "4.0.18",
|
||||||
"chalk": "5.6.2",
|
"chalk": "5.6.2",
|
||||||
"cross-env": "10.1.0",
|
"cross-env": "10.1.0",
|
||||||
"dpdm": "4.0.1",
|
"dpdm": "4.0.1",
|
||||||
@@ -77,7 +77,7 @@
|
|||||||
"upath": "2.0.1",
|
"upath": "2.0.1",
|
||||||
"vite": "7.3.1",
|
"vite": "7.3.1",
|
||||||
"vite-plugin-dts": "4.5.4",
|
"vite-plugin-dts": "4.5.4",
|
||||||
"vitest": "4.1.0"
|
"vitest": "4.0.18"
|
||||||
},
|
},
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"author": {
|
"author": {
|
||||||
|
|||||||
@@ -26,8 +26,8 @@
|
|||||||
"@ckeditor/ckeditor5-package-tools": "5.0.1",
|
"@ckeditor/ckeditor5-package-tools": "5.0.1",
|
||||||
"@typescript-eslint/eslint-plugin": "8.57.0",
|
"@typescript-eslint/eslint-plugin": "8.57.0",
|
||||||
"@typescript-eslint/parser": "8.57.0",
|
"@typescript-eslint/parser": "8.57.0",
|
||||||
"@vitest/browser": "4.1.0",
|
"@vitest/browser": "4.0.18",
|
||||||
"@vitest/coverage-istanbul": "4.1.0",
|
"@vitest/coverage-istanbul": "4.0.18",
|
||||||
"ckeditor5": "47.4.0",
|
"ckeditor5": "47.4.0",
|
||||||
"eslint": "10.0.3",
|
"eslint": "10.0.3",
|
||||||
"eslint-config-ckeditor5": ">=9.1.0",
|
"eslint-config-ckeditor5": ">=9.1.0",
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
"ts-node": "10.9.2",
|
"ts-node": "10.9.2",
|
||||||
"typescript": "5.9.3",
|
"typescript": "5.9.3",
|
||||||
"vite-plugin-svgo": "2.0.0",
|
"vite-plugin-svgo": "2.0.0",
|
||||||
"vitest": "4.1.0",
|
"vitest": "4.0.18",
|
||||||
"webdriverio": "9.25.0"
|
"webdriverio": "9.25.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|||||||
@@ -27,8 +27,8 @@
|
|||||||
"@ckeditor/ckeditor5-package-tools": "5.0.1",
|
"@ckeditor/ckeditor5-package-tools": "5.0.1",
|
||||||
"@typescript-eslint/eslint-plugin": "8.57.0",
|
"@typescript-eslint/eslint-plugin": "8.57.0",
|
||||||
"@typescript-eslint/parser": "8.57.0",
|
"@typescript-eslint/parser": "8.57.0",
|
||||||
"@vitest/browser": "4.1.0",
|
"@vitest/browser": "4.0.18",
|
||||||
"@vitest/coverage-istanbul": "4.1.0",
|
"@vitest/coverage-istanbul": "4.0.18",
|
||||||
"ckeditor5": "47.4.0",
|
"ckeditor5": "47.4.0",
|
||||||
"eslint": "10.0.3",
|
"eslint": "10.0.3",
|
||||||
"eslint-config-ckeditor5": ">=9.1.0",
|
"eslint-config-ckeditor5": ">=9.1.0",
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
"ts-node": "10.9.2",
|
"ts-node": "10.9.2",
|
||||||
"typescript": "5.9.3",
|
"typescript": "5.9.3",
|
||||||
"vite-plugin-svgo": "2.0.0",
|
"vite-plugin-svgo": "2.0.0",
|
||||||
"vitest": "4.1.0",
|
"vitest": "4.0.18",
|
||||||
"webdriverio": "9.25.0"
|
"webdriverio": "9.25.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|||||||
@@ -29,8 +29,8 @@
|
|||||||
"@ckeditor/ckeditor5-package-tools": "5.0.1",
|
"@ckeditor/ckeditor5-package-tools": "5.0.1",
|
||||||
"@typescript-eslint/eslint-plugin": "8.57.0",
|
"@typescript-eslint/eslint-plugin": "8.57.0",
|
||||||
"@typescript-eslint/parser": "8.57.0",
|
"@typescript-eslint/parser": "8.57.0",
|
||||||
"@vitest/browser": "4.1.0",
|
"@vitest/browser": "4.0.18",
|
||||||
"@vitest/coverage-istanbul": "4.1.0",
|
"@vitest/coverage-istanbul": "4.0.18",
|
||||||
"ckeditor5": "47.4.0",
|
"ckeditor5": "47.4.0",
|
||||||
"eslint": "10.0.3",
|
"eslint": "10.0.3",
|
||||||
"eslint-config-ckeditor5": ">=9.1.0",
|
"eslint-config-ckeditor5": ">=9.1.0",
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
"ts-node": "10.9.2",
|
"ts-node": "10.9.2",
|
||||||
"typescript": "5.9.3",
|
"typescript": "5.9.3",
|
||||||
"vite-plugin-svgo": "2.0.0",
|
"vite-plugin-svgo": "2.0.0",
|
||||||
"vitest": "4.1.0",
|
"vitest": "4.0.18",
|
||||||
"webdriverio": "9.25.0"
|
"webdriverio": "9.25.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|||||||
@@ -29,8 +29,8 @@
|
|||||||
"@ckeditor/ckeditor5-package-tools": "5.0.1",
|
"@ckeditor/ckeditor5-package-tools": "5.0.1",
|
||||||
"@typescript-eslint/eslint-plugin": "8.57.0",
|
"@typescript-eslint/eslint-plugin": "8.57.0",
|
||||||
"@typescript-eslint/parser": "8.57.0",
|
"@typescript-eslint/parser": "8.57.0",
|
||||||
"@vitest/browser": "4.1.0",
|
"@vitest/browser": "4.0.18",
|
||||||
"@vitest/coverage-istanbul": "4.1.0",
|
"@vitest/coverage-istanbul": "4.0.18",
|
||||||
"ckeditor5": "47.4.0",
|
"ckeditor5": "47.4.0",
|
||||||
"eslint": "10.0.3",
|
"eslint": "10.0.3",
|
||||||
"eslint-config-ckeditor5": ">=9.1.0",
|
"eslint-config-ckeditor5": ">=9.1.0",
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
"ts-node": "10.9.2",
|
"ts-node": "10.9.2",
|
||||||
"typescript": "5.9.3",
|
"typescript": "5.9.3",
|
||||||
"vite-plugin-svgo": "2.0.0",
|
"vite-plugin-svgo": "2.0.0",
|
||||||
"vitest": "4.1.0",
|
"vitest": "4.0.18",
|
||||||
"webdriverio": "9.25.0"
|
"webdriverio": "9.25.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
@@ -71,6 +71,6 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ckeditor/ckeditor5-icons": "47.4.0",
|
"@ckeditor/ckeditor5-icons": "47.4.0",
|
||||||
"mathlive": "0.109.0"
|
"mathlive": "0.108.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,8 +29,8 @@
|
|||||||
"@ckeditor/ckeditor5-package-tools": "5.0.1",
|
"@ckeditor/ckeditor5-package-tools": "5.0.1",
|
||||||
"@typescript-eslint/eslint-plugin": "8.57.0",
|
"@typescript-eslint/eslint-plugin": "8.57.0",
|
||||||
"@typescript-eslint/parser": "8.57.0",
|
"@typescript-eslint/parser": "8.57.0",
|
||||||
"@vitest/browser": "4.1.0",
|
"@vitest/browser": "4.0.18",
|
||||||
"@vitest/coverage-istanbul": "4.1.0",
|
"@vitest/coverage-istanbul": "4.0.18",
|
||||||
"ckeditor5": "47.4.0",
|
"ckeditor5": "47.4.0",
|
||||||
"eslint": "10.0.3",
|
"eslint": "10.0.3",
|
||||||
"eslint-config-ckeditor5": ">=9.1.0",
|
"eslint-config-ckeditor5": ">=9.1.0",
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
"ts-node": "10.9.2",
|
"ts-node": "10.9.2",
|
||||||
"typescript": "5.9.3",
|
"typescript": "5.9.3",
|
||||||
"vite-plugin-svgo": "2.0.0",
|
"vite-plugin-svgo": "2.0.0",
|
||||||
"vitest": "4.1.0",
|
"vitest": "4.0.18",
|
||||||
"webdriverio": "9.25.0"
|
"webdriverio": "9.25.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
"test": "vitest"
|
"test": "vitest"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"dayjs": "1.11.20",
|
"dayjs": "1.11.19",
|
||||||
"dayjs-plugin-utc": "0.1.2"
|
"dayjs-plugin-utc": "0.1.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
964
pnpm-lock.yaml
generated
964
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user