mirror of
https://github.com/vale981/riot-katex
synced 2025-03-04 16:51:37 -05:00
support replies
This commit is contained in:
parent
f4bd466812
commit
0dd7574ab6
2 changed files with 10 additions and 13 deletions
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "Riot KaTeX",
|
"name": "Riot KaTeX",
|
||||||
"version": "1.0.7",
|
"version": "1.0.8",
|
||||||
|
|
||||||
"description": "Renders formulas on riot chat instances chats using KaTeX.",
|
"description": "Renders formulas on riot chat instances chats using KaTeX.",
|
||||||
|
|
||||||
|
|
|
@ -31,22 +31,19 @@
|
||||||
|
|
||||||
let li = node.closest('li');
|
let li = node.closest('li');
|
||||||
|
|
||||||
// we have already rendered this element
|
let contentNodes = li.querySelectorAll('.mx_EventTile_body');
|
||||||
if (li.getAttribute('originalContent')) {
|
|
||||||
|
if (!content) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let og_content = (' ' + node.textContent).slice(1);
|
for (let content of contentNodes) {
|
||||||
li.setAttribute('originalContent', og_content);
|
if(content.getAttribute('originalContent') || content.getAttribute('editing')) // already rendered
|
||||||
renderMathInElement(node);
|
continue;
|
||||||
|
|
||||||
let edit_button = li.querySelector('.mx_MessageActionBar_maskButton[title="Edit"]');
|
let og_content = (' ' + content.textContent).slice(1);
|
||||||
if (edit_button) {
|
content.setAttribute('originalContent', og_content);
|
||||||
li.querySelector('.mx_MessageActionBar_maskButton[title="Edit"]')
|
renderMathInElement(content);
|
||||||
.addEventListener("click", event => {
|
|
||||||
event.target.closest('li').setAttribute('originalContent', '');
|
|
||||||
node.textContent = og_content;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue