feat: branch off / create from template
This commit is contained in:
@@ -171,7 +171,7 @@ export default {
|
||||
|
||||
this.initContentParsed = this.initContent ? Base64.decode(this.initContent) : ''
|
||||
this.$store.set('editor/content', this.initContentParsed)
|
||||
if (this.mode === 'create') {
|
||||
if (this.mode === 'create' && !this.initEditor) {
|
||||
_.delay(() => {
|
||||
this.dialogEditorSelector = true
|
||||
}, 500)
|
||||
|
@@ -474,7 +474,7 @@ export default {
|
||||
mounted() {
|
||||
this.$store.set('editor/editorKey', 'markdown')
|
||||
|
||||
if (this.mode === 'create') {
|
||||
if (this.mode === 'create' && !this.$store.get('editor/content')) {
|
||||
this.$store.set('editor/content', '# Header\nYour content here')
|
||||
}
|
||||
|
||||
|
@@ -122,6 +122,8 @@
|
||||
v-btn(text, @click='isRestoreConfirmDialogShown = false', :disabled='restoreLoading') {{$t('common:actions.cancel')}}
|
||||
v-btn(color='orange darken-2', dark, @click='restoreConfirm', :loading='restoreLoading') {{$t('history:restore.confirmButton')}}
|
||||
|
||||
page-selector(mode='create', v-model='branchOffOpts.modal', :open-handler='branchOffHandle', :path='branchOffOpts.path', :locale='branchOffOpts.locale')
|
||||
|
||||
nav-footer
|
||||
notify
|
||||
search-results
|
||||
@@ -211,6 +213,12 @@ export default {
|
||||
versionId: 0,
|
||||
versionDate: ''
|
||||
},
|
||||
branchOffOpts: {
|
||||
versionId: 0,
|
||||
locale: 'en',
|
||||
path: 'new-page',
|
||||
modal: false
|
||||
},
|
||||
isRestoreConfirmDialogShown: false,
|
||||
restoreLoading: false
|
||||
}
|
||||
@@ -408,7 +416,16 @@ export default {
|
||||
this.restoreLoading = false
|
||||
},
|
||||
branchOff (versionId) {
|
||||
|
||||
const pathParts = this.path.split('/')
|
||||
this.branchOffOpts = {
|
||||
versionId: versionId,
|
||||
locale: this.locale,
|
||||
path: (pathParts.length > 1) ? _.initial(pathParts).join('/') + `/new-page` : `new-page`,
|
||||
modal: true
|
||||
}
|
||||
},
|
||||
branchOffHandle ({ locale, path }) {
|
||||
window.location.assign(`/e/${locale}/${path}?from=${this.pageId},${this.branchOffOpts.versionId}`)
|
||||
},
|
||||
toggleViewMode () {
|
||||
this.viewMode = (this.viewMode === 'line-by-line') ? 'side-by-side' : 'line-by-line'
|
||||
|
Reference in New Issue
Block a user