parent
841f39c57b
commit
4dfe33655e
3 changed files with 17 additions and 1 deletions
|
|
@ -272,6 +272,10 @@ var Editor =function(renderer, session) {
|
||||||
this.textInput.focus();
|
this.textInput.focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.isFocused = function() {
|
||||||
|
return this.textInput.isFocused();
|
||||||
|
};
|
||||||
|
|
||||||
this.blur = function() {
|
this.blur = function() {
|
||||||
this.textInput.blur();
|
this.textInput.blur();
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ define(function(require, exports, module) {
|
||||||
|
|
||||||
var event = require("pilot/event");
|
var event = require("pilot/event");
|
||||||
var dom = require("pilot/dom");
|
var dom = require("pilot/dom");
|
||||||
|
var BrowserFocus = require("pilot/browser_focus").BrowserFocus;
|
||||||
|
|
||||||
var STATE_UNKNOWN = 0;
|
var STATE_UNKNOWN = 0;
|
||||||
var STATE_SELECT = 1;
|
var STATE_SELECT = 1;
|
||||||
|
|
@ -51,6 +52,8 @@ var DRAG_OFFSET = 5; // pixels
|
||||||
|
|
||||||
var MouseHandler = function(editor) {
|
var MouseHandler = function(editor) {
|
||||||
this.editor = editor;
|
this.editor = editor;
|
||||||
|
|
||||||
|
this.browserFocus = new BrowserFocus();
|
||||||
event.addListener(editor.container, "mousedown", function(e) {
|
event.addListener(editor.container, "mousedown", function(e) {
|
||||||
editor.focus();
|
editor.focus();
|
||||||
return event.preventDefault(e);
|
return event.preventDefault(e);
|
||||||
|
|
@ -91,6 +94,15 @@ var MouseHandler = function(editor) {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.onMouseDown = function(e) {
|
this.onMouseDown = function(e) {
|
||||||
|
// if this click caused the editor to be focused ignore the click
|
||||||
|
// for selection and cursor placement
|
||||||
|
if (
|
||||||
|
!this.browserFocus.isFocused()
|
||||||
|
|| new Date().getTime() - this.browserFocus.lastFocus < 20
|
||||||
|
|| !this.editor.isFocused()
|
||||||
|
)
|
||||||
|
return;
|
||||||
|
|
||||||
var pageX = event.getDocumentX(e);
|
var pageX = event.getDocumentX(e);
|
||||||
var pageY = event.getDocumentY(e);
|
var pageY = event.getDocumentY(e);
|
||||||
var pos = this.$getEventPosition(e);
|
var pos = this.$getEventPosition(e);
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
Subproject commit e89a461ee76ae49e9fc1653dd28ad2064e18f51f
|
Subproject commit fb3c117f12a55432a5f5e3d056b877217ec32202
|
||||||
Loading…
Add table
Add a link
Reference in a new issue