2022-12-23 18:06:19 -05:00
|
|
|
import {
|
|
|
|
FontFamily,
|
|
|
|
LineHeight,
|
|
|
|
OverallTheme,
|
|
|
|
} from '../../../../../modules/source-editor/frontend/js/extensions/theme'
|
2022-12-27 14:54:21 -05:00
|
|
|
import {
|
|
|
|
Keybindings,
|
|
|
|
PdfViewer,
|
|
|
|
ProjectCompiler,
|
|
|
|
} from '../../../../../types/project-settings'
|
2022-12-23 18:06:19 -05:00
|
|
|
import { postJSON } from '../../../infrastructure/fetch-json'
|
|
|
|
|
|
|
|
export type UserSettingsScope = {
|
|
|
|
pdfViewer: PdfViewer
|
|
|
|
autoComplete: boolean
|
|
|
|
autoPairDelimiters: boolean
|
|
|
|
syntaxValidation: boolean
|
|
|
|
editorTheme: string
|
|
|
|
overallTheme: OverallTheme
|
|
|
|
mode: Keybindings
|
|
|
|
fontSize: string
|
|
|
|
fontFamily: FontFamily
|
|
|
|
lineHeight: LineHeight
|
|
|
|
}
|
|
|
|
|
|
|
|
export function saveUserSettings(data: Partial<UserSettingsScope>) {
|
|
|
|
postJSON('/user/settings', {
|
|
|
|
body: data,
|
|
|
|
})
|
|
|
|
}
|
2022-12-27 14:54:21 -05:00
|
|
|
|
|
|
|
export type ProjectSettingsScope = {
|
|
|
|
compiler: ProjectCompiler
|
|
|
|
imageName: string
|
|
|
|
rootDoc_id: string
|
|
|
|
spellCheckLanguage: string
|
|
|
|
}
|
|
|
|
|
|
|
|
export const saveProjectSettings = async (
|
|
|
|
projectId: string,
|
|
|
|
data: Partial<ProjectSettingsScope>
|
|
|
|
) => {
|
|
|
|
await postJSON<never>(`/project/${projectId}/settings`, {
|
|
|
|
body: data,
|
|
|
|
})
|
|
|
|
}
|