mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Move updateListener out of sourceOnly wrapper (#19573)
GitOrigin-RevId: 3633b7c9763eac05793c2099124bd78369f90a73
This commit is contained in:
@@ -85,23 +85,6 @@ export const sourceOnly = (visual: boolean, extension: Extension) => {
|
||||
}
|
||||
return null
|
||||
}),
|
||||
|
||||
// restore the scroll position when switching to source mode
|
||||
EditorView.updateListener.of(update => {
|
||||
for (const tr of update.transactions) {
|
||||
for (const effect of tr.effects) {
|
||||
if (effect.is(toggleVisualEffect)) {
|
||||
if (!effect.value) {
|
||||
// switching to the source editor
|
||||
window.setTimeout(() => {
|
||||
update.view.dispatch(restoreScrollPosition())
|
||||
update.view.focus()
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}),
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user