mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-30 12:24:25 +02:00
Merge pull request #3510 from overleaf/jpa-fix-cm-listener-signature
[frontend] EditorWatchdogManager: fix signature of CM 'change' handler GitOrigin-RevId: 9803876db052533de156087d38eb2a9486eb341f
This commit is contained in:
@@ -177,9 +177,21 @@ export default class EditorWatchdogManager {
|
||||
}
|
||||
|
||||
attachToEditor(editorName, editor) {
|
||||
const onChange = change => {
|
||||
// Ignore remote changes.
|
||||
if (change.origin !== 'remote') this.onEdit()
|
||||
let onChange
|
||||
if (editorName === 'CM') {
|
||||
// CM is passing the CM instance as first parameter, then the change.
|
||||
onChange = (editor, change) => {
|
||||
// Ignore remote changes.
|
||||
if (change.origin === 'remote') return
|
||||
this.onEdit()
|
||||
}
|
||||
} else {
|
||||
// ACE is passing the change object as first parameter.
|
||||
onChange = change => {
|
||||
// Ignore remote changes.
|
||||
if (change.origin === 'remote') return
|
||||
this.onEdit()
|
||||
}
|
||||
}
|
||||
this._log('attach to editor', editorName)
|
||||
editor.on('change', onChange)
|
||||
|
||||
Reference in New Issue
Block a user