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
If I repeatedly right-click (as in #104) on a text element, the logged message remains the same; window.getSelection() is not updated. This is despite having reposition: false.
I tested this with the browser's native context menu:
This is the workaround I have been using, but the ideal would really be to re-fire the right-click event as if it was the first time:
//if a contextmenu event is triggered by a library, the clientX values may be missing//https://gist.github.com/branneman/fc66785c082099298955varclientX=e.clientX||(e.pageX-document.body.scrollLeft-document.documentElement.scrollLeft);varclientY=e.clientY||(e.pageY-document.body.scrollTop-document.documentElement.scrollTop);varpointRange=document.caretRangeFromPoint(clientX,clientY);varselectionRange=window.getSelection().getRangeAt(0);//refocus select if right-click outside of selection range if(pointRange.startOffset<selectionRange.startOffset||pointRange.endOffset>selectionRange.endOffset){selectionRange=pointRange.cloneRange();window.getSelection().removeAllRanges();window.getSelection().addRange(selectionRange);}
Using a registered event similar to this:
If I repeatedly right-click (as in #104) on a text element, the logged message remains the same;
window.getSelection()
is not updated. This is despite havingreposition: false
.I tested this with the browser's native context menu:
and that does refresh.
using jQuery.contextMenu v2.7.0, Chrome 67
The text was updated successfully, but these errors were encountered: