diff --git a/packages/page-controller/src/actions.ts b/packages/page-controller/src/actions.ts index e496b2d..3a7c4fd 100644 --- a/packages/page-controller/src/actions.ts +++ b/packages/page-controller/src/actions.ts @@ -123,12 +123,10 @@ export async function inputTextElement(element: HTMLElement, text: string) { // to Plan B (execCommand) if the text wasn't actually inserted. // // Plan A: Dispatch synthetic events - // Works: React contenteditable, Quill, some LinkedIn versions. + // Works: React contenteditable, Quill, LinkedIn. // Fails: Slate.js, some contenteditable editors that ignore synthetic events. // Sequence: beforeinput -> mutation -> input -> change -> blur - let planASucceeded = false - // Dispatch beforeinput + mutation + input for clearing if ( element.dispatchEvent( @@ -170,8 +168,7 @@ export async function inputTextElement(element: HTMLElement, text: string) { } // Verify Plan A worked by checking if the text was actually inserted - const currentText = element.innerText.trim() - planASucceeded = currentText === text.trim() + const planASucceeded = element.innerText.trim() === text.trim() if (!planASucceeded) { // Plan B: execCommand fallback (deprecated but widely supported)