mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-27 02:51:57 +02:00
28 lines
522 B
JavaScript
28 lines
522 B
JavaScript
import React, { createContext, useContext } from 'react'
|
|
import PropTypes from 'prop-types'
|
|
|
|
export const EditorContext = createContext()
|
|
|
|
export function EditorProvider({ children }) {
|
|
return (
|
|
<EditorContext.Provider
|
|
value={{
|
|
projectId: window.project_id
|
|
}}
|
|
>
|
|
{children}
|
|
</EditorContext.Provider>
|
|
)
|
|
}
|
|
|
|
EditorProvider.propTypes = {
|
|
children: PropTypes.any
|
|
}
|
|
|
|
export function useEditorContext() {
|
|
const { projectId } = useContext(EditorContext)
|
|
return {
|
|
projectId
|
|
}
|
|
}
|