Skip to content

[stable-18.4.x] XWIKI-24800: The WYSIWYG editor sometimes doesn't join the realtime collaboration session - #6302

Merged
vmassol merged 1 commit into
stable-18.4.xfrom
backport/stable-18.4.x/XWIKI-24800
Sep 3, 2026
Merged

[stable-18.4.x] XWIKI-24800: The WYSIWYG editor sometimes doesn't join the realtime collaboration session#6302
vmassol merged 1 commit into
stable-18.4.xfrom
backport/stable-18.4.x/XWIKI-24800

Conversation

@vmassol

@vmassol vmassol commented Sep 3, 2026

Copy link
Copy Markdown
Member

Jira URL

https://jira.xwiki.org/browse/XWIKI-24800

Backport of #6301 (merged on master as fbf84d5) to stable-18.4.x.

Changes

Description

Clean git cherry-pick -x of the master commit — no adaptation was needed, and the result
reproduces the original commit's stat exactly (1 file changed, 25 insertions, 1 deletion).

  • Wait for the CKEditor editing mode to be set before deciding whether the realtime collaboration
    session can be joined.

CKEDITOR.plugins.add('xwiki-realtime').init() runs at pluginsLoaded, but editor.mode is only
assigned 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 on
joining 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.x is affected: the guard was added by XWIKI-23985 (f582505), first released in
    18.1.0, and is present in this branch at
    xwiki-realtime/plugin.js:252.
  • stable-17.10.x and stable-16.10.x predate f582505 and are not affected, so they need no
    backport.
  • No pom, @since or Java-level adaptation applies — the change is a single JavaScript file and this
    branch 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 SUCCESS

The full realtime Docker IT suite was run on the master version of this change (#6301):
RealtimeWYSIWYGEditorIT 28/28 and RealtimeWikiEditorIT 2/2, on containerised Tomcat 11 +
PostgreSQL + Firefox. The functional runs for this branch are left to CI.

Expected merging strategy

  • Prefers squash: Yes
  • Backport on branches: none — this is the backport.

🤖 Generated with Claude Code

…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)
@vmassol vmassol self-assigned this Sep 3, 2026
@vmassol
vmassol merged commit 0fc65e7 into stable-18.4.x Sep 3, 2026
2 checks passed
@vmassol
vmassol deleted the backport/stable-18.4.x/XWIKI-24800 branch September 3, 2026 20:44
};
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());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants