fix: buffer operations in Stale/StaleWithBuffer instead of throwing (#6342)
When 5+ users edit concurrently, revision gaps trigger the Stale state which throws 'Ignored server-side change.' on incoming operations. This causes document divergence, silent data corruption, and eventually force-resets that discard local edits. Changes: - Stale/StaleWithBuffer.applyServer: buffer incoming operations instead of throwing, apply them sequentially after missing ops arrive - Stale.applyClient: carry pendingOps to StaleWithBuffer on transition - editor-socketio-server: retry-based force-reset (3 failures) instead of immediate nuclear reset on any OT error - hex2rgb: defensive null checks for old non-hex color records Signed-off-by: bxff <51504045+bxff@users.noreply.github.com>
This commit is contained in:
9
public/vendor/ot/hex2rgb.js
vendored
9
public/vendor/ot/hex2rgb.js
vendored
@@ -1,12 +1,17 @@
|
||||
function hex2rgb (hex) {
|
||||
if (!hex || typeof hex !== 'string') return { red: 0, green: 0, blue: 0 }
|
||||
if (hex[0] == '#') hex = hex.substr(1)
|
||||
if (hex.length == 3) {
|
||||
var temp = hex
|
||||
hex = ''
|
||||
temp = /^([a-f0-9])([a-f0-9])([a-f0-9])$/i.exec(temp).slice(1)
|
||||
var match = /^([a-f0-9])([a-f0-9])([a-f0-9])$/i.exec(temp)
|
||||
if (!match) return { red: 0, green: 0, blue: 0 }
|
||||
temp = match.slice(1)
|
||||
for (var i = 0; i < 3; i++) hex += temp[i] + temp[i]
|
||||
}
|
||||
var triplets = /^([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i.exec(hex).slice(1)
|
||||
var result = /^([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i.exec(hex)
|
||||
if (!result) return { red: 0, green: 0, blue: 0 }
|
||||
var triplets = result.slice(1)
|
||||
return {
|
||||
red: parseInt(triplets[0], 16),
|
||||
green: parseInt(triplets[1], 16),
|
||||
|
||||
Reference in New Issue
Block a user