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