editor.pug 7.6 KB

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