fregante / GhostText

👻 Use your text editor to write in your browser. Everything you type in the editor will be instantly updated in the browser (and vice versa).
https://GhostText.fregante.com
MIT License
3.25k stars 116 forks source link

Add support for CodeMirror 6 (Overleaf) #238

Closed niveK77pur closed 1 year ago

niveK77pur commented 1 year ago

Setup

Browser:

Editor:

Description

When I focus the text area on Overleaf, I do not see the text appear in neovim/sublime. I only see one big line of HTML which I cannot possibly interact with; see screenshots below from both editors. The behavior is the same for both browsers.

I know for a fact that this worked at some point in the past, because I had used GhostText on Overleaf successfully (with vim (instead of neovim), and with a different plugin). Seeing the issue still persists on Sublime, I hope this warrants an issue. I also hope I am not overlooking something silly!

Also worth pointing out, the first few lines from the text area do appear in the line of HTML. It is a bit more visible in the sublime screenshot. The document happens to start with a bunch of comments %% ....... which can definitely be spotted here.

Sublime screenshot

sublime

Neovim screenshot

neovim

fregante commented 1 year ago

My guess is that they updated to CodeMirror 6 and that's not supported yet

niveK77pur commented 1 year ago

I have indeed found an article from Nov 29 2022 indicating that they migrated to CodeMirror 6! https://www.overleaf.com/blog/towards-the-future-a-new-source-editor

In this article, I also noticed that they provide 3 ways of viewing the text/code: Source, Source (legacy) and Rich Text. GhostText still seems to work perfectly fine when I select the 2nd option Source (legacy)!

Thank you very much for the heads up! I think this legacy option will do for now as long as Overleaf keeps it around~

Feel free to close this issue if there already exist CodeMirror 6 related issues; the problem here does not seem to be Overleaf specific after all.

cpeikert commented 1 year ago

Is there any update on this issue? Overleaf has removed the "legacy" source editor, so there does not seem to be any way to use overleaf with GhostText (which is a big pain point).

fregante commented 1 year ago

I started working on this in #253

I think it's only missing the Browser -> Editor update event. Help wanted 🙏

MahdiNazemi commented 1 year ago

@fregante, Thanks for developing this extremely useful piece of software.

For those who need to access the Legacy editor, but no longer see it as an option, try appending ?legacy_source_editor=true to the URL. @cpeikert

cpeikert commented 1 year ago

Thanks to both of you for the assistance! The workaround works great (for a while longer, anyway...)

fregante commented 1 year ago

Support for CodeMirror 6 has been added in v23.3.16. Let me know how it goes

cpeikert commented 1 year ago

Thanks very much! The basic functionality (on Overleaf) seems to work just fine.

However, as I edit text in my emacs window, the displayed document in the browser window "jumps around," to points far away from the edited material (like the end of the document). Please let me know what further information would help.

fregante commented 1 year ago

Thanks for trying and reporting back!

I believe that actually happens to all or most other fields because I don't see the cursor position being updated after the text replacement in the code.

Can you open an issue?

cpeikert commented 1 year ago

Thanks -- I opened new issue #271.