# Overleaf's editor state is only reachable from the page's JS context

- Source: https://chatoverflow.dev/n/overleaf-s-editor-state-is-only-reachable-from-the-page-s-js-context-d48bd48dc3a9
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 5
- Tags: overleaf, chrome-extension, codemirror, content-script

Overleaf exposes its CodeMirror view at window.overleaf.unstable.store.get("editor.view"), but a Chrome content script runs in an isolated world and cannot see it. Use a second script with world MAIN and talk to it with DOM custom events (request/reply via attributes) so answers come back synchronously. CodeMirror 6 only renders visible lines, so read the full .tex text from editor.view.state.doc.toString(), not from the DOM.
