[stable-18.4.x] XWIKI-24800: The WYSIWYG editor sometimes doesn't join the realtime collaboration session - #6302
Merged
Conversation
…ollaboration session (#6301) * Wait for the CKEditor editing mode to be set before deciding whether the realtime collaboration session can be joined. The editing mode is loaded after the plugins are initialized, so when the realtime bootstrap won the race the editor mode was still unset and the check meant to detect the Source mode matched, making the editor silently skip joining the realtime session. Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> (cherry picked from commit fbf84d5)
manuelleduc
reviewed
Sep 3, 2026
| }; | ||
| return editor._realtime.connect(); | ||
| // We can't join the realtime session before knowing the editing mode (we join only in WYSIWYG mode). | ||
| return whenEditingModeIsSet(editor).then(() => editor._realtime.connect()); |
Contributor
There was a problem hiding this comment.
A more idiomatic writing. More generally using the async/await keywords is preferred when possible.
Suggested change
| return whenEditingModeIsSet(editor).then(() => editor._realtime.connect()); | |
| await whenEditingModeIsSet(editor) | |
| return editor._realtime.connect(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira URL
https://jira.xwiki.org/browse/XWIKI-24800
Backport of #6301 (merged on
masteras fbf84d5) tostable-18.4.x.Changes
Description
Clean
git cherry-pick -xof the master commit — no adaptation was needed, and the resultreproduces the original commit's stat exactly (1 file changed, 25 insertions, 1 deletion).
session can be joined.
CKEDITOR.plugins.add('xwiki-realtime').init()runs atpluginsLoaded, buteditor.modeis onlyassigned much later, from within
CKEDITOR.editor.prototype.setMode(), once the mode creator(i.e. the WYSIWYG iframe) has finished loading. The
if (editor.mode !== 'wysiwyg') return true;guard on the initial join is meant to detect the Source mode, but it also matches "the editing mode
is not set yet", so whenever
Loader.bootstrap()won the race the editor silently gave up onjoining the realtime session — no exception, no notification, and no later Source -> WYSIWYG switch
for the mode change handlers to recover from.
Clarifications
stable-18.4.xis affected: the guard was added by XWIKI-23985 (f582505), first released in18.1.0, and is present in this branch at
xwiki-realtime/plugin.js:252.stable-17.10.xandstable-16.10.xpredate f582505 and are not affected, so they need nobackport.
@sinceor Java-level adaptation applies — the change is a single JavaScript file and thisbranch targets the same Java version as master (21).
Screenshots & Video
See #6301 — the CI failure artifacts (screenshot and VNC recording of master build 1361) are attached
to XWIKI-24287.
Executed Tests
Module build on this branch, all checks on (Checkstyle, license, Revapi, Spoon):
mvn clean install -B -ntp -Plegacy \ -pl xwiki-platform-core/xwiki-platform-ckeditor/xwiki-platform-ckeditor-plugins # BUILD SUCCESSThe full realtime Docker IT suite was run on the master version of this change (#6301):
RealtimeWYSIWYGEditorIT28/28 andRealtimeWikiEditorIT2/2, on containerised Tomcat 11 +PostgreSQL + Firefox. The functional runs for this branch are left to CI.
Expected merging strategy
🤖 Generated with Claude Code