Skip to content

Commit

Permalink
[#50692] Fix isFirstUser check when multiple editors are opened
Browse files Browse the repository at this point in the history
  • Loading branch information
MaciejWas committed Oct 26, 2023
1 parent 88c85a1 commit c412926
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/CodeMirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,12 @@ const CodeMirror = ({ text, setText, id, name, className, shown, syncText, setSy
}, []);

useEffect(() => {
const isFirstUser = collaboration.enabled && ytext.toString().length == 0 && provider.awareness.getStates().size == 1 && provider.firstUser && ready;
const mystEditorCount = document.querySelectorAll("#myst-css-namespace").length;
const isFirstUser = collaboration.enabled &&
ytext.toString().length == 0 &&
provider.awareness.getStates().size == mystEditorCount &&
provider.firstUser &&
ready;

if (ytext && ytext.toString().length != 0) setText(ytext.toString());

Expand Down

0 comments on commit c412926

Please sign in to comment.