fix right click selection bug
This commit is contained in:
parent
b51d0e763c
commit
8391b59feb
1 changed files with 13 additions and 12 deletions
|
|
@ -76,6 +76,19 @@ function DefaultHandlers(editor) {
|
|||
var selectionEmpty = selectionRange.isEmpty();
|
||||
var state = STATE_UNKNOWN;
|
||||
|
||||
var button = ev.getButton();
|
||||
if (button !== 0) {
|
||||
if (selectionEmpty) {
|
||||
editor.moveCursorToPosition(pos);
|
||||
editor.selection.clearSelection();
|
||||
}
|
||||
if (button == 2) {
|
||||
editor.textInput.onContextMenu({x: ev.clientX, y: ev.clientY}, selectionEmpty);
|
||||
event.capture(editor.container, function(){}, editor.textInput.onContextMenuClose);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// if this click caused the editor to be focused should not clear the
|
||||
// selection
|
||||
if (
|
||||
|
|
@ -89,18 +102,6 @@ function DefaultHandlers(editor) {
|
|||
return;
|
||||
}
|
||||
|
||||
var button = ev.getButton();
|
||||
if (button !== 0) {
|
||||
if (selectionEmpty) {
|
||||
editor.moveCursorToPosition(pos);
|
||||
}
|
||||
if (button == 2) {
|
||||
editor.textInput.onContextMenu({x: ev.clientX, y: ev.clientY}, selectionEmpty);
|
||||
event.capture(editor.container, function(){}, editor.textInput.onContextMenuClose);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!inSelection) {
|
||||
// Directly pick STATE_SELECT, since the user is not clicking inside
|
||||
// a selection.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue