You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
is there any possibility to create demo with .destroy() method?
I tried to initialize the plug in on click and I would like to have off button to switch it off,
so I tried destroy() method, but it did not stop highlighting. Once I switch it on,
I cannot switch it off. I would like to have it like "higlight pen" button on my page and when you select
this tool you can highlight text. If you switch it of, it should not highlight anymore until you selet the tool again.
Hi there,
we seem to have the same problem. We call destroy() but the events for highlighting are still triggered. Anyone have any clue about this problem (it seems that mir3z is not maintaining this project anymore...)?.
You can use a method (which I don't know if it's the most suitable), but I had the same problem and now I've managed to solve it.
The method is as follows:
"Your instance" .doHighlight = () => {};
If you prefer, before deleting, simply store the "doHighlight" function in a variable beforehand.
Thus, to restore, simply assign the content of the variable to "doHighlight".
Example:
Before: var MyFunction = "Your instance" .doHighlight;
"Your instance" .doHighlight = () => {};
After "Your instance" .doHighlight = MyFunction;
In Brazil, we call this "Gambiarra"
Hello,
is there any possibility to create demo with .destroy() method?
I tried to initialize the plug in on click and I would like to have off button to switch it off,
so I tried destroy() method, but it did not stop highlighting. Once I switch it on,
I cannot switch it off. I would like to have it like "higlight pen" button on my page and when you select
this tool you can highlight text. If you switch it of, it should not highlight anymore until you selet the tool again.
example:
jQuery('#textHighlightHandlerOn').click(function(e){ e.preventDefault(); hltr = new TextHighlighter(sandbox); }); jQuery('#textHighlightHandlerOff').click(function(e){ e.preventDefault(); hltr.destroy(); });
Thanks for the details!
The text was updated successfully, but these errors were encountered: