Merge pull request #371 from d-r-w/main

Makes entire note clickable
This commit is contained in:
2023-03-07 15:29:38 +00:00
committed by GitHub
2 changed files with 12 additions and 4 deletions

View File

@ -173,7 +173,11 @@ export default function Note(props: NoteProps) {
}
}, [inView, entry, extendable]);
function goToEvent(e: React.MouseEvent, id: u256) {
function goToEvent(e: React.MouseEvent, id: u256, isTargetAllowed: boolean = e.target === e.currentTarget) {
if (!isTargetAllowed) {
return;
}
e.stopPropagation();
// detect cmd key and open in new tab
if (e.metaKey) {
@ -282,7 +286,7 @@ export default function Note(props: NoteProps) {
)}
</div>
)}
<div className="body" onClick={e => goToEvent(e, ev.Id)}>
<div className="body" onClick={e => goToEvent(e, ev.Id, true)}>
{transformBody()}
{translation()}
{options.showReactionsLink && (
@ -315,6 +319,7 @@ export default function Note(props: NoteProps) {
const note = (
<div
className={`${baseClassName}${highlight ? " active " : " "}${extendable && !showMore ? " note-expand" : ""}`}
onClick={e => goToEvent(e, ev.Id)}
ref={ref}>
{content()}
</div>