mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-13 21:53:43 +01:00
Merge pull request #35898 from overleaf/dp-visual-markdown-editor-setting
[web] Track markdown editor mode separately and default to visual GitOrigin-RevId: 7195189c683618b3e0c735f91193fb662078b558
This commit is contained in:
@@ -14,7 +14,10 @@ import getMeta from '@/utils/meta'
|
||||
import { useUnstableStoreSync } from '@/shared/hooks/use-unstable-store-sync'
|
||||
import { sendMB } from '@/infrastructure/event-tracking'
|
||||
import { useEditorOpenDocContext } from '@/features/ide-react/context/editor-open-doc-context'
|
||||
import { getVisualEditorStorageKey } from '@/features/source-editor/utils/visual-editor'
|
||||
import {
|
||||
getVisualEditorDefault,
|
||||
getVisualEditorStorageKey,
|
||||
} from '@/features/source-editor/utils/visual-editor'
|
||||
|
||||
// Context value type
|
||||
export type EditorPropertiesContextValue = {
|
||||
@@ -60,7 +63,7 @@ export function showVisualForFile(filename: string): boolean {
|
||||
if (key === 'editor.lastUsedMode') {
|
||||
return migrateTexVisualMode()
|
||||
}
|
||||
return false
|
||||
return getVisualEditorDefault(filename)
|
||||
}
|
||||
|
||||
export const EditorPropertiesProvider: FC<PropsWithChildren> = ({
|
||||
|
||||
@@ -24,6 +24,7 @@ import { sendMB } from '@/infrastructure/event-tracking'
|
||||
import { FileRef } from '../../../../../types/file-ref'
|
||||
import { useLayoutContext } from '@/shared/context/layout-context'
|
||||
import { isVisualEditorAvailable } from '@/features/source-editor/utils/visual-editor'
|
||||
import { isMarkdownFile } from '@/features/source-editor/utils/file'
|
||||
|
||||
const FileTreeOpenContext = createContext<
|
||||
| {
|
||||
@@ -108,6 +109,12 @@ export const FileTreeOpenProvider: FC<React.PropsWithChildren> = ({
|
||||
editorMode,
|
||||
})
|
||||
}
|
||||
if (isMarkdownFile(selected.entity.name)) {
|
||||
sendMB('open-md-file', {
|
||||
projectOwner,
|
||||
editorMode,
|
||||
})
|
||||
}
|
||||
}
|
||||
// Keep openFile scope value in sync with the file tree
|
||||
const openFile =
|
||||
|
||||
Reference in New Issue
Block a user