mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 15:19:01 +02:00
feat(views/table): integrate reference-like for relations
This commit is contained in:
parent
45ac70b78f
commit
ac70908c5a
@ -384,7 +384,7 @@ function linkContextMenu(e: PointerEvent) {
|
||||
linkContextMenuService.openContextMenu(notePath, e, viewScope, null);
|
||||
}
|
||||
|
||||
async function loadReferenceLinkTitle($el: JQuery<HTMLElement>, href: string | null | undefined = null) {
|
||||
export async function loadReferenceLinkTitle($el: JQuery<HTMLElement>, href: string | null | undefined = null) {
|
||||
const $link = $el[0].tagName === "A" ? $el : $el.find("a");
|
||||
|
||||
href = href || $link.attr("href");
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { CellComponent } from "tabulator-tables";
|
||||
import note_autocomplete from "../../../services/note_autocomplete";
|
||||
import { loadReferenceLinkTitle } from "../../../services/link";
|
||||
|
||||
export function RelationEditor(cell: CellComponent, onRendered, success, cancel, editorParams){
|
||||
//cell - the cell component for the editable cell
|
||||
@ -45,5 +46,12 @@ export function RelationFormatter(cell: CellComponent, formatterParams, onRender
|
||||
return "";
|
||||
}
|
||||
|
||||
return `<a href="#root/${noteId}">Title goes here</a>`;
|
||||
onRendered(async () => {
|
||||
const $link = $("<a>");
|
||||
$link.addClass("reference-link");
|
||||
$link.attr("href", `#root/${noteId}`);
|
||||
await loadReferenceLinkTitle($link);
|
||||
cell.getElement().appendChild($link[0]);
|
||||
});
|
||||
return "";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user