feat(views/table): integrate reference-like for relations

This commit is contained in:
Elian Doran 2025-07-04 16:14:14 +03:00
parent 45ac70b78f
commit ac70908c5a
No known key found for this signature in database
2 changed files with 10 additions and 2 deletions

View File

@ -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");

View File

@ -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 "";
} }