Fix for clicking on notes.
This fixes an issue where when clicking on names or note links within notes it only taking you to the thread view. It also allows you to perform text selection too.
This commit is contained in:
parent
a8b3d5986b
commit
36149d9db0
3 changed files with 9 additions and 3 deletions
|
@ -81,8 +81,8 @@ function fmt_mentions(model, str, tags) {
|
||||||
data-thread-id="${ref}">note:${fmt_pubkey(ref)}</span>`;
|
data-thread-id="${ref}">note:${fmt_pubkey(ref)}</span>`;
|
||||||
} else if (tag[0] == 'p') {
|
} else if (tag[0] == 'p') {
|
||||||
let profile = model_get_profile(model, ref);
|
let profile = model_get_profile(model, ref);
|
||||||
buf += `<span class="username clickable" data-pubkey="${ref}">
|
buf += `<span class="username clickable" action="open-profile"
|
||||||
${fmt_name(profile)}</span>`;
|
data-pubkey="${ref}">${fmt_name(profile)}</span>`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return buf;
|
return buf;
|
||||||
|
|
|
@ -251,7 +251,7 @@ function render_mentioned_name(pk, profile) {
|
||||||
function render_name(pk, profile, prefix="") {
|
function render_name(pk, profile, prefix="") {
|
||||||
// Beware of whitespace.
|
// Beware of whitespace.
|
||||||
return html`<span>${prefix}<span class="username clickable"
|
return html`<span>${prefix}<span class="username clickable"
|
||||||
role="open-profile" data-pubkey="${pk}">
|
action="open-profile" data-pubkey="${pk}">
|
||||||
${fmt_profile_name(profile, fmt_pubkey(pk))}</span></span>`
|
${fmt_profile_name(profile, fmt_pubkey(pk))}</span></span>`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -683,6 +683,12 @@ function onclick_toggle_cw(ev) {
|
||||||
|
|
||||||
function onclick_any(ev) {
|
function onclick_any(ev) {
|
||||||
let el = ev.target;
|
let el = ev.target;
|
||||||
|
// Check if we have a selection and don't bother with anything
|
||||||
|
let selection = document.getSelection();
|
||||||
|
if (selection && selection.isCollapsed == false &&
|
||||||
|
view_get_timeline_el().contains(selection.anchorNode)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let action = el.getAttribute("action");
|
let action = el.getAttribute("action");
|
||||||
if (action == null && el.tagName != "A") {
|
if (action == null && el.tagName != "A") {
|
||||||
const parent = find_parent(el, "[action]");
|
const parent = find_parent(el, "[action]");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue