mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-03 14:19:01 +02:00
removing the usage of useIsNewEditorEnabled from first set of files (#31800)
GitOrigin-RevId: 821885295f4dab046d9abf552d7fbd7a21d86fb5
This commit is contained in:
@@ -357,7 +357,6 @@
|
||||
"cookie_banner_info": "",
|
||||
"copied": "",
|
||||
"copy": "",
|
||||
"copy_code": "",
|
||||
"copy_project": "",
|
||||
"copy_response": "",
|
||||
"copying": "",
|
||||
@@ -444,7 +443,6 @@
|
||||
"disable_ai_features": "",
|
||||
"disable_equation_preview": "",
|
||||
"disable_equation_preview_confirm": "",
|
||||
"disable_equation_preview_enable": "",
|
||||
"disable_equation_preview_enable_in_settings": "",
|
||||
"disable_single_sign_on": "",
|
||||
"disable_sso": "",
|
||||
@@ -748,7 +746,6 @@
|
||||
"github_workflow_files_error": "",
|
||||
"github_workflow_files_error_non_owner": "",
|
||||
"give_feedback": "",
|
||||
"give_your_feedback": "",
|
||||
"go_next_page": "",
|
||||
"go_page": "",
|
||||
"go_prev_page": "",
|
||||
@@ -1930,7 +1927,6 @@
|
||||
"this_experiment_gives_you_access_to_new_versions_of_latex": "",
|
||||
"this_field_is_required": "",
|
||||
"this_grants_access_to_features_2": "",
|
||||
"this_is_a_new_feature": "",
|
||||
"this_is_the_file_that_references_pulled_from_your_reference_manager_will_be_added_to": "",
|
||||
"this_organization_is_tax_exempt": "",
|
||||
"this_project_already_has_maximum_collaborators": "",
|
||||
|
||||
@@ -24,13 +24,11 @@ import {
|
||||
prependMessages,
|
||||
} from '../utils/message-list-utils'
|
||||
import useBrowserWindow from '../../../shared/hooks/use-browser-window'
|
||||
import { useLayoutContext } from '../../../shared/context/layout-context'
|
||||
import { useIdeContext } from '@/shared/context/ide-context'
|
||||
import getMeta from '@/utils/meta'
|
||||
import { debugConsole } from '@/utils/debugging'
|
||||
import { User } from '../../../../../types/user'
|
||||
import { useRailContext } from '@/features/ide-react/context/rail-context'
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
|
||||
const PAGE_SIZE = 50
|
||||
|
||||
@@ -272,12 +270,8 @@ export const ChatProvider: FC<React.PropsWithChildren> = ({ children }) => {
|
||||
const user = useUserContext()
|
||||
const { projectId } = useProjectContext()
|
||||
|
||||
const { chatIsOpen: chatIsOpenOldEditor } = useLayoutContext()
|
||||
const { selectedTab: selectedRailTab, isOpen: railIsOpen } = useRailContext()
|
||||
const newEditor = useIsNewEditorEnabled()
|
||||
const chatIsOpen = newEditor
|
||||
? selectedRailTab === 'chat' && railIsOpen
|
||||
: chatIsOpenOldEditor
|
||||
const chatIsOpen = selectedRailTab === 'chat' && railIsOpen
|
||||
|
||||
const {
|
||||
hasFocus: windowHasFocus,
|
||||
|
||||
@@ -9,14 +9,12 @@ import { useFileTreeMainContext } from '../contexts/file-tree-main'
|
||||
|
||||
import FileTreeItemMenuItems from './file-tree-item/file-tree-item-menu-items'
|
||||
import classNames from 'classnames'
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
|
||||
function FileTreeContextMenu() {
|
||||
const { fileTreeReadOnly } = useFileTreeData()
|
||||
const { contextMenuCoords, setContextMenuCoords } = useFileTreeMainContext()
|
||||
const toggleButtonRef = useRef<HTMLButtonElement | null>(null)
|
||||
const keyboardInputRef = useRef(false)
|
||||
const newEditor = useIsNewEditorEnabled()
|
||||
|
||||
useEffect(() => {
|
||||
if (contextMenuCoords) {
|
||||
@@ -90,7 +88,7 @@ function FileTreeContextMenu() {
|
||||
style={contextMenuCoords}
|
||||
// TODO ide-redesign-cleanup: remove 'ide-redesign-main' class when old editor is removed
|
||||
// It is only used to apply dark theme styles to the context menu in the new editor
|
||||
className={classNames('context-menu', { 'ide-redesign-main': newEditor })}
|
||||
className="context-menu ide-redesign-main"
|
||||
>
|
||||
<Dropdown
|
||||
show
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import iconTypeFromName, {
|
||||
newEditorIconTypeFromName,
|
||||
} from '../util/icon-type-from-name'
|
||||
import { newEditorIconTypeFromName } from '../util/icon-type-from-name'
|
||||
import classnames from 'classnames'
|
||||
import MaterialIcon from '@/shared/components/material-icon'
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
|
||||
function FileTreeIcon({
|
||||
isLinkedFile,
|
||||
@@ -19,32 +16,13 @@ function FileTreeIcon({
|
||||
'linked-file-icon': isLinkedFile,
|
||||
})
|
||||
|
||||
const newEditor = useIsNewEditorEnabled()
|
||||
|
||||
if (newEditor) {
|
||||
return (
|
||||
<>
|
||||
<MaterialIcon
|
||||
unfilled
|
||||
type={newEditorIconTypeFromName(name)}
|
||||
className={className}
|
||||
/>
|
||||
{isLinkedFile && (
|
||||
<MaterialIcon
|
||||
type="open_in_new"
|
||||
modifier="rotate-180"
|
||||
className="linked-file-highlight"
|
||||
accessibilityLabel={t('linked_file')}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
<MaterialIcon type={iconTypeFromName(name)} className={className} />
|
||||
<MaterialIcon
|
||||
unfilled
|
||||
type={newEditorIconTypeFromName(name)}
|
||||
className={className}
|
||||
/>
|
||||
{isLinkedFile && (
|
||||
<MaterialIcon
|
||||
type="open_in_new"
|
||||
|
||||
+12
-28
@@ -11,7 +11,6 @@ import FileTreeItemMenu from './file-tree-item-menu'
|
||||
import { useFileTreeSelectable } from '../../contexts/file-tree-selectable'
|
||||
import { useFileTreeActionable } from '../../contexts/file-tree-actionable'
|
||||
import { useDragDropManager } from 'react-dnd'
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
|
||||
function FileTreeItemInner({
|
||||
id,
|
||||
@@ -113,39 +112,24 @@ const FileTreeItemIconsAndName = ({
|
||||
onClick?: () => void
|
||||
setIsDraggable: (isDraggable: boolean) => void
|
||||
}) => {
|
||||
const newEditor = useIsNewEditorEnabled()
|
||||
|
||||
if (newEditor) {
|
||||
return onClick ? (
|
||||
<button className="file-tree-entity-button" onClick={onClick}>
|
||||
{icons}
|
||||
<FileTreeItemName
|
||||
name={name}
|
||||
isSelected={isSelected}
|
||||
setIsDraggable={setIsDraggable}
|
||||
/>
|
||||
</button>
|
||||
) : (
|
||||
<div className="file-tree-entity-details">
|
||||
{icons}
|
||||
<FileTreeItemName
|
||||
name={name}
|
||||
isSelected={isSelected}
|
||||
setIsDraggable={setIsDraggable}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
return onClick ? (
|
||||
<button className="file-tree-entity-button" onClick={onClick}>
|
||||
{icons}
|
||||
<FileTreeItemName
|
||||
name={name}
|
||||
isSelected={isSelected}
|
||||
setIsDraggable={setIsDraggable}
|
||||
/>
|
||||
</>
|
||||
</button>
|
||||
) : (
|
||||
<div className="file-tree-entity-details">
|
||||
{icons}
|
||||
<FileTreeItemName
|
||||
name={name}
|
||||
isSelected={isSelected}
|
||||
setIsDraggable={setIsDraggable}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import FileTreeContext from './file-tree-context'
|
||||
import FileTreeDraggablePreviewLayer from './file-tree-draggable-preview-layer'
|
||||
import FileTreeFolderList from './file-tree-folder-list'
|
||||
import FileTreeToolbar from './file-tree-toolbar'
|
||||
import FileTreeToolbarNew from '@/features/file-tree/components/file-tree-toolbar'
|
||||
import FileTreeModalDelete from './modals/file-tree-modal-delete'
|
||||
import FileTreeModalCreateFolder from './modals/file-tree-modal-create-folder'
|
||||
import FileTreeModalError from './modals/file-tree-modal-error'
|
||||
@@ -19,7 +18,6 @@ import FileTreeInner from './file-tree-inner'
|
||||
import { useDragLayer } from 'react-dnd'
|
||||
import classnames from 'classnames'
|
||||
import { pathInFolder } from '@/features/file-tree/util/path'
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
import { FileTreeFindResult } from '@/features/ide-react/types/file-tree'
|
||||
|
||||
const FileTreeRoot = React.memo<{
|
||||
@@ -44,7 +42,6 @@ const FileTreeRoot = React.memo<{
|
||||
const { projectId } = useProjectContext()
|
||||
const { fileTreeData } = useFileTreeData()
|
||||
const isReady = Boolean(projectId && fileTreeData)
|
||||
const newEditor = useIsNewEditorEnabled()
|
||||
|
||||
useEffect(() => {
|
||||
if (fileTreeContainer) {
|
||||
@@ -101,7 +98,7 @@ const FileTreeRoot = React.memo<{
|
||||
fileTreeContainer={fileTreeContainer}
|
||||
>
|
||||
{isConnected ? null : <div className="disconnected-overlay" />}
|
||||
{newEditor ? <FileTreeToolbarNew /> : <FileTreeToolbar />}
|
||||
<FileTreeToolbar />
|
||||
<FileTreeContextMenu />
|
||||
<FileTreeInner>
|
||||
<FileTreeRootFolder onDelete={onDelete} />
|
||||
|
||||
@@ -18,20 +18,3 @@ export const newEditorIconTypeFromName = (
|
||||
}
|
||||
return 'description'
|
||||
}
|
||||
|
||||
export default function iconTypeFromName(name: string): string {
|
||||
let ext = name.split('.').pop()
|
||||
ext = ext ? ext.toLowerCase() : ext
|
||||
|
||||
if (ext && ['png', 'pdf', 'jpg', 'jpeg', 'gif'].includes(ext)) {
|
||||
return 'image'
|
||||
} else if (ext && ['csv', 'xls', 'xlsx'].includes(ext)) {
|
||||
return 'table_chart'
|
||||
} else if (ext && ['py', 'r'].includes(ext)) {
|
||||
return 'code'
|
||||
} else if (ext && ['bib'].includes(ext)) {
|
||||
return 'menu_book'
|
||||
} else {
|
||||
return 'description'
|
||||
}
|
||||
}
|
||||
|
||||
+8
-15
@@ -1,12 +1,9 @@
|
||||
import { memo } from 'react'
|
||||
import classNames from 'classnames'
|
||||
import HistoryFileTreeItem from './history-file-tree-item'
|
||||
import iconTypeFromName, {
|
||||
newEditorIconTypeFromName,
|
||||
} from '../../../file-tree/util/icon-type-from-name'
|
||||
import { newEditorIconTypeFromName } from '../../../file-tree/util/icon-type-from-name'
|
||||
import type { FileDiff } from '../../services/types/file'
|
||||
import MaterialIcon from '@/shared/components/material-icon'
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
|
||||
type HistoryFileTreeDocProps = {
|
||||
file: FileDiff
|
||||
@@ -23,16 +20,6 @@ function HistoryFileTreeDoc({
|
||||
onClick,
|
||||
onKeyDown,
|
||||
}: HistoryFileTreeDocProps) {
|
||||
const newEditor = useIsNewEditorEnabled()
|
||||
const icon = newEditor ? (
|
||||
<MaterialIcon
|
||||
unfilled
|
||||
type={newEditorIconTypeFromName(name)}
|
||||
className="file-tree-icon"
|
||||
/>
|
||||
) : (
|
||||
<MaterialIcon type={iconTypeFromName(name)} className="file-tree-icon" />
|
||||
)
|
||||
return (
|
||||
<li
|
||||
role="treeitem"
|
||||
@@ -47,7 +34,13 @@ function HistoryFileTreeDoc({
|
||||
<HistoryFileTreeItem
|
||||
name={name}
|
||||
operation={'operation' in file ? file.operation : undefined}
|
||||
icons={icon}
|
||||
icons={
|
||||
<MaterialIcon
|
||||
unfilled
|
||||
type={newEditorIconTypeFromName(name)}
|
||||
className="file-tree-icon"
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</li>
|
||||
)
|
||||
|
||||
-8
@@ -6,7 +6,6 @@ import HistoryFileTreeFolderList from './history-file-tree-folder-list'
|
||||
|
||||
import type { HistoryDoc, HistoryFileTree } from '../../utils/file-tree'
|
||||
import MaterialIcon from '@/shared/components/material-icon'
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
|
||||
type HistoryFileTreeFolderProps = {
|
||||
name: string
|
||||
@@ -36,7 +35,6 @@ function HistoryFileTreeFolder({
|
||||
docs,
|
||||
}: HistoryFileTreeFolderProps) {
|
||||
const { t } = useTranslation()
|
||||
const newEditor = useIsNewEditorEnabled()
|
||||
|
||||
const [expanded, setExpanded] = useState(() => {
|
||||
return hasChanges({ name, folders, docs })
|
||||
@@ -54,12 +52,6 @@ function HistoryFileTreeFolder({
|
||||
className="file-tree-expand-icon"
|
||||
/>
|
||||
</button>
|
||||
{!newEditor && (
|
||||
<MaterialIcon
|
||||
type={expanded ? 'folder_open' : 'folder'}
|
||||
className="file-tree-folder-icon"
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
)
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import { OLToastContainer } from '@/shared/components/ol/ol-toast-container'
|
||||
import useTutorial from '@/shared/hooks/promotions/use-tutorial'
|
||||
import { memo, useCallback, useEffect, useMemo, useState } from 'react'
|
||||
import { sendMB } from '@/infrastructure/event-tracking'
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
|
||||
type EditorSurveyPage = 'ease-of-use' | 'meets-my-needs' | 'thank-you'
|
||||
@@ -27,7 +26,6 @@ const EditorSurveyContent = () => {
|
||||
const [easeOfUse, setEaseOfUse] = useState<number | null>(null)
|
||||
const [meetsMyNeeds, setMeetsMyNeeds] = useState<number | null>(null)
|
||||
const [page, setPage] = useState<EditorSurveyPage>('ease-of-use')
|
||||
const newEditor = useIsNewEditorEnabled()
|
||||
|
||||
const { t } = useTranslation()
|
||||
|
||||
@@ -51,11 +49,10 @@ const EditorSurveyContent = () => {
|
||||
sendMB('editor-survey-submit', {
|
||||
easeOfUse,
|
||||
meetsMyNeeds,
|
||||
newEditor,
|
||||
})
|
||||
setPage('thank-you')
|
||||
completeSurvey({ event: 'promo-click', action: 'complete' })
|
||||
}, [easeOfUse, meetsMyNeeds, completeSurvey, newEditor])
|
||||
}, [easeOfUse, meetsMyNeeds, completeSurvey])
|
||||
|
||||
if (!showSurvey && page !== 'thank-you') {
|
||||
return null
|
||||
|
||||
@@ -3,12 +3,10 @@ import { useCallback, useId } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context'
|
||||
import OLIconButton from '@/shared/components/ol/ol-icon-button'
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
|
||||
export const PdfHybridThemeButton = () => {
|
||||
const id = useId()
|
||||
const { t } = useTranslation()
|
||||
const usesNewEditor = useIsNewEditorEnabled()
|
||||
const {
|
||||
pdfViewer,
|
||||
darkModePdf,
|
||||
@@ -21,11 +19,6 @@ export const PdfHybridThemeButton = () => {
|
||||
setDarkModePdf(!darkModePdf)
|
||||
}, [darkModePdf, setDarkModePdf])
|
||||
|
||||
if (!usesNewEditor) {
|
||||
// The old editor does not support dark mode PDF, so don't show the button
|
||||
return null
|
||||
}
|
||||
|
||||
if (activeOverallTheme !== 'dark') {
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ import { createRoot } from 'react-dom/client'
|
||||
import PdfPreview from './pdf-preview'
|
||||
import useWaitForI18n from '../../../shared/hooks/use-wait-for-i18n'
|
||||
import { ReactContextRoot } from '@/features/ide-react/context/react-context-root'
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
import { useDetachCompileContext as useCompileContext } from '@/shared/context/detach-compile-context'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
@@ -36,11 +35,6 @@ function PdfPreviewDetachedRootContent() {
|
||||
)
|
||||
}
|
||||
function EditorRedesignWrapper({ children }: { children: React.ReactNode }) {
|
||||
const newEditorEnabled = useIsNewEditorEnabled()
|
||||
if (!newEditorEnabled) {
|
||||
return <>{children}</>
|
||||
}
|
||||
|
||||
// TODO ide-redesign-cleanup: this wrapper should not be required
|
||||
return <div className="ide-redesign-main">{children}</div>
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import { PdfPreviewMessages } from './pdf-preview-messages'
|
||||
import CompileTimeWarningUpgradePrompt from './compile-time-warning-upgrade-prompt'
|
||||
import { PdfPreviewProvider } from './pdf-preview-provider'
|
||||
import PdfPreviewHybridToolbar from '@/features/pdf-preview/components/pdf-preview-hybrid-toolbar'
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
import importOverleafModules from '../../../../macros/import-overleaf-module.macro'
|
||||
import PdfCodeCheckFailedBanner from '@/features/pdf-preview/components/pdf-code-check-failed-banner'
|
||||
import getMeta from '@/utils/meta'
|
||||
@@ -21,12 +20,8 @@ function PdfPreviewPane() {
|
||||
activeOverallTheme,
|
||||
} = useCompileContext()
|
||||
const { compileTimeout } = getMeta('ol-compileSettings')
|
||||
const usesNewEditor = useIsNewEditorEnabled()
|
||||
const darkModePdf =
|
||||
usesNewEditor &&
|
||||
pdfViewer === 'pdfjs' &&
|
||||
activeOverallTheme === 'dark' &&
|
||||
darkModeSetting
|
||||
pdfViewer === 'pdfjs' && activeOverallTheme === 'dark' && darkModeSetting
|
||||
|
||||
const classes = classNames('pdf', 'full-size', {
|
||||
'pdf-empty': !pdfUrl,
|
||||
|
||||
@@ -2,7 +2,6 @@ import { useCallback } from 'react'
|
||||
import { useLayoutContext } from '@/shared/context/layout-context'
|
||||
import { useEditorContext } from '@/shared/context/editor-context'
|
||||
import useEventListener from '@/shared/hooks/use-event-listener'
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
|
||||
function scrollIntoView(element: Element) {
|
||||
setTimeout(() => {
|
||||
@@ -18,39 +17,8 @@ function scrollIntoView(element: Element) {
|
||||
*/
|
||||
export const useLogEvents = (setShowLogs: (show: boolean) => void) => {
|
||||
const { pdfLayout, setView } = useLayoutContext()
|
||||
const newEditor = useIsNewEditorEnabled()
|
||||
const { hasPremiumSuggestion } = useEditorContext()
|
||||
|
||||
const selectLogOldLogs = useCallback((id: string, suggestFix: boolean) => {
|
||||
window.setTimeout(() => {
|
||||
const element = document.querySelector(
|
||||
`.log-entry[data-log-entry-id="${id}"]`
|
||||
)
|
||||
|
||||
if (element) {
|
||||
scrollIntoView(element)
|
||||
|
||||
if (suggestFix) {
|
||||
// if they are paywalled, click that instead
|
||||
const paywall = document.querySelector<HTMLButtonElement>(
|
||||
'button[data-action="assistant-paywall-show"]'
|
||||
)
|
||||
|
||||
if (paywall) {
|
||||
scrollIntoView(paywall)
|
||||
paywall.click()
|
||||
} else {
|
||||
element
|
||||
.querySelector<HTMLButtonElement>(
|
||||
'button[data-action="suggest-fix"]'
|
||||
)
|
||||
?.click()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}, [])
|
||||
|
||||
const selectLogNewLogs = useCallback(
|
||||
(
|
||||
id: string,
|
||||
@@ -117,17 +85,13 @@ export const useLogEvents = (setShowLogs: (show: boolean) => void) => {
|
||||
|
||||
openLogs()
|
||||
|
||||
if (newEditor) {
|
||||
selectLogNewLogs(
|
||||
id,
|
||||
Boolean(suggestFix),
|
||||
Boolean(showPaywallIfOutOfSuggestions)
|
||||
)
|
||||
} else {
|
||||
selectLogOldLogs(id, Boolean(suggestFix))
|
||||
}
|
||||
selectLogNewLogs(
|
||||
id,
|
||||
Boolean(suggestFix),
|
||||
Boolean(showPaywallIfOutOfSuggestions)
|
||||
)
|
||||
},
|
||||
[openLogs, selectLogNewLogs, selectLogOldLogs, newEditor]
|
||||
[openLogs, selectLogNewLogs]
|
||||
)
|
||||
|
||||
useEventListener(
|
||||
|
||||
@@ -1,28 +1,17 @@
|
||||
import { FC, memo } from 'react'
|
||||
import { ReviewPanelResolvedThreadsButton } from './review-panel-resolved-threads-button'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { PanelHeading } from '@/shared/components/panel-heading'
|
||||
import useReviewPanelLayout from '../hooks/use-review-panel-layout'
|
||||
import RailPanelHeader from '@/features/ide-react/components/rail/rail-panel-header'
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
|
||||
const ReviewPanelHeader: FC = () => {
|
||||
const { closeReviewPanel } = useReviewPanelLayout()
|
||||
const { t } = useTranslation()
|
||||
const newEditor = useIsNewEditorEnabled()
|
||||
|
||||
return (
|
||||
<div className="review-panel-header">
|
||||
{newEditor ? (
|
||||
<RailPanelHeader
|
||||
title={t('review')}
|
||||
actions={<ReviewPanelResolvedThreadsButton key="resolve-threads" />}
|
||||
/>
|
||||
) : (
|
||||
<PanelHeading title={t('review')} handleClose={closeReviewPanel}>
|
||||
<ReviewPanelResolvedThreadsButton />
|
||||
</PanelHeading>
|
||||
)}
|
||||
<RailPanelHeader
|
||||
title={t('review')}
|
||||
actions={<ReviewPanelResolvedThreadsButton key="resolve-threads" />}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ import { useTranslation } from 'react-i18next'
|
||||
import { ToggleSearchButton } from '@/features/source-editor/components/toolbar/toggle-search-button'
|
||||
import ReviewPanelHeader from '@/features/review-panel/components/review-panel-header'
|
||||
import useReviewPanelLayout from '@/features/review-panel/hooks/use-review-panel-layout'
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
import Breadcrumbs from '@/features/source-editor/extensions/breadcrumbs'
|
||||
import classNames from 'classnames'
|
||||
import { useUserSettingsContext } from '@/shared/context/user-settings-context'
|
||||
@@ -73,7 +72,6 @@ const Toolbar = memo(function Toolbar() {
|
||||
|
||||
const listDepth = minimumListDepthForSelection(state)
|
||||
|
||||
const newEditor = useIsNewEditorEnabled()
|
||||
const { showHeader: showReviewPanelHeader } = useReviewPanelLayout()
|
||||
|
||||
const {
|
||||
@@ -162,11 +160,11 @@ const Toolbar = memo(function Toolbar() {
|
||||
|
||||
return (
|
||||
<>
|
||||
{newEditor && showReviewPanelHeader && <ReviewPanelHeader />}
|
||||
{showReviewPanelHeader && <ReviewPanelHeader />}
|
||||
<div
|
||||
id="ol-cm-toolbar-wrapper"
|
||||
className={classNames('ol-cm-toolbar-wrapper', {
|
||||
'ol-cm-toolbar-wrapper-indented': newEditor && showReviewPanelHeader,
|
||||
'ol-cm-toolbar-wrapper-indented': showReviewPanelHeader,
|
||||
})}
|
||||
>
|
||||
<div
|
||||
@@ -224,7 +222,7 @@ const Toolbar = memo(function Toolbar() {
|
||||
<Component key={path} />
|
||||
)
|
||||
)}
|
||||
{newEditor && breadcrumbs && <Breadcrumbs />}
|
||||
{breadcrumbs && <Breadcrumbs />}
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
|
||||
+3
-10
@@ -1,35 +1,28 @@
|
||||
import { sendSearchEvent } from '@/features/event-tracking/search-events'
|
||||
import OLButton from '@/shared/components/ol/ol-button'
|
||||
import OLTooltip from '@/shared/components/ol/ol-tooltip'
|
||||
import { useLayoutContext } from '@/shared/context/layout-context'
|
||||
import { closeSearchPanel, SearchQuery } from '@codemirror/search'
|
||||
import { useCallback } from 'react'
|
||||
import { useCodeMirrorViewContext } from './codemirror-context'
|
||||
import MaterialIcon from '@/shared/components/material-icon'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
import { useRailContext } from '@/features/ide-react/context/rail-context'
|
||||
|
||||
export const FullProjectSearchButton = ({ query }: { query: SearchQuery }) => {
|
||||
const view = useCodeMirrorViewContext()
|
||||
const { t } = useTranslation()
|
||||
const { setProjectSearchIsOpen } = useLayoutContext()
|
||||
const newEditor = useIsNewEditorEnabled()
|
||||
const { openTab } = useRailContext()
|
||||
|
||||
const openFullProjectSearch = useCallback(() => {
|
||||
if (newEditor) {
|
||||
openTab('full-project-search')
|
||||
} else {
|
||||
setProjectSearchIsOpen(true)
|
||||
}
|
||||
openTab('full-project-search')
|
||||
|
||||
closeSearchPanel(view)
|
||||
window.setTimeout(() => {
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('editor:full-project-search', { detail: query })
|
||||
)
|
||||
}, 200)
|
||||
}, [setProjectSearchIsOpen, query, view, newEditor, openTab])
|
||||
}, [query, view, openTab])
|
||||
|
||||
const onClick = useCallback(() => {
|
||||
sendSearchEvent('search-open', {
|
||||
|
||||
+4
-14
@@ -24,7 +24,6 @@ import { mathPreviewStateField } from '../extensions/math-preview'
|
||||
import { getTooltip } from '@codemirror/view'
|
||||
import ReactDOM from 'react-dom'
|
||||
import OLDropdownMenuItem from '@/shared/components/ol/ol-dropdown-menu-item'
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
|
||||
const MathPreviewTooltipContainer: FC = () => {
|
||||
const state = useCodeMirrorStateContext()
|
||||
@@ -60,8 +59,6 @@ const MathPreviewTooltipContainer: FC = () => {
|
||||
const MathPreviewTooltipMenu: FC = () => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
const newEditor = useIsNewEditorEnabled()
|
||||
|
||||
const [showDisableModal, setShowDisableModal] = useState(false)
|
||||
const { setMathPreview } = useProjectSettingsContext()
|
||||
const openDisableModal = useCallback(() => setShowDisableModal(true), [])
|
||||
@@ -126,17 +123,10 @@ const MathPreviewTooltipMenu: FC = () => {
|
||||
<OLModalBody>
|
||||
{t('disable_equation_preview_confirm')}
|
||||
<br />
|
||||
{newEditor ? (
|
||||
<Trans
|
||||
i18nKey="disable_equation_preview_enable_in_settings"
|
||||
components={{ b: <strong /> }}
|
||||
/>
|
||||
) : (
|
||||
<Trans
|
||||
i18nKey="disable_equation_preview_enable"
|
||||
components={{ b: <strong /> }}
|
||||
/>
|
||||
)}
|
||||
<Trans
|
||||
i18nKey="disable_equation_preview_enable_in_settings"
|
||||
components={{ b: <strong /> }}
|
||||
/>
|
||||
</OLModalBody>
|
||||
|
||||
<OLModalFooter>
|
||||
|
||||
+4
-9
@@ -13,7 +13,6 @@ import { redo, selectAll, undo } from '@codemirror/commands'
|
||||
import { openSearchPanel } from '@codemirror/search'
|
||||
import { useCallback } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import { useIsNewEditorEnabled } from '../../ide-redesign/utils/new-editor-utils'
|
||||
import { usePermissionsContext } from '@/features/ide-react/context/permissions-context'
|
||||
import { language } from '@codemirror/language'
|
||||
|
||||
@@ -35,10 +34,8 @@ export const useToolbarMenuBarEditorCommands = () => {
|
||||
)
|
||||
}, [])
|
||||
|
||||
const newEditor = useIsNewEditorEnabled()
|
||||
|
||||
useCommandProvider(() => {
|
||||
if (!newEditor || !editorIsVisible) {
|
||||
if (!editorIsVisible) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -80,11 +77,11 @@ export const useToolbarMenuBarEditorCommands = () => {
|
||||
},
|
||||
},
|
||||
]
|
||||
}, [editorIsVisible, t, view, trackedWrite, newEditor])
|
||||
}, [editorIsVisible, t, view, trackedWrite])
|
||||
|
||||
// LaTeX commands
|
||||
useCommandProvider(() => {
|
||||
if (!newEditor || !editorIsVisible) {
|
||||
if (!editorIsVisible) {
|
||||
return
|
||||
}
|
||||
if (!isTeXFile || !trackedWrite) {
|
||||
@@ -284,7 +281,6 @@ export const useToolbarMenuBarEditorCommands = () => {
|
||||
t,
|
||||
editorIsVisible,
|
||||
openFigureModal,
|
||||
newEditor,
|
||||
trackedWrite,
|
||||
isTeXFile,
|
||||
state.selection.main.empty,
|
||||
@@ -294,7 +290,7 @@ export const useToolbarMenuBarEditorCommands = () => {
|
||||
const { toggleSymbolPalette } = useEditorPropertiesContext()
|
||||
const symbolPaletteAvailable = getMeta('ol-symbolPaletteAvailable')
|
||||
useCommandProvider(() => {
|
||||
if (!newEditor || !editorIsVisible) {
|
||||
if (!editorIsVisible) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -322,6 +318,5 @@ export const useToolbarMenuBarEditorCommands = () => {
|
||||
editorIsVisible,
|
||||
isTeXFile,
|
||||
trackedWrite,
|
||||
newEditor,
|
||||
])
|
||||
}
|
||||
|
||||
@@ -457,7 +457,6 @@
|
||||
"cookie_banner_info": "We only use cookies for essential purposes and to improve your experience on our site. You can find out more in our <0>cookie policy</0>.",
|
||||
"copied": "Copied",
|
||||
"copy": "Copy",
|
||||
"copy_code": "Copy code",
|
||||
"copy_project": "Copy project",
|
||||
"copy_response": "Copy response",
|
||||
"copying": "Copying",
|
||||
@@ -567,7 +566,6 @@
|
||||
"disable_ai_features": "Disable AI features",
|
||||
"disable_equation_preview": "Disable equation preview",
|
||||
"disable_equation_preview_confirm": "This will disable equation preview for you in all projects.",
|
||||
"disable_equation_preview_enable": "You can enable it again from the <b>Menu</b>.",
|
||||
"disable_equation_preview_enable_in_settings": "You can enable it again in <b>Settings</b>.",
|
||||
"disable_single_sign_on": "Disable single sign-on",
|
||||
"disable_sso": "Disable SSO",
|
||||
@@ -953,7 +951,6 @@
|
||||
"github_workflow_files_error": "The __appName__ GitHub sync service couldn’t sync GitHub Workflow files (in .github/workflows/). Please authorize __appName__ to edit your GitHub workflow files and try again.",
|
||||
"github_workflow_files_error_non_owner": "The __appName__ GitHub sync service couldn’t sync GitHub Workflow files (in .github/workflows/). Please ensure the project owner has authorized __appName__ to edit this project’s GitHub workflow files and try again.",
|
||||
"give_feedback": "Give feedback",
|
||||
"give_your_feedback": "give your feedback",
|
||||
"global": "global",
|
||||
"go_back_and_link_accts": "<a href=\"__link__\">Go back</a> and link your accounts",
|
||||
"go_next_page": "Go to Next Page",
|
||||
@@ -2458,7 +2455,6 @@
|
||||
"this_experiment_gives_you_access_to_new_versions_of_latex": "For advanced users only. This experiment gives you regular access to new, untested versions of TeX Live (the LaTeX engine used for compiling). You can then <0>choose this as your compiler</0> on a project-by-project basis. <1>Find out more about rolling TeX Live</1>",
|
||||
"this_field_is_required": "This field is required",
|
||||
"this_grants_access_to_features_2": "This grants you access to <0>__appName__</0> <0>__featureType__</0> features.",
|
||||
"this_is_a_new_feature": "This is a new feature",
|
||||
"this_is_the_file_that_references_pulled_from_your_reference_manager_will_be_added_to": "This is the file that references pulled from your reference manager will be added to.",
|
||||
"this_is_your_template": "This is your template from your project",
|
||||
"this_organization_is_tax_exempt": "This organization is tax exempt",
|
||||
|
||||
@@ -504,7 +504,6 @@
|
||||
"disable_ai_features": "禁用 AI 功能",
|
||||
"disable_equation_preview": "禁用公式预览",
|
||||
"disable_equation_preview_confirm": "这将在所有项目中禁用公式预览。",
|
||||
"disable_equation_preview_enable": "您可以从<b>菜单</b>再次启用它。",
|
||||
"disable_single_sign_on": "禁用 单点登录(SSO)",
|
||||
"disable_sso": "关闭 SSO",
|
||||
"disable_stop_on_first_error": "禁用 “出现第一个错误时停止”",
|
||||
|
||||
-9
@@ -1,17 +1,8 @@
|
||||
import React, { FC, lazy, Suspense } from 'react'
|
||||
import { useLayoutContext } from '@/shared/context/layout-context'
|
||||
import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
|
||||
|
||||
const FullProjectSearchUI = lazy(() => import('./full-project-search-ui'))
|
||||
|
||||
const FullProjectSearch: FC = () => {
|
||||
const { projectSearchIsOpen } = useLayoutContext()
|
||||
const newEditor = useIsNewEditorEnabled()
|
||||
|
||||
if (!projectSearchIsOpen && !newEditor) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<Suspense fallback={null}>
|
||||
<FullProjectSearchUI />
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
import { expect } from 'chai'
|
||||
|
||||
import iconTypeFromName from '../../../../../frontend/js/features/file-tree/util/icon-type-from-name'
|
||||
|
||||
describe('iconTypeFromName', function () {
|
||||
it('returns correct icon type', function () {
|
||||
expect(iconTypeFromName('main.tex')).to.equal('description')
|
||||
expect(iconTypeFromName('main.png')).to.equal('image')
|
||||
expect(iconTypeFromName('main.csv')).to.equal('table_chart')
|
||||
expect(iconTypeFromName('main.py')).to.equal('code')
|
||||
expect(iconTypeFromName('main.bib')).to.equal('menu_book')
|
||||
})
|
||||
|
||||
it('handles missing extensions', function () {
|
||||
expect(iconTypeFromName('main')).to.equal('description')
|
||||
})
|
||||
|
||||
it('lowercases extension', function () {
|
||||
expect(iconTypeFromName('ZOTERO.BIB')).to.equal('menu_book')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user