mirror of https://github.com/requarks/wiki
parent
30ce9c8670
commit
23a6be1219
@ -1,21 +0,0 @@
|
|||||||
<template lang="pug">
|
|
||||||
transition(name='alert', enter-active-class="animated zoomIn", leave-active-class="animated fadeOutRight")
|
|
||||||
.alert(v-if='shown', v-bind:class='style')
|
|
||||||
.alert-icon: i(v-bind:class='icon')
|
|
||||||
.alert-msg {{ msg }}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'alert',
|
|
||||||
data () {
|
|
||||||
return {}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
shown() { return this.$store.state.alert.shown },
|
|
||||||
style() { return 'is-' + this.$store.state.alert.style },
|
|
||||||
icon() { return 'nc-icon-outline ' + this.$store.state.alert.icon },
|
|
||||||
msg() { return this.$store.state.alert.msg }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,55 +0,0 @@
|
|||||||
<template lang="pug">
|
|
||||||
transition(:duration="400")
|
|
||||||
.modal(v-show='isShown', v-cloak)
|
|
||||||
transition(name='modal-background')
|
|
||||||
.modal-background(v-show='isShown')
|
|
||||||
.modal-container
|
|
||||||
transition(name='modal-content')
|
|
||||||
.modal-content(v-show='isShown')
|
|
||||||
header.is-blue
|
|
||||||
span {{ $t('modal.anchortitle') }}
|
|
||||||
section
|
|
||||||
p.control.is-fullwidth
|
|
||||||
input.input(type='text', ref='anchorURLinput', v-model='anchorURL')
|
|
||||||
footer
|
|
||||||
a.button.is-grey.is-outlined(v-on:click='cancel') {{ $t('modal.discard') }}
|
|
||||||
a.button.is-blue(v-clipboard='anchorURL', @success="clipboardSuccess", @error="clipboardError") {{ $t('modal.copyclipboard') }}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'anchor',
|
|
||||||
data () {
|
|
||||||
return {}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
anchorURL () {
|
|
||||||
return window.location.href.split('#')[0] + '#' + this.$store.state.anchor.hash
|
|
||||||
},
|
|
||||||
isShown () {
|
|
||||||
return this.$store.state.anchor.shown
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
cancel () {
|
|
||||||
this.$store.dispatch('anchor/close')
|
|
||||||
},
|
|
||||||
clipboardSuccess () {
|
|
||||||
this.$store.dispatch('alert', {
|
|
||||||
style: 'blue',
|
|
||||||
icon: 'business_notes',
|
|
||||||
msg: this.$t('modal.anchorsuccess')
|
|
||||||
})
|
|
||||||
this.$store.dispatch('anchor/close')
|
|
||||||
},
|
|
||||||
clipboardError () {
|
|
||||||
this.$store.dispatch('alert', {
|
|
||||||
style: 'red',
|
|
||||||
icon: 'business_notes',
|
|
||||||
msg: this.$t('modal.anchorerror')
|
|
||||||
})
|
|
||||||
this.$refs.anchorURLinput.select()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,41 +0,0 @@
|
|||||||
<template lang="pug">
|
|
||||||
.colorpicker
|
|
||||||
.colorpicker-choice(v-for='color in colors', :class='["is-" + color, color === value ? "is-active" : ""]', @click='setColor(color)')
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'color-picker',
|
|
||||||
props: ['value'],
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
colors: [
|
|
||||||
'red',
|
|
||||||
'pink',
|
|
||||||
'purple',
|
|
||||||
'deep-purple',
|
|
||||||
'indigo',
|
|
||||||
'blue',
|
|
||||||
'light-blue',
|
|
||||||
'cyan',
|
|
||||||
'teal',
|
|
||||||
'green',
|
|
||||||
'light-green',
|
|
||||||
'lime',
|
|
||||||
'yellow',
|
|
||||||
'amber',
|
|
||||||
'orange',
|
|
||||||
'deep-orange',
|
|
||||||
'brown',
|
|
||||||
'grey',
|
|
||||||
'blue-grey'
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
setColor(color) {
|
|
||||||
this.$emit('input', color)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,128 +0,0 @@
|
|||||||
<template lang="pug">
|
|
||||||
transition(:duration="400")
|
|
||||||
.modal(v-show='isShown', v-cloak)
|
|
||||||
transition(name='modal-background')
|
|
||||||
.modal-background(v-show='isShown')
|
|
||||||
.modal-container
|
|
||||||
transition(name='modal-content')
|
|
||||||
.modal-content.is-expanded(v-show='isShown')
|
|
||||||
header.is-green
|
|
||||||
span {{ $t('editor.codeblocktitle') }}
|
|
||||||
p.modal-notify(v-bind:class='{ "is-active": isLoading }')
|
|
||||||
span {{ $t('editor.codeblockloading', { name: modeSelected }) }}
|
|
||||||
i
|
|
||||||
section.is-gapless
|
|
||||||
.columns.is-stretched
|
|
||||||
.column.is-one-quarter.modal-sidebar.is-green(style={'max-width':'350px'})
|
|
||||||
.model-sidebar-header {{ $t('editor.codeblocklanguage') }}
|
|
||||||
.model-sidebar-content
|
|
||||||
p.control.is-fullwidth
|
|
||||||
select(v-model='modeSelected')
|
|
||||||
option(v-for='mode in modes', v-bind:value='mode.name') {{ mode.caption }}
|
|
||||||
.column.ace-container
|
|
||||||
#codeblock-editor
|
|
||||||
footer
|
|
||||||
a.button.is-grey.is-outlined(v-on:click='cancel') {{ $t('editor.discard') }}
|
|
||||||
a.button.is-green(v-on:click='insertCode') {{ $t('editor.codeblockinsert') }}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
let codeEditor
|
|
||||||
let ace
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'editor-codeblock',
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
modes: [],
|
|
||||||
modeSelected: 'text',
|
|
||||||
modelistLoaded: [],
|
|
||||||
isLoading: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
content() {
|
|
||||||
return this.$store.state.editorCodeblock.content
|
|
||||||
},
|
|
||||||
isShown() {
|
|
||||||
return this.$store.state.editorCodeblock.shown
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
modeSelected(val, oldVal) {
|
|
||||||
this.loadMode(val)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
init() {
|
|
||||||
let self = this
|
|
||||||
self._.delay(() => {
|
|
||||||
codeEditor = ace.edit('codeblock-editor')
|
|
||||||
codeEditor.setTheme('ace/theme/tomorrow_night')
|
|
||||||
codeEditor.getSession().setMode('ace/mode/' + self.modeSelected)
|
|
||||||
codeEditor.setOption('fontSize', '14px')
|
|
||||||
codeEditor.setOption('hScrollBarAlwaysVisible', false)
|
|
||||||
codeEditor.setOption('wrap', true)
|
|
||||||
codeEditor.setOption('useSoftTabs', true)
|
|
||||||
codeEditor.setOption('tabSize', 2)
|
|
||||||
codeEditor.setOption('showPrintMargin', false)
|
|
||||||
|
|
||||||
codeEditor.setValue(self.content)
|
|
||||||
|
|
||||||
codeEditor.focus()
|
|
||||||
codeEditor.renderer.updateFull()
|
|
||||||
}, 100)
|
|
||||||
},
|
|
||||||
loadMode(m) {
|
|
||||||
let self = this
|
|
||||||
if (self._.includes(self.modelistLoaded, m)) {
|
|
||||||
codeEditor.getSession().setMode('ace/mode/' + m)
|
|
||||||
} else {
|
|
||||||
self.isLoading = true
|
|
||||||
self.$http.get('/js/ace/mode-' + m + '.js').then(resp => {
|
|
||||||
if (resp.ok) {
|
|
||||||
eval(resp.bodyText) // eslint-disable-line no-eval
|
|
||||||
self.modelistLoaded.push(m)
|
|
||||||
ace.acequire('ace/mode/' + m)
|
|
||||||
codeEditor.getSession().setMode('ace/mode/' + m)
|
|
||||||
self._.delay(() => { self.isLoading = false }, 500)
|
|
||||||
} else {
|
|
||||||
this.$store.dispatch('alert', {
|
|
||||||
style: 'red',
|
|
||||||
icon: 'ui-2_square-remove-09',
|
|
||||||
msg: self.$t('editor.codeblockloadingerror')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}).catch(err => {
|
|
||||||
this.$store.dispatch('alert', {
|
|
||||||
style: 'red',
|
|
||||||
icon: 'ui-2_square-remove-09',
|
|
||||||
msg: 'Error: ' + err.body.msg
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
cancel() {
|
|
||||||
codeEditor.destroy()
|
|
||||||
this.$store.dispatch('editorCodeblock/close')
|
|
||||||
},
|
|
||||||
insertCode() {
|
|
||||||
let codeBlockText = '\n```' + this.modeSelected + '\n' + codeEditor.getValue() + '\n```\n'
|
|
||||||
this.$store.dispatch('editor/insert', codeBlockText)
|
|
||||||
this.$store.dispatch('alert', {
|
|
||||||
style: 'blue',
|
|
||||||
icon: 'files_archive-3d-check',
|
|
||||||
msg: this.$t('editor.codeblocksuccess')
|
|
||||||
})
|
|
||||||
this.cancel()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
FuseBox.import('/js/ace/ace.js', (acePkg) => {
|
|
||||||
ace = acePkg
|
|
||||||
this.modes = ace.acequire('ace/ext/modelist').modesByName
|
|
||||||
})
|
|
||||||
this.$root.$on('editorCodeblock/init', this.init)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,605 +0,0 @@
|
|||||||
<template lang="pug">
|
|
||||||
transition(:duration="400")
|
|
||||||
.modal(v-show='isShown', v-cloak)
|
|
||||||
transition(name='modal-background')
|
|
||||||
.modal-background(v-show='isShown')
|
|
||||||
.modal-container
|
|
||||||
transition(name='modal-content')
|
|
||||||
.modal-content.is-expanded(v-show='isShown')
|
|
||||||
header.is-green
|
|
||||||
span {{ (mode === 'file') ? $t('editor.filetitle') : $t('editor.imagetitle') }}
|
|
||||||
p.modal-notify(:class='{ "is-active": isLoading }')
|
|
||||||
span {{ isLoadingText }}
|
|
||||||
i
|
|
||||||
.modal-toolbar.is-green
|
|
||||||
a.button(@click='newFolder')
|
|
||||||
i.nc-icon-outline.files_folder-14
|
|
||||||
span {{ $t('editor.newfolder') }}
|
|
||||||
a.button#btn-editor-file-upload
|
|
||||||
i.nc-icon-outline.arrows-1_cloud-upload-94
|
|
||||||
span {{ (mode === 'file') ? $t('editor.fileupload') : $t('editor.imageupload') }}
|
|
||||||
label
|
|
||||||
input(type='file', multiple, :disabled='isLoading', ref='editorFileUploadInput')
|
|
||||||
a.button(v-if='mode === "image"', @click='fetchFromUrl')
|
|
||||||
i.nc-icon-outline.arrows-1_cloud-download-93
|
|
||||||
span Fetch from URL
|
|
||||||
section.is-gapless
|
|
||||||
.columns.is-stretched
|
|
||||||
.column.is-one-quarter.modal-sidebar.is-green(style={'max-width':'350px'})
|
|
||||||
.model-sidebar-header {{ $t('editor.folders') }}
|
|
||||||
ul.model-sidebar-list
|
|
||||||
li(v-for='fld in folders')
|
|
||||||
a(@click='selectFolder(fld)', :class='{ "is-active": currentFolder === fld }')
|
|
||||||
i.nc-icon-outline.files_folder-17
|
|
||||||
span / {{ fld }}
|
|
||||||
.model-sidebar-header(v-if='mode === "image"') Alignment
|
|
||||||
.model-sidebar-content(v-if='mode === "image"')
|
|
||||||
p.control.is-fullwidth
|
|
||||||
select(v-model='currentAlign')
|
|
||||||
option(value='left') {{ $t('editor.imagealignleft') }}
|
|
||||||
option(value='center') {{ $t('editor.imagealigncenter') }}
|
|
||||||
option(value='right') {{ $t('editor.imagealignright') }}
|
|
||||||
option(value='logo') {{ $t('editor.imagealignlogo') }}
|
|
||||||
.column.editor-modal-choices.editor-modal-file-choices(v-if='mode === "file"')
|
|
||||||
figure(v-for='fl in files', :class='{ "is-active": currentFile === fl._id }', @click='selectFile(fl._id)', :data-uid='fl._id')
|
|
||||||
i(class='icon-file')
|
|
||||||
span: strong {{ fl.filename }}
|
|
||||||
span {{ fl.mime }}
|
|
||||||
span {{ filesize(fl.filesize) }}
|
|
||||||
em(v-show='files.length < 1')
|
|
||||||
i.icon-marquee-minus
|
|
||||||
| {{ $t('editor.filefolderempty') }}
|
|
||||||
.column.editor-modal-choices.editor-modal-image-choices(v-if='mode === "image"')
|
|
||||||
figure(v-for='img in files', v-bind:class='{ "is-active": currentFile === img._id }', v-on:click='selectFile(img._id)', v-bind:data-uid='img._id')
|
|
||||||
img(v-bind:src='"/uploads/t/" + img._id + ".png"')
|
|
||||||
span: strong {{ img.basename }}
|
|
||||||
span {{ filesize(img.filesize) }}
|
|
||||||
em(v-show='files.length < 1')
|
|
||||||
i.icon-marquee-minus
|
|
||||||
| {{ $t('editor.filefolderempty') }}
|
|
||||||
footer
|
|
||||||
a.button.is-grey.is-outlined(@click='cancel') {{ $t('editor.discard') }}
|
|
||||||
a.button.is-green(@click='insertFileLink') {{ (mode === 'file') ? $t('editor.fileinsert') : $t('editor.imageinsert') }}
|
|
||||||
|
|
||||||
transition(:duration="400")
|
|
||||||
.modal.is-superimposed(v-show='newFolderShow')
|
|
||||||
transition(name='modal-background')
|
|
||||||
.modal-background(v-show='newFolderShow')
|
|
||||||
.modal-container
|
|
||||||
transition(name='modal-content')
|
|
||||||
.modal-content(v-show='newFolderShow')
|
|
||||||
header.is-light-blue {{ $t('modal.newfoldertitle') }}
|
|
||||||
section
|
|
||||||
label.label {{ $t('modal.newfoldername') }}
|
|
||||||
p.control.is-fullwidth
|
|
||||||
input.input(type='text', :placeholder='$t("modal.newfoldernameplaceholder")', v-model='newFolderName', ref='editorFileNewFolderInput', @keyup.enter='newFolderCreate', @keyup.esc='newFolderDiscard')
|
|
||||||
span.help.is-danger(v-show='newFolderError') {{ $t('modal.newfolderinvalid') }}
|
|
||||||
footer
|
|
||||||
a.button.is-grey.is-outlined(@click='newFolderDiscard') {{ $t('modal.discard') }}
|
|
||||||
a.button.is-light-blue(@click='newFolderCreate') {{ $t('modal.create') }}
|
|
||||||
|
|
||||||
transition(:duration="400")
|
|
||||||
.modal.is-superimposed(v-show='fetchFromUrlShow')
|
|
||||||
transition(name='modal-background')
|
|
||||||
.modal-background(v-show='fetchFromUrlShow')
|
|
||||||
.modal-container
|
|
||||||
transition(name='modal-content')
|
|
||||||
.modal-content(v-show='fetchFromUrlShow')
|
|
||||||
header.is-light-blue Fetch Image from URL
|
|
||||||
section
|
|
||||||
label.label Enter full URL path to the image:
|
|
||||||
p.control.is-fullwidth
|
|
||||||
input.input(type='text', placeholder='http://www.example.com/some-image.png', v-model='fetchFromUrlURL', ref='editorFileFetchInput', @keyup.enter='fetchFromUrlGo', @keyup.esc='fetchFromUrlDiscard')
|
|
||||||
span.help.is-danger.is-hidden This URL path is invalid!
|
|
||||||
footer
|
|
||||||
a.button.is-grey.is-outlined(v-on:click='fetchFromUrlDiscard') Discard
|
|
||||||
a.button.is-light-blue(v-on:click='fetchFromUrlGo') Fetch
|
|
||||||
|
|
||||||
transition(:duration="400")
|
|
||||||
.modal.is-superimposed(v-show='renameFileShow')
|
|
||||||
transition(name='modal-background')
|
|
||||||
.modal-background(v-show='renameFileShow')
|
|
||||||
.modal-container
|
|
||||||
transition(name='modal-content')
|
|
||||||
.modal-content(v-show='renameFileShow')
|
|
||||||
header.is-indigo {{ $t('modal.renamefiletitle') }}
|
|
||||||
section
|
|
||||||
label.label {{ $t('modal.renamefilename') }}
|
|
||||||
p.control.is-fullwidth
|
|
||||||
input.input#txt-editor-file-rename(type='text', :placeholder='$t("modal.renamefilenameplaceholder")', v-model='renameFileFilename', ref='editorFileRenameInput', @keyup.enter='renameFileGo', @keyup.esc='renameFileDiscard')
|
|
||||||
span.help.is-danger.is-hidden {{ $t('modal.renamefileinvalid') }}
|
|
||||||
footer
|
|
||||||
a.button.is-grey.is-outlined(@click='renameFileDiscard') {{ $t('modal.discard') }}
|
|
||||||
a.button.is-light-blue(@click='renameFileGo') {{ $t('modal.renamefile') }}
|
|
||||||
|
|
||||||
transition(:duration="400")
|
|
||||||
.modal.is-superimposed(v-show='deleteFileShow')
|
|
||||||
transition(name='modal-background')
|
|
||||||
.modal-background(v-show='deleteFileShow')
|
|
||||||
.modal-container
|
|
||||||
transition(name='modal-content')
|
|
||||||
.modal-content(v-show='deleteFileShow')
|
|
||||||
header.is-red {{ $t('modal.deletefiletitle') }}
|
|
||||||
section
|
|
||||||
span {{ $t('modal.deletefilewarn') }} #[strong {{deleteFileFilename}}]?
|
|
||||||
footer
|
|
||||||
a.button.is-grey.is-outlined(@click='deleteFileWarn(false)') {{ $t('modal.discard') }}
|
|
||||||
a.button.is-red(@click='deleteFileGo') {{ $t('modal.delete') }}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
/* global $, socket */
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'editor-file',
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
isLoading: false,
|
|
||||||
isLoadingText: '',
|
|
||||||
newFolderName: '',
|
|
||||||
newFolderShow: false,
|
|
||||||
newFolderError: false,
|
|
||||||
fetchFromUrlURL: '',
|
|
||||||
fetchFromUrlShow: false,
|
|
||||||
folders: [],
|
|
||||||
currentFolder: '',
|
|
||||||
currentFile: '',
|
|
||||||
currentAlign: 'left',
|
|
||||||
files: [],
|
|
||||||
uploadSucceeded: false,
|
|
||||||
postUploadChecks: 0,
|
|
||||||
renameFileShow: false,
|
|
||||||
renameFileId: '',
|
|
||||||
renameFileFilename: '',
|
|
||||||
deleteFileShow: false,
|
|
||||||
deleteFileId: '',
|
|
||||||
deleteFileFilename: ''
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
isShown () {
|
|
||||||
return this.$store.state.editorFile.shown
|
|
||||||
},
|
|
||||||
mode () {
|
|
||||||
return this.$store.state.editorFile.mode
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
init () {
|
|
||||||
$(this.$refs.editorFileUploadInput).on('change', this.upload)
|
|
||||||
this.refreshFolders()
|
|
||||||
},
|
|
||||||
cancel () {
|
|
||||||
$(this.$refs.editorFileUploadInput).off('change', this.upload)
|
|
||||||
this.$store.dispatch('editorFile/close')
|
|
||||||
},
|
|
||||||
filesize (rawSize) {
|
|
||||||
return this.$helpers.common.filesize(rawSize)
|
|
||||||
},
|
|
||||||
|
|
||||||
// -------------------------------------------
|
|
||||||
// INSERT LINK TO FILE
|
|
||||||
// -------------------------------------------
|
|
||||||
|
|
||||||
selectFile(fileId) {
|
|
||||||
this.currentFile = fileId
|
|
||||||
},
|
|
||||||
insertFileLink() {
|
|
||||||
let selFile = this._.find(this.files, ['_id', this.currentFile])
|
|
||||||
selFile.normalizedPath = (selFile.folder === 'f:') ? selFile.filename : selFile.folder.slice(2) + '/' + selFile.filename
|
|
||||||
selFile.titleGuess = this._.startCase(selFile.basename)
|
|
||||||
|
|
||||||
let textToInsert = ''
|
|
||||||
|
|
||||||
if (this.mode === 'image') {
|
|
||||||
textToInsert = ''
|
|
||||||
switch (this.currentAlign) {
|
|
||||||
case 'center':
|
|
||||||
textToInsert += '{.align-center}'
|
|
||||||
break
|
|
||||||
case 'right':
|
|
||||||
textToInsert += '{.align-right}'
|
|
||||||
break
|
|
||||||
case 'logo':
|
|
||||||
textToInsert += '{.pagelogo}'
|
|
||||||
break
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
textToInsert = '[' + selFile.titleGuess + '](/uploads/' + selFile.normalizedPath + ' "' + selFile.titleGuess + '")'
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$store.dispatch('editor/insert', textToInsert)
|
|
||||||
this.$store.dispatch('alert', {
|
|
||||||
style: 'blue',
|
|
||||||
icon: 'ui-1_check-square-09',
|
|
||||||
msg: (this.mode === 'file') ? this.$t('editor.filesuccess') : this.$t('editor.imagesuccess')
|
|
||||||
})
|
|
||||||
this.cancel()
|
|
||||||
},
|
|
||||||
|
|
||||||
// -------------------------------------------
|
|
||||||
// NEW FOLDER
|
|
||||||
// -------------------------------------------
|
|
||||||
|
|
||||||
newFolder() {
|
|
||||||
let self = this
|
|
||||||
this.newFolderName = ''
|
|
||||||
this.newFolderError = false
|
|
||||||
this.newFolderShow = true
|
|
||||||
this._.delay(() => { self.$refs.editorFileNewFolderInput.focus() }, 400)
|
|
||||||
},
|
|
||||||
newFolderDiscard() {
|
|
||||||
this.newFolderShow = false
|
|
||||||
},
|
|
||||||
newFolderCreate() {
|
|
||||||
let self = this
|
|
||||||
let regFolderName = new RegExp('^[a-z0-9][a-z0-9-]*[a-z0-9]$')
|
|
||||||
this.newFolderName = this._.kebabCase(this._.trim(this.newFolderName))
|
|
||||||
|
|
||||||
if (this._.isEmpty(this.newFolderName) || !regFolderName.test(this.newFolderName)) {
|
|
||||||
this.newFolderError = true
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
this.newFolderDiscard()
|
|
||||||
this.isLoadingText = this.$t('modal.newfolderloading')
|
|
||||||
this.isLoading = true
|
|
||||||
|
|
||||||
this.$nextTick(() => {
|
|
||||||
socket.emit('uploadsCreateFolder', { foldername: self.newFolderName }, (data) => {
|
|
||||||
self.folders = data
|
|
||||||
self.currentFolder = self.newFolderName
|
|
||||||
self.files = []
|
|
||||||
self.isLoading = false
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'blue',
|
|
||||||
icon: 'files_folder-check',
|
|
||||||
msg: self.$t('modal.newfoldersuccess', { name: self.newFolderName })
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
// -------------------------------------------
|
|
||||||
// FETCH FROM URL
|
|
||||||
// -------------------------------------------
|
|
||||||
|
|
||||||
fetchFromUrl() {
|
|
||||||
let self = this
|
|
||||||
this.fetchFromUrlURL = ''
|
|
||||||
this.fetchFromUrlShow = true
|
|
||||||
this._.delay(() => { self.$refs.editorFileFetchInput.focus() }, 400)
|
|
||||||
},
|
|
||||||
fetchFromUrlDiscard() {
|
|
||||||
this.fetchFromUrlShow = false
|
|
||||||
},
|
|
||||||
fetchFromUrlGo() {
|
|
||||||
let self = this
|
|
||||||
this.fetchFromUrlDiscard()
|
|
||||||
this.isLoadingText = 'Fetching image...'
|
|
||||||
this.isLoading = true
|
|
||||||
|
|
||||||
this.$nextTick(() => {
|
|
||||||
socket.emit('uploadsFetchFileFromURL', { folder: self.currentFolder, fetchUrl: self.fetchFromUrlURL }, (data) => {
|
|
||||||
if (data.ok) {
|
|
||||||
self.waitChangeComplete(self.files.length, true)
|
|
||||||
} else {
|
|
||||||
self.isLoading = false
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'red',
|
|
||||||
icon: 'ui-2_square-remove-09',
|
|
||||||
msg: self.$t('editor.fileuploaderror', { err: data.msg })
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
// -------------------------------------------
|
|
||||||
// RENAME FILE
|
|
||||||
// -------------------------------------------
|
|
||||||
|
|
||||||
renameFile() {
|
|
||||||
let self = this
|
|
||||||
let c = this._.find(this.files, [ '_id', this.renameFileId ])
|
|
||||||
this.renameFileFilename = c.basename || ''
|
|
||||||
this.renameFileShow = true
|
|
||||||
this._.delay(() => {
|
|
||||||
self.$refs.editorFileRenameInput.select()
|
|
||||||
}, 100)
|
|
||||||
},
|
|
||||||
renameFileDiscard() {
|
|
||||||
this.renameFileShow = false
|
|
||||||
},
|
|
||||||
renameFileGo() {
|
|
||||||
let self = this
|
|
||||||
this.renameFileDiscard()
|
|
||||||
this.isLoadingText = this.$t('modal.renamefileloading')
|
|
||||||
this.isLoading = true
|
|
||||||
|
|
||||||
this.$nextTick(() => {
|
|
||||||
socket.emit('uploadsRenameFile', { uid: self.renameFileId, folder: self.currentFolder, filename: self.renameFileFilename }, (data) => {
|
|
||||||
if (data.ok) {
|
|
||||||
self.waitChangeComplete(self.files.length, false)
|
|
||||||
} else {
|
|
||||||
self.isLoading = false
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'red',
|
|
||||||
icon: 'ui-2_square-remove-09',
|
|
||||||
msg: self.$t('modal.renamefileerror', { err: data.msg })
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
// -------------------------------------------
|
|
||||||
// MOVE FILE
|
|
||||||
// -------------------------------------------
|
|
||||||
|
|
||||||
moveFile(uid, fld) {
|
|
||||||
let self = this
|
|
||||||
this.isLoadingText = this.$t('editor.filemoveloading')
|
|
||||||
this.isLoading = true
|
|
||||||
this.$nextTick(() => {
|
|
||||||
socket.emit('uploadsMoveFile', { uid, folder: fld }, (data) => {
|
|
||||||
if (data.ok) {
|
|
||||||
self.loadFiles()
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'blue',
|
|
||||||
icon: 'files_check',
|
|
||||||
msg: self.$t('editor.filemovesuccess')
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
self.isLoading = false
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'red',
|
|
||||||
icon: 'ui-2_square-remove-09',
|
|
||||||
msg: self.$t('editor.filemoveerror', { err: data.msg })
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
// -------------------------------------------
|
|
||||||
// DELETE FILE
|
|
||||||
// -------------------------------------------
|
|
||||||
|
|
||||||
deleteFileWarn(show) {
|
|
||||||
if (show) {
|
|
||||||
let c = this._.find(this.files, [ '_id', this.deleteFileId ])
|
|
||||||
this.deleteFileFilename = c.filename || this.$t('editor.filedeletedefault')
|
|
||||||
}
|
|
||||||
this.deleteFileShow = show
|
|
||||||
},
|
|
||||||
deleteFileGo() {
|
|
||||||
let self = this
|
|
||||||
this.deleteFileWarn(false)
|
|
||||||
this.isLoadingText = this.$t('editor.filedeleteloading')
|
|
||||||
this.isLoading = true
|
|
||||||
this.$nextTick(() => {
|
|
||||||
socket.emit('uploadsDeleteFile', { uid: this.deleteFileId }, (data) => {
|
|
||||||
self.loadFiles()
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'blue',
|
|
||||||
icon: 'ui-1_trash',
|
|
||||||
msg: self.$t('editor.filedeletesuccess')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
// -------------------------------------------
|
|
||||||
// LOAD FROM REMOTE
|
|
||||||
// -------------------------------------------
|
|
||||||
|
|
||||||
selectFolder(fldName) {
|
|
||||||
this.currentFolder = fldName
|
|
||||||
this.loadFiles()
|
|
||||||
},
|
|
||||||
|
|
||||||
refreshFolders() {
|
|
||||||
let self = this
|
|
||||||
this.isLoadingText = this.$t('editor.foldersloading')
|
|
||||||
this.isLoading = true
|
|
||||||
this.currentFolder = ''
|
|
||||||
this.currentImage = ''
|
|
||||||
this.$nextTick(() => {
|
|
||||||
socket.emit('uploadsGetFolders', { }, (data) => {
|
|
||||||
self.folders = data
|
|
||||||
self.loadFiles()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
loadFiles(silent) {
|
|
||||||
let self = this
|
|
||||||
if (!silent) {
|
|
||||||
this.isLoadingText = this.$t('editor.fileloading')
|
|
||||||
this.isLoading = true
|
|
||||||
}
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
self.$nextTick(() => {
|
|
||||||
let loadAction = (self.mode === 'image') ? 'uploadsGetImages' : 'uploadsGetFiles'
|
|
||||||
socket.emit(loadAction, { folder: self.currentFolder }, (data) => {
|
|
||||||
self.files = data
|
|
||||||
if (!silent) {
|
|
||||||
self.isLoading = false
|
|
||||||
}
|
|
||||||
self.attachContextMenus()
|
|
||||||
resolve(true)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
waitChangeComplete(oldAmount, expectChange) {
|
|
||||||
let self = this
|
|
||||||
expectChange = (this._.isBoolean(expectChange)) ? expectChange : true
|
|
||||||
|
|
||||||
this.postUploadChecks++
|
|
||||||
this.isLoadingText = this.$t('editor.fileprocessing')
|
|
||||||
|
|
||||||
this.$nextTick(() => {
|
|
||||||
self.loadFiles(true).then(() => {
|
|
||||||
if ((self.files.length !== oldAmount) === expectChange) {
|
|
||||||
self.postUploadChecks = 0
|
|
||||||
self.isLoading = false
|
|
||||||
} else if (self.postUploadChecks > 5) {
|
|
||||||
self.postUploadChecks = 0
|
|
||||||
self.isLoading = false
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'red',
|
|
||||||
icon: 'ui-2_square-remove-09',
|
|
||||||
msg: self.$t('editor.fileerror')
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
self._.delay(() => {
|
|
||||||
self.waitChangeComplete(oldAmount, expectChange)
|
|
||||||
}, 1500)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
// -------------------------------------------
|
|
||||||
// IMAGE CONTEXT MENU
|
|
||||||
// -------------------------------------------
|
|
||||||
|
|
||||||
attachContextMenus() {
|
|
||||||
let self = this
|
|
||||||
let moveFolders = this._.map(this.folders, (f) => {
|
|
||||||
return {
|
|
||||||
name: (f !== '') ? f : '/ (root)',
|
|
||||||
icon: 'nc-icon-outline files_folder-15',
|
|
||||||
callback: (key, opt) => {
|
|
||||||
let moveFileId = self._.toString($(opt.$trigger).data('uid'))
|
|
||||||
let moveFileDestFolder = self._.nth(self.folders, key)
|
|
||||||
self.moveFile(moveFileId, moveFileDestFolder)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
$.contextMenu('destroy', '.editor-modal-choices > figure')
|
|
||||||
$.contextMenu({
|
|
||||||
selector: '.editor-modal-choices > figure',
|
|
||||||
appendTo: '.editor-modal-choices',
|
|
||||||
position: (opt, x, y) => {
|
|
||||||
$(opt.$trigger).addClass('is-contextopen')
|
|
||||||
let trigPos = $(opt.$trigger).position()
|
|
||||||
let trigDim = { w: $(opt.$trigger).width() / 5, h: $(opt.$trigger).height() / 2 }
|
|
||||||
opt.$menu.css({ top: trigPos.top + trigDim.h, left: trigPos.left + trigDim.w })
|
|
||||||
},
|
|
||||||
events: {
|
|
||||||
hide: (opt) => {
|
|
||||||
$(opt.$trigger).removeClass('is-contextopen')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
items: {
|
|
||||||
rename: {
|
|
||||||
name: self.$t('editor.filerenameaction'),
|
|
||||||
icon: 'nc-icon-outline files_vector',
|
|
||||||
callback: (key, opt) => {
|
|
||||||
self.renameFileId = self._.toString(opt.$trigger[0].dataset.uid)
|
|
||||||
self.renameFile()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
move: {
|
|
||||||
name: self.$t('editor.filemoveaction'),
|
|
||||||
icon: 'fa-folder-open-o',
|
|
||||||
items: moveFolders
|
|
||||||
},
|
|
||||||
delete: {
|
|
||||||
name: self.$t('editor.filedeleteaction'),
|
|
||||||
icon: 'icon-trash2',
|
|
||||||
callback: (key, opt) => {
|
|
||||||
self.deleteFileId = self._.toString(opt.$trigger[0].dataset.uid)
|
|
||||||
self.deleteFileWarn(true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
upload() {
|
|
||||||
let self = this
|
|
||||||
let curFileAmount = this.files.length
|
|
||||||
let uplUrl = (self.mode === 'image') ? '/uploads/img' : '/uploads/file'
|
|
||||||
|
|
||||||
$(this.$refs.editorFileUploadInput).simpleUpload(uplUrl, {
|
|
||||||
|
|
||||||
name: (self.mode === 'image') ? 'imgfile' : 'binfile',
|
|
||||||
data: {
|
|
||||||
folder: self.currentFolder
|
|
||||||
},
|
|
||||||
limit: 20,
|
|
||||||
expect: 'json',
|
|
||||||
allowedExts: (self.mode === 'image') ? ['jpg', 'jpeg', 'gif', 'png', 'webp'] : undefined,
|
|
||||||
allowedTypes: (self.mode === 'image') ? ['image/png', 'image/jpeg', 'image/gif', 'image/webp'] : undefined,
|
|
||||||
maxFileSize: (self.mode === 'image') ? 3145728 : 0, // max 3 MB
|
|
||||||
|
|
||||||
init: (totalUploads) => {
|
|
||||||
self.uploadSucceeded = false
|
|
||||||
self.isLoadingText = 'Preparing to upload...'
|
|
||||||
self.isLoading = true
|
|
||||||
},
|
|
||||||
|
|
||||||
progress: (progress) => {
|
|
||||||
self.isLoadingText = 'Uploading...' + Math.round(progress) + '%'
|
|
||||||
},
|
|
||||||
|
|
||||||
success: (data) => {
|
|
||||||
if (data.ok) {
|
|
||||||
let failedUpls = self._.filter(data.results, ['ok', false])
|
|
||||||
if (failedUpls.length) {
|
|
||||||
self._.forEach(failedUpls, (u) => {
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'red',
|
|
||||||
icon: 'ui-2_square-remove-09',
|
|
||||||
msg: self.$t('editor.fileuploaderror', { err: u.msg })
|
|
||||||
})
|
|
||||||
})
|
|
||||||
if (failedUpls.length < data.results.length) {
|
|
||||||
self.uploadSucceeded = true
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
self.uploadSucceeded = true
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'blue',
|
|
||||||
icon: 'arrows-1_cloud-upload-96',
|
|
||||||
msg: self.$t('editor.fileuploadsuccess')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'red',
|
|
||||||
icon: 'ui-2_square-remove-09',
|
|
||||||
msg: self.$t('editor.fileuploaderror', { err: data.msg })
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
error: (error) => {
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'red',
|
|
||||||
icon: 'ui-2_square-remove-09',
|
|
||||||
msg: self.$t('editor.fileuploaderror', { err: error.message })
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
finish: () => {
|
|
||||||
if (self.uploadSucceeded) {
|
|
||||||
self.waitChangeComplete(curFileAmount, true)
|
|
||||||
} else {
|
|
||||||
self.isLoading = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.$root.$on('editorFile/init', this.init)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,94 +0,0 @@
|
|||||||
<template lang="pug">
|
|
||||||
transition(:duration="400")
|
|
||||||
.modal(v-show='isShown', v-cloak)
|
|
||||||
transition(name='modal-background')
|
|
||||||
.modal-background(v-show='isShown')
|
|
||||||
.modal-container
|
|
||||||
transition(name='modal-content')
|
|
||||||
.modal-content(v-show='isShown')
|
|
||||||
header.is-green
|
|
||||||
span {{ $t('editor.videotitle') }}
|
|
||||||
section
|
|
||||||
label.label
|
|
||||||
p.control.is-fullwidth
|
|
||||||
input.input(type='text', placeholder='https://www.youtube.com/watch?v=xxxxxxxxxxx', v-model='link', ref='editorVideoInput', @keyup.enter='insertVideo', @keyup.esc='cancel')
|
|
||||||
span.help.is-red(v-show='isInvalid') {{ $t('editor.videonotsupported') }}
|
|
||||||
.note {{ $t('editor.videosupportedtitle') }}
|
|
||||||
ul
|
|
||||||
li
|
|
||||||
i.icon-youtube-play
|
|
||||||
span Youtube
|
|
||||||
li
|
|
||||||
i.icon-vimeo
|
|
||||||
span Vimeo
|
|
||||||
li
|
|
||||||
i.nc-icon-outline.media-1_play-69
|
|
||||||
span Dailymotion
|
|
||||||
li
|
|
||||||
i.icon-video
|
|
||||||
span {{ $t('editor.videoanymp4file') }}
|
|
||||||
footer
|
|
||||||
a.button.is-grey.is-outlined(v-on:click='cancel') {{ $t('editor.discard') }}
|
|
||||||
a.button.is-green(v-on:click='insertVideo') {{ $t('editor.videoinsert') }}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
const videoRules = {
|
|
||||||
'youtube': new RegExp('/(?:(?:youtu\\.be\\/|v\\/|vi\\/|u\\/\\w\\/|embed\\/)|(?:(?:watch)?\\?v(?:i)?=|&v(?:i)?=))([^#&?]*).*/', 'i'),
|
|
||||||
'vimeo': new RegExp('/vimeo.com\\/(?:channels\\/(?:\\w+\\/)?|groups\\/(?:[^/]*)\\/videos\\/|album\\/(?:\\d+)\\/video\\/|)(\\d+)(?:$|\\/|\\?)/', 'i'),
|
|
||||||
'dailymotion': new RegExp('/(?:dailymotion\\.com(?:\\/embed)?(?:\\/video|\\/hub)|dai\\.ly)\\/([0-9a-z]+)(?:[-_0-9a-zA-Z]+(?:#video=)?([a-z0-9]+)?)?/', 'i')
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'editor-video',
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
link: '',
|
|
||||||
isInvalid: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
isShown () {
|
|
||||||
return this.$store.state.editorVideo.shown
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
init () {
|
|
||||||
let self = this
|
|
||||||
self.isInvalid = false
|
|
||||||
self._.delay(() => {
|
|
||||||
self.$refs.editorVideoInput.focus()
|
|
||||||
}, 100)
|
|
||||||
},
|
|
||||||
cancel () {
|
|
||||||
this.$store.dispatch('editorVideo/close')
|
|
||||||
},
|
|
||||||
insertVideo () {
|
|
||||||
let self = this
|
|
||||||
|
|
||||||
if (this._.isEmpty(self.link) || self.link.length < 5) {
|
|
||||||
this.isInvalid = true
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
let videoType = this._.findKey(videoRules, (vr) => {
|
|
||||||
return vr.test(self.link)
|
|
||||||
})
|
|
||||||
if (this._.isNil(videoType)) {
|
|
||||||
videoType = 'video'
|
|
||||||
}
|
|
||||||
let videoText = '[video](' + this.link + '){.' + videoType + '}\n'
|
|
||||||
this.$store.dispatch('editor/insert', videoText)
|
|
||||||
this.$store.dispatch('alert', {
|
|
||||||
style: 'blue',
|
|
||||||
icon: 'media-1_action-74',
|
|
||||||
msg: self.$t('editor.videosuccess')
|
|
||||||
})
|
|
||||||
this.cancel()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted () {
|
|
||||||
this.$root.$on('editorVideo/init', this.init)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,221 +0,0 @@
|
|||||||
/* global $, siteRoot */
|
|
||||||
|
|
||||||
let mde
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'editor',
|
|
||||||
props: ['currentPath'],
|
|
||||||
data() {
|
|
||||||
return {}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
insertContent() {
|
|
||||||
return this.$store.state.editor.insertContent
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
insert(content) {
|
|
||||||
if (mde.codemirror.doc.somethingSelected()) {
|
|
||||||
mde.codemirror.execCommand('singleSelection')
|
|
||||||
}
|
|
||||||
mde.codemirror.doc.replaceSelection(this.insertContent)
|
|
||||||
},
|
|
||||||
save() {
|
|
||||||
let self = this
|
|
||||||
this.$http.put(window.location.href, {
|
|
||||||
markdown: mde.value()
|
|
||||||
}).then(resp => {
|
|
||||||
return resp.json()
|
|
||||||
}).then(resp => {
|
|
||||||
if (resp.ok) {
|
|
||||||
window.location.assign(siteRoot + '/' + self.currentPath)
|
|
||||||
} else {
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'red',
|
|
||||||
icon: 'ui-2_square-remove-09',
|
|
||||||
msg: resp.msg
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}).catch(err => {
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'red',
|
|
||||||
icon: 'ui-2_square-remove-09',
|
|
||||||
msg: 'Error: ' + err.body.msg
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
let self = this
|
|
||||||
FuseBox.import('/js/simplemde/simplemde.min.js', (SimpleMDE) => {
|
|
||||||
mde = new SimpleMDE({
|
|
||||||
autofocus: true,
|
|
||||||
autoDownloadFontAwesome: false,
|
|
||||||
element: this.$refs.editorTextArea,
|
|
||||||
placeholder: 'Enter Markdown formatted content here...',
|
|
||||||
spellChecker: false,
|
|
||||||
status: false,
|
|
||||||
toolbar: [
|
|
||||||
{
|
|
||||||
name: 'bold',
|
|
||||||
action: SimpleMDE.toggleBold,
|
|
||||||
className: 'icon-bold',
|
|
||||||
title: 'Bold'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'italic',
|
|
||||||
action: SimpleMDE.toggleItalic,
|
|
||||||
className: 'icon-italic',
|
|
||||||
title: 'Italic'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'strikethrough',
|
|
||||||
action: SimpleMDE.toggleStrikethrough,
|
|
||||||
className: 'icon-strikethrough',
|
|
||||||
title: 'Strikethrough'
|
|
||||||
},
|
|
||||||
'|',
|
|
||||||
{
|
|
||||||
name: 'heading-1',
|
|
||||||
action: SimpleMDE.toggleHeading1,
|
|
||||||
className: 'icon-header fa-header-x fa-header-1',
|
|
||||||
title: 'Header (Level 1)'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'heading-2',
|
|
||||||
action: SimpleMDE.toggleHeading2,
|
|
||||||
className: 'icon-header fa-header-x fa-header-2',
|
|
||||||
title: 'Header (Level 2)'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'heading-3',
|
|
||||||
action: SimpleMDE.toggleHeading3,
|
|
||||||
className: 'icon-header fa-header-x fa-header-3',
|
|
||||||
title: 'Header (Level 3)'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'quote',
|
|
||||||
action: SimpleMDE.toggleBlockquote,
|
|
||||||
className: 'nc-icon-outline text_quote',
|
|
||||||
title: 'Quote'
|
|
||||||
},
|
|
||||||
'|',
|
|
||||||
{
|
|
||||||
name: 'unordered-list',
|
|
||||||
action: SimpleMDE.toggleUnorderedList,
|
|
||||||
className: 'nc-icon-outline text_list-bullet',
|
|
||||||
title: 'Bullet List'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'ordered-list',
|
|
||||||
action: SimpleMDE.toggleOrderedList,
|
|
||||||
className: 'nc-icon-outline text_list-numbers',
|
|
||||||
title: 'Numbered List'
|
|
||||||
},
|
|
||||||
'|',
|
|
||||||
{
|
|
||||||
name: 'link',
|
|
||||||
action: (editor) => {
|
|
||||||
window.alert('Coming soon!')
|
|
||||||
// todo
|
|
||||||
},
|
|
||||||
className: 'nc-icon-outline ui-2_link-68',
|
|
||||||
title: 'Insert Link'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'image',
|
|
||||||
action: (editor) => {
|
|
||||||
self.$store.dispatch('editorFile/open', { mode: 'image' })
|
|
||||||
},
|
|
||||||
className: 'nc-icon-outline design_image',
|
|
||||||
title: 'Insert Image'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'file',
|
|
||||||
action: (editor) => {
|
|
||||||
self.$store.dispatch('editorFile/open', { mode: 'file' })
|
|
||||||
},
|
|
||||||
className: 'nc-icon-outline files_zip-54',
|
|
||||||
title: 'Insert File'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'video',
|
|
||||||
action: (editor) => {
|
|
||||||
self.$store.dispatch('editorVideo/open')
|
|
||||||
},
|
|
||||||
className: 'nc-icon-outline media-1_video-64',
|
|
||||||
title: 'Insert Video Player'
|
|
||||||
},
|
|
||||||
'|',
|
|
||||||
{
|
|
||||||
name: 'inline-code',
|
|
||||||
action: (editor) => {
|
|
||||||
if (!editor.codemirror.doc.somethingSelected()) {
|
|
||||||
return self.$store.dispatch('alert', {
|
|
||||||
style: 'orange',
|
|
||||||
icon: 'design_drag',
|
|
||||||
msg: 'Invalid selection. Select at least 1 character.'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
let curSel = editor.codemirror.doc.getSelections()
|
|
||||||
curSel = self._.map(curSel, (s) => {
|
|
||||||
return '`' + s + '`'
|
|
||||||
})
|
|
||||||
editor.codemirror.doc.replaceSelections(curSel)
|
|
||||||
},
|
|
||||||
className: 'nc-icon-outline arrows-4_enlarge-46',
|
|
||||||
title: 'Inline Code'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'code-block',
|
|
||||||
action: (editor) => {
|
|
||||||
self.$store.dispatch('editorCodeblock/open', {
|
|
||||||
initialContent: (mde.codemirror.doc.somethingSelected()) ? mde.codemirror.doc.getSelection() : ''
|
|
||||||
})
|
|
||||||
},
|
|
||||||
className: 'nc-icon-outline design_code',
|
|
||||||
title: 'Code Block'
|
|
||||||
},
|
|
||||||
'|',
|
|
||||||
{
|
|
||||||
name: 'table',
|
|
||||||
action: (editor) => {
|
|
||||||
window.alert('Coming soon!')
|
|
||||||
// todo
|
|
||||||
},
|
|
||||||
className: 'nc-icon-outline ui-2_grid-square',
|
|
||||||
title: 'Insert Table'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'horizontal-rule',
|
|
||||||
action: SimpleMDE.drawHorizontalRule,
|
|
||||||
className: 'nc-icon-outline design_distribute-vertical',
|
|
||||||
title: 'Horizontal Rule'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
shortcuts: {
|
|
||||||
'toggleBlockquote': null,
|
|
||||||
'toggleFullScreen': null
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// Save
|
|
||||||
$(window).bind('keydown', (ev) => {
|
|
||||||
if (ev.ctrlKey || ev.metaKey) {
|
|
||||||
switch (String.fromCharCode(ev.which).toLowerCase()) {
|
|
||||||
case 's':
|
|
||||||
ev.preventDefault()
|
|
||||||
self.save()
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// Listeners
|
|
||||||
this.$root.$on('editor/save', this.save)
|
|
||||||
this.$root.$on('editor/insert', this.insert)
|
|
||||||
|
|
||||||
this.$store.dispatch('pageLoader/complete')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,127 +0,0 @@
|
|||||||
<template lang="pug">
|
|
||||||
.container.is-fluid
|
|
||||||
.columns.is-gapless
|
|
||||||
|
|
||||||
.column.is-narrow.is-hidden-touch.sidebar
|
|
||||||
aside.stickyscroll
|
|
||||||
.sidebar-label
|
|
||||||
span {{ $t('history.pastversions') }}
|
|
||||||
ul.sidebar-menu
|
|
||||||
li(v-for='item in versions')
|
|
||||||
a.is-multiline(:title='item.dateFull', @click='changeCommit(item)', :class='{ "is-active": item.commit === current.commit }')
|
|
||||||
span {{ item.dateCalendar }}
|
|
||||||
span.is-small {{ item.commitAbbr }}
|
|
||||||
|
|
||||||
.column
|
|
||||||
.history
|
|
||||||
.history-title {{ currentPath }}
|
|
||||||
.history-info
|
|
||||||
.columns
|
|
||||||
.column.history-info-meta
|
|
||||||
p
|
|
||||||
i.nc-icon-outline.ui-1_calendar-check-62
|
|
||||||
span {{ $t('history.timestamp') }}: #[strong {{ current.dateFull }}]
|
|
||||||
p
|
|
||||||
i.nc-icon-outline.i.nc-icon-outline.users_man-23
|
|
||||||
span {{ $t('history.author') }}: #[strong {{ current.name }} <{{ current.email }}>]
|
|
||||||
p
|
|
||||||
i.nc-icon-outline.media-1_flash-21
|
|
||||||
span {{ $t('history.commit') }}: #[strong {{ current.commit }}]
|
|
||||||
.column.history-info-actions
|
|
||||||
.button-group
|
|
||||||
button.button.is-blue-grey(@click='compareWith')
|
|
||||||
i.nc-icon-outline.design_path-intersect
|
|
||||||
span {{ $t('history.comparewith') }}
|
|
||||||
button.button.is-blue-grey(@click='view')
|
|
||||||
i.nc-icon-outline.ui-1_eye-17
|
|
||||||
span {{ $t('history.view') }}
|
|
||||||
button.button.is-blue-grey(@click='revertToVersion')
|
|
||||||
i.nc-icon-outline.arrows-4_undo-29
|
|
||||||
span {{ $t('history.reverttoversion') }}
|
|
||||||
toggle.is-dark(v-model='sidebyside', :desc='$t("history.sidebyside")')
|
|
||||||
.history-diff#diff
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
/* global wiki, Diff2HtmlUI */
|
|
||||||
|
|
||||||
let diffui
|
|
||||||
let diffuiIsReady = false
|
|
||||||
export default {
|
|
||||||
name: 'history',
|
|
||||||
props: ['currentPath', 'historyData'],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
versions: [],
|
|
||||||
current: {},
|
|
||||||
diffui: {},
|
|
||||||
sidebyside: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
sidebyside() {
|
|
||||||
this.draw()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
compareWith() {
|
|
||||||
this.$store.dispatch('alert', {
|
|
||||||
style: 'purple',
|
|
||||||
icon: 'objects_astronaut',
|
|
||||||
msg: 'Sorry, this function is not available. Coming soon!'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
view() {
|
|
||||||
this.$store.dispatch('alert', {
|
|
||||||
style: 'purple',
|
|
||||||
icon: 'objects_astronaut',
|
|
||||||
msg: 'Sorry, this function is not available. Coming soon!'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
revertToVersion() {
|
|
||||||
this.$store.dispatch('alert', {
|
|
||||||
style: 'purple',
|
|
||||||
icon: 'objects_astronaut',
|
|
||||||
msg: 'Sorry, this function is not available. Coming soon!'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
draw() {
|
|
||||||
if (diffuiIsReady) {
|
|
||||||
diffui.draw('#diff', {
|
|
||||||
inputFormat: 'diff',
|
|
||||||
outputFormat: this.sidebyside ? 'side-by-side' : 'line-by-line',
|
|
||||||
matching: 'words',
|
|
||||||
synchronisedScroll: true
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
changeCommit(cm) {
|
|
||||||
let self = this
|
|
||||||
diffuiIsReady = false
|
|
||||||
self.current = cm
|
|
||||||
self.$http.post(wiki.siteRoot + '/hist', {
|
|
||||||
path: self.currentPath,
|
|
||||||
commit: cm.commit
|
|
||||||
}).then(resp => {
|
|
||||||
return resp.json()
|
|
||||||
}).then(resp => {
|
|
||||||
diffui = new Diff2HtmlUI({ diff: resp.diff })
|
|
||||||
diffuiIsReady = true
|
|
||||||
self.draw()
|
|
||||||
}).catch(err => {
|
|
||||||
console.log(err)
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'red',
|
|
||||||
icon: 'ui-2_square-remove-09',
|
|
||||||
msg: 'Error: ' + err.body.error
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.versions = JSON.parse(this.historyData)
|
|
||||||
this.changeCommit(this.versions[0])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,12 +0,0 @@
|
|||||||
<template lang="pug">
|
|
||||||
i.nav-item#notifload(v-bind:class='{ "is-active": loading }')
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { mapState } from 'vuex'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'loading-spinner',
|
|
||||||
computed: mapState(['loading'])
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,67 +0,0 @@
|
|||||||
<template lang="pug">
|
|
||||||
transition(:duration="400")
|
|
||||||
.modal(v-show='isShown', v-cloak)
|
|
||||||
transition(name='modal-background')
|
|
||||||
.modal-background(v-show='isShown')
|
|
||||||
.modal-container
|
|
||||||
transition(name='modal-content')
|
|
||||||
.modal-content(v-show='isShown')
|
|
||||||
header.is-light-blue {{ $t('modal.createpagetitle') }}
|
|
||||||
section
|
|
||||||
label.label {{ $t('modal.createpagepath') }}
|
|
||||||
p.control.is-fullwidth(v-bind:class='{ "is-loading": isLoading }')
|
|
||||||
input.input(type='text', placeholder='page-name', v-model='userPath', ref='createPageInput', @keyup.enter='create', @keyup.esc='cancel')
|
|
||||||
span.help.is-red(v-show='isInvalid') {{ $t('modal.createpageinvalid') }}
|
|
||||||
footer
|
|
||||||
a.button.is-grey.is-outlined(v-on:click='cancel') {{ $t('modal.discard') }}
|
|
||||||
a.button.is-light-blue(v-on:click='create') {{ $t('modal.create') }}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'modal-create-page',
|
|
||||||
props: ['basepath'],
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
currentPath: '',
|
|
||||||
userPath: '',
|
|
||||||
isLoading: false,
|
|
||||||
isInvalid: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
isShown () {
|
|
||||||
if (this.$store.state.modalCreatePage.shown) {
|
|
||||||
this.makeSelection()
|
|
||||||
}
|
|
||||||
return this.$store.state.modalCreatePage.shown
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
makeSelection: function () {
|
|
||||||
let self = this
|
|
||||||
self._.delay(() => {
|
|
||||||
let startPos = (self.currentPath.length > 0) ? self.currentPath.length + 1 : 0
|
|
||||||
self.$helpers.form.setInputSelection(self.$refs.createPageInput, startPos, self.userPath.length)
|
|
||||||
}, 100)
|
|
||||||
},
|
|
||||||
cancel: function () {
|
|
||||||
this.$store.dispatch('modalCreatePage/close')
|
|
||||||
},
|
|
||||||
create: function () {
|
|
||||||
this.isInvalid = false
|
|
||||||
let newDocPath = this.$helpers.pages.makeSafePath(this.userPath)
|
|
||||||
if (this._.isEmpty(newDocPath)) {
|
|
||||||
this.isInvalid = true
|
|
||||||
} else {
|
|
||||||
this.isLoading = true
|
|
||||||
window.location.assign('/create/' + newDocPath)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted () {
|
|
||||||
this.currentPath = (this.basepath === 'home') ? '' : this.basepath
|
|
||||||
this.userPath = (this._.isEmpty(this.currentPath)) ? 'new-page' : this.currentPath + '/new-page'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,105 +0,0 @@
|
|||||||
<template lang="pug">
|
|
||||||
transition(:duration="400")
|
|
||||||
.modal(v-show='isShown', v-cloak)
|
|
||||||
transition(name='modal-background')
|
|
||||||
.modal-background(v-show='isShown')
|
|
||||||
.modal-container
|
|
||||||
transition(name='modal-content')
|
|
||||||
.modal-content(v-show='isShown')
|
|
||||||
header.is-blue
|
|
||||||
span {{ $t('modal.createusertitle') }}
|
|
||||||
p.modal-notify(:class='{ "is-active": isLoading }'): i
|
|
||||||
section
|
|
||||||
label.label {{ $t('modal.createuseremail') }}
|
|
||||||
p.control.is-fullwidth
|
|
||||||
input.input(type='text', :placeholder='$t("modal.createuseremailplaceholder")', v-model='email', ref='createUserEmailInput')
|
|
||||||
section
|
|
||||||
label.label {{ $t('modal.createuserprovider') }}
|
|
||||||
p.control.is-fullwidth
|
|
||||||
select(v-model='provider')
|
|
||||||
option(value='local') Local Database
|
|
||||||
option(value='windowslive') Microsoft Account
|
|
||||||
option(value='google') Google ID
|
|
||||||
option(value='facebook') Facebook
|
|
||||||
option(value='github') GitHub
|
|
||||||
option(value='slack') Slack
|
|
||||||
section(v-if='provider=="local"')
|
|
||||||
label.label {{ $t('modal.createuserpassword') }}
|
|
||||||
p.control.is-fullwidth
|
|
||||||
input.input(type='password', placeholder='', v-model='password')
|
|
||||||
section(v-if='provider=="local"')
|
|
||||||
label.label {{ $t('modal.createusername') }}
|
|
||||||
p.control.is-fullwidth
|
|
||||||
input.input(type='text', :placeholder='$t("modal.createusernameplaceholder")', v-model='name')
|
|
||||||
footer
|
|
||||||
a.button.is-grey.is-outlined(@click='cancel') {{ $t('modal.discard') }}
|
|
||||||
a.button(@click='create', v-if='provider=="local"', :disabled='isLoading', :class='{ "is-disabled": isLoading, "is-blue": !loading }') {{ $t('modal.createuser') }}
|
|
||||||
a.button(@click='create', v-if='provider!="local"', :disabled='isLoading', :class='{ "is-disabled": isLoading, "is-blue": !loading }') {{ $t('modal.createuserauthorize') }}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'modal-create-user',
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
email: '',
|
|
||||||
provider: 'local',
|
|
||||||
password: '',
|
|
||||||
name: '',
|
|
||||||
isLoading: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
isShown() {
|
|
||||||
return this.$store.state.modalCreateUser.shown
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
init() {
|
|
||||||
let self = this
|
|
||||||
self._.delay(() => {
|
|
||||||
self.$refs.createUserEmailInput.focus()
|
|
||||||
}, 100)
|
|
||||||
},
|
|
||||||
cancel() {
|
|
||||||
this.$store.dispatch('modalCreateUser/close')
|
|
||||||
this.email = ''
|
|
||||||
this.provider = 'local'
|
|
||||||
},
|
|
||||||
create() {
|
|
||||||
let self = this
|
|
||||||
this.isLoading = true
|
|
||||||
this.$http.post('/admin/users/create', {
|
|
||||||
email: this.email,
|
|
||||||
provider: this.provider,
|
|
||||||
password: this.password,
|
|
||||||
name: this.name
|
|
||||||
}).then(resp => {
|
|
||||||
return resp.json()
|
|
||||||
}).then(resp => {
|
|
||||||
this.isLoading = false
|
|
||||||
if (resp.ok) {
|
|
||||||
this.cancel()
|
|
||||||
window.location.reload(true)
|
|
||||||
} else {
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'red',
|
|
||||||
icon: 'ui-2_square-remove-09',
|
|
||||||
msg: resp.msg
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}).catch(err => {
|
|
||||||
this.isLoading = false
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'red',
|
|
||||||
icon: 'ui-2_square-remove-09',
|
|
||||||
msg: 'Error: ' + err.body.msg
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.$root.$on('modalCreateUser/init', this.init)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,66 +0,0 @@
|
|||||||
<template lang="pug">
|
|
||||||
transition(:duration="400")
|
|
||||||
.modal(v-show='isShown', v-cloak)
|
|
||||||
transition(name='modal-background')
|
|
||||||
.modal-background(v-show='isShown')
|
|
||||||
.modal-container
|
|
||||||
transition(name='modal-content')
|
|
||||||
.modal-content(v-show='isShown')
|
|
||||||
header.is-red
|
|
||||||
span {{ $t('modal.deletepagetitle') }}
|
|
||||||
p.modal-notify(v-bind:class='{ "is-active": isLoading }'): i
|
|
||||||
section
|
|
||||||
span {{ $t('modal.deletepagewarning') }}
|
|
||||||
footer
|
|
||||||
a.button.is-grey.is-outlined(v-on:click='discard') {{ $t('modal.discard') }}
|
|
||||||
a.button.is-red(v-on:click='deletePage') {{ $t('modal.delete') }}
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'modal-delete-page',
|
|
||||||
props: ['currentPath'],
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
isLoading: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
isShown () {
|
|
||||||
return this.$store.state.modalDeletePage.shown
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
discard () {
|
|
||||||
this.isLoading = false
|
|
||||||
this.$store.dispatch('modalDeletePage/close')
|
|
||||||
},
|
|
||||||
deletePage () {
|
|
||||||
let self = this
|
|
||||||
this.isLoading = true
|
|
||||||
this.$http.delete(window.location.href).then(resp => {
|
|
||||||
return resp.json()
|
|
||||||
}).then(resp => {
|
|
||||||
if (resp.ok) {
|
|
||||||
window.location.assign('/')
|
|
||||||
} else {
|
|
||||||
self.isLoading = false
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'red',
|
|
||||||
icon: 'ui-2_square-remove-09',
|
|
||||||
msg: resp.msg
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}).catch(err => {
|
|
||||||
self.isLoading = false
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'red',
|
|
||||||
icon: 'ui-2_square-remove-09',
|
|
||||||
msg: 'Error: ' + err.body.msg
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,65 +0,0 @@
|
|||||||
<template lang="pug">
|
|
||||||
transition(:duration="400")
|
|
||||||
.modal(v-show='isShown', v-cloak)
|
|
||||||
transition(name='modal-background')
|
|
||||||
.modal-background(v-show='isShown')
|
|
||||||
.modal-container
|
|
||||||
transition(name='modal-content')
|
|
||||||
.modal-content(v-show='isShown')
|
|
||||||
header.is-red
|
|
||||||
span {{ $t('modal.deleteusertitle') }}
|
|
||||||
p.modal-notify(v-bind:class='{ "is-active": isLoading }'): i
|
|
||||||
section
|
|
||||||
span {{ $t('modal.deleteuserwarning') }}
|
|
||||||
footer
|
|
||||||
a.button.is-grey.is-outlined(@click='cancel') {{ $t('modal.abort') }}
|
|
||||||
a.button.is-red(@click='deleteUser') {{ $t('modal.delete') }}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'modal-delete-user',
|
|
||||||
props: ['currentUser'],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
isLoading: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
isShown() {
|
|
||||||
return this.$store.state.modalDeleteUser.shown
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
cancel: function () {
|
|
||||||
this.isLoading = false
|
|
||||||
this.$store.dispatch('modalDeleteUser/close')
|
|
||||||
},
|
|
||||||
deleteUser: function () {
|
|
||||||
let self = this
|
|
||||||
this.isLoading = true
|
|
||||||
this.$http.delete('/admin/users/' + this.currentUser).then(resp => {
|
|
||||||
return resp.json()
|
|
||||||
}).then(resp => {
|
|
||||||
if (resp.ok) {
|
|
||||||
window.location.assign('/admin/users')
|
|
||||||
} else {
|
|
||||||
self.isLoading = false
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'red',
|
|
||||||
icon: 'ui-2_square-remove-09',
|
|
||||||
msg: resp.msg
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}).catch(err => {
|
|
||||||
self.isLoading = false
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'red',
|
|
||||||
icon: 'ui-2_square-remove-09',
|
|
||||||
msg: 'Error: ' + err.body.msg
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,43 +0,0 @@
|
|||||||
<template lang="pug">
|
|
||||||
transition(:duration="400")
|
|
||||||
.modal(v-show='isShown', v-cloak)
|
|
||||||
transition(name='modal-background')
|
|
||||||
.modal-background(v-show='isShown')
|
|
||||||
.modal-container
|
|
||||||
transition(name='modal-content')
|
|
||||||
.modal-content(v-show='isShown')
|
|
||||||
header.is-orange {{ $t('modal.discardpagetitle') }}
|
|
||||||
section
|
|
||||||
span(v-if='mode === "create"') {{ $t('modal.discardpagecreate') }}
|
|
||||||
span(v-else) {{ $t('modal.discardpageedit') }}
|
|
||||||
footer
|
|
||||||
a.button.is-grey.is-outlined(v-on:click='stay') {{ $t('modal.discardpagestay') }}
|
|
||||||
a.button.is-orange(v-on:click='discard') {{ $t('modal.discard') }}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'modal-discard-page',
|
|
||||||
props: ['mode', 'currentPath'],
|
|
||||||
data () {
|
|
||||||
return {}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
isShown () {
|
|
||||||
return this.$store.state.modalDiscardPage.shown
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
stay: function () {
|
|
||||||
this.$store.dispatch('modalDiscardPage/close')
|
|
||||||
},
|
|
||||||
discard: function () {
|
|
||||||
if (this.mode === 'create') {
|
|
||||||
window.location.assign('/')
|
|
||||||
} else {
|
|
||||||
window.location.assign('/' + this.currentPath)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,86 +0,0 @@
|
|||||||
<template lang="pug">
|
|
||||||
transition(:duration="400")
|
|
||||||
.modal(v-show='isShown', v-cloak)
|
|
||||||
transition(name='modal-background')
|
|
||||||
.modal-background(v-show='isShown')
|
|
||||||
.modal-container
|
|
||||||
transition(name='modal-content')
|
|
||||||
.modal-content(v-show='isShown')
|
|
||||||
header.is-indigo {{ $t('modal.movepagetitle') }}
|
|
||||||
section
|
|
||||||
label.label {{ $t('modal.movepagepath') }}
|
|
||||||
p.control.is-fullwidth(v-bind:class='{ "is-loading": isLoading }')
|
|
||||||
input.input(type='text', v-bind:placeholder='$t("modal.movepageplaceholder")', v-model='movePath', ref='movePageInput', @keyup.enter='move', @keyup.esc='cancel')
|
|
||||||
span.help.is-red(v-show='isInvalid') {{ $t('modal.movepageinvalid') }}
|
|
||||||
span.note {{ $t('modal.movepagewarning') }}
|
|
||||||
footer
|
|
||||||
a.button.is-grey.is-outlined(v-on:click='cancel') {{ $t('modal.discard') }}
|
|
||||||
a.button.is-indigo(v-on:click='move') {{ $t('modal.move') }}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'modal-move-page',
|
|
||||||
props: ['currentPath'],
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
movePath: '',
|
|
||||||
isLoading: false,
|
|
||||||
isInvalid: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
isShown () {
|
|
||||||
if (this.$store.state.modalMovePage.shown) {
|
|
||||||
this.movePath = this.currentPath
|
|
||||||
this.makeSelection()
|
|
||||||
}
|
|
||||||
return this.$store.state.modalMovePage.shown
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
makeSelection() {
|
|
||||||
let self = this
|
|
||||||
self._.delay(() => {
|
|
||||||
let startPos = (self._.includes(self.currentPath, '/')) ? self._.lastIndexOf(self.movePath, '/') + 1 : 0
|
|
||||||
self.$helpers.form.setInputSelection(self.$refs.movePageInput, startPos, self.movePath.length)
|
|
||||||
}, 100)
|
|
||||||
},
|
|
||||||
cancel() {
|
|
||||||
this.$store.dispatch('modalMovePage/close')
|
|
||||||
},
|
|
||||||
move () {
|
|
||||||
this.isInvalid = false
|
|
||||||
let newDocPath = this.$helpers.pages.makeSafePath(this.movePath)
|
|
||||||
if (this._.isEmpty(newDocPath) || newDocPath === this.currentPath || newDocPath === 'home') {
|
|
||||||
this.isInvalid = true
|
|
||||||
} else {
|
|
||||||
this.isLoading = true
|
|
||||||
this.$http.put(window.location.href, {
|
|
||||||
move: newDocPath
|
|
||||||
}).then(resp => {
|
|
||||||
return resp.json()
|
|
||||||
}).then(resp => {
|
|
||||||
if (resp.ok) {
|
|
||||||
window.location.assign('/' + newDocPath)
|
|
||||||
} else {
|
|
||||||
this.loading = false
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'red',
|
|
||||||
icon: 'ui-2_square-remove-09',
|
|
||||||
msg: resp.msg
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}).catch(err => {
|
|
||||||
this.loading = false
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'red',
|
|
||||||
icon: 'ui-2_square-remove-09',
|
|
||||||
msg: 'Error: ' + err.body.msg
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,66 +0,0 @@
|
|||||||
<template lang="pug">
|
|
||||||
transition(:duration="400")
|
|
||||||
.modal(v-show='isShown', v-cloak)
|
|
||||||
transition(name='modal-background')
|
|
||||||
.modal-background(v-show='isShown')
|
|
||||||
.modal-container
|
|
||||||
transition(name='modal-content')
|
|
||||||
.modal-content(v-show='isShown')
|
|
||||||
template(v-if='step === "qr"')
|
|
||||||
header.is-blue Setup your 2FA app
|
|
||||||
section.modal-loading
|
|
||||||
i
|
|
||||||
span Wiki.js {{ mode }} in progress...
|
|
||||||
em Please wait
|
|
||||||
template(v-if='step === "error"')
|
|
||||||
header.is-red Error
|
|
||||||
section.modal-loading
|
|
||||||
span {{ error }}
|
|
||||||
footer
|
|
||||||
a.button.is-grey.is-outlined(@click='cancel') Discard
|
|
||||||
template(v-if='step === "confirm"')
|
|
||||||
header.is-blue Two-Factor Authentication
|
|
||||||
section
|
|
||||||
label.label Do you want to enable 2FA?
|
|
||||||
span.note Two-Factor Authentication (2FA) provides an extra layer of security for your account. Upon login, you will be prompted to enter a token generated by a 2FA app (e.g. Authy, Google Authenticator, etc.).
|
|
||||||
footer
|
|
||||||
a.button.is-grey.is-outlined(@click='cancel') Discard
|
|
||||||
a.button.is-blue(@click='confirm') Setup
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'modal-profile-2fa',
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
isLoading: false,
|
|
||||||
error: ''
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
isShown() {
|
|
||||||
return this.$store.state.modalProfile2fa.shown
|
|
||||||
},
|
|
||||||
step() {
|
|
||||||
return this.$store.state.modalProfile2fa.step
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
cancel() {
|
|
||||||
this.isLoading = false
|
|
||||||
this.$store.dispatch('modalProfile2fa/close')
|
|
||||||
},
|
|
||||||
confirm() {
|
|
||||||
this.$http.post('/admin/profile/2fa', {
|
|
||||||
action: 'setup'
|
|
||||||
}).then(resp => {
|
|
||||||
this.$store.commit('modalProfile2fa/stepChange', 'qr')
|
|
||||||
}).catch(err => {
|
|
||||||
this.$store.commit('modalProfile2fa/stepChange', 'error')
|
|
||||||
this.error = err.body.msg
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,70 +0,0 @@
|
|||||||
<template lang="pug">
|
|
||||||
transition(:duration="400")
|
|
||||||
.modal(v-show='isShown', v-cloak)
|
|
||||||
transition(name='modal-background')
|
|
||||||
.modal-background(v-show='isShown')
|
|
||||||
.modal-container
|
|
||||||
transition(name='modal-content')
|
|
||||||
.modal-content(v-show='isShown')
|
|
||||||
template(v-if='step === "running"')
|
|
||||||
header.is-blue Install
|
|
||||||
section.modal-loading
|
|
||||||
i
|
|
||||||
span Wiki.js {{ mode }} in progress...
|
|
||||||
em Please wait
|
|
||||||
template(v-if='step === "error"')
|
|
||||||
header.is-red Installation Error
|
|
||||||
section.modal-loading
|
|
||||||
span {{ error }}
|
|
||||||
footer
|
|
||||||
a.button.is-grey.is-outlined(@click='upgradeCancel') Abort
|
|
||||||
a.button.is-deep-orange(@click='upgradeStart') Try Again
|
|
||||||
template(v-if='step === "confirm"')
|
|
||||||
header.is-deep-orange Are you sure?
|
|
||||||
section
|
|
||||||
label.label You are about to {{ mode }} Wiki.js.
|
|
||||||
span.note You will not be able to access your wiki during the operation. Content will not be affected. However, it is your responsability to ensure you have a backup in the unexpected event content gets lost or corrupted.
|
|
||||||
footer
|
|
||||||
a.button.is-grey.is-outlined(@click='upgradeCancel') Abort
|
|
||||||
a.button.is-deep-orange(@click='upgradeStart') Start
|
|
||||||
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'modal-upgrade-system',
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
isLoading: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
isShown() {
|
|
||||||
return this.$store.state.modalUpgradeSystem.shown
|
|
||||||
},
|
|
||||||
mode() {
|
|
||||||
return this.$store.state.modalUpgradeSystem.mode
|
|
||||||
},
|
|
||||||
step() {
|
|
||||||
return this.$store.state.modalUpgradeSystem.step
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
upgradeCancel() {
|
|
||||||
this.isLoading = false
|
|
||||||
this.$store.dispatch('modalUpgradeSystem/close')
|
|
||||||
},
|
|
||||||
upgradeStart() {
|
|
||||||
this.$store.commit('modalUpgradeSystem/stepChange', 'running')
|
|
||||||
this.$http.post('/admin/system/install', {
|
|
||||||
mode: this.mode
|
|
||||||
}).then(resp => {
|
|
||||||
// todo
|
|
||||||
}).catch(err => {
|
|
||||||
this.$store.commit('modalUpgradeSystem/stepChange', 'error')
|
|
||||||
this.error = err.body
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,23 +0,0 @@
|
|||||||
<template lang="pug">
|
|
||||||
transition(name='page-loader')
|
|
||||||
.page-loader(v-if='isShown')
|
|
||||||
i
|
|
||||||
span {{ msg }}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script type='js'>
|
|
||||||
export default {
|
|
||||||
name: 'page-loader',
|
|
||||||
props: ['text'],
|
|
||||||
data () {
|
|
||||||
return {}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
msg () { return this.$store.state.pageLoader.msg },
|
|
||||||
isShown () { return this.$store.state.pageLoader.shown }
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
this.$store.commit('pageLoader/msgChange', this.text)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,103 +0,0 @@
|
|||||||
<template lang="pug">
|
|
||||||
.nav-item
|
|
||||||
p.control(v-bind:class='{ "is-loading": searchload > 0 }')
|
|
||||||
input.input#search-input(type='text', v-model='searchq', autofocus, @keyup.esc='closeSearch', @keyup.down='moveDownSearch', @keyup.up='moveUpSearch', @keyup.enter='moveSelectSearch', debounce='400', v-bind:placeholder='$t("search.placeholder")')
|
|
||||||
|
|
||||||
transition(name='searchresults')
|
|
||||||
.searchresults(v-show='searchactive', v-cloak)
|
|
||||||
p.searchresults-label {{ $t('search.results') }}
|
|
||||||
ul.searchresults-list
|
|
||||||
li(v-if='searchres.length === 0')
|
|
||||||
a: em {{ $t('search.nomatch') }}
|
|
||||||
li(v-for='sres in searchres', v-bind:class='{ "is-active": searchmovekey === "res." + sres.entryPath }')
|
|
||||||
a(v-bind:href='sres.entryPath') {{ sres.title }}
|
|
||||||
p.searchresults-label(v-if='searchsuggest.length > 0') {{ $t('search.didyoumean') }}
|
|
||||||
ul.searchresults-list(v-if='searchsuggest.length > 0')
|
|
||||||
li(v-for='sug in searchsuggest', v-bind:class='{ "is-active": searchmovekey === "sug." + sug }')
|
|
||||||
a(v-on:click='useSuggestion(sug)') {{ sug }}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
/* global siteRoot, socket, $ */
|
|
||||||
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
searchq: '',
|
|
||||||
searchres: [],
|
|
||||||
searchsuggest: [],
|
|
||||||
searchload: 0,
|
|
||||||
searchactive: false,
|
|
||||||
searchmoveidx: 0,
|
|
||||||
searchmovekey: '',
|
|
||||||
searchmovearr: []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
searchq: function (val, oldVal) {
|
|
||||||
let self = this
|
|
||||||
self.searchmoveidx = 0
|
|
||||||
if (val.length >= 3) {
|
|
||||||
self.searchactive = true
|
|
||||||
self.searchload++
|
|
||||||
socket.emit('search', { terms: val }, (data) => {
|
|
||||||
self.searchres = self._.map(data.match, m => {
|
|
||||||
m.entryPath = `${siteRoot}/${m.entryPath}`
|
|
||||||
return m
|
|
||||||
})
|
|
||||||
self.searchsuggest = data.suggest
|
|
||||||
self.searchmovearr = self._.concat([], self.searchres, self.searchsuggest)
|
|
||||||
if (self.searchload > 0) { self.searchload-- }
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
self.searchactive = false
|
|
||||||
self.searchres = []
|
|
||||||
self.searchsuggest = []
|
|
||||||
self.searchmovearr = []
|
|
||||||
self.searchload = 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
searchmoveidx: function (val, oldVal) {
|
|
||||||
if (val > 0) {
|
|
||||||
this.searchmovekey = (this.searchmovearr[val - 1]) ?
|
|
||||||
'res.' + this.searchmovearr[val - 1].entryPath :
|
|
||||||
'sug.' + this.searchmovearr[val - 1]
|
|
||||||
} else {
|
|
||||||
this.searchmovekey = ''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
useSuggestion: function (sug) {
|
|
||||||
this.searchq = sug
|
|
||||||
},
|
|
||||||
closeSearch: function () {
|
|
||||||
this.searchq = ''
|
|
||||||
},
|
|
||||||
moveSelectSearch: function () {
|
|
||||||
if (this.searchmoveidx < 1) { return }
|
|
||||||
let i = this.searchmoveidx - 1
|
|
||||||
|
|
||||||
if (this.searchmovearr[i]) {
|
|
||||||
window.location.assign(this.searchmovearr[i].entryPath)
|
|
||||||
} else {
|
|
||||||
this.searchq = this.searchmovearr[i]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
moveDownSearch: function () {
|
|
||||||
if (this.searchmoveidx < this.searchmovearr.length) {
|
|
||||||
this.searchmoveidx++
|
|
||||||
}
|
|
||||||
},
|
|
||||||
moveUpSearch: function () {
|
|
||||||
if (this.searchmoveidx > 0) {
|
|
||||||
this.searchmoveidx--
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted: function () {
|
|
||||||
let self = this
|
|
||||||
$('main').on('click', self.closeSearch)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,84 +0,0 @@
|
|||||||
<template lang="pug">
|
|
||||||
.has-collapsable-nav
|
|
||||||
ul.collapsable-nav(v-for='treeItem in tree', :class='{ "has-children": treeItem.hasChildren }', v-cloak)
|
|
||||||
li(v-for='page in treeItem.pages', :class='{ "is-active": page.isActive }')
|
|
||||||
a(v-on:click='mainAction(page)')
|
|
||||||
template(v-if='page._id !== "home"')
|
|
||||||
i(:class='{ "icon-folder2": page.isDirectory, "icon-file-text-o": !page.isDirectory }')
|
|
||||||
span {{ page.title }}
|
|
||||||
template(v-else)
|
|
||||||
i.icon-home
|
|
||||||
span {{ $t('nav.home') }}
|
|
||||||
a.is-pagelink(v-if='page.isDirectory && page.isEntry', v-on:click='goto(page._id)')
|
|
||||||
i.icon-file-text-o
|
|
||||||
i.icon-arrow-right2
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
/* global socket, siteRoot */
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'tree',
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
tree: []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
fetch (basePath) {
|
|
||||||
let self = this
|
|
||||||
self.$store.dispatch('startLoading')
|
|
||||||
self.$nextTick(() => {
|
|
||||||
socket.emit('treeFetch', { basePath }, (data) => {
|
|
||||||
if (self.tree.length > 0) {
|
|
||||||
let branch = self._.last(self.tree)
|
|
||||||
branch.hasChildren = true
|
|
||||||
self._.find(branch.pages, { _id: basePath }).isActive = true
|
|
||||||
}
|
|
||||||
self.tree.push({
|
|
||||||
hasChildren: false,
|
|
||||||
pages: data
|
|
||||||
})
|
|
||||||
self.$store.dispatch('stopLoading')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
goto (entryPath) {
|
|
||||||
window.location.assign(siteRoot + '/' + entryPath)
|
|
||||||
},
|
|
||||||
unfold (entryPath) {
|
|
||||||
let self = this
|
|
||||||
let lastIndex = 0
|
|
||||||
self._.forEach(self.tree, branch => {
|
|
||||||
lastIndex++
|
|
||||||
if (self._.find(branch.pages, { _id: entryPath }) !== undefined) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
self.tree = self._.slice(self.tree, 0, lastIndex)
|
|
||||||
let branch = self._.last(self.tree)
|
|
||||||
branch.hasChildren = false
|
|
||||||
branch.pages.forEach(page => {
|
|
||||||
page.isActive = false
|
|
||||||
})
|
|
||||||
},
|
|
||||||
mainAction (page) {
|
|
||||||
let self = this
|
|
||||||
if (page.isActive) {
|
|
||||||
self.unfold(page._id)
|
|
||||||
} else if (page.isDirectory) {
|
|
||||||
self.fetch(page._id)
|
|
||||||
} else {
|
|
||||||
self.goto(page._id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted () {
|
|
||||||
let basePath = window.location.pathname.slice(0, -4)
|
|
||||||
if (basePath.length > 1) {
|
|
||||||
basePath = basePath.slice(1)
|
|
||||||
}
|
|
||||||
this.fetch(basePath)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
@ -1,65 +0,0 @@
|
|||||||
// ====================================
|
|
||||||
// Load minimal lodash
|
|
||||||
// ====================================
|
|
||||||
|
|
||||||
import cloneDeep from 'lodash/cloneDeep'
|
|
||||||
import concat from 'lodash/concat'
|
|
||||||
import debounce from 'lodash/debounce'
|
|
||||||
import deburr from 'lodash/deburr'
|
|
||||||
import delay from 'lodash/delay'
|
|
||||||
import filter from 'lodash/filter'
|
|
||||||
import find from 'lodash/find'
|
|
||||||
import findKey from 'lodash/findKey'
|
|
||||||
import forEach from 'lodash/forEach'
|
|
||||||
import includes from 'lodash/includes'
|
|
||||||
import isBoolean from 'lodash/isBoolean'
|
|
||||||
import isEmpty from 'lodash/isEmpty'
|
|
||||||
import isNil from 'lodash/isNil'
|
|
||||||
import join from 'lodash/join'
|
|
||||||
import kebabCase from 'lodash/kebabCase'
|
|
||||||
import last from 'lodash/last'
|
|
||||||
import map from 'lodash/map'
|
|
||||||
import nth from 'lodash/nth'
|
|
||||||
import pullAt from 'lodash/pullAt'
|
|
||||||
import reject from 'lodash/reject'
|
|
||||||
import slice from 'lodash/slice'
|
|
||||||
import split from 'lodash/split'
|
|
||||||
import startCase from 'lodash/startCase'
|
|
||||||
import startsWith from 'lodash/startsWith'
|
|
||||||
import toString from 'lodash/toString'
|
|
||||||
import toUpper from 'lodash/toUpper'
|
|
||||||
import trim from 'lodash/trim'
|
|
||||||
|
|
||||||
// ====================================
|
|
||||||
// Build lodash object
|
|
||||||
// ====================================
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
deburr,
|
|
||||||
concat,
|
|
||||||
cloneDeep,
|
|
||||||
debounce,
|
|
||||||
delay,
|
|
||||||
filter,
|
|
||||||
find,
|
|
||||||
findKey,
|
|
||||||
forEach,
|
|
||||||
includes,
|
|
||||||
isBoolean,
|
|
||||||
isEmpty,
|
|
||||||
isNil,
|
|
||||||
join,
|
|
||||||
kebabCase,
|
|
||||||
last,
|
|
||||||
map,
|
|
||||||
nth,
|
|
||||||
pullAt,
|
|
||||||
reject,
|
|
||||||
slice,
|
|
||||||
split,
|
|
||||||
startCase,
|
|
||||||
startsWith,
|
|
||||||
toString,
|
|
||||||
toUpper,
|
|
||||||
trim
|
|
||||||
}
|
|
@ -0,0 +1,68 @@
|
|||||||
|
export default {
|
||||||
|
readyStates: [],
|
||||||
|
callbacks: [],
|
||||||
|
/**
|
||||||
|
* Check if event has been sent
|
||||||
|
*
|
||||||
|
* @param {String} evt Event name
|
||||||
|
* @returns {Boolean} True if fired
|
||||||
|
*/
|
||||||
|
isReady (evt) {
|
||||||
|
return this.readyStates.indexOf(evt) >= 0
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Register a callback to be executed when event is sent
|
||||||
|
*
|
||||||
|
* @param {String} evt Event name to register to
|
||||||
|
* @param {Function} clb Callback function
|
||||||
|
* @param {Boolean} once If the callback should be called only once
|
||||||
|
*/
|
||||||
|
register (evt, clb, once) {
|
||||||
|
if (this.isReady(evt)) {
|
||||||
|
clb()
|
||||||
|
} else {
|
||||||
|
this.callbacks.push({
|
||||||
|
event: evt,
|
||||||
|
callback: clb,
|
||||||
|
once: false,
|
||||||
|
called: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Register a callback to be executed only once when event is sent
|
||||||
|
*
|
||||||
|
* @param {String} evt Event name to register to
|
||||||
|
* @param {Function} clb Callback function
|
||||||
|
*/
|
||||||
|
registerOnce (evt, clb) {
|
||||||
|
this.register(evt, clb, true)
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Set ready state and execute callbacks
|
||||||
|
*/
|
||||||
|
notify (evt) {
|
||||||
|
this.readyStates.push(evt)
|
||||||
|
this.callbacks.forEach(clb => {
|
||||||
|
if (clb.event === evt) {
|
||||||
|
if (clb.once && clb.called) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
clb.called = true
|
||||||
|
clb.callback()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* Execute callback on DOM ready
|
||||||
|
*
|
||||||
|
* @param {Function} clb Callback function
|
||||||
|
*/
|
||||||
|
onDOMReady (clb) {
|
||||||
|
if (document.readyState === 'interactive' || document.readyState === 'complete' || document.readyState === 'loaded') {
|
||||||
|
clb()
|
||||||
|
} else {
|
||||||
|
document.addEventListener('DOMContentLoaded', clb)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,72 +0,0 @@
|
|||||||
export default {
|
|
||||||
name: 'admin-edit-user',
|
|
||||||
props: ['usrdata'],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
id: '',
|
|
||||||
email: '',
|
|
||||||
password: '********',
|
|
||||||
name: '',
|
|
||||||
rights: [],
|
|
||||||
roleoverride: 'none'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
addRightsRow() {
|
|
||||||
this.rights.push({
|
|
||||||
role: 'write',
|
|
||||||
path: '/',
|
|
||||||
exact: false,
|
|
||||||
deny: false
|
|
||||||
})
|
|
||||||
},
|
|
||||||
removeRightsRow(idx) {
|
|
||||||
this._.pullAt(this.rights, idx)
|
|
||||||
this.$forceUpdate()
|
|
||||||
},
|
|
||||||
saveUser() {
|
|
||||||
let self = this
|
|
||||||
let formattedRights = this._.cloneDeep(this.rights)
|
|
||||||
switch (this.roleoverride) {
|
|
||||||
case 'admin':
|
|
||||||
formattedRights.push({
|
|
||||||
role: 'admin',
|
|
||||||
path: '/',
|
|
||||||
exact: false,
|
|
||||||
deny: false
|
|
||||||
})
|
|
||||||
break
|
|
||||||
}
|
|
||||||
this.$http.post(window.location.href, {
|
|
||||||
password: this.password,
|
|
||||||
name: this.name,
|
|
||||||
rights: JSON.stringify(formattedRights)
|
|
||||||
}).then(resp => {
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'green',
|
|
||||||
icon: 'check',
|
|
||||||
msg: 'Changes have been applied successfully.'
|
|
||||||
})
|
|
||||||
}).catch(err => {
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'red',
|
|
||||||
icon: 'square-cross',
|
|
||||||
msg: 'Error: ' + err.body.msg
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
let usr = JSON.parse(this.usrdata)
|
|
||||||
this.id = usr._id
|
|
||||||
this.email = usr.email
|
|
||||||
this.name = usr.name
|
|
||||||
|
|
||||||
if (this._.find(usr.rights, { role: 'admin' })) {
|
|
||||||
this.rights = this._.reject(usr.rights, ['role', 'admin'])
|
|
||||||
this.roleoverride = 'admin'
|
|
||||||
} else {
|
|
||||||
this.rights = usr.rights
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
export default {
|
|
||||||
name: 'admin-profile',
|
|
||||||
props: ['email', 'name', 'provider', 'tfaIsActive'],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
password: '********',
|
|
||||||
passwordVerify: '********'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
tfaStatus() {
|
|
||||||
return this.tfaIsActive ? this.$t('profile.tfaenabled') : this.$t('profile.tfadisabled')
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
saveUser() {
|
|
||||||
let self = this
|
|
||||||
if (this.password !== this.passwordVerify) {
|
|
||||||
return self.$store.dispatch('alert', {
|
|
||||||
style: 'red',
|
|
||||||
icon: 'square-cross',
|
|
||||||
msg: 'The passwords don\'t match. Try again.'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.$http.post(window.location.href, {
|
|
||||||
password: this.password,
|
|
||||||
name: this.name
|
|
||||||
}).then(resp => {
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'green',
|
|
||||||
icon: 'check',
|
|
||||||
msg: 'Changes have been applied successfully.'
|
|
||||||
})
|
|
||||||
}).catch(err => {
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'red',
|
|
||||||
icon: 'square-cross',
|
|
||||||
msg: 'Error: ' + err.body.msg
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
export default {
|
|
||||||
name: 'admin-settings',
|
|
||||||
data() {
|
|
||||||
return {}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
flushcache() {
|
|
||||||
window.alert('Coming soon!')
|
|
||||||
},
|
|
||||||
resetaccounts() {
|
|
||||||
window.alert('Coming soon!')
|
|
||||||
},
|
|
||||||
flushsessions() {
|
|
||||||
window.alert('Coming soon!')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
export default {
|
|
||||||
name: 'admin-theme',
|
|
||||||
props: ['themedata'],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
primary: 'indigo',
|
|
||||||
alt: 'blue-grey',
|
|
||||||
footer: 'blue-grey',
|
|
||||||
codedark: 'true',
|
|
||||||
codecolorize: 'true'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
primary(val) {
|
|
||||||
this.$root.changeTheme(this.$data)
|
|
||||||
},
|
|
||||||
alt(val) {
|
|
||||||
this.$root.changeTheme(this.$data)
|
|
||||||
},
|
|
||||||
footer(val) {
|
|
||||||
this.$root.changeTheme(this.$data)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
saveTheme() {
|
|
||||||
let self = this
|
|
||||||
this.$http.post(window.location.href, self.$data).then(resp => {
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'green',
|
|
||||||
icon: 'check',
|
|
||||||
msg: 'Theme settings have been applied successfully.'
|
|
||||||
})
|
|
||||||
}).catch(err => {
|
|
||||||
self.$store.dispatch('alert', {
|
|
||||||
style: 'red',
|
|
||||||
icon: 'square-cross',
|
|
||||||
msg: 'Error: ' + err.body.msg
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
resetTheme() {
|
|
||||||
this.primary = 'indigo'
|
|
||||||
this.alt = 'blue-grey'
|
|
||||||
this.footer = 'blue-grey'
|
|
||||||
this.codedark = 'true'
|
|
||||||
this.codecolorize = 'true'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
let theme = JSON.parse(this.themedata)
|
|
||||||
this.primary = theme.primary
|
|
||||||
this.alt = theme.alt
|
|
||||||
this.footer = theme.footer
|
|
||||||
this.codedark = theme.code.dark.toString()
|
|
||||||
this.codecolorize = theme.code.colorize.toString()
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
/* global $ */
|
|
||||||
|
|
||||||
export default {
|
|
||||||
name: 'content-view',
|
|
||||||
data() {
|
|
||||||
return {}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
let self = this
|
|
||||||
$('a.toc-anchor').each((i, elm) => {
|
|
||||||
let hashText = $(elm).attr('href').slice(1)
|
|
||||||
$(elm).on('click', (ev) => {
|
|
||||||
ev.stopImmediatePropagation()
|
|
||||||
self.$store.dispatch('anchor/open', hashText)
|
|
||||||
return false
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
export default {
|
|
||||||
name: 'source-view',
|
|
||||||
data() {
|
|
||||||
return {}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
let self = this
|
|
||||||
FuseBox.import('/js/ace/ace.js', (ace) => {
|
|
||||||
let scEditor = ace.edit('source-display')
|
|
||||||
scEditor.setTheme('ace/theme/dawn')
|
|
||||||
scEditor.getSession().setMode('ace/mode/markdown')
|
|
||||||
scEditor.setOption('fontSize', '14px')
|
|
||||||
scEditor.setOption('hScrollBarAlwaysVisible', false)
|
|
||||||
scEditor.setOption('wrap', true)
|
|
||||||
scEditor.setOption('showPrintMargin', false)
|
|
||||||
scEditor.setReadOnly(true)
|
|
||||||
scEditor.renderer.updateFull()
|
|
||||||
scEditor.renderer.on('afterRender', () => {
|
|
||||||
self.$store.dispatch('pageLoader/complete')
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
export default {
|
|
||||||
namespaced: true,
|
|
||||||
state: {
|
|
||||||
shown: false,
|
|
||||||
hash: ''
|
|
||||||
},
|
|
||||||
getters: {},
|
|
||||||
mutations: {
|
|
||||||
anchorChange: (state, opts) => {
|
|
||||||
state.shown = (opts.shown === true)
|
|
||||||
state.hash = opts.hash || ''
|
|
||||||
}
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
open({ commit }, hash) {
|
|
||||||
commit('anchorChange', { shown: true, hash })
|
|
||||||
},
|
|
||||||
close({ commit }) {
|
|
||||||
commit('anchorChange', { shown: false })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
/* global wikijs */
|
|
||||||
|
|
||||||
export default {
|
|
||||||
namespaced: true,
|
|
||||||
state: {
|
|
||||||
shown: false,
|
|
||||||
content: ''
|
|
||||||
},
|
|
||||||
getters: {},
|
|
||||||
mutations: {
|
|
||||||
shownChange: (state, shownState) => { state.shown = shownState },
|
|
||||||
contentChange: (state, newContent) => { state.content = newContent }
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
open({ commit }, opts) {
|
|
||||||
commit('shownChange', true)
|
|
||||||
commit('contentChange', opts.initialContent || '')
|
|
||||||
wikijs.$emit('editorCodeblock/init')
|
|
||||||
},
|
|
||||||
close({ commit }) { commit('shownChange', false) }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
/* global wikijs */
|
|
||||||
|
|
||||||
export default {
|
|
||||||
namespaced: true,
|
|
||||||
state: {
|
|
||||||
shown: false,
|
|
||||||
mode: 'image'
|
|
||||||
},
|
|
||||||
getters: {},
|
|
||||||
mutations: {
|
|
||||||
shownChange: (state, shownState) => { state.shown = shownState },
|
|
||||||
modeChange: (state, modeState) => { state.mode = modeState }
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
open({ commit }, opts) {
|
|
||||||
commit('shownChange', true)
|
|
||||||
commit('modeChange', opts.mode)
|
|
||||||
wikijs.$emit('editorFile/init')
|
|
||||||
},
|
|
||||||
close({ commit }) { commit('shownChange', false) }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
/* global wikijs */
|
|
||||||
|
|
||||||
export default {
|
|
||||||
namespaced: true,
|
|
||||||
state: {
|
|
||||||
shown: false
|
|
||||||
},
|
|
||||||
getters: {},
|
|
||||||
mutations: {
|
|
||||||
shownChange: (state, shownState) => { state.shown = shownState }
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
open({ commit }) {
|
|
||||||
commit('shownChange', true)
|
|
||||||
wikijs.$emit('editorVideo/init')
|
|
||||||
},
|
|
||||||
close({ commit }) { commit('shownChange', false) }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
/* global wikijs */
|
|
||||||
|
|
||||||
export default {
|
|
||||||
namespaced: true,
|
|
||||||
state: {
|
|
||||||
busy: false,
|
|
||||||
insertContent: ''
|
|
||||||
},
|
|
||||||
getters: {},
|
|
||||||
mutations: {
|
|
||||||
busyChange: (state, busyState) => { state.shown = busyState },
|
|
||||||
insertContentChange: (state, newContent) => { state.insertContent = newContent }
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
busyStart({ commit }) { commit('busyChange', true) },
|
|
||||||
busyStop({ commit }) { commit('busyChange', false) },
|
|
||||||
insert({ commit }, content) {
|
|
||||||
commit('insertContentChange', content)
|
|
||||||
wikijs.$emit('editor/insert')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
export default {
|
|
||||||
namespaced: true,
|
|
||||||
state: {
|
|
||||||
shown: false
|
|
||||||
},
|
|
||||||
getters: {},
|
|
||||||
mutations: {
|
|
||||||
shownChange: (state, shownState) => { state.shown = shownState }
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
open({ commit }) { commit('shownChange', true) },
|
|
||||||
close({ commit }) { commit('shownChange', false) }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
/* global wikijs */
|
|
||||||
|
|
||||||
export default {
|
|
||||||
namespaced: true,
|
|
||||||
state: {
|
|
||||||
shown: false
|
|
||||||
},
|
|
||||||
getters: {},
|
|
||||||
mutations: {
|
|
||||||
shownChange: (state, shownState) => { state.shown = shownState }
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
open({ commit }) {
|
|
||||||
commit('shownChange', true)
|
|
||||||
wikijs.$emit('modalCreateUser/init')
|
|
||||||
},
|
|
||||||
close({ commit }) { commit('shownChange', false) }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
export default {
|
|
||||||
namespaced: true,
|
|
||||||
state: {
|
|
||||||
shown: false
|
|
||||||
},
|
|
||||||
getters: {},
|
|
||||||
mutations: {
|
|
||||||
shownChange: (state, shownState) => { state.shown = shownState }
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
open({ commit }) { commit('shownChange', true) },
|
|
||||||
close({ commit }) { commit('shownChange', false) }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
export default {
|
|
||||||
namespaced: true,
|
|
||||||
state: {
|
|
||||||
shown: false
|
|
||||||
},
|
|
||||||
getters: {},
|
|
||||||
mutations: {
|
|
||||||
shownChange: (state, shownState) => { state.shown = shownState }
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
open({ commit }) { commit('shownChange', true) },
|
|
||||||
close({ commit }) { commit('shownChange', false) }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
export default {
|
|
||||||
namespaced: true,
|
|
||||||
state: {
|
|
||||||
shown: false
|
|
||||||
},
|
|
||||||
getters: {},
|
|
||||||
mutations: {
|
|
||||||
shownChange: (state, shownState) => { state.shown = shownState }
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
open({ commit }) { commit('shownChange', true) },
|
|
||||||
close({ commit }) { commit('shownChange', false) }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,14 +0,0 @@
|
|||||||
export default {
|
|
||||||
namespaced: true,
|
|
||||||
state: {
|
|
||||||
shown: false
|
|
||||||
},
|
|
||||||
getters: {},
|
|
||||||
mutations: {
|
|
||||||
shownChange: (state, shownState) => { state.shown = shownState }
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
open({ commit }) { commit('shownChange', true) },
|
|
||||||
close({ commit }) { commit('shownChange', false) }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
export default {
|
|
||||||
namespaced: true,
|
|
||||||
state: {
|
|
||||||
shown: false,
|
|
||||||
step: 'confirm'
|
|
||||||
},
|
|
||||||
getters: {},
|
|
||||||
mutations: {
|
|
||||||
shownChange: (state, shownState) => { state.shown = shownState },
|
|
||||||
stepChange: (state, stepState) => { state.step = stepState }
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
open({ commit }, opts) {
|
|
||||||
commit('shownChange', true)
|
|
||||||
commit('stepChange', 'confirm')
|
|
||||||
},
|
|
||||||
close({ commit }) { commit('shownChange', false) }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
export default {
|
|
||||||
namespaced: true,
|
|
||||||
state: {
|
|
||||||
shown: false,
|
|
||||||
mode: 'upgrade',
|
|
||||||
step: 'confirm'
|
|
||||||
},
|
|
||||||
getters: {},
|
|
||||||
mutations: {
|
|
||||||
shownChange: (state, shownState) => { state.shown = shownState },
|
|
||||||
modeChange: (state, modeState) => { state.mode = modeState },
|
|
||||||
stepChange: (state, stepState) => { state.step = stepState }
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
open({ commit }, opts) {
|
|
||||||
commit('shownChange', true)
|
|
||||||
commit('modeChange', opts.mode)
|
|
||||||
commit('stepChange', 'confirm')
|
|
||||||
},
|
|
||||||
close({ commit }) { commit('shownChange', false) }
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
export default {
|
|
||||||
namespaced: true,
|
|
||||||
state: {
|
|
||||||
shown: true,
|
|
||||||
msg: 'Loading...'
|
|
||||||
},
|
|
||||||
getters: {},
|
|
||||||
mutations: {
|
|
||||||
shownChange: (state, shownState) => { state.shown = shownState },
|
|
||||||
msgChange: (state, newText) => { state.msg = newText }
|
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
complete({ commit }) { commit('shownChange', false) }
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in new issue