Browse Source

Fix #307 - edit elements inside [contenteditable]

pull/188/merge
Jānis Skarnelis 2 years ago
parent
commit
683f6dbd19
  1. 12
      src/Fancybox/Fancybox.js
  2. 5
      src/Panzoom/Panzoom.js

12
src/Fancybox/Fancybox.js

@ -559,8 +559,16 @@ class Fancybox extends Base {
return;
}
if (!eventTarget.matches(FOCUSABLE_ELEMENTS)) {
document.activeElement.blur();
const activeElement = document.activeElement;
if (activeElement) {
if (activeElement.closest("[contenteditable]")) {
return;
}
if (!eventTarget.matches(FOCUSABLE_ELEMENTS)) {
activeElement.blur();
}
}
// Skip if clicked inside content area

5
src/Panzoom/Panzoom.js

@ -229,6 +229,10 @@ export class Panzoom extends Base {
return;
}
if (document.activeElement && document.activeElement.closest("[contenteditable]")) {
return;
}
// Skip if text is selected
if (
this.option("textSelection") &&
@ -238,7 +242,6 @@ export class Panzoom extends Base {
event.stopPropagation();
return;
}
// console.log(`onClickonClickonClickonClick#2`);
const rect = this.$content.getClientRects()[0];

Loading…
Cancel
Save