Merge pull request #31909 from overleaf/ds-removing-useIsNewEditorEnabled-2
[Part 2] Removing the usage of `useIsNewEditorEnabled` for editor tear down GitOrigin-RevId: 864652da0edcedab4f3b1ba47d8d42fb65260118
This commit is contained in:
+3
-18
@@ -28,14 +28,12 @@ import { useUserSettingsContext } from '@/shared/context/user-settings-context'
|
||||
import { FullProjectMatchCounts } from './full-project-match-counts'
|
||||
import { FullProjectSearchModifiers } from './full-project-search-modifiers'
|
||||
import { isMac } from '@/shared/utils/os'
|
||||
import { PanelHeading } from '@/shared/components/panel-heading'
|
||||
import { useEditorManagerContext } from '@/features/ide-react/context/editor-manager-context'
|
||||
import { createRegExp } from '@/features/source-editor/utils/regexp'
|
||||
import { useEditorOpenDocContext } from '@/features/ide-react/context/editor-open-doc-context'
|
||||
import { useFileTreePathContext } from '@/features/file-tree/contexts/file-tree-path'
|
||||
import { FullProjectSearchResults } from './full-project-search-results'
|
||||
import { signalWithTimeout } from '@/utils/abort-signal'
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
import RailPanelHeader from '@/features/ide-react/components/rail/rail-panel-header'
|
||||
import { useActiveOverallTheme } from '@/shared/hooks/use-active-overall-theme'
|
||||
|
||||
@@ -45,7 +43,6 @@ const FullProjectSearchUI: FC = () => {
|
||||
const { projectSnapshot } = useProjectContext()
|
||||
const { openDocs } = useEditorManagerContext()
|
||||
const { pathInFolder } = useFileTreePathContext()
|
||||
const newEditor = useIsNewEditorEnabled()
|
||||
|
||||
const { currentDocument: currentDoc } = useEditorOpenDocContext()
|
||||
|
||||
@@ -111,11 +108,7 @@ const FullProjectSearchUI: FC = () => {
|
||||
|
||||
await projectSnapshot.refresh()
|
||||
if (!abortControllerRef.current.signal.aborted) {
|
||||
const results = await searchSnapshot(
|
||||
projectSnapshot,
|
||||
searchQuery,
|
||||
newEditor
|
||||
)
|
||||
const results = await searchSnapshot(projectSnapshot, searchQuery)
|
||||
setMatchedFiles(results)
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -125,7 +118,7 @@ const FullProjectSearchUI: FC = () => {
|
||||
setLoading(false)
|
||||
}
|
||||
},
|
||||
[openDocs, projectSnapshot, t, newEditor]
|
||||
[openDocs, projectSnapshot, t]
|
||||
)
|
||||
|
||||
const searchInputRef = useRef<HTMLInputElement>(null)
|
||||
@@ -191,15 +184,7 @@ const FullProjectSearchUI: FC = () => {
|
||||
style={variableStyle}
|
||||
data-bs-theme={activeOverallTheme === 'light' ? 'light' : 'dark'}
|
||||
>
|
||||
{newEditor ? (
|
||||
<RailPanelHeader title={t('search')} />
|
||||
) : (
|
||||
<PanelHeading
|
||||
title={t('search')}
|
||||
handleClose={() => setProjectSearchIsOpen(false)}
|
||||
splitTestName="full-project-search"
|
||||
/>
|
||||
)}
|
||||
<RailPanelHeader title={t('search')} />
|
||||
|
||||
<div // eslint-disable-line jsx-a11y/no-static-element-interactions
|
||||
className="full-project-search-form"
|
||||
|
||||
@@ -21,8 +21,7 @@ const toLowerCase = (string: string) => string.toLowerCase()
|
||||
|
||||
export const searchSnapshot = async (
|
||||
projectSnapshot: ProjectSnapshot,
|
||||
searchQuery: SearchQuery,
|
||||
newEditor: boolean
|
||||
searchQuery: SearchQuery
|
||||
) => {
|
||||
if (!searchQuery.search.trim().length) {
|
||||
return
|
||||
@@ -86,14 +85,11 @@ export const searchSnapshot = async (
|
||||
|
||||
sendSearchEvent(
|
||||
'search-execute',
|
||||
populateEditorRedesignSegmentation(
|
||||
{
|
||||
searchType: 'full-project',
|
||||
totalDocs: docPaths.length,
|
||||
totalResults: results.flatMap(file => file.hits).length,
|
||||
},
|
||||
newEditor
|
||||
)
|
||||
populateEditorRedesignSegmentation({
|
||||
searchType: 'full-project',
|
||||
totalDocs: docPaths.length,
|
||||
totalResults: results.flatMap(file => file.hits).length,
|
||||
})
|
||||
)
|
||||
|
||||
return results
|
||||
|
||||
-15
@@ -34,7 +34,6 @@
|
||||
--matched-hit-selected-unfocused-highlight-color: var(--content-primary);
|
||||
--collapsible-file-header-count-color: var(--content-primary);
|
||||
--collapsible-file-header-count-bg-color: var(--bg-light-tertiary);
|
||||
--panel-heading-color: var(--content-primary-dark);
|
||||
--search-modifier-checked-bg: var(--green-70);
|
||||
--search-modifier-hover-color: var(--bg-dark-secondary);
|
||||
|
||||
@@ -144,7 +143,6 @@
|
||||
--matched-hit-selected-unfocused-highlight-color: var(--bg-dark-primary);
|
||||
--collapsible-file-header-count-color: var(--bs-body-color);
|
||||
--collapsible-file-header-count-bg-color: var(--bg-dark-secondary);
|
||||
--panel-heading-color: var(--content-primary-dark);
|
||||
--search-modifier-checked-bg: var(--neutral-90);
|
||||
--search-modifier-hover-color: var(--neutral-70);
|
||||
|
||||
@@ -157,15 +155,6 @@
|
||||
color: inherit;
|
||||
}
|
||||
}
|
||||
|
||||
.panel-heading-close-button {
|
||||
color: var(--content-primary-dark);
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
color: var(--content-primary);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
position: absolute;
|
||||
@@ -185,10 +174,6 @@
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.panel-heading-label {
|
||||
margin-left: var(--spacing-02);
|
||||
}
|
||||
|
||||
.full-project-search-form {
|
||||
padding: 8px;
|
||||
flex-shrink: 0;
|
||||
|
||||
Reference in New Issue
Block a user