editor.jade 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. include ./editor/dropbox
  49. .ui-layout-east
  50. include ./editor/chat
  51. include ./editor/hotkeys
  52. script(type="text/ng-template", id="genericMessageModalTemplate")
  53. .modal-header
  54. button.close(
  55. type="button"
  56. data-dismiss="modal"
  57. ng-click="done()"
  58. ) ×
  59. h3 {{ title }}
  60. .modal-body {{ message }}
  61. .modal-footer
  62. button.btn.btn-info(ng-click="done()") #{translate("ok")}
  63. script(src='/socket.io/socket.io.js')
  64. //- We need to do .replace(/\//g, '\\/') do that '</script>' -> '<\/script>'
  65. //- and doesn't prematurely end the script tag.
  66. script(type='text/javascript').
  67. window.project_id = "!{project_id}";
  68. window.websocketsUrl = "!{settings.websocketsUrl}";
  69. window.userSettings = !{JSON.stringify(userSettings).replace(/\//g, '\\/')};
  70. window.user = !{JSON.stringify(user).replace(/\//g, '\\/')};
  71. window.csrfToken = "!{csrfToken}";
  72. window.anonymous = #{anonymous};
  73. window.requirejs = {
  74. "paths" : {
  75. "mathjax": "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML",
  76. "moment": "libs/moment-2.7.0"
  77. },
  78. "urlArgs" : "fingerprint=#{fingerprint(jsPath + 'ide.js')}-#{fingerprint(jsPath + 'libs.js')}",
  79. "waitSeconds": 0,
  80. "shim": {
  81. "libs/pdfListView/PdfListView": {
  82. deps: ["libs/pdf"]
  83. },
  84. "libs/pdf": {
  85. deps: ["libs/compatibility"]
  86. },
  87. "ace/ext-searchbox": {
  88. deps: ["ace/ace"]
  89. }
  90. }
  91. };
  92. window.aceFingerprint = "#{fingerprint(jsPath + 'ace/ace.js')}"
  93. script(type='text/javascript').
  94. ga('send', 'event', 'editor-interaction', 'editor-opened')
  95. - locals.suppressDefaultJs = true
  96. - // user.featureSwitches = {} // override
  97. - var usePdfNG = user.featureSwitches && user.featureSwitches.pdfng;
  98. - var pdfPath = 'libs/pdf.worker.js';
  99. - if (usePdfNG) { pdfPath = 'libs/pdfjs-1.0.712/pdf.worker.js'; }
  100. - var fingerprintedPath = fingerprint(jsPath+pdfPath)
  101. - var pdfJsWorkerPath = jsPath+pdfPath+'?fingerprint='+fingerprintedPath
  102. script(type='text/javascript').
  103. window.pdfJsWorkerPath = "#{pdfJsWorkerPath}";
  104. // when using pdfng we need a different pdfjs version
  105. if usePdfNG
  106. script(type='text/javascript').
  107. window.requirejs.paths['libs/pdf'] = 'libs/pdfjs-1.0.712/pdf'
  108. window.requirejs.paths['libs/compatibility'] = 'libs/pdfjs-1.0.712/compatibility'
  109. script(
  110. data-main=jsPath+"ide.js",
  111. baseurl=jsPath,
  112. data-ace-base=jsPath+'ace',
  113. src=jsPath+'libs/require.js?fingerprint='+fingerprint(jsPath + 'libs/require.js')
  114. )