Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
fix(chrome-ext): don't interfere with the Gutenberg rendering process (#1534)
Elijah Potter73cd8c383050
diff --git a/packages/chrome-plugin/src/Highlights.ts b/packages/chrome-plugin/src/Highlights.tsindex c89c4d740..f3a0ac13c 100644--- a/packages/chrome-plugin/src/Highlights.ts+++ b/packages/chrome-plugin/src/Highlights.ts@@ -4,6 +4,7 @@ import { type LintBox, isBoxInScreen } from './Box';import RenderBox from './RenderBox';import {getCMRoot,+ getGutenbergRoot,getLexicalRoot,getMediumRoot,getNotionRoot,@@ -138,6 +139,7 @@ export default class Highlights {getQuillJsRoot,getLexicalRoot,getP2Root,+ getGutenbergRoot,getTrixRoot,];diff --git a/packages/chrome-plugin/src/editorUtils.ts b/packages/chrome-plugin/src/editorUtils.tsindex a7fb63c1e..e249073b8 100644--- a/packages/chrome-plugin/src/editorUtils.ts+++ b/packages/chrome-plugin/src/editorUtils.ts@@ -21,6 +21,14 @@ export function getP2Root(el: HTMLElement): HTMLElement | null {return findAncestor(el, (node: HTMLElement) => node.classList.contains('p2-editor'));}+/** Determines if a given node is a child of a Gutenberg editor instance.+ * If so, returns the root node of that instance. */+export function getGutenbergRoot(el: HTMLElement): HTMLElement | null {+ return findAncestor(el, (node: HTMLElement) =>+ node.classList.contains('block-editor-block-canvas'),+ );+}+/** Determines if a given node is a child of a Lexical editor instance.* If so, returns the root node of that instance. */export function getLexicalRoot(el: HTMLElement): HTMLElement | null {