I'm using mark.js to mark the user selection text on some html element (like an ordinary text editor). However, the mark js marker cancels the user selection and its disapear so i can't use it anymore.
I have tried to use rangy.saveSelection() and rangy.restoreSelection() but it didn't help.
My code is something like this:
$(document).ready(function() {
$("#p").on('mouseup', function() {
$("#p").unmark({
done: function() {
$("#p").mark(window.getSelection().toString(), {
seperateWordSearch: false
});
}
})
});
})