show crosshair cursor when alt is pressed
This commit is contained in:
parent
544cb09499
commit
6a781ad9d3
1 changed files with 27 additions and 0 deletions
|
|
@ -623,6 +623,33 @@ function MultiSelect(editor) {
|
||||||
|
|
||||||
editor.on("mousedown", onMouseDown);
|
editor.on("mousedown", onMouseDown);
|
||||||
editor.commands.addCommands(exports.commands.defaultCommands);
|
editor.commands.addCommands(exports.commands.defaultCommands);
|
||||||
|
|
||||||
|
addAltCursorListeners(editor);
|
||||||
|
}
|
||||||
|
|
||||||
|
function addAltCursorListeners(editor){
|
||||||
|
var el = editor.textInput.getElement();
|
||||||
|
var altCursor = false;
|
||||||
|
var contentEl = editor.renderer.content;
|
||||||
|
el.addEventListener("keydown", function(e) {
|
||||||
|
if (e.keyCode == 18 && !(e.ctrlKey || e.shiftKey || e.metaKey)) {
|
||||||
|
if (!altCursor) {
|
||||||
|
contentEl.style.cursor = "crosshair";
|
||||||
|
altCursor = true;
|
||||||
|
}
|
||||||
|
} else if (altCursor) {
|
||||||
|
contentEl.style.cursor = "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
el.addEventListener("keyup", reset);
|
||||||
|
el.addEventListener("blur", reset);
|
||||||
|
function reset() {
|
||||||
|
if (altCursor) {
|
||||||
|
contentEl.style.cursor = "";
|
||||||
|
altCursor = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.MultiSelect = MultiSelect;
|
exports.MultiSelect = MultiSelect;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue