Monaco-editor: Mouse click on selection

Created on 6 Jul 2017  路  2Comments  路  Source: microsoft/monaco-editor


monaco-editor version: 0.9.0
Browser: Chrome
OS: Windows 10
Steps or JS usage snippet reproducing the issue:

  1. Select text (from bottom to top)
  2. Verify selected text highlighted in blue color.
  3. Click outside the selection

Expected behavior:

  1. The cursor's position should be at the end of the text.
  2. Highlight color should be gone.

Actual behavior:

  1. Selected text is still highlighted in blue
  2. Cursor's position is still at the beginning of the selected text.

This is happening also in the playground in Chrome.
It is working properly on Edge.

  • I debugged this issue and found out the event :
    editor.onDidChangeCursorSelection(function(e) {
    console.log(e.selection);
    })

    won't fire in Chrome, when the text is selected and I click inside\outside the text.

Most helpful comment

@galyech we added a new feature called Drag and Drop on selections, which blocks you on seleletion change event in this case

image

You can disable it by setting editor.dragAndDrop to false to have it turned off.

All 2 comments

@galyech we added a new feature called Drag and Drop on selections, which blocks you on seleletion change event in this case

image

You can disable it by setting editor.dragAndDrop to false to have it turned off.

shouldn't the D&D behavior be compatible with clicking outside the selection? Many editors know the difference between dragging text selection and clicking outside a selection (and removing the highlight), It seems you can only get one of the 2 behaviors.

Was this page helpful?
0 / 5 - 0 ratings