forked from mirrors/catstodon
Revert "[Glitch] Fix nodes order being sometimes mangled when rewriting emoji"
This reverts commit 06faf2f977
.
This commit is contained in:
parent
06faf2f977
commit
14ef153c69
2 changed files with 5 additions and 12 deletions
|
@ -19,13 +19,10 @@ const emojiFilename = (filename) => {
|
|||
return borderedEmoji.includes(filename) ? (filename + '_border') : filename;
|
||||
};
|
||||
|
||||
const domParser = new DOMParser();
|
||||
|
||||
const emojifyTextNode = (node, customEmojis) => {
|
||||
const parentElement = node.parentElement;
|
||||
let str = node.textContent;
|
||||
|
||||
const fragment = new DocumentFragment();
|
||||
|
||||
for (;;) {
|
||||
let match, i = 0;
|
||||
|
||||
|
@ -67,16 +64,12 @@ const emojifyTextNode = (node, customEmojis) => {
|
|||
}
|
||||
}
|
||||
|
||||
fragment.append(document.createTextNode(str.slice(0, i)));
|
||||
if (replacement) {
|
||||
fragment.append(domParser.parseFromString(replacement, 'text/html').documentElement.getElementsByTagName('img')[0]);
|
||||
}
|
||||
node.textContent = str.slice(0, i);
|
||||
parentElement.insertAdjacentHTML('beforeend', replacement);
|
||||
str = str.slice(rend);
|
||||
node = document.createTextNode(str);
|
||||
parentElement.append(node);
|
||||
}
|
||||
|
||||
fragment.append(document.createTextNode(str));
|
||||
node.parentElement.replaceChild(fragment, node);
|
||||
};
|
||||
|
||||
const emojifyNode = (node, customEmojis) => {
|
||||
|
|
|
@ -25,7 +25,7 @@ module Mastodon
|
|||
end
|
||||
|
||||
def suffix_version
|
||||
'+1.0.1'
|
||||
'+1.0.0'
|
||||
end
|
||||
|
||||
def to_a
|
||||
|
|
Loading…
Reference in a new issue