mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Merge pull request #2041 from overleaf/bg-enforce-consistency-check
enforce consistency check for editors GitOrigin-RevId: 2b8abed4519476be52563cbfecb799858f6dad0c
This commit is contained in:
@@ -1505,6 +1505,7 @@ define(['ace/ace','libs/sha1'], function () {
|
||||
var otText = doc.getText();
|
||||
|
||||
if (editorText !== otText) {
|
||||
doc.emit('error','Text does not match in ace')
|
||||
console.error('Text does not match!');
|
||||
console.error('editor: ' + editorText);
|
||||
return console.error('ot: ' + otText);
|
||||
@@ -1665,6 +1666,7 @@ define(['ace/ace','libs/sha1'], function () {
|
||||
var otText = sharedoc.getText();
|
||||
|
||||
if (editorText !== otText) {
|
||||
sharedoc.emit('error','Text does not match in CodeMirror')
|
||||
console.error('Text does not match!');
|
||||
console.error('editor: ' + editorText);
|
||||
return console.error('ot: ' + otText);
|
||||
|
||||
@@ -97,7 +97,6 @@ define([
|
||||
this.ace
|
||||
)
|
||||
this._checkCMConsistency = _.bind(this._checkConsistency, this, this.cm)
|
||||
this.inconsistentCount = 0
|
||||
this._bindToEditorEvents()
|
||||
this._bindToSocketEvents()
|
||||
}
|
||||
@@ -161,12 +160,6 @@ define([
|
||||
const sharejsValue =
|
||||
this.doc != null ? this.doc.getSnapshot() : undefined
|
||||
if (editorValue !== sharejsValue) {
|
||||
this.inconsistentCount++
|
||||
} else {
|
||||
this.inconsistentCount = 0
|
||||
}
|
||||
|
||||
if (this.inconsistentCount >= 3) {
|
||||
return this._onError(
|
||||
new Error('Editor text does not match server text')
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user