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

Not working for code.yandex-team.ru #206

Closed belonesox closed 3 years ago

belonesox commented 3 years ago

Browser:

Editor:

Description

See anigif. bug-code avi

fregante commented 3 years ago

That URL isn't public so there's nothing I can do about it. It appears to be a CodeMirror field and it should work, I don't know why that happens.

belonesox commented 3 years ago

That URL isn't public so there's nothing I can do about it.

May be something wrong happened.

URL/service is public, I just created a room https://code.yandex-team.ru/b00dda88-2737-4b5b-a63d-0bbe110948c6 and tested it from different IP/proxies.

image

fregante commented 3 years ago

Thank you for the link! I just tried it and it looks like the editor is buggy there, it should be fixed by Yandex.

For example, if you press ctrl+a to select everything, the selection is lost immediately. GhostText relies on this feature to select everything and replace it, that's why the text is just appended instead of being replaced.

fregante commented 3 years ago

gif

belonesox commented 3 years ago

For example, if you press ctrl+a to select everything, the selection is lost immediately.

What browser? I just checked this with Firefox & Chrome, and cannot confirm. "Ctrl-a" selection works OK.

But the bug still persists.

fregante commented 3 years ago

Every browser. This is Chrome. You can see that the first time I press ctrl+a it's reset, and maybe the next one stays… until the content is updated.

gif

fregante commented 3 years ago

I just checked my code and it's using the simplest API possible, it's a plain .setValue call that should just replace the whole field’s content. I'm not manually selecting and replacing it like I said previously

https://github.com/fregante/GhostText/blob/ad87dffac1e1355e44e7c240a5e571575280b7af/source/unsafe-messenger.js#L47

My guess is that they hacked the CodeMirror code to implement concurrent multi-user edits, so it broke the regular API. A solution could be to transfer just the specific changed text from the editor, but that requires a rewrite of GhostText and that's not happening anytime soon, unfortunately.

belonesox commented 3 years ago

Every browser. This is Chrome. You can see that the first time I press ctrl+a it's reset, and maybe the next one stays… until the content is updated.

Hmm. Something strange. I never see that «Ctrl-a reset» in browser window. See the demo with pure Chrome (Google Chrome 89.0.4356.6 dev) with no extensions except GhostText:

https://vimeo.com/453011419/b1d25fbd3c

My guess is that they hacked the CodeMirror code to implement concurrent multi-user edits, so it broke the regular API.

May be, but I cannot reproduce and report «Ctrl-A bug» for them…