You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
937 B

  1. 'use strict'
  2. import $ from 'jquery'
  3. import * as ace from 'brace'
  4. import 'brace/theme/tomorrow_night'
  5. import 'brace/mode/markdown'
  6. import pageLoader from '../components/page-loader'
  7. module.exports = (alerts) => {
  8. if ($('#page-type-source').length) {
  9. var scEditor = ace.edit('source-display')
  10. scEditor.setTheme('ace/theme/tomorrow_night')
  11. scEditor.getSession().setMode('ace/mode/markdown')
  12. scEditor.setOption('fontSize', '14px')
  13. scEditor.setOption('hScrollBarAlwaysVisible', false)
  14. scEditor.setOption('wrap', true)
  15. scEditor.setReadOnly(true)
  16. scEditor.renderer.updateFull()
  17. let currentBasePath = ($('#page-type-source').data('entrypath') !== 'home') ? $('#page-type-source').data('entrypath') : ''
  18. require('../modals/create.js')(currentBasePath)
  19. require('../modals/move.js')(currentBasePath, alerts)
  20. scEditor.renderer.on('afterRender', () => {
  21. pageLoader.complete()
  22. })
  23. }
  24. }