1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 14:05:56 +00:00

prevent filter selected text dialog from opening in wrong order

This commit is contained in:
Andrew Dolgov
2021-02-20 21:07:28 +03:00
parent 590b1fc39e
commit da97b29dbe
3 changed files with 313 additions and 324 deletions

View File

@@ -358,6 +358,27 @@ const App = {
return p;
}
},
// http://stackoverflow.com/questions/6251937/how-to-get-selecteduser-highlighted-text-in-contenteditable-element-and-replac
getSelectedText: function() {
let text = "";
if (typeof window.getSelection != "undefined") {
const sel = window.getSelection();
if (sel.rangeCount) {
const container = document.createElement("div");
for (let i = 0, len = sel.rangeCount; i < len; ++i) {
container.appendChild(sel.getRangeAt(i).cloneContents());
}
text = container.innerHTML;
}
} else if (typeof document.selection != "undefined") {
if (document.selection.type == "Text") {
text = document.selection.createRange().textText;
}
}
return text.stripTags();
},
displayIfChecked: function(checkbox, elemId) {
if (checkbox.checked) {
Element.show(elemId);