|
@@ -10,6 +10,7 @@ import useScopeValue from '../hooks/use-scope-value'
|
|
|
import useBrowserWindow from '../hooks/use-browser-window'
|
|
import useBrowserWindow from '../hooks/use-browser-window'
|
|
|
import { useIdeContext } from './ide-context'
|
|
import { useIdeContext } from './ide-context'
|
|
|
import { useProjectContext } from './project-context'
|
|
import { useProjectContext } from './project-context'
|
|
|
|
|
+import { useDetachContext } from './detach-context'
|
|
|
|
|
|
|
|
export const EditorContext = createContext()
|
|
export const EditorContext = createContext()
|
|
|
|
|
|
|
@@ -41,6 +42,8 @@ EditorContext.Provider.propTypes = {
|
|
|
export function EditorProvider({ children, settings }) {
|
|
export function EditorProvider({ children, settings }) {
|
|
|
const ide = useIdeContext()
|
|
const ide = useIdeContext()
|
|
|
|
|
|
|
|
|
|
+ const { role } = useDetachContext()
|
|
|
|
|
+
|
|
|
const { owner, features } = useProjectContext({
|
|
const { owner, features } = useProjectContext({
|
|
|
owner: PropTypes.shape({
|
|
owner: PropTypes.shape({
|
|
|
_id: PropTypes.string.isRequired,
|
|
_id: PropTypes.string.isRequired,
|
|
@@ -107,12 +110,24 @@ export function EditorProvider({ children, settings }) {
|
|
|
|
|
|
|
|
const { setTitle } = useBrowserWindow()
|
|
const { setTitle } = useBrowserWindow()
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
- setTitle(
|
|
|
|
|
- `${projectName ? projectName + ' - ' : ''}Online LaTeX Editor ${
|
|
|
|
|
- window.ExposedSettings.appName
|
|
|
|
|
- }`
|
|
|
|
|
- )
|
|
|
|
|
- }, [projectName, setTitle])
|
|
|
|
|
|
|
+ const parts = []
|
|
|
|
|
+
|
|
|
|
|
+ if (role === 'detached') {
|
|
|
|
|
+ parts.push('[PDF]')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (projectName) {
|
|
|
|
|
+ parts.push(projectName)
|
|
|
|
|
+ parts.push('-')
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ parts.push('Online LaTeX Editor')
|
|
|
|
|
+ parts.push(window.ExposedSettings.appName)
|
|
|
|
|
+
|
|
|
|
|
+ const title = parts.join(' ')
|
|
|
|
|
+
|
|
|
|
|
+ setTitle(title)
|
|
|
|
|
+ }, [projectName, setTitle, role])
|
|
|
|
|
|
|
|
const insertSymbol = useCallback(symbol => {
|
|
const insertSymbol = useCallback(symbol => {
|
|
|
window.dispatchEvent(
|
|
window.dispatchEvent(
|