mock-ide.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import getMeta from '../../../utils/meta'
  2. // When rendered without Angular, ide isn't defined. In that case we use
  3. // a mock object that only has the required properties to pass proptypes
  4. // checks and the values needed for the app. In the longer term, the mock
  5. // object will replace ide completely.
  6. export const getMockIde = () => {
  7. return {
  8. _id: getMeta('ol-project_id'),
  9. $scope: {
  10. $on: () => {},
  11. $watch: () => {},
  12. $applyAsync: () => {},
  13. user: {},
  14. project: {
  15. _id: getMeta('ol-project_id'),
  16. name: getMeta('ol-projectName'),
  17. rootDocId: '',
  18. members: [],
  19. invites: [],
  20. features: {
  21. collaborators: 0,
  22. compileGroup: 'standard',
  23. trackChangesVisible: false,
  24. references: false,
  25. mendeley: false,
  26. zotero: false,
  27. },
  28. publicAccessLevel: '',
  29. tokens: {
  30. readOnly: '',
  31. readAndWrite: '',
  32. },
  33. owner: {
  34. _id: '',
  35. email: '',
  36. },
  37. },
  38. state: { loading: false },
  39. permissionsLevel: 'readOnly',
  40. editor: {
  41. sharejs_doc: null,
  42. showSymbolPalette: false,
  43. toggleSymbolPalette: () => {},
  44. },
  45. ui: {
  46. view: 'pdf',
  47. chatOpen: false,
  48. reviewPanelOpen: false,
  49. leftMenuShown: false,
  50. pdfLayout: 'flat',
  51. },
  52. pdf: {
  53. uncompiled: true,
  54. logEntryAnnotations: {},
  55. },
  56. settings: { syntaxValidation: false, pdfViewer: 'pdfjs' },
  57. hasLintingError: false,
  58. },
  59. editorManager: {
  60. openDoc: () => {},
  61. getCurrentDocId: () => {},
  62. },
  63. }
  64. }