Fix module-scope DOM access for Node.js/SSR compatibility#4787
Open
brrichards wants to merge 3 commits intoslab:mainfrom
Open
Fix module-scope DOM access for Node.js/SSR compatibility#4787brrichards wants to merge 3 commits intoslab:mainfrom
brrichards wants to merge 3 commits intoslab:mainfrom
Conversation
Co-authored-by: Craig Macomber (Microsoft) <42876482+CraigMacomber@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #4594
Quill crashes with
ReferenceErrorwhen imported in Node.js/SSR environments because several modules access browser globals at module scope (import time).emitter.tsdocument.addEventListenerto lazyensureDocumentListeners(), called from Quill constructorquill.tsensureDocumentListeners()after instance registrationclipboard.tsNode.TEXT_NODE/Node.ELEMENT_NODEwith numeric constants per DOM speckeyboard.tsnavigator.platformwithtypeofcheckuiNode.tsnavigator.platformwithtypeofchecksyntax.tswindow.hljswithtypeofcheckValidated against FluidFramework, which currently requires a global-jsdom workaround to import Quill, no longer needed with these fixes.