diff --git a/cypress/integration/text.spec.js b/cypress/integration/text.spec.js index bb174c90..d12f9a92 100644 --- a/cypress/integration/text.spec.js +++ b/cypress/integration/text.spec.js @@ -447,6 +447,27 @@ describe('Text Layer', () => { expect(textarea.selectionEnd).to.eq(0); }); }); + + it('enable map dragging after blur', () => { + cy.window().then(({ map, L }) => { + const textLayer = L.marker(map.getCenter(), { + textMarker: true, + text: 'Text Layer', + }).addTo(map); + + expect(map.dragging.enabled()).to.eq(true); + + const textarea = textLayer.pm.getElement(); + textLayer.pm.enable(); + textarea.focus(); + + expect(map.dragging.enabled()).to.eq(false); + + textLayer.pm.disable(); + + expect(map.dragging.enabled()).to.eq(true); + }); + }); }); describe('Events', () => { it("fire event 'pm:textchange'", () => { diff --git a/src/js/Edit/L.PM.Edit.Text.js b/src/js/Edit/L.PM.Edit.Text.js index bfce1c6c..91a86d17 100644 --- a/src/js/Edit/L.PM.Edit.Text.js +++ b/src/js/Edit/L.PM.Edit.Text.js @@ -26,6 +26,8 @@ Edit.Text = Edit.extend({ } this.applyOptions(); + this._safeToCacheDragState = true; + this._focusChange(); this.textArea.readOnly = false; this.textArea.classList.remove('pm-disabled');