mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 23:29:02 +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);
|
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");
|
const $link = $el[0].tagName === "A" ? $el : $el.find("a");
|
||||||
|
|
||||||
href = href || $link.attr("href");
|
href = href || $link.attr("href");
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { CellComponent } from "tabulator-tables";
|
import { CellComponent } from "tabulator-tables";
|
||||||
import note_autocomplete from "../../../services/note_autocomplete";
|
import note_autocomplete from "../../../services/note_autocomplete";
|
||||||
|
import { loadReferenceLinkTitle } from "../../../services/link";
|
||||||
|
|
||||||
export function RelationEditor(cell: CellComponent, onRendered, success, cancel, editorParams){
|
export function RelationEditor(cell: CellComponent, onRendered, success, cancel, editorParams){
|
||||||
//cell - the cell component for the editable cell
|
//cell - the cell component for the editable cell
|
||||||
@ -45,5 +46,12 @@ export function RelationFormatter(cell: CellComponent, formatterParams, onRender
|
|||||||
return "";
|
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