mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-19 16:15:25 +00: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:
parent
8779e731e1
commit
ae511474f2
1 changed files with 15 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue