mirror of
https://github.com/vale981/riot-katex
synced 2025-03-05 09:01:40 -05:00
rerender after edit
This commit is contained in:
parent
56fe2f4717
commit
aab8fbc5d3
1 changed files with 8 additions and 1 deletions
|
@ -20,10 +20,17 @@
|
||||||
|
|
||||||
function renderMath(node) {
|
function renderMath(node) {
|
||||||
let li = node.closest('li');
|
let li = node.closest('li');
|
||||||
|
|
||||||
|
// we have already rendered this element
|
||||||
|
if (li.getAttribute('originalContent')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let og_content = (' ' + node.textContent).slice(1);
|
let og_content = (' ' + node.textContent).slice(1);
|
||||||
li.setAttribute('originalContent', og_content);
|
li.setAttribute('originalContent', og_content);
|
||||||
li.querySelector('.mx_MessageActionBar_maskButton[title="Edit"]')
|
li.querySelector('.mx_MessageActionBar_maskButton[title="Edit"]')
|
||||||
.addEventListener("click", () => {
|
.addEventListener("click", event => {
|
||||||
|
event.target.closest('li').setAttribute('originalContent', '');
|
||||||
node.textContent = og_content;
|
node.textContent = og_content;
|
||||||
});
|
});
|
||||||
renderMathInElement(node);
|
renderMathInElement(node);
|
||||||
|
|
Loading…
Add table
Reference in a new issue