Ace Editor, How To Turn On Block Selection Without Having To Press Alt
Normally in ace-editor, to if you hold down the alt key, while making a selection, it will select it in block form which i think is called block selection. How do i make it so that
Solution 1:
It looks as simple as changing this line...
var alt = ev.altKey;
to this...
var alt = !ev.altKey;
Solution 2:
This can be done without altering ace.js by replacing the onMouseDown function stored in the editor's _eventRegistry.mousedown[1] with a wrapper that calls the same function with an inverted value for ev.altKey as follows.
editor._eventRegistry.mousedown[1] = (func => e => func({ ...e, ...e.__proto__, getButton: () => e.getButton(), domEvent: { ...e.domEvent, altKey: !e.domEvent.altKey, shiftKey: e.domEvent.shiftKey, ctrlKey: e.domEvent.ctrlKey, }, }))(editor._eventRegistry.mousedown[1])
Post a Comment for "Ace Editor, How To Turn On Block Selection Without Having To Press Alt"