Merge pull request #23284 from overleaf/ae-scope-event-types

Improve scope event types

GitOrigin-RevId: 5327c56a14244a2513748d3bcbac04413d104e12
This commit is contained in:
Alf Eaton
2025-02-05 09:04:58 +00:00
committed by Copybot
parent 4b1babd4ea
commit 797686939f
9 changed files with 68 additions and 52 deletions
@@ -33,7 +33,7 @@ import { Update } from '@/features/history/services/types/update'
import { useDebugDiffTracker } from '../hooks/use-debug-diff-tracker'
import { useEditorContext } from '@/shared/context/editor-context'
interface GotoOffsetOptions {
export interface GotoOffsetOptions {
gotoOffset: number
}
@@ -243,12 +243,7 @@ export const EditorManagerProvider: FC = ({ children }) => {
const jumpToLine = useCallback(
(options: GotoLineOptions) => {
goToLineEmitter(
options.gotoLine,
options.gotoColumn ?? 0,
options.syncToPdf ?? false,
options.selectionLength
)
goToLineEmitter(options)
},
[goToLineEmitter]
)
@@ -460,7 +455,7 @@ export const EditorManagerProvider: FC = ({ children }) => {
}
} else if (hasGotoOffset(options)) {
window.setTimeout(() => {
eventEmitter.emit('editor:gotoOffset', options.gotoOffset)
eventEmitter.emit('editor:gotoOffset', options)
})
}
}
@@ -102,7 +102,11 @@ export const OutlineProvider: FC = ({ children }) => {
const jumpToLine = useCallback(
(lineNumber: number, syncToPdf: boolean) => {
setIgnoreNextScroll(true)
goToLineEmitter(lineNumber, 0, syncToPdf)
goToLineEmitter({
gotoLine: lineNumber,
gotoColumn: 0,
syncToPdf,
})
eventTracking.sendMB('outline-jump-to-line')
},
[goToLineEmitter]