Просмотр исходного кода

Standardise naming of `openDocId` as `openDocWithId` or `currentDocumentId` (#23307)

GitOrigin-RevId: d71b6d878188c7b916f02a3749976ecd96d648a3
Alf Eaton 1 год назад
Родитель
Сommit
87186eb568

+ 1 - 1
services/web/frontend/js/features/history/context/hooks/use-restore-deleted-file.ts

@@ -42,7 +42,7 @@ export function useRestoreDeletedFile() {
         // Once Angular is gone, these can be replaced with calls to context
         // Once Angular is gone, these can be replaced with calls to context
         // methods
         // methods
         if (restoredFileMetadata.type === 'doc') {
         if (restoredFileMetadata.type === 'doc') {
-          ide.editorManager.openDocId(id)
+          ide.editorManager.openDocWithId(id)
         } else {
         } else {
           ide.binaryFilesManager.openFileWithId(id)
           ide.binaryFilesManager.openFileWithId(id)
         }
         }

+ 1 - 1
services/web/frontend/js/features/history/context/hooks/use-restore-selected-file.ts

@@ -43,7 +43,7 @@ export function useRestoreSelectedFile() {
         // Once Angular is gone, these can be replaced with calls to context
         // Once Angular is gone, these can be replaced with calls to context
         // methods
         // methods
         if (restoredFileMetadata.type === 'doc') {
         if (restoredFileMetadata.type === 'doc') {
-          ide.editorManager.openDocId(id)
+          ide.editorManager.openDocWithId(id)
         } else {
         } else {
           ide.binaryFilesManager.openFileWithId(id)
           ide.binaryFilesManager.openFileWithId(id)
         }
         }

+ 28 - 25
services/web/frontend/js/features/ide-react/context/editor-manager-context.tsx

@@ -51,10 +51,10 @@ export type EditorManager = {
   currentDocument: DocumentContainer
   currentDocument: DocumentContainer
   currentDocumentId: DocId | null
   currentDocumentId: DocId | null
   getCurrentDocValue: () => string | null
   getCurrentDocValue: () => string | null
-  getCurrentDocId: () => DocId | null
+  getCurrentDocumentId: () => DocId | null
   startIgnoringExternalUpdates: () => void
   startIgnoringExternalUpdates: () => void
   stopIgnoringExternalUpdates: () => void
   stopIgnoringExternalUpdates: () => void
-  openDocId: (docId: string, options?: OpenDocOptions) => void
+  openDocWithId: (docId: string, options?: OpenDocOptions) => void
   openDoc: (document: Doc, options?: OpenDocOptions) => void
   openDoc: (document: Doc, options?: OpenDocOptions) => void
   openDocs: OpenDocuments
   openDocs: OpenDocuments
   openInitialDoc: (docId: string) => void
   openInitialDoc: (docId: string) => void
@@ -109,7 +109,7 @@ export const EditorManagerProvider: FC = ({ children }) => {
   const [showVisual] = useScopeValue<boolean>('editor.showVisual')
   const [showVisual] = useScopeValue<boolean>('editor.showVisual')
   const [currentDocument, setCurrentDocument] =
   const [currentDocument, setCurrentDocument] =
     useScopeValue<DocumentContainer>('editor.sharejs_doc')
     useScopeValue<DocumentContainer>('editor.sharejs_doc')
-  const [openDocId, setOpenDocId] = useScopeValue<DocId | null>(
+  const [currentDocumentId, setCurrentDocumentId] = useScopeValue<DocId | null>(
     'editor.open_doc_id'
     'editor.open_doc_id'
   )
   )
   const [, setOpenDocName] = useScopeValue<string | null>(
   const [, setOpenDocName] = useScopeValue<string | null>(
@@ -191,14 +191,14 @@ export const EditorManagerProvider: FC = ({ children }) => {
       )
       )
   )
   )
 
 
-  const openDocIdStorageKey = `doc.open_id.${projectId}`
+  const currentDocumentIdStorageKey = `doc.open_id.${projectId}`
 
 
   // Persist the open document ID to local storage
   // Persist the open document ID to local storage
   useEffect(() => {
   useEffect(() => {
-    if (openDocId) {
-      customLocalStorage.setItem(openDocIdStorageKey, openDocId)
+    if (currentDocumentId) {
+      customLocalStorage.setItem(currentDocumentIdStorageKey, currentDocumentId)
     }
     }
-  }, [openDocId, openDocIdStorageKey])
+  }, [currentDocumentId, currentDocumentIdStorageKey])
 
 
   const editorOpenDocEpochRef = useRef(0)
   const editorOpenDocEpochRef = useRef(0)
 
 
@@ -230,7 +230,10 @@ export const EditorManagerProvider: FC = ({ children }) => {
     return currentDocument?.getSnapshot() ?? null
     return currentDocument?.getSnapshot() ?? null
   }, [currentDocument])
   }, [currentDocument])
 
 
-  const getCurrentDocId = useCallback(() => openDocId, [openDocId])
+  const getCurrentDocumentId = useCallback(
+    () => currentDocumentId,
+    [currentDocumentId]
+  )
 
 
   const startIgnoringExternalUpdates = useCallback(
   const startIgnoringExternalUpdates = useCallback(
     () => setIgnoringExternalUpdates(true),
     () => setIgnoringExternalUpdates(true),
@@ -379,9 +382,9 @@ export const EditorManagerProvider: FC = ({ children }) => {
       //     between leaving and joining the same document
       //     between leaving and joining the same document
       //  - when the current one has pending ops that need flushing, to avoid
       //  - when the current one has pending ops that need flushing, to avoid
       //     race conditions from cleanup
       //     race conditions from cleanup
-      const currentDocId = currentDocument?.doc_id
+      const currentDocumentId = currentDocument?.doc_id
       const hasBufferedOps = currentDocument?.hasBufferedOps()
       const hasBufferedOps = currentDocument?.hasBufferedOps()
-      const changingDoc = currentDocument && currentDocId !== doc._id
+      const changingDoc = currentDocument && currentDocumentId !== doc._id
       if (changingDoc || hasBufferedOps) {
       if (changingDoc || hasBufferedOps) {
         debugConsole.log('[openNewDocument] Leaving existing open doc...')
         debugConsole.log('[openNewDocument] Leaving existing open doc...')
 
 
@@ -401,7 +404,7 @@ export const EditorManagerProvider: FC = ({ children }) => {
           await currentDocument.leaveAndCleanUpPromise()
           await currentDocument.leaveAndCleanUpPromise()
         } catch (error) {
         } catch (error) {
           debugConsole.log(
           debugConsole.log(
-            `[openNewDocument] error leaving doc ${currentDocId}`,
+            `[openNewDocument] error leaving doc ${currentDocumentId}`,
             error
             error
           )
           )
           throw error
           throw error
@@ -419,10 +422,10 @@ export const EditorManagerProvider: FC = ({ children }) => {
     [attachErrorHandlerToDocument, doOpenNewDocument, currentDocument]
     [attachErrorHandlerToDocument, doOpenNewDocument, currentDocument]
   )
   )
 
 
-  const openDocIdRef = useRef(openDocId)
+  const currentDocumentIdRef = useRef(currentDocumentId)
   useEffect(() => {
   useEffect(() => {
-    openDocIdRef.current = openDocId
-  }, [openDocId])
+    currentDocumentIdRef.current = currentDocumentId
+  }, [currentDocumentId])
 
 
   const openDoc = useCallback(
   const openDoc = useCallback(
     async (doc: Doc, options: OpenDocOptions = {}) => {
     async (doc: Doc, options: OpenDocOptions = {}) => {
@@ -468,14 +471,14 @@ export const EditorManagerProvider: FC = ({ children }) => {
       // If we already have the document open, or are opening the document, we can return at this point.
       // If we already have the document open, or are opening the document, we can return at this point.
       // Note: only use forceReopen:true to override this when the document is
       // Note: only use forceReopen:true to override this when the document is
       // out of sync and needs to be reloaded from the server.
       // out of sync and needs to be reloaded from the server.
-      if (doc._id === openDocIdRef.current && !options.forceReopen) {
+      if (doc._id === currentDocumentIdRef.current && !options.forceReopen) {
         done(false)
         done(false)
         return
         return
       }
       }
 
 
       // We're now either opening a new document or reloading a broken one.
       // We're now either opening a new document or reloading a broken one.
-      openDocIdRef.current = doc._id as DocId
-      setOpenDocId(doc._id as DocId)
+      currentDocumentIdRef.current = doc._id as DocId
+      setCurrentDocumentId(doc._id as DocId)
       setOpenDocName(doc.name)
       setOpenDocName(doc.name)
       setOpening(true)
       setOpening(true)
 
 
@@ -507,7 +510,7 @@ export const EditorManagerProvider: FC = ({ children }) => {
       jumpToLine,
       jumpToLine,
       openNewDocument,
       openNewDocument,
       setCurrentDocument,
       setCurrentDocument,
-      setOpenDocId,
+      setCurrentDocumentId,
       setOpenDocName,
       setOpenDocName,
       setOpening,
       setOpening,
       setView,
       setView,
@@ -532,12 +535,12 @@ export const EditorManagerProvider: FC = ({ children }) => {
   const openInitialDoc = useCallback(
   const openInitialDoc = useCallback(
     (fallbackDocId: string) => {
     (fallbackDocId: string) => {
       const docId =
       const docId =
-        customLocalStorage.getItem(openDocIdStorageKey) || fallbackDocId
+        customLocalStorage.getItem(currentDocumentIdStorageKey) || fallbackDocId
       if (docId) {
       if (docId) {
         openDocWithId(docId)
         openDocWithId(docId)
       }
       }
     },
     },
-    [openDocIdStorageKey, openDocWithId]
+    [currentDocumentIdStorageKey, openDocWithId]
   )
   )
 
 
   useEffect(() => {
   useEffect(() => {
@@ -662,12 +665,12 @@ export const EditorManagerProvider: FC = ({ children }) => {
       getEditorType,
       getEditorType,
       showSymbolPalette,
       showSymbolPalette,
       currentDocument,
       currentDocument,
-      currentDocumentId: openDocId,
+      currentDocumentId,
       getCurrentDocValue,
       getCurrentDocValue,
-      getCurrentDocId,
+      getCurrentDocumentId,
       startIgnoringExternalUpdates,
       startIgnoringExternalUpdates,
       stopIgnoringExternalUpdates,
       stopIgnoringExternalUpdates,
-      openDocId: openDocWithId,
+      openDocWithId,
       openDoc,
       openDoc,
       openDocs,
       openDocs,
       openInitialDoc,
       openInitialDoc,
@@ -680,9 +683,9 @@ export const EditorManagerProvider: FC = ({ children }) => {
       getEditorType,
       getEditorType,
       showSymbolPalette,
       showSymbolPalette,
       currentDocument,
       currentDocument,
-      openDocId,
+      currentDocumentId,
       getCurrentDocValue,
       getCurrentDocValue,
-      getCurrentDocId,
+      getCurrentDocumentId,
       startIgnoringExternalUpdates,
       startIgnoringExternalUpdates,
       stopIgnoringExternalUpdates,
       stopIgnoringExternalUpdates,
       openDocWithId,
       openDocWithId,

+ 5 - 8
services/web/frontend/js/features/ide-react/context/file-tree-open-context.tsx

@@ -39,11 +39,8 @@ const FileTreeOpenContext = createContext<
 export const FileTreeOpenProvider: FC = ({ children }) => {
 export const FileTreeOpenProvider: FC = ({ children }) => {
   const { rootDocId, owner } = useProjectContext()
   const { rootDocId, owner } = useProjectContext()
   const { eventEmitter, projectJoined } = useIdeReactContext()
   const { eventEmitter, projectJoined } = useIdeReactContext()
-  const {
-    openDocId: openDocWithId,
-    currentDocumentId: openDocId,
-    openInitialDoc,
-  } = useEditorManagerContext()
+  const { openDocWithId, currentDocumentId, openInitialDoc } =
+    useEditorManagerContext()
   const { selectEntity } = useSelectFileTreeEntity()
   const { selectEntity } = useSelectFileTreeEntity()
   const [, setOpenFile] = useScopeValue<BinaryFile | null>('openFile')
   const [, setOpenFile] = useScopeValue<BinaryFile | null>('openFile')
   const [openEntity, setOpenEntity] = useState<
   const [openEntity, setOpenEntity] = useState<
@@ -107,14 +104,14 @@ export const FileTreeOpenProvider: FC = ({ children }) => {
     (entity: FileTreeFindResult) => {
     (entity: FileTreeFindResult) => {
       eventEmitter.emit('entity:deleted', entity)
       eventEmitter.emit('entity:deleted', entity)
       // Select the root document if the current document was deleted
       // Select the root document if the current document was deleted
-      if (entity.entity._id === openDocId) {
+      if (entity.entity._id === currentDocumentId) {
         openDocWithId(rootDocId!)
         openDocWithId(rootDocId!)
       }
       }
     },
     },
-    [eventEmitter, openDocId, openDocWithId, rootDocId]
+    [eventEmitter, currentDocumentId, openDocWithId, rootDocId]
   )
   )
 
 
-  // Synchronize the file tree when openDoc or openDocId is called on the editor
+  // Synchronize the file tree when openDoc or openDocWithId is called on the editor
   // manager context from elsewhere. If the file tree does change, it will
   // manager context from elsewhere. If the file tree does change, it will
   // trigger the onSelect handler in this component, which will update the local
   // trigger the onSelect handler in this component, which will update the local
   // state.
   // state.

+ 3 - 3
services/web/frontend/js/features/ide-react/context/online-users-context.tsx

@@ -76,7 +76,7 @@ const OnlineUsersContext = createContext<OnlineUsersContextValue | undefined>(
 export const OnlineUsersProvider: FC = ({ children }) => {
 export const OnlineUsersProvider: FC = ({ children }) => {
   const { eventEmitter } = useIdeReactContext()
   const { eventEmitter } = useIdeReactContext()
   const { socket } = useConnectionContext()
   const { socket } = useConnectionContext()
-  const [openDocId] = useScopeValue<string | null>('editor.open_doc_id')
+  const [currentDocumentId] = useScopeValue<string | null>('editor.open_doc_id')
   const { fileTreeData } = useFileTreeData()
   const { fileTreeData } = useFileTreeData()
 
 
   const [onlineUsers, setOnlineUsers] =
   const [onlineUsers, setOnlineUsers] =
@@ -235,14 +235,14 @@ export const OnlineUsersProvider: FC = ({ children }) => {
       socket.emit('clientTracking.updatePosition', {
       socket.emit('clientTracking.updatePosition', {
         row: currentPosition?.row,
         row: currentPosition?.row,
         column: currentPosition?.column,
         column: currentPosition?.column,
-        doc_id: openDocId,
+        doc_id: currentDocumentId,
       })
       })
     }, cursorUpdateInterval)
     }, cursorUpdateInterval)
 
 
     return () => {
     return () => {
       window.clearTimeout(timer)
       window.clearTimeout(timer)
     }
     }
-  }, [currentPosition, cursorUpdateInterval, openDocId, socket])
+  }, [currentPosition, cursorUpdateInterval, currentDocumentId, socket])
 
 
   const handleClientUpdated = useCallback(
   const handleClientUpdated = useCallback(
     (client: OnlineUser) => {
     (client: OnlineUser) => {

+ 3 - 3
services/web/frontend/js/features/ide-react/context/review-panel/hooks/use-review-panel-state.ts

@@ -138,7 +138,7 @@ function useReviewPanelState(): ReviewPanel.ReviewPanelState {
   } = project
   } = project
   const { isRestrictedTokenMember } = useEditorContext()
   const { isRestrictedTokenMember } = useEditorContext()
   const {
   const {
-    openDocId,
+    openDocWithId,
     currentDocument,
     currentDocument,
     currentDocumentId,
     currentDocumentId,
     wantTrackChanges,
     wantTrackChanges,
@@ -845,9 +845,9 @@ function useReviewPanelState(): ReviewPanel.ReviewPanelState {
 
 
   const gotoEntry = useCallback(
   const gotoEntry = useCallback(
     (docId: DocId, entryOffset: number) => {
     (docId: DocId, entryOffset: number) => {
-      openDocId(docId, { gotoOffset: entryOffset })
+      openDocWithId(docId, { gotoOffset: entryOffset })
     },
     },
-    [openDocId]
+    [openDocWithId]
   )
   )
 
 
   const view = reviewPanelOpen ? subView : 'mini'
   const view = reviewPanelOpen ? subView : 'mini'

+ 3 - 3
services/web/frontend/js/features/pdf-preview/components/pdf-synctex-controls.jsx

@@ -190,7 +190,7 @@ function PdfSynctexControls() {
 
 
   const [cursorPosition, setCursorPosition] = useState(() => {
   const [cursorPosition, setCursorPosition] = useState(() => {
     const position = localStorage.getItem(
     const position = localStorage.getItem(
-      `doc.position.${ide.editorManager.getCurrentDocId()}`
+      `doc.position.${ide.editorManager.getCurrentDocumentId()}`
     )
     )
     return position ? position.cursorPosition : null
     return position ? position.cursorPosition : null
   })
   })
@@ -216,7 +216,7 @@ function PdfSynctexControls() {
   const [, setSynctexError] = useScopeValue('sync_tex_error')
   const [, setSynctexError] = useScopeValue('sync_tex_error')
 
 
   const getCurrentFilePath = useCallback(() => {
   const getCurrentFilePath = useCallback(() => {
-    const docId = ide.editorManager.getCurrentDocId()
+    const docId = ide.editorManager.getCurrentDocumentId()
     let path = pathInFolder(docId)
     let path = pathInFolder(docId)
 
 
     // If the root file is folder/main.tex, then synctex sees the path as folder/./main.tex
     // If the root file is folder/main.tex, then synctex sees the path as folder/./main.tex
@@ -238,7 +238,7 @@ function PdfSynctexControls() {
           return
           return
         }
         }
 
 
-        ide.editorManager.openDocId(doc._id, {
+        ide.editorManager.openDocWithId(doc._id, {
           gotoLine: line,
           gotoLine: line,
         })
         })
       } else {
       } else {

+ 5 - 5
services/web/frontend/js/features/review-panel-new/components/review-panel-entry.tsx

@@ -45,7 +45,7 @@ export const ReviewPanelEntry: FC<{
 }) => {
 }) => {
   const state = useCodeMirrorStateContext()
   const state = useCodeMirrorStateContext()
   const view = useCodeMirrorViewContext()
   const view = useCodeMirrorViewContext()
-  const { openDocId, getCurrentDocId } = useEditorManagerContext()
+  const { openDocWithId, getCurrentDocumentId } = useEditorManagerContext()
   const [selected, setSelected] = useState(false)
   const [selected, setSelected] = useState(false)
   const [focused, setFocused] = useState(false)
   const [focused, setFocused] = useState(false)
   const [textareaFocused, setTextareaFocused] = useState(false)
   const [textareaFocused, setTextareaFocused] = useState(false)
@@ -89,8 +89,8 @@ export const ReviewPanelEntry: FC<{
         return
         return
       }
       }
 
 
-      if (getCurrentDocId() !== docId) {
-        openDocId(docId, { gotoOffset: position, keepCurrentView: true })
+      if (getCurrentDocumentId() !== docId) {
+        openDocWithId(docId, { gotoOffset: position, keepCurrentView: true })
       } else {
       } else {
         setTimeout(() =>
         setTimeout(() =>
           view.dispatch({
           view.dispatch({
@@ -101,12 +101,12 @@ export const ReviewPanelEntry: FC<{
       }
       }
     },
     },
     [
     [
-      getCurrentDocId,
+      getCurrentDocumentId,
       docId,
       docId,
       selectLineOnFocus,
       selectLineOnFocus,
       view,
       view,
       position,
       position,
-      openDocId,
+      openDocWithId,
       reviewPanelOpen,
       reviewPanelOpen,
     ]
     ]
   )
   )

+ 3 - 3
services/web/frontend/js/features/source-editor/hooks/use-included-file.ts

@@ -12,7 +12,7 @@ import {
 export const useIncludedFile = (argumentType: string) => {
 export const useIncludedFile = (argumentType: string) => {
   const state = useCodeMirrorStateContext()
   const state = useCodeMirrorStateContext()
   const { findEntityByPath } = useFileTreePathContext()
   const { findEntityByPath } = useFileTreePathContext()
-  const { openDocId } = useEditorManagerContext()
+  const { openDocWithId } = useEditorManagerContext()
 
 
   const openIncludedFile = useCallback(() => {
   const openIncludedFile = useCallback(() => {
     const name = readIncludedPath(state, argumentType)
     const name = readIncludedPath(state, argumentType)
@@ -21,12 +21,12 @@ export const useIncludedFile = (argumentType: string) => {
       for (const extension of ['.tex', '']) {
       for (const extension of ['.tex', '']) {
         const result = findEntityByPath(`${name}${extension}`)
         const result = findEntityByPath(`${name}${extension}`)
         if (result) {
         if (result) {
-          return openDocId(result.entity._id)
+          return openDocWithId(result.entity._id)
         }
         }
       }
       }
       // TODO: handle file not found
       // TODO: handle file not found
     }
     }
-  }, [argumentType, findEntityByPath, openDocId, state])
+  }, [argumentType, findEntityByPath, openDocWithId, state])
 
 
   return { openIncludedFile }
   return { openIncludedFile }
 }
 }

+ 3 - 3
services/web/frontend/js/shared/context/file-tree-data-context.tsx

@@ -178,7 +178,7 @@ export function useFileTreeData() {
 
 
 export const FileTreeDataProvider: FC = ({ children }) => {
 export const FileTreeDataProvider: FC = ({ children }) => {
   const [project] = useScopeValue<Project>('project')
   const [project] = useScopeValue<Project>('project')
-  const [openDocId] = useScopeValue('editor.open_doc_id')
+  const [currentDocumentId] = useScopeValue('editor.open_doc_id')
   const [, setOpenDocName] = useScopeValueSetterOnly('editor.open_doc_name')
   const [, setOpenDocName] = useScopeValueSetterOnly('editor.open_doc_name')
   const [permissionsLevel] = useScopeValue('permissionsLevel')
   const [permissionsLevel] = useScopeValue('permissionsLevel')
   const { fileTreeFromHistory, snapshot, snapshotVersion } =
   const { fileTreeFromHistory, snapshot, snapshotVersion } =
@@ -267,11 +267,11 @@ export const FileTreeDataProvider: FC = ({ children }) => {
         newName,
         newName,
         id,
         id,
       })
       })
-      if (id === openDocId) {
+      if (id === currentDocumentId) {
         setOpenDocName(newName)
         setOpenDocName(newName)
       }
       }
     },
     },
-    [openDocId, setOpenDocName]
+    [currentDocumentId, setOpenDocName]
   )
   )
 
 
   const dispatchDelete = useCallback((id: string) => {
   const dispatchDelete = useCallback((id: string) => {

+ 3 - 3
services/web/frontend/js/shared/context/local-compile-context.tsx

@@ -115,7 +115,7 @@ export const LocalCompileProvider: FC = ({ children }) => {
   const ide = useIdeContext()
   const ide = useIdeContext()
 
 
   const { hasPremiumCompile, isProjectOwner } = useEditorContext()
   const { hasPremiumCompile, isProjectOwner } = useEditorContext()
-  const { openDocId, openDocs } = useEditorManagerContext()
+  const { openDocWithId, openDocs } = useEditorManagerContext()
 
 
   const { _id: projectId, rootDocId } = useProjectContext()
   const { _id: projectId, rootDocId } = useProjectContext()
 
 
@@ -620,14 +620,14 @@ export const LocalCompileProvider: FC = ({ children }) => {
       const result = findEntityByPath(entry.file)
       const result = findEntityByPath(entry.file)
 
 
       if (result && result.type === 'doc') {
       if (result && result.type === 'doc') {
-        openDocId(result.entity._id, {
+        openDocWithId(result.entity._id, {
           gotoLine: entry.line ?? undefined,
           gotoLine: entry.line ?? undefined,
           gotoColumn: entry.column ?? undefined,
           gotoColumn: entry.column ?? undefined,
           keepCurrentView,
           keepCurrentView,
         })
         })
       }
       }
     },
     },
-    [findEntityByPath, openDocId]
+    [findEntityByPath, openDocWithId]
   )
   )
 
 
   // clear the cache then run a compile, triggered by a menu item
   // clear the cache then run a compile, triggered by a menu item

+ 1 - 1
services/web/frontend/js/shared/context/mock/mock-ide.js

@@ -55,7 +55,7 @@ export const getMockIde = () => {
     },
     },
     editorManager: {
     editorManager: {
       openDoc: () => {},
       openDoc: () => {},
-      getCurrentDocId: () => {},
+      getCurrentDocumentId: () => {},
     },
     },
   }
   }
 }
 }

+ 1 - 1
services/web/frontend/stories/decorators/scope.tsx

@@ -103,7 +103,7 @@ const initialize = () => {
       new SocketIOMock()
       new SocketIOMock()
     ) as unknown as Socket,
     ) as unknown as Socket,
     editorManager: {
     editorManager: {
-      getCurrentDocId: () => 'foo',
+      getCurrentDocumentId: () => 'foo',
       openDoc: (id: string, options: unknown) => {
       openDoc: (id: string, options: unknown) => {
         console.log('open doc', id, options)
         console.log('open doc', id, options)
       },
       },

+ 4 - 4
services/web/test/frontend/components/pdf-preview/pdf-logs-entries.spec.tsx

@@ -36,7 +36,7 @@ describe('<PdfLogsEntries/>', function () {
 
 
   const EditorManagerProvider: FC = ({ children }) => {
   const EditorManagerProvider: FC = ({ children }) => {
     const value = {
     const value = {
-      openDocId: cy.spy().as('openDocId'),
+      openDocWithId: cy.spy().as('openDocWithId'),
       // @ts-ignore
       // @ts-ignore
       openDocs: new OpenDocuments(),
       openDocs: new OpenDocuments(),
     } as unknown as EditorManager
     } as unknown as EditorManager
@@ -96,7 +96,7 @@ describe('<PdfLogsEntries/>', function () {
     }).click()
     }).click()
 
 
     cy.get('@findEntityByPath').should('have.been.calledOnceWith', 'main.tex')
     cy.get('@findEntityByPath').should('have.been.calledOnceWith', 'main.tex')
-    cy.get('@openDocId').should(
+    cy.get('@openDocWithId').should(
       'have.been.calledOnceWith',
       'have.been.calledOnceWith',
       fakeFindEntityResult.entity._id,
       fakeFindEntityResult.entity._id,
       {
       {
@@ -136,7 +136,7 @@ describe('<PdfLogsEntries/>', function () {
     })
     })
 
 
     cy.get('@findEntityByPath').should('have.been.calledOnce')
     cy.get('@findEntityByPath').should('have.been.calledOnce')
-    cy.get('@openDocId').should(
+    cy.get('@openDocWithId').should(
       'have.been.calledOnceWith',
       'have.been.calledOnceWith',
       fakeFindEntityResult.entity._id,
       fakeFindEntityResult.entity._id,
       {
       {
@@ -168,7 +168,7 @@ describe('<PdfLogsEntries/>', function () {
     }).click()
     }).click()
 
 
     cy.get('@findEntityByPath').should('not.have.been.called')
     cy.get('@findEntityByPath').should('not.have.been.called')
-    cy.get('@openDocId').should('not.have.been.called')
+    cy.get('@openDocWithId').should('not.have.been.called')
     cy.get('@postDetachMessage').should('have.been.calledWith', {
     cy.get('@postDetachMessage').should('have.been.calledWith', {
       role: 'detached',
       role: 'detached',
       event: 'action-sync-to-entry',
       event: 'action-sync-to-entry',

+ 1 - 1
services/web/test/frontend/helpers/editor-providers.jsx

@@ -72,7 +72,7 @@ export function EditorProviders({
     getPreviewByPath: path => ({ url: path, extension: 'png' }),
     getPreviewByPath: path => ({ url: path, extension: 'png' }),
   },
   },
   editorManager = {
   editorManager = {
-    getCurrentDocId: () => 'foo',
+    getCurrentDocumentId: () => 'foo',
     getCurrentDocValue: () => {},
     getCurrentDocValue: () => {},
     openDoc: sinon.stub(),
     openDoc: sinon.stub(),
   },
   },