mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Merge pull request #25808 from overleaf/mj-ide-full-project-search
[web] Editor redesign: Add full project search GitOrigin-RevId: b4327c4ba0ddd7387ec8d6640e31200ca0fe4a6e
This commit is contained in:
committed by
Copybot
parent
3a96df4623
commit
48337b2e2c
+1
-4
@@ -36,7 +36,6 @@ import { getStoredSelection, setStoredSelection } from '../extensions/search'
|
||||
import { debounce } from 'lodash'
|
||||
import { EditorSelection, EditorState } from '@codemirror/state'
|
||||
import { sendSearchEvent } from '@/features/event-tracking/search-events'
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
import { FullProjectSearchButton } from './full-project-search-button'
|
||||
|
||||
const MATCH_COUNT_DEBOUNCE_WAIT = 100 // the amount of ms to wait before counting matches
|
||||
@@ -82,8 +81,6 @@ const CodeMirrorSearchForm: FC<React.PropsWithChildren> = () => {
|
||||
const inputRef = useRef<HTMLInputElement | null>(null)
|
||||
const replaceRef = useRef<HTMLInputElement | null>(null)
|
||||
|
||||
const newEditor = useIsNewEditorEnabled()
|
||||
|
||||
const handleInputRef = useCallback((node: HTMLInputElement) => {
|
||||
inputRef.current = node
|
||||
|
||||
@@ -443,7 +440,7 @@ const CodeMirrorSearchForm: FC<React.PropsWithChildren> = () => {
|
||||
</OLButton>
|
||||
</OLButtonGroup>
|
||||
|
||||
{!newEditor && <FullProjectSearchButton query={query} />}
|
||||
<FullProjectSearchButton query={query} />
|
||||
|
||||
{position !== null && (
|
||||
<div className="ol-cm-search-form-position">
|
||||
|
||||
+10
-2
@@ -12,6 +12,8 @@ import Close from '@/shared/components/close'
|
||||
import useTutorial from '@/shared/hooks/promotions/use-tutorial'
|
||||
import { useEditorContext } from '@/shared/context/editor-context'
|
||||
import getMeta from '@/utils/meta'
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
import { useRailContext } from '@/features/ide-redesign/contexts/rail-context'
|
||||
|
||||
const PROMOTION_SIGNUP_CUT_OFF_DATE = new Date('2025-04-22T00:00:00Z')
|
||||
|
||||
@@ -19,6 +21,8 @@ export const FullProjectSearchButton = ({ query }: { query: SearchQuery }) => {
|
||||
const view = useCodeMirrorViewContext()
|
||||
const { t } = useTranslation()
|
||||
const { setProjectSearchIsOpen } = useLayoutContext()
|
||||
const newEditor = useIsNewEditorEnabled()
|
||||
const { openTab } = useRailContext()
|
||||
const ref = useRef<HTMLButtonElement>(null)
|
||||
|
||||
const { inactiveTutorials } = useEditorContext()
|
||||
@@ -44,14 +48,18 @@ export const FullProjectSearchButton = ({ query }: { query: SearchQuery }) => {
|
||||
}
|
||||
|
||||
const openFullProjectSearch = useCallback(() => {
|
||||
setProjectSearchIsOpen(true)
|
||||
if (newEditor) {
|
||||
openTab('full-project-search')
|
||||
} else {
|
||||
setProjectSearchIsOpen(true)
|
||||
}
|
||||
closeSearchPanel(view)
|
||||
window.setTimeout(() => {
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('editor:full-project-search', { detail: query })
|
||||
)
|
||||
}, 200)
|
||||
}, [setProjectSearchIsOpen, query, view])
|
||||
}, [setProjectSearchIsOpen, query, view, newEditor, openTab])
|
||||
|
||||
const onClick = useCallback(() => {
|
||||
sendSearchEvent('search-open', {
|
||||
|
||||
Reference in New Issue
Block a user