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 Monaco Editor #239

Closed ryan6416 closed 1 year ago

ryan6416 commented 1 year ago

This pull request adds support for the Monaco Editor. This resolves issue #140, which requested the ability to use GhostText with the Monaco Editor.

The changes include a new condition in the unsafe-messenger.js file that checks for the existence of the monaco object, and a new function monacoEditor(target) that handles the events and value transfer for the Monaco Editor.

This has been tested and confirmed to work with the Monaco Editor, and should not affect the existing support for CodeMirror and Ace.

Here's a demo of the update:

https://user-images.githubusercontent.com/12979345/214165120-d559ea7e-8ebd-4083-9f0e-a3fbdcbc3bab.mp4

ryan6416 commented 1 year ago

Thank you for the PR! Can you add a Monaco editor to the demo page on the demo/testing page? ghosttext.fregante.com/test The "edit" link is at the bottom

Done @fregante https://github.com/fregante/ghosttext.fregante.com/pull/10

fregante commented 1 year ago

Refer to https://github.com/fregante/GhostText/blob/main/contributing.md#adding-support-for-more-editors for more information if you haven't.

Linting is still failing here as well and it should pass for this PR to be merged

fregante commented 1 year ago

You marked some of my comments as resolved but you did not address them. Please review again

fregante commented 1 year ago

Fixed:

Not fixed:

fregante commented 1 year ago

@ryan-efendy are you able to finish this soon? I'd love to include it in this week’s release, otherwise it'll have to wait longer