Add event.stopPropagation() to extraNetworksShowMetadata()

Prevent bubbling the same way "replace preview" does
This commit is contained in:
missionfloyd 2023-03-20 18:04:22 -06:00
parent 64fc936738
commit 8e3ced73a8
2 changed files with 4 additions and 2 deletions

View File

@ -132,10 +132,12 @@ function popup(contents){
globalPopup.style.display = "flex";
}
function extraNetworksShowMetadata(text){
function extraNetworksShowMetadata(event, text){
elem = document.createElement('pre')
elem.classList.add('popup-metadata');
elem.textContent = text;
popup(elem);
event.stopPropagation()
}

View File

@ -127,7 +127,7 @@ class ExtraNetworksPage:
metadata_button = ""
metadata = item.get("metadata")
if metadata:
metadata_onclick = '"' + html.escape(f"""extraNetworksShowMetadata({json.dumps(metadata)}); event.stopPropagation(); return false;""") + '"'
metadata_onclick = '"' + html.escape(f"""return extraNetworksShowMetadata(event, {json.dumps(metadata)})""") + '"'
metadata_button = f"<div class='metadata-button' title='Show metadata' onclick={metadata_onclick}></div>"
args = {