From adb3920233e5c6958a62c92301cb20f35dd3e604 Mon Sep 17 00:00:00 2001 From: PP Date: Thu, 5 Jul 2018 21:22:47 +0800 Subject: [PATCH] fix editbox 'this' missing (#2944) --- cocos2d/core/components/editbox/CCEditBoxImpl.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cocos2d/core/components/editbox/CCEditBoxImpl.js b/cocos2d/core/components/editbox/CCEditBoxImpl.js index 10654b7149..0b7a624f6a 100644 --- a/cocos2d/core/components/editbox/CCEditBoxImpl.js +++ b/cocos2d/core/components/editbox/CCEditBoxImpl.js @@ -267,7 +267,7 @@ let EditBoxImpl = cc.Class({ _endEditing () { let self = this; let hideDomInputAndShowLabel = function () { - if (!self._alwaysOnTop) { + if (!self._alwaysOnTop && self._edTxt) { self._edTxt.style.display = 'none'; } if (self._delegate && self._delegate.editBoxEditingDidEnded) { @@ -397,8 +397,9 @@ _p.createInput = function() { // Called before editbox focus to register cc.view status _p._beginEditingOnMobile = function () { + let self = this; this.__orientationChanged = function () { - this._adjustEditBoxPosition(); + self._adjustEditBoxPosition(); }; window.addEventListener('orientationchange', this.__orientationChanged);