Skip to content

Commit

Permalink
Fix map dragging after editing Text-Layer (#1302) (patch)
Browse files Browse the repository at this point in the history
  • Loading branch information
Falke-Design authored Feb 19, 2023
1 parent 68f6dd1 commit b6cb71e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
21 changes: 21 additions & 0 deletions cypress/integration/text.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'", () => {
Expand Down
2 changes: 2 additions & 0 deletions src/js/Edit/L.PM.Edit.Text.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit b6cb71e

Please sign in to comment.