editor.jade 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. extends ../layout
  2. block vars
  3. - var suppressNavbar = true
  4. - var suppressFooter = true
  5. - var suppressDefaultJs = true
  6. - var suppressSystemMessages = true
  7. block content
  8. .editor(ng-controller="IdeController").full-size
  9. .loading-screen(ng-show="state.loading")
  10. .container
  11. h3 #{translate("loading")}...
  12. .progress
  13. .progress-bar(style="width: 20%", ng-style="{'width': state.load_progress + '%'}")
  14. .global-alerts(ng-cloak)
  15. .alert.alert-danger.small(ng-if="connection.forced_disconnect")
  16. strong #{translate("disconnected")}
  17. | #{translate("please_refresh")}
  18. .alert.alert-warning.small(ng-if="connection.reconnection_countdown")
  19. strong #{translate("lost_connection")}.
  20. | #{translate("reconnecting_in_x_secs", {seconds:"{{ connection.reconnection_countdown }}"})}.
  21. a.pull-right(href, ng-click="tryReconnectNow()") #{translate("try_now")}
  22. .alert.alert-warning.small(ng-if="connection.reconnecting")
  23. strong #{translate("reconnecting")}...
  24. .div(ng-controller="SavingNotificationController")
  25. .alert.alert-warning.small( ng-repeat="(doc_id, state) in docSavingStatus" ng-if="state.unsavedSeconds > 3") #{translate("saving_notification_with_seconds", {docname:"{{ state.doc.name }}", seconds:"{{ state.unsavedSeconds }}"})}
  26. include ./editor/left-menu
  27. #chat-wrapper(
  28. layout="chat",
  29. spacing-open="12",
  30. spacing-closed="0",
  31. initial-size-east="250",
  32. init-closed-east="true",
  33. open-east="ui.chatOpen",
  34. ng-hide="state.loading",
  35. ng-cloak
  36. )
  37. .ui-layout-center
  38. include ./editor/header
  39. include ./editor/share
  40. #ide-body(ng-cloak, layout="main", ng-hide="state.loading", resize-on="layout:chat:resize")
  41. .ui-layout-west
  42. include ./editor/file-tree
  43. .ui-layout-center
  44. include ./editor/editor
  45. include ./editor/binary-file
  46. include ./editor/track-changes
  47. include ./editor/publish-template
  48. .ui-layout-east
  49. include ./editor/chat
  50. include ./editor/hotkeys
  51. script(type="text/ng-template", id="genericMessageModalTemplate")
  52. .modal-header
  53. button.close(
  54. type="button"
  55. data-dismiss="modal"
  56. ng-click="done()"
  57. ) ×
  58. h3 {{ title }}
  59. .modal-body {{ message }}
  60. .modal-footer
  61. button.btn.btn-info(ng-click="done()") #{translate("ok")}
  62. script(src='#{settings.websocketsUrl}/socket.io/socket.io.js')
  63. //- We need to do .replace(/\//g, '\\/') do that '</script>' -> '<\/script>'
  64. //- and doesn't prematurely end the script tag.
  65. script(type='text/javascript').
  66. window.project_id = "!{project_id}";
  67. window.websocketsUrl = "!{settings.websocketsUrl}";
  68. window.userSettings = !{JSON.stringify(userSettings).replace(/\//g, '\\/')};
  69. window.user = !{JSON.stringify(user).replace(/\//g, '\\/')};
  70. window.csrfToken = "!{csrfToken}";
  71. window.anonymous = #{anonymous};
  72. window.requirejs = {
  73. "paths" : {
  74. "mathjax": "/js/libs/mathjax/MathJax.js?config=TeX-AMS_HTML",
  75. "moment": "libs/moment-2.7.0"
  76. },
  77. "urlArgs" : "fingerprint=#{fingerprint(jsPath + 'ide.js')}-#{fingerprint(jsPath + 'libs.js')}",
  78. "waitSeconds": 0,
  79. "shim": {
  80. "libs/pdfListView/PdfListView": {
  81. deps: ["libs/pdf"]
  82. },
  83. "libs/pdf": {
  84. deps: ["libs/compatibility"]
  85. },
  86. "ace/ext-searchbox": {
  87. deps: ["ace/ace"]
  88. }
  89. },
  90. config:{
  91. moment:{
  92. noGlobal: true
  93. }
  94. }
  95. };
  96. window.aceFingerprint = "#{fingerprint(jsPath + 'ace/ace.js')}"
  97. script(type='text/javascript').
  98. ga('send', 'event', 'editor-interaction', 'editor-opened')
  99. - locals.suppressDefaultJs = true
  100. - // user.featureSwitches = {} // override
  101. - var usePdfNG = user.featureSwitches && user.featureSwitches.pdfng;
  102. - var pdfPath = 'libs/pdf.worker.js';
  103. - if (usePdfNG) { pdfPath = 'libs/pdfjs-1.0.712/pdf.worker.js'; }
  104. - var fingerprintedPath = fingerprint(jsPath+pdfPath)
  105. - var pdfJsWorkerPath = jsPath+pdfPath+'?fingerprint='+fingerprintedPath
  106. script(type='text/javascript').
  107. window.pdfJsWorkerPath = "#{pdfJsWorkerPath}";
  108. // when using pdfng we need a different pdfjs version
  109. if usePdfNG
  110. script(type='text/javascript').
  111. window.requirejs.paths['libs/pdf'] = 'libs/pdfjs-1.0.712/pdf'
  112. window.requirejs.paths['libs/compatibility'] = 'libs/pdfjs-1.0.712/compatibility'
  113. script(
  114. data-main=jsPath+"ide.js",
  115. baseurl=jsPath,
  116. data-ace-base=jsPath+'ace',
  117. src=jsPath+'libs/require.js?fingerprint='+fingerprint(jsPath + 'libs/require.js')
  118. )