From 96b03d4aaf0a8d9f0ca3f7b7edb30a21cb080063 Mon Sep 17 00:00:00 2001 From: Sungho Kim Date: Wed, 27 Jul 2016 16:15:42 +0900 Subject: [PATCH 1/2] Fire focus or blur event manually in focus/blur method for MSIE because MSIE invoke focus/blur event listener asynchronously --- source/Constants.js | 1 + source/Editor.js | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/source/Constants.js b/source/Constants.js index fe5f4e7..b04172a 100644 --- a/source/Constants.js +++ b/source/Constants.js @@ -34,6 +34,7 @@ var isIElt11 = /Trident\/[456]\./.test( ua ); var isPresto = !!win.opera; var isEdge = /Edge\//.test( ua ); var isWebKit = !isEdge && /WebKit\//.test( ua ); +var isIE = /MSIE/.test( ua ); var ctrlKey = isMac ? 'meta-' : 'ctrl-'; diff --git a/source/Editor.js b/source/Editor.js index 66a2229..c773dcd 100644 --- a/source/Editor.js +++ b/source/Editor.js @@ -619,11 +619,21 @@ proto._updatePathOnEvent = function () { proto.focus = function () { this._root.focus(); + + if ( isIE ) { + this.fireEvent( 'focus' ); + } + return this; }; proto.blur = function () { this._root.blur(); + + if ( isIE ) { + this.fireEvent( 'blur' ); + } + return this; }; From c3d4d551ed62c45b249f91f58c996a45fbb92760 Mon Sep 17 00:00:00 2001 From: Sungho Kim Date: Wed, 27 Jul 2016 16:33:06 +0900 Subject: [PATCH 2/2] Fix MSIE detection regex --- source/Constants.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Constants.js b/source/Constants.js index b04172a..aeec0e2 100644 --- a/source/Constants.js +++ b/source/Constants.js @@ -34,7 +34,7 @@ var isIElt11 = /Trident\/[456]\./.test( ua ); var isPresto = !!win.opera; var isEdge = /Edge\//.test( ua ); var isWebKit = !isEdge && /WebKit\//.test( ua ); -var isIE = /MSIE/.test( ua ); +var isIE = /Trident\/[4567]\./.test( ua ); var ctrlKey = isMac ? 'meta-' : 'ctrl-';