Skip to content

Commit

Permalink
ShadowDOM support
Browse files Browse the repository at this point in the history
  • Loading branch information
marker dao ® committed Apr 26, 2024
1 parent 20c787f commit 0249d56
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion core/emitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ const EVENTS = ['selectionchange', 'mousedown', 'mouseup', 'click'];
if (hasWindow()) {
EVENTS.forEach((eventName) => {
document.addEventListener(eventName, (...args) => {
Array.from(document.querySelectorAll('.ql-container')).forEach((node) => {
const event = args[0];

const target = event?.target;
const shadowRoot = target?.shadowRoot;

const root = shadowRoot ?? document;

Array.from(root.querySelectorAll('.ql-container')).forEach((node) => {
const quill = instances.get(node);
if (quill && quill.emitter) {
quill.emitter.handleDOM(...args);
Expand Down

0 comments on commit 0249d56

Please sign in to comment.