mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Merge pull request #28392 from overleaf/dp-segment-editor-analytics
Add editor-redesign segmentation to a bunch of analytics events GitOrigin-RevId: e8d2091028dab09de06362c38c5a17f32253e7cc
This commit is contained in:
@@ -10,12 +10,12 @@ import {
|
||||
} from 'react'
|
||||
import useScopeEventEmitter from '@/shared/hooks/use-scope-event-emitter'
|
||||
import useEventListener from '@/shared/hooks/use-event-listener'
|
||||
import * as eventTracking from '@/infrastructure/event-tracking'
|
||||
import { isValidTeXFile } from '@/main/is-valid-tex-file'
|
||||
import localStorage from '@/infrastructure/local-storage'
|
||||
import { useProjectContext } from '@/shared/context/project-context'
|
||||
import { useEditorOpenDocContext } from '@/features/ide-react/context/editor-open-doc-context'
|
||||
import { useFileTreeOpenContext } from './file-tree-open-context'
|
||||
import { useEditorAnalytics } from '@/shared/hooks/use-editor-analytics'
|
||||
|
||||
export type PartialFlatOutline = {
|
||||
level: number
|
||||
@@ -53,6 +53,7 @@ export const OutlineProvider: FC<React.PropsWithChildren> = ({ children }) => {
|
||||
const [ignoreNextCursorUpdate, setIgnoreNextCursorUpdate] =
|
||||
useState<boolean>(false)
|
||||
const [ignoreNextScroll, setIgnoreNextScroll] = useState<boolean>(false)
|
||||
const { sendEvent } = useEditorAnalytics()
|
||||
|
||||
const goToLineEmitter = useScopeEventEmitter('editor:gotoLine', true)
|
||||
|
||||
@@ -110,9 +111,9 @@ export const OutlineProvider: FC<React.PropsWithChildren> = ({ children }) => {
|
||||
gotoColumn: 0,
|
||||
syncToPdf,
|
||||
})
|
||||
eventTracking.sendMB('outline-jump-to-line')
|
||||
sendEvent('outline-jump-to-line')
|
||||
},
|
||||
[goToLineEmitter]
|
||||
[goToLineEmitter, sendEvent]
|
||||
)
|
||||
|
||||
const highlightedLine = useMemo(
|
||||
@@ -142,18 +143,18 @@ export const OutlineProvider: FC<React.PropsWithChildren> = ({ children }) => {
|
||||
const expandOutline = useCallback(() => {
|
||||
if (canShowOutline) {
|
||||
localStorage.setItem(storageKey, true)
|
||||
eventTracking.sendMB('outline-expand')
|
||||
sendEvent('outline-expand')
|
||||
setOutlineExpanded(true)
|
||||
}
|
||||
}, [canShowOutline, storageKey])
|
||||
}, [canShowOutline, storageKey, sendEvent])
|
||||
|
||||
const collapseOutline = useCallback(() => {
|
||||
if (canShowOutline) {
|
||||
localStorage.setItem(storageKey, false)
|
||||
eventTracking.sendMB('outline-collapse')
|
||||
sendEvent('outline-collapse')
|
||||
setOutlineExpanded(false)
|
||||
}
|
||||
}, [canShowOutline, storageKey])
|
||||
}, [canShowOutline, storageKey, sendEvent])
|
||||
|
||||
const toggleOutlineExpanded = useCallback(() => {
|
||||
if (outlineExpanded) {
|
||||
|
||||
Reference in New Issue
Block a user