chore(type_widgets): start porting context menu

This commit is contained in:
Elian Doran
2025-09-29 20:33:15 +03:00
parent 3571023685
commit 0937ef72e2
3 changed files with 31 additions and 8 deletions

View File

@@ -14,9 +14,10 @@ interface NoteLinkOpts {
// Override the text of the link, otherwise the note title is used.
title?: string;
viewScope?: ViewScope;
noContextMenu?: boolean;
}
export default function NoteLink({ className, notePath, showNotePath, showNoteIcon, style, noPreview, noTnLink, highlightedTokens, title, viewScope }: NoteLinkOpts) {
export default function NoteLink({ className, notePath, showNotePath, showNoteIcon, style, noPreview, noTnLink, highlightedTokens, title, viewScope, noContextMenu }: NoteLinkOpts) {
const stringifiedNotePath = Array.isArray(notePath) ? notePath.join("/") : notePath;
const ref = useRef<HTMLSpanElement>(null);
const [ jqueryEl, setJqueryEl ] = useState<JQuery<HTMLElement>>();
@@ -50,6 +51,10 @@ export default function NoteLink({ className, notePath, showNotePath, showNoteIc
$linkEl?.addClass("tn-link");
}
if (noContextMenu) {
$linkEl?.attr("data-no-context-menu", "true");
}
if (className) {
$linkEl?.addClass(className);
}