fix ie focus issues

This commit is contained in:
nightwing 2014-04-10 15:11:11 +04:00
commit 5aba18ea06
2 changed files with 13 additions and 5 deletions

View file

@ -63,6 +63,7 @@ var Autocomplete = function() {
this.insertMatch();
e.stop();
}.bind(this));
this.popup.focus = this.editor.focus.bind(this.editor);
};
this.openPopup = function(editor, prefix, keepPopupPosition) {
@ -122,7 +123,10 @@ var Autocomplete = function() {
};
this.blurListener = function() {
if (document.activeElement != this.editor.textInput.getElement())
// we have to check if activeElement is a child of popup because
// on IE preventDefault doesn't stop scrollbar from being focussed
var el = document.activeElement;
if (el != this.editor.textInput.getElement() && el.parentNode != this.popup.container)
this.detach();
};

View file

@ -45,7 +45,9 @@ var MouseHandler = function(editor) {
new DefaultHandlers(this);
new DefaultGutterHandler(this);
new DragdropHandler(this);
var focusEditor = function(e) { editor.focus() };
var mouseTarget = editor.renderer.getMouseEventTarget();
event.addListener(mouseTarget, "click", this.onMouseEvent.bind(this, "click"));
event.addListener(mouseTarget, "mousemove", this.onMouseMove.bind(this, "mousemove"));
@ -53,6 +55,10 @@ var MouseHandler = function(editor) {
if (editor.renderer.scrollBarV) {
event.addMultiMouseDownListener(editor.renderer.scrollBarV.inner, [400, 300, 250], this, "onMouseEvent");
event.addMultiMouseDownListener(editor.renderer.scrollBarH.inner, [400, 300, 250], this, "onMouseEvent");
if (useragent.isIE) {
event.addListener(editor.renderer.scrollBarV.element, "mousedown", focusEditor);
event.addListener(editor.renderer.scrollBarH.element, "mousemove", focusEditor);
}
}
event.addMouseWheelListener(editor.container, this.onMouseWheel.bind(this, "mousewheel"));
@ -62,9 +68,7 @@ var MouseHandler = function(editor) {
event.addListener(gutterEl, "dblclick", this.onMouseEvent.bind(this, "gutterdblclick"));
event.addListener(gutterEl, "mousemove", this.onMouseEvent.bind(this, "guttermousemove"));
event.addListener(mouseTarget, "mousedown", function(e) {
editor.focus();
});
event.addListener(mouseTarget, "mousedown", focusEditor);
event.addListener(gutterEl, "mousedown", function(e) {
editor.focus();