mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +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 FNote from "../../../entities/fnote.js";
|
||||||
import type { LabelType } from "../../../services/promoted_attribute_definition_parser.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 type { ColumnDefinition } from "tabulator-tables";
|
||||||
|
import link from "../../../services/link.js";
|
||||||
|
|
||||||
export type TableData = {
|
export type TableData = {
|
||||||
noteId: string;
|
noteId: string;
|
||||||
@ -39,7 +38,6 @@ export function buildColumnDefinitions(info: PromotedAttributeInformation[]) {
|
|||||||
headerSort: false,
|
headerSort: false,
|
||||||
hozAlign: "center",
|
hozAlign: "center",
|
||||||
formatter(cell) {
|
formatter(cell) {
|
||||||
console.log(cell);
|
|
||||||
const iconClass = cell.getValue();
|
const iconClass = cell.getValue();
|
||||||
return `<span class="bx ${iconClass}"></span>`;
|
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;
|
return columnDefs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ export default class TableView extends ViewMode<StateInfo> {
|
|||||||
const viewStorage = await this.viewStorage.restore();
|
const viewStorage = await this.viewStorage.restore();
|
||||||
const initialState = viewStorage?.gridState;
|
const initialState = viewStorage?.gridState;
|
||||||
|
|
||||||
const modules = [SortModule, FormatModule];
|
const modules = [SortModule, FormatModule, InteractionModule];
|
||||||
for (const module of modules) {
|
for (const module of modules) {
|
||||||
Tabulator.registerModule(module);
|
Tabulator.registerModule(module);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user