overleaf/services/web/frontend/js/features/ide-react/util/find-doc-entity-by-id.ts
Tim Down 01439641ca Merge pull request #15376 from overleaf/td-ide-page-working-editor
React IDE page: working editor

GitOrigin-RevId: 3ba8cb787a6f7f8435686d8962adb7444d09acb5
2023-10-27 08:03:07 +00:00

11 lines
377 B
TypeScript

import { findInTree } from '@/features/file-tree/util/find-in-tree'
import { Folder } from '../../../../../types/folder'
import { Doc } from '../../../../../types/doc'
export function findDocEntityById(fileTreeData: Folder, docId: string) {
const item = findInTree(fileTreeData, docId)
if (!item || item.type !== 'doc') {
return null
}
return item.entity as Doc
}