editor.jade 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. extends ../layout
  2. block vars
  3. - var suppressNavbar = true
  4. - var suppressFooter = true
  5. - var suppressDefaultJs = true
  6. block scripts
  7. //- Only use the native bootstrap on the editor page,
  8. //- since we use the Angular-based bootstrap elsewhere.
  9. script(src=jsPath+'libs/bootstrap-3.1.1.js')
  10. script(src=jsPath+'libs/jquery-layout.js')
  11. script(src=jsPath+'libs/jquery.storage.js')
  12. block content
  13. .editor(ng-controller="IdeController")
  14. .loading-screen(ng-show="state.loading")
  15. .container
  16. h3 Loading...
  17. .progress
  18. .progress-bar(ng-style="{'width': state.load_progress + '%'}")
  19. .global-alerts(ng-cloak)
  20. .alert.alert-danger.small(ng-if="connection.forced_disconnect")
  21. strong Disconnected
  22. | Please refresh the page to continue.
  23. .alert.alert-warning.small(ng-if="connection.reconnection_countdown")
  24. strong Lost Connection.
  25. | Reconnecting in {{ connection.reconnection_countdown }} secs.
  26. a.pull-right(href, ng-click="tryReconnectNow()") Try Now
  27. .alert.alert-warning.small(ng-if="connection.reconnecting")
  28. strong Reconnecting...
  29. aside#left-menu(
  30. ng-class="{ 'shown': ui.leftMenuShown }"
  31. ng-cloak
  32. )
  33. h4 Settings
  34. form
  35. .form-controls
  36. label(for="compiler") Compiler
  37. select.form-control(
  38. name="compiler"
  39. ng-model="project.compiler"
  40. )
  41. option(value='pdflatex') pdfLaTeX
  42. option(value='latex') LaTeX
  43. option(value='xelatex') XeLaTeX
  44. option(value='lualatex') LuaLaTeX
  45. .form-controls
  46. label(for="spellCheckLanguage") Spell Check
  47. select.form-control(
  48. name="spellCheckLanguage"
  49. ng-model="project.spellCheckLanguage"
  50. )
  51. option(value="") Off
  52. optgroup(label="Language")
  53. for language in languages
  54. option(
  55. value=language.code
  56. )= language.name
  57. .form-controls
  58. label(for="autoComplete") Auto-Complete
  59. input.form-control(
  60. type="checkbox"
  61. name="autoComplete"
  62. ng-model="settings.autoComplete"
  63. )
  64. .form-controls
  65. label(for="theme") Theme
  66. select.form-control(
  67. name="theme"
  68. ng-model="settings.theme"
  69. )
  70. each theme in themes
  71. option(value=theme) #{theme}
  72. .form-controls
  73. label(for="mode") Keybindings
  74. select.form-control(
  75. name="mode"
  76. ng-model="settings.mode"
  77. )
  78. option(value='default') None
  79. option(value='vim') Vim
  80. option(value='emacs') Emacs
  81. .form-controls
  82. label(for="fontSize") Font Size
  83. select.form-control(
  84. name="fontSize"
  85. ng-model="settings.fontSize"
  86. )
  87. each size in ['10','11','12','13','14','16','20','24']
  88. option(value=size) #{size}px
  89. #left-menu-mask(
  90. ng-show="ui.leftMenuShown",
  91. ng-click="ui.leftMenuShown = false"
  92. ng-cloak
  93. )
  94. header.toolbar.toolbar-header(ng-cloak, ng-hide="state.loading")
  95. a.btn.btn-full-height(
  96. href,
  97. ng-click="ui.leftMenuShown = true"
  98. tooltip="Menu",
  99. tooltip-placement="bottom"
  100. )
  101. i.fa.fa-bars
  102. span.name {{ project.name }}
  103. a(href='#', data-toggle="tooltip", title="Rename")
  104. i.fa.fa-pencil
  105. .toolbar-right
  106. a.btn.btn-full-height(href='#', tooltip="Share", tooltip-placement="bottom")
  107. i.fa.fa-group
  108. a.btn.btn-full-height(href='#', tooltip="Recent Changes", tooltip-placement="bottom")
  109. i.fa.fa-history
  110. a.btn.btn-full-height(href='#', tooltip="Chat", tooltip-placement="bottom")
  111. i.fa.fa-comment
  112. #ide-body(ng-cloak, layout="main", ng-hide="state.loading")
  113. include ./editor/file-tree
  114. .ui-layout-center
  115. .loading(ng-show="!editor.sharejs_doc || editor.opening")
  116. i.fa.fa-spin.fa-refresh
  117. |   Loading...
  118. #editor(
  119. ace-editor,
  120. ng-show="!!editor.sharejs_doc && !editor.opening"
  121. theme="settings.theme",
  122. keybindings="settings.mode",
  123. font-size="settings.fontSize",
  124. auto-complete="settings.autoComplete",
  125. spell-check-language="project.spellCheckLanguage",
  126. annotations="onlineUserCursorAnnotations[editor.open_doc_id]"
  127. show-print-margin="false",
  128. sharejs-doc="editor.sharejs_doc",
  129. last-updated="editor.last_updated",
  130. cursor-position="editor.cursorPosition"
  131. )
  132. //- #loadingScreen
  133. //- h3 Loading...
  134. //- p#loadingMessage Loading editor
  135. //- #errorMessages
  136. //- #connectionLostMessage(style="display: none;")
  137. //- | Lost connection.
  138. //- span#trying-reconnect
  139. //- | Reconnecting in
  140. //- span#reconnection-countdown ?
  141. //- | seconds.
  142. //- a(href='#')#try-reconnect-now Try now.
  143. //- span#reconnecting
  144. //- | Reconnecting...
  145. //- #savingProblems(style="display: none")
  146. //- | Saving...
  147. //- div#toolbar.sidebar-navigation
  148. //- ul#tabs
  149. //- #toolbar-footer
  150. //- #tab-content.tab-content
  151. //- include ../templates
  152. //- include ../templates/dropbox
  153. script(src='/socket.io/socket.io.js')
  154. script(type='text/javascript').
  155. window.project_id = "!{project_id}"
  156. window.sharelatex = !{sharelatexObject};
  157. window.userSettings = !{userSettingsObject};
  158. window.user = !{userObject};
  159. window.csrfToken = "!{csrfToken}";
  160. window.requirejs = {
  161. "paths" : {
  162. "underscore": "../libs/underscore-1.3.3",
  163. "mathjax": "https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS_HTML",
  164. "moment": "libs/moment-2.4.0",
  165. "ace": "#{jsPath}ace"
  166. },
  167. "urlArgs" : "fingerprint=#{fingerprint(jsPath + 'ide.js')}",
  168. "waitSeconds": 0,
  169. "shim": {
  170. "libs/backbone": {
  171. deps: ["libs/underscore-1.3.3"]
  172. },
  173. "libs/pdfListView/PdfListView": {
  174. deps: ["libs/pdf"]
  175. },
  176. "libs/pdf": {
  177. deps: ["libs/compatibility"]
  178. }
  179. }
  180. };
  181. script(type='text/javascript').
  182. ga('send', 'event', 'editor-interaction', 'editor-opened')
  183. - locals.suppressDefaultJs = true
  184. - var fingerprintedPath = fingerprint(jsPath+'libs/pdf.worker.js')
  185. - var pdfJsWorkerPath = jsPath+'libs/pdf.worker.js?fingerprint='+fingerprintedPath
  186. script(type='text/javascript').
  187. window.sharelatex.pdfJsWorkerPath = "#{pdfJsWorkerPath}"
  188. script(
  189. data-main=jsPath+'app/ide.js',
  190. baseurl=jsPath,
  191. data-ace-base=jsPath+'ace',
  192. src=jsPath+'libs/require.js?fingerprint='+fingerprint(jsPath + 'libs/require.js')
  193. )
  194. - if (!anonymous)
  195. script(type="text/javascript").
  196. var chatReq = require.config({
  197. context: "chat",
  198. baseUrl: "#{chatUrl}/chat"
  199. });
  200. chatReq(["require", "chat"], function(require, Chat) {
  201. new Chat({
  202. room: {
  203. project_id: window.userSettings.project_id
  204. },
  205. url: "#{chatUrl}"
  206. })
  207. });