editor.pug 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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. script(type="text/ng-template", id="genericMessageModalTemplate")
  96. .modal-header
  97. button.close(
  98. type="button"
  99. data-dismiss="modal"
  100. ng-click="done()"
  101. aria-label="Close"
  102. )
  103. span(aria-hidden="true") ×
  104. h3 {{ title }}
  105. .modal-body(ng-bind-html="message")
  106. .modal-footer
  107. button.btn.btn-info(ng-click="done()") #{translate("ok")}
  108. script(type="text/ng-template", id="outOfSyncModalTemplate")
  109. .modal-header
  110. button.close(
  111. type="button"
  112. data-dismiss="modal"
  113. ng-click="done()"
  114. aria-label="Close"
  115. )
  116. span(aria-hidden="true") ×
  117. h3 {{ title }}
  118. .modal-body(ng-bind-html="message")
  119. .modal-body
  120. button.btn.btn-info(
  121. ng-init="showFileContents = false"
  122. ng-click="showFileContents = !showFileContents"
  123. )
  124. | {{showFileContents ? "Hide" : "Show"}} Local File Contents
  125. .text-preview(ng-show="showFileContents")
  126. .scroll-container
  127. | {{editorContent}}
  128. .modal-footer
  129. button.btn.btn-info(ng-click="done()") #{translate("ok")}
  130. script(type="text/ng-template", id="lockEditorModalTemplate")
  131. .modal-header
  132. h3 {{ title }}
  133. .modal-body(ng-bind-html="message")
  134. //- We need to do .replace(/\//g, '\\/') do that '</script>' -> '<\/script>'
  135. //- and doesn't prematurely end the script tag.
  136. script#data(type="application/json").
  137. !{StringHelper.stringifyJsonForScript({ userSettings: userSettings, user: user, trackChangesState: trackChangesState, useV2History: useV2History, enabledLinkedFileTypes: settings.enabledLinkedFileTypes, brandVariation: brandVariation })}
  138. script(type='text/javascript').
  139. window.data = JSON.parse(document.querySelector("#data").text);
  140. window.project_id = "!{project_id}";
  141. window.userSettings = window.data.userSettings;
  142. window.user = window.data.user;
  143. window.enabledLinkedFiles = window.data.enabledLinkedFiles;
  144. window.csrfToken = "!{csrfToken}";
  145. window.anonymous = #{anonymous};
  146. window.brandVariation = window.data.brandVariation;
  147. window.anonymousAccessToken = "#{anonymousAccessToken}";
  148. window.isTokenMember = #{!!isTokenMember};
  149. window.isRestrictedTokenMember = #{!!isRestrictedTokenMember};
  150. window.maxDocLength = #{maxDocLength};
  151. window.trackChangesState = window.data.trackChangesState;
  152. window.wikiEnabled = #{!!(settings.apis.wiki && settings.apis.wiki.url)};
  153. window.gitBridgePublicBaseUrl = '#{gitBridgePublicBaseUrl}'
  154. //- Set base path for Ace scripts loaded on demand/workers and don't use cdn
  155. window.aceBasePath = "/js/#{lib('ace')}"
  156. //- Set path for PDFjs CMaps
  157. window.pdfCMapsPath = "/js/cmaps/"
  158. window.uiConfig = JSON.parse('!{StringHelper.stringifyJsonForScript(uiConfig)}');
  159. //- enable doc hash checking for all projects
  160. //- used in public/js/libs/sharejs.js
  161. window.useShareJsHash = true
  162. window.wsRetryHandshake = #{settings.wsRetryHandshake}
  163. window.showReactFileTree = "!{showReactFileTree}" === 'true'
  164. - if (settings.overleaf != null)
  165. script(type='text/javascript').
  166. window.overallThemes = JSON.parse('!{StringHelper.stringifyJsonForScript(overallThemes)}');
  167. block foot-scripts
  168. script(type="text/javascript" src=(wsUrl || '/socket.io') + '/socket.io.js')
  169. script(src=mathJaxPath)
  170. script(src=buildJsPath('libraries.js'))
  171. script(src=buildJsPath('ide.js'))