2017-04-01 21:07:01 +00:00
|
|
|
'use strict'
|
2016-08-30 02:19:47 +00:00
|
|
|
|
2017-04-01 21:07:01 +00:00
|
|
|
import $ from 'jquery'
|
|
|
|
import * as ace from 'brace'
|
|
|
|
import 'brace/theme/tomorrow_night'
|
|
|
|
import 'brace/mode/markdown'
|
2017-04-03 03:27:07 +00:00
|
|
|
import pageLoader from '../components/page-loader'
|
2016-08-30 02:19:47 +00:00
|
|
|
|
2017-04-01 21:07:01 +00:00
|
|
|
module.exports = (alerts) => {
|
|
|
|
if ($('#page-type-source').length) {
|
|
|
|
var scEditor = ace.edit('source-display')
|
|
|
|
scEditor.setTheme('ace/theme/tomorrow_night')
|
|
|
|
scEditor.getSession().setMode('ace/mode/markdown')
|
|
|
|
scEditor.setOption('fontSize', '14px')
|
|
|
|
scEditor.setOption('hScrollBarAlwaysVisible', false)
|
|
|
|
scEditor.setOption('wrap', true)
|
|
|
|
scEditor.setReadOnly(true)
|
|
|
|
scEditor.renderer.updateFull()
|
2016-08-30 02:19:47 +00:00
|
|
|
|
2017-04-01 21:07:01 +00:00
|
|
|
let currentBasePath = ($('#page-type-source').data('entrypath') !== 'home') ? $('#page-type-source').data('entrypath') : ''
|
|
|
|
|
|
|
|
require('../modals/create.js')(currentBasePath)
|
|
|
|
require('../modals/move.js')(currentBasePath, alerts)
|
2017-04-03 03:27:07 +00:00
|
|
|
|
|
|
|
scEditor.renderer.on('afterRender', () => {
|
|
|
|
pageLoader.complete()
|
|
|
|
})
|
2017-04-01 21:07:01 +00:00
|
|
|
}
|
2017-02-09 01:52:37 +00:00
|
|
|
}
|