loleaflet: encapsulate activeElement

Change-Id: I21326c075c7a40b96ac946daaf70d488e0d633f9
This commit is contained in:
Henry Castro 2018-08-22 15:53:05 -04:00
parent 66f2be060a
commit a6d505ad45
3 changed files with 6 additions and 2 deletions

View file

@ -91,6 +91,10 @@ L.ClipboardContainer = L.Layer.extend({
this._textArea.setAttribute('spellcheck', 'false');
},
activeElement: function () {
return this._textArea;
},
_setPos: function (pos) {
L.DomUtil.setPosition(this._container, pos);
}

View file

@ -1586,7 +1586,7 @@ L.TileLayer = L.GridLayer.extend({
// the state of the document (if the falgs are set)
_updateCursorAndOverlay: function (/*update*/) {
if (this._map._permission === 'edit'
&& this._map._clipboardContainer._textArea === document.activeElement
&& this._map._clipboardContainer.activeElement() === document.activeElement
&& this._isCursorVisible
&& this._isCursorOverlayVisible
&& !this._isEmptyRectangle(this._visibleCursor)) {

View file

@ -252,7 +252,7 @@ L.Map.Keyboard = L.Handler.extend({
compEventFn = L.bind(docLayer._postCompositionEvent, docLayer, 0 /* winid */);
}
if (!inputEle) {
inputEle = this._map._clipboardContainer._textArea;
inputEle = this._map._clipboardContainer.activeElement();
}
this.modifier = 0;
var shift = e.originalEvent.shiftKey ? this.keyModifier.shift : 0;