scope.tsx 914 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { MainDocument } from '../../../../types/project-settings'
  2. import { PdfViewer } from '../../../../types/user-settings'
  3. type Scope = {
  4. settings?: {
  5. syntaxValidation?: boolean
  6. pdfViewer?: PdfViewer
  7. }
  8. editor?: {
  9. sharejs_doc?: {
  10. doc_id?: string
  11. getSnapshot?: () => string
  12. }
  13. }
  14. ui?: {
  15. view?: 'editor' | 'history' | 'file' | 'pdf'
  16. pdfLayout?: 'flat' | 'sideBySide' | 'split'
  17. leftMenuShown?: boolean
  18. }
  19. project?: {
  20. members?: any[]
  21. owner: {
  22. _id: string
  23. }
  24. features?: {
  25. gitBridge?: boolean
  26. }
  27. }
  28. user?: {
  29. features?: {
  30. dropbox: boolean
  31. }
  32. }
  33. docs?: MainDocument[]
  34. }
  35. export const mockScope = (scope?: Scope) => ({
  36. settings: {
  37. syntaxValidation: false,
  38. pdfViewer: 'pdfjs',
  39. },
  40. editor: {
  41. sharejs_doc: {
  42. doc_id: 'test-doc',
  43. getSnapshot: () => 'some doc content',
  44. },
  45. },
  46. ...scope,
  47. })