add renderer.setMouseCursor
This commit is contained in:
parent
2cef7f4747
commit
a44cbdc5c2
2 changed files with 15 additions and 9 deletions
|
|
@ -887,24 +887,25 @@ function MultiSelect(editor) {
|
|||
function addAltCursorListeners(editor){
|
||||
var el = editor.textInput.getElement();
|
||||
var altCursor = false;
|
||||
var contentEl = editor.renderer.content;
|
||||
event.addListener(el, "keydown", function(e) {
|
||||
if (e.keyCode == 18 && !(e.ctrlKey || e.shiftKey || e.metaKey)) {
|
||||
if (!altCursor) {
|
||||
contentEl.style.cursor = "crosshair";
|
||||
editor.renderer.setMouseCursor("crosshair");
|
||||
altCursor = true;
|
||||
}
|
||||
} else if (altCursor) {
|
||||
contentEl.style.cursor = "";
|
||||
reset();
|
||||
}
|
||||
});
|
||||
|
||||
event.addListener(el, "keyup", reset);
|
||||
event.addListener(el, "blur", reset);
|
||||
function reset() {
|
||||
function reset(e) {
|
||||
if (altCursor) {
|
||||
contentEl.style.cursor = "";
|
||||
editor.renderer.setMouseCursor("");
|
||||
altCursor = false;
|
||||
// TODO disable menu poping up
|
||||
// e && e.preventDefault()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1504,9 +1504,8 @@ var VirtualRenderer = function(container, theme) {
|
|||
* [Adds a new class, `style`, to the editor.]{: #VirtualRenderer.setStyle}
|
||||
* @param {String} style A class name
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.setStyle = function setStyle(style, include) {
|
||||
this.setStyle = function(style, include) {
|
||||
dom.setCssClass(this.container, style, include != false);
|
||||
};
|
||||
|
||||
|
|
@ -1514,14 +1513,20 @@ var VirtualRenderer = function(container, theme) {
|
|||
* [Removes the class `style` from the editor.]{: #VirtualRenderer.unsetStyle}
|
||||
* @param {String} style A class name
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.unsetStyle = function unsetStyle(style) {
|
||||
this.unsetStyle = function(style) {
|
||||
dom.removeCssClass(this.container, style);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {String} cursorStyle A css cursor style
|
||||
*
|
||||
**/
|
||||
this.setMouseCursor = function(cursorStyle) {
|
||||
this.content.style.cursor = cursorStyle;
|
||||
};
|
||||
|
||||
/**
|
||||
* Destroys the text and cursor layers for this renderer.
|
||||
**/
|
||||
this.destroy = function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue