2016-10-08 00:31:32 +08:00
|
|
|
/* global $ */
|
|
|
|
|
2016-09-25 00:27:04 +08:00
|
|
|
import React from 'react'
|
|
|
|
import ReactDOM from 'react-dom'
|
|
|
|
import outdent from 'outdent'
|
|
|
|
|
|
|
|
import ImportDialogBox from '../../components/ImportDialogBox'
|
|
|
|
|
|
|
|
import PasteInput from '../PasteInput'
|
|
|
|
|
|
|
|
const ImportDialog = {
|
|
|
|
openLightbox: null,
|
|
|
|
closeLightbox: null,
|
|
|
|
|
2016-10-08 00:31:32 +08:00
|
|
|
init: function (serverData, openLightbox, closeLightbox) {
|
2016-09-25 00:27:04 +08:00
|
|
|
const self = ImportDialog
|
|
|
|
self.openLightbox = openLightbox
|
|
|
|
self.closeLightbox = closeLightbox
|
|
|
|
|
|
|
|
$('#lightbox_content').append($(outdent`
|
|
|
|
<div class="lightboxContent" id="import-dialog-lightbox">
|
|
|
|
<div class="importDialogWrapper" />
|
|
|
|
</div>
|
|
|
|
`))
|
|
|
|
ReactDOM.render(React.createElement(ImportDialogBox, {
|
|
|
|
onFileAdded: PasteInput.handleFile,
|
2016-10-08 00:31:32 +08:00
|
|
|
exampleImageUrl: serverData['import-example.png']
|
2016-09-25 00:27:04 +08:00
|
|
|
}), $('.importDialogWrapper').get(0))
|
|
|
|
},
|
2016-10-08 00:31:32 +08:00
|
|
|
show: function () {
|
|
|
|
ImportDialog.openLightbox('import-dialog')
|
2016-09-25 00:27:04 +08:00
|
|
|
},
|
2016-10-08 00:31:32 +08:00
|
|
|
hide: function () {
|
|
|
|
ImportDialog.closeLightbox('import-dialog')
|
2016-09-25 00:27:04 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ImportDialog
|