mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 07:08:55 +02:00
feat(views/table): add column to open note
This commit is contained in:
parent
4a26f30d65
commit
56d366a286
@ -1,8 +1,7 @@
|
||||
import FNote from "../../../entities/fnote.js";
|
||||
import type { LabelType } from "../../../services/promoted_attribute_definition_parser.js";
|
||||
import froca from "../../../services/froca.js";
|
||||
import { title } from "process";
|
||||
import type { ColumnDefinition } from "tabulator-tables";
|
||||
import link from "../../../services/link.js";
|
||||
|
||||
export type TableData = {
|
||||
noteId: string;
|
||||
@ -39,7 +38,6 @@ export function buildColumnDefinitions(info: PromotedAttributeInformation[]) {
|
||||
headerSort: false,
|
||||
hozAlign: "center",
|
||||
formatter(cell) {
|
||||
console.log(cell);
|
||||
const iconClass = cell.getValue();
|
||||
return `<span class="bx ${iconClass}"></span>`;
|
||||
},
|
||||
@ -66,6 +64,21 @@ export function buildColumnDefinitions(info: PromotedAttributeInformation[]) {
|
||||
});
|
||||
}
|
||||
|
||||
// End actions
|
||||
columnDefs.push({
|
||||
title: "Open note",
|
||||
width: 40,
|
||||
hozAlign: "center",
|
||||
formatter: () => `<span class="bx bx-window-open"></span>`,
|
||||
cellClick: (e, cell) => {
|
||||
const noteId = cell.getRow().getCell("noteId").getValue();
|
||||
console.log("Got note ID", noteId);
|
||||
if (noteId) {
|
||||
link.goToLinkExt(e as MouseEvent, `#root/${noteId}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return columnDefs;
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ export default class TableView extends ViewMode<StateInfo> {
|
||||
const viewStorage = await this.viewStorage.restore();
|
||||
const initialState = viewStorage?.gridState;
|
||||
|
||||
const modules = [SortModule, FormatModule];
|
||||
const modules = [SortModule, FormatModule, InteractionModule];
|
||||
for (const module of modules) {
|
||||
Tabulator.registerModule(module);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user