Skip to content
Snippets Groups Projects
Commit e3a9fa02 authored by Marius Dumitru Florea's avatar Marius Dumitru Florea
Browse files

XWIKI-22385: The WYSIWYG editor remains read-only after it reconnects to the realtime session

* Pair the existing setEditable(false) with an setEditable(true)
* Upgrade Netflux WebSocket WebJar to fix a bug related to how sessions with large lag are disconnected

(cherry picked from commit 04225d5b)
parent ded9e3b0
No related branches found
No related tags found
No related merge requests found
......@@ -53,7 +53,7 @@
<dependency>
<groupId>org.xwiki.contrib</groupId>
<artifactId>chainpad-netflux-webjar</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
......
......@@ -524,11 +524,17 @@ define('xwiki-realtime-wysiwyg', [
} else {
// The Netflux channel used before the WebSocket connection closed is not available anymore so we have to
// abort the current realtime session.
this.setEditable(false);
this._onAbort();
if (!this._saver.getLocalEditFlag()) {
// Fortunately we don't have any unsaved local changes so we can rejoin the realtime session using the new
// Netflux channel.
//
// The editor was previously put in read-only mode when we got disconnected from the WebSocket (i.e. when
// the WebSocket connection status changed, see above). The editor takes into account nested calls to
// setReadOnly so we need to make sure the previous setEditable(false) has a corresponding call to
// setEditable(true). The user won't be able to edit right away because the editor is put back in read-only
// mode while we reconnect to the realtime session (in _startRealtimeSync).
this.setEditable(true);
this._startRealtimeSync();
} else {
// We can't rejoin the realtime session using the new Netflux channel because we would lose the unsaved
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment