mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 07:13:08 -05:00
Fix issue with focusing image within editor
This commit is contained in:
parent
a69c81fbd7
commit
aa41badbe0
3 changed files with 26 additions and 6 deletions
|
@ -2934,8 +2934,18 @@ proto.getSelection = function () {
|
|||
return selection;
|
||||
};
|
||||
|
||||
function enableRestoreSelection () {
|
||||
this._restoreSelection = true;
|
||||
function enableRestoreSelection (ev) {
|
||||
// Blur can be called when you are focusing on other elements within the
|
||||
// editor. We should only want to restore the selection if we are coming
|
||||
// from outside of the editor. We need to do this on a timeout because we
|
||||
// cannot determine what the new focused element is until after the blur.
|
||||
var self = this;
|
||||
setTimeout(function() {
|
||||
var target = document.activeElement;
|
||||
if( !isOrContains( self._root, document.activeElement ) ) {
|
||||
this._restoreSelection = true;
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
function disableRestoreSelection () {
|
||||
this._restoreSelection = false;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -488,8 +488,18 @@ proto.getSelection = function () {
|
|||
return selection;
|
||||
};
|
||||
|
||||
function enableRestoreSelection () {
|
||||
this._restoreSelection = true;
|
||||
function enableRestoreSelection (ev) {
|
||||
// Blur can be called when you are focusing on other elements within the
|
||||
// editor. We should only want to restore the selection if we are coming
|
||||
// from outside of the editor. We need to do this on a timeout because we
|
||||
// cannot determine what the new focused element is until after the blur.
|
||||
var self = this;
|
||||
setTimeout(function() {
|
||||
var target = document.activeElement;
|
||||
if( !isOrContains( self._root, document.activeElement ) ) {
|
||||
this._restoreSelection = true;
|
||||
}
|
||||
}, 1);
|
||||
}
|
||||
function disableRestoreSelection () {
|
||||
this._restoreSelection = false;
|
||||
|
|
Loading…
Reference in a new issue