Fix contextMenu when editor require scrolling
When editor is not at the top of the page (requires scrolling), textarea right-click context menu will fail to appear. Use clientX and clientY which returns the relative coordinates instead of pageX and pageY.
This commit is contained in:
parent
cd271f1a8b
commit
92d1b7559b
2 changed files with 5 additions and 2 deletions
|
|
@ -96,7 +96,7 @@ function DefaultHandlers(editor) {
|
||||||
editor.moveCursorToPosition(pos);
|
editor.moveCursorToPosition(pos);
|
||||||
}
|
}
|
||||||
if(button == 2) {
|
if(button == 2) {
|
||||||
editor.textInput.onContextMenu({x: pageX, y: pageY}, selectionEmpty);
|
editor.textInput.onContextMenu({x: ev.clientX, y: ev.clientY}, selectionEmpty);
|
||||||
event.capture(editor.container, function(){}, editor.textInput.onContextMenuClose);
|
event.capture(editor.container, function(){}, editor.textInput.onContextMenuClose);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,9 @@ var MouseEvent = exports.MouseEvent = function(domEvent, editor) {
|
||||||
this.pageX = event.getDocumentX(domEvent);
|
this.pageX = event.getDocumentX(domEvent);
|
||||||
this.pageY = event.getDocumentY(domEvent);
|
this.pageY = event.getDocumentY(domEvent);
|
||||||
|
|
||||||
|
this.clientX = domEvent.clientX;
|
||||||
|
this.clientY = domEvent.clientY;
|
||||||
|
|
||||||
this.$pos = null;
|
this.$pos = null;
|
||||||
this.$inSelection = null;
|
this.$inSelection = null;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue