mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
Use tracked changes and comments from the snapshot (#26267)
GitOrigin-RevId: c2bf0c9c9a5ab4f8837b8712ca549119a31cf067
This commit is contained in:
@@ -29,6 +29,10 @@ import {
|
||||
import { ThreadId } from '../../../../../types/review-panel/review-panel'
|
||||
import getMeta from '@/utils/meta'
|
||||
import OError from '@overleaf/o-error'
|
||||
import {
|
||||
HistoryOTShareDoc,
|
||||
ShareLatexOTShareDoc,
|
||||
} from '../../../../../types/share-doc'
|
||||
|
||||
const MAX_PENDING_OP_SIZE = 64
|
||||
|
||||
@@ -121,6 +125,27 @@ export class DocumentContainer extends EventEmitter {
|
||||
this.bindToSocketEvents()
|
||||
}
|
||||
|
||||
get shareDoc() {
|
||||
if (!this.doc) {
|
||||
throw new Error('Missing ShareJSDoc')
|
||||
}
|
||||
if (!this.doc._doc) {
|
||||
throw new Error('Missing ShareJS Doc')
|
||||
}
|
||||
return this.doc._doc as HistoryOTShareDoc | ShareLatexOTShareDoc
|
||||
}
|
||||
|
||||
isHistoryOT() {
|
||||
return this.shareDoc.otType === 'history-ot'
|
||||
}
|
||||
|
||||
get historyOTShareDoc() {
|
||||
if (!this.isHistoryOT()) {
|
||||
throw new Error('shareDoc is not historyOT')
|
||||
}
|
||||
return this.shareDoc as HistoryOTShareDoc
|
||||
}
|
||||
|
||||
attachToCM6(cm6: EditorFacade) {
|
||||
this.cm6 = cm6
|
||||
if (this.doc) {
|
||||
@@ -613,6 +638,9 @@ export class DocumentContainer extends EventEmitter {
|
||||
this.trigger('op:timeout')
|
||||
return this.onError(new Error('op timed out'))
|
||||
})
|
||||
this.doc.on('ranges:dirty', (...args) => {
|
||||
return this.trigger('ranges:dirty', ...args)
|
||||
})
|
||||
|
||||
let docChangedTimeout: number | null = null
|
||||
this.doc.on(
|
||||
|
||||
Reference in New Issue
Block a user