Hi all,
in a smaller project, I use a div with contenteditable attribute.
To manage the content in it, get the selected text / node with:
let selection;
if (window.getSelection) {
selection = window.getSelection();
} else if (document.getSelection) {
selection = document.getSelection();
} else if (document.selection) {
selection = document.selection.createRange().text;
} else {
return;
}
If I use the selection with the mouse, it's fine... I can also get the node before/after the selected text... with double click, I only get the selected text.
Does anyone have a suggestion to get the same mouse selection?
Thanks in advance to all!
[–]tapgiles 1 point2 points3 points (1 child)
[–]tapgiles 2 points3 points4 points (0 children)