I am using rangy selection method for highlighted text. Get highlighted and remove highlighted functionality are working fine for me but the problem is that i am unable to copy the highlighted text.
Here are my code.
var highlighter;
var highlightTextToBeRemoved;
rangy.init();
highlighter = rangy.createHighlighter();
highlighter.addClassApplier(rangy.createClassApplier("highlight", {
ignoreWhiteSpace: true,
tagNames: ["span", "a"]
}));
document.onclick = function(event) {
event = event || window.event;
var target = event.target || event.srcElement;
highlightTextToBeRemoved = highlighter.getHighlightForElement(target);
};
$scope.highlightSelectedText = function () {
highlighter.highlightSelection("highlight");
};
$scope.removeHighlightFromSelectedText = function(event) {
if (highlightTextToBeRemoved) {
highlighter.removeHighlights( [highlightTextToBeRemoved] );
highlightTextToBeRemoved='';
}
};
So i want copy functionality on highlighted text.
Any Idea?