editor.pug 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. extends ../layout
  2. block vars
  3. - var suppressNavbar = true
  4. - var suppressFooter = true
  5. - metadata.robotsNoindexNofollow = true
  6. block content
  7. .editor(ng-controller="IdeController").full-size
  8. //- required by react2angular-shared-context, must be rendered as a top level component
  9. shared-context-react()
  10. .loading-screen(ng-if="state.loading")
  11. .loading-screen-brand-container
  12. .loading-screen-brand(
  13. style="height: 20%;"
  14. ng-style="{ 'height': state.load_progress + '%' }"
  15. )
  16. h3.loading-screen-label(ng-if="!state.error") #{translate("loading")}
  17. span.loading-screen-ellip .
  18. span.loading-screen-ellip .
  19. span.loading-screen-ellip .
  20. p.loading-screen-error(ng-if="state.error").ng-cloak
  21. span(ng-bind-html="state.error")
  22. .global-alerts(ng-cloak ng-hide="editor.error_state")
  23. .alert.alert-danger.small(ng-if="connection.forced_disconnect")
  24. strong #{translate("disconnected")}
  25. | #{translate("please_refresh")}
  26. .alert.alert-warning.small(ng-if="connection.reconnection_countdown")
  27. strong #{translate("lost_connection")}.
  28. | #{translate("reconnecting_in_x_secs", {seconds:"{{ connection.reconnection_countdown }}"})}.
  29. a#try-reconnect-now-button.alert-link-as-btn.pull-right(href, ng-click="tryReconnectNow()") #{translate("try_now")}
  30. .alert.alert-warning.small(ng-if="connection.reconnecting && connection.stillReconnecting")
  31. strong #{translate("reconnecting")}…
  32. .alert.alert-warning.small(ng-if="sync_tex_error")
  33. strong #{translate("synctex_failed")}.
  34. a#synctex-more-info-button.alert-link-as-btn.pull-right(
  35. href="/learn/how-to/SyncTeX_Errors"
  36. target="_blank"
  37. ) #{translate("more_info")}
  38. .alert.alert-warning.small(ng-if="connection.inactive_disconnect")
  39. strong #{translate("editor_disconected_click_to_reconnect")}
  40. .alert.alert-warning.small(ng-if="connection.debug") {{ connection.state }}
  41. .div(ng-controller="SavingNotificationController")
  42. .alert.alert-warning.small(ng-repeat="(doc_id, state) in docSavingStatus" ng-if="state.unsavedSeconds > 8") #{translate("saving_notification_with_seconds", {docname:"{{ state.doc.name }}", seconds:"{{ state.unsavedSeconds }}"})}
  43. .div(ng-controller="SystemMessagesController")
  44. .alert.alert-warning.system-message(
  45. ng-repeat="message in messages"
  46. ng-controller="SystemMessageController"
  47. ng-hide="hidden"
  48. )
  49. button(ng-hide="protected",ng-click="hide()").close.pull-right
  50. span(aria-hidden="true") ×
  51. span.sr-only #{translate("close")}
  52. .system-message-content(ng-bind-html="htmlContent")
  53. include ./editor/left-menu
  54. #chat-wrapper.full-size(
  55. layout="chat",
  56. spacing-open="{{ui.chatResizerSizeOpen}}",
  57. spacing-closed="{{ui.chatResizerSizeClosed}}",
  58. initial-size-east="250",
  59. init-closed-east="true",
  60. open-east="ui.chatOpen",
  61. ng-hide="state.loading",
  62. ng-cloak
  63. )
  64. .ui-layout-center
  65. include ./editor/header
  66. include ./editor/share
  67. != moduleIncludes("publish:body", locals)
  68. include ./editor/history/toolbarV2.pug
  69. main#ide-body(
  70. ng-cloak,
  71. role="main",
  72. ng-class="{ 'ide-history-open' : (ui.view == 'history' && history.isV2) }",
  73. layout="main",
  74. ng-hide="state.loading",
  75. resize-on="layout:chat:resize,history:toggle",
  76. minimum-restore-size-west="130"
  77. custom-toggler-pane=hasFeature('custom-togglers') ? "west" : false
  78. custom-toggler-msg-when-open=hasFeature('custom-togglers') ? translate("tooltip_hide_filetree") : false
  79. custom-toggler-msg-when-closed=hasFeature('custom-togglers') ? translate("tooltip_show_filetree") : false
  80. )
  81. .ui-layout-west
  82. if showReactFileTree
  83. include ./editor/file-tree-react
  84. else
  85. include ./editor/file-tree
  86. include ./editor/history/fileTreeV2
  87. .ui-layout-center
  88. include ./editor/editor
  89. include ./editor/binary-file
  90. include ./editor/history
  91. if !isRestrictedTokenMember
  92. .ui-layout-east
  93. aside.chat(
  94. ng-controller="ReactChatController"
  95. )
  96. chat(reset-unread-messages="resetUnreadMessages" chat-is-open="chatIsOpen")
  97. script(type="text/ng-template", id="genericMessageModalTemplate")
  98. .modal-header
  99. button.close(
  100. type="button"
  101. data-dismiss="modal"
  102. ng-click="done()"
  103. aria-label="Close"
  104. )
  105. span(aria-hidden="true") ×
  106. h3 {{ title }}
  107. .modal-body(ng-bind-html="message")
  108. .modal-footer
  109. button.btn.btn-info(ng-click="done()") #{translate("ok")}
  110. script(type="text/ng-template", id="outOfSyncModalTemplate")
  111. .modal-header
  112. button.close(
  113. type="button"
  114. data-dismiss="modal"
  115. ng-click="done()"
  116. aria-label="Close"
  117. )
  118. span(aria-hidden="true") ×
  119. h3 {{ title }}
  120. .modal-body(ng-bind-html="message")
  121. .modal-body
  122. button.btn.btn-info(
  123. ng-init="showFileContents = false"
  124. ng-click="showFileContents = !showFileContents"
  125. )
  126. | {{showFileContents ? "Hide" : "Show"}} Local File Contents
  127. .text-preview(ng-show="showFileContents")
  128. .scroll-container
  129. | {{editorContent}}
  130. .modal-footer
  131. button.btn.btn-info(ng-click="done()") #{translate("reload_editor")}
  132. script(type="text/ng-template", id="lockEditorModalTemplate")
  133. .modal-header
  134. h3 {{ title }}
  135. .modal-body(ng-bind-html="message")
  136. //- We need to do .replace(/\//g, '\\/') do that '</script>' -> '<\/script>'
  137. //- and doesn't prematurely end the script tag.
  138. script#data(type="application/json").
  139. !{StringHelper.stringifyJsonForScript({ userSettings: userSettings, user: user, trackChangesState: trackChangesState, useV2History: useV2History, enabledLinkedFileTypes: settings.enabledLinkedFileTypes, brandVariation: brandVariation })}
  140. script(type='text/javascript').
  141. window.data = JSON.parse(document.querySelector("#data").text);
  142. window.project_id = "!{project_id}";
  143. window.userSettings = window.data.userSettings;
  144. window.user = window.data.user;
  145. window.enabledLinkedFiles = window.data.enabledLinkedFiles;
  146. window.csrfToken = "!{csrfToken}";
  147. window.anonymous = #{anonymous};
  148. window.brandVariation = window.data.brandVariation;
  149. window.anonymousAccessToken = "#{anonymousAccessToken}";
  150. window.isTokenMember = #{!!isTokenMember};
  151. window.isRestrictedTokenMember = #{!!isRestrictedTokenMember};
  152. window.maxDocLength = #{maxDocLength};
  153. window.trackChangesState = window.data.trackChangesState;
  154. window.wikiEnabled = #{!!(settings.apis.wiki && settings.apis.wiki.url)};
  155. window.gitBridgePublicBaseUrl = '#{gitBridgePublicBaseUrl}'
  156. //- Set base path for Ace scripts loaded on demand/workers and don't use cdn
  157. window.aceBasePath = "/js/#{lib('ace')}"
  158. //- Set path for PDFjs CMaps
  159. window.pdfCMapsPath = "/js/cmaps/"
  160. window.uiConfig = JSON.parse('!{StringHelper.stringifyJsonForScript(uiConfig)}');
  161. //- enable doc hash checking for all projects
  162. //- used in public/js/libs/sharejs.js
  163. window.useShareJsHash = true
  164. window.wsRetryHandshake = #{settings.wsRetryHandshake}
  165. window.showReactFileTree = "!{showReactFileTree}" === 'true'
  166. - if (settings.overleaf != null)
  167. script(type='text/javascript').
  168. window.overallThemes = JSON.parse('!{StringHelper.stringifyJsonForScript(overallThemes)}');
  169. block foot-scripts
  170. script(type="text/javascript" src=(wsUrl || '/socket.io') + '/socket.io.js')
  171. script(src=mathJaxPath)
  172. script(src=buildJsPath('libraries.js'))
  173. script(src=buildJsPath('ide.js'))