feat: content rendering improvements + save fix
This commit is contained in:
parent
91b79dfa1f
commit
0b5a4e0c63
@ -161,14 +161,15 @@ Vue.component('admin', () => import(/* webpackChunkName: "admin" */ './component
|
|||||||
Vue.component('editor', () => import(/* webpackPrefetch: -100, webpackChunkName: "editor" */ './components/editor.vue'))
|
Vue.component('editor', () => import(/* webpackPrefetch: -100, webpackChunkName: "editor" */ './components/editor.vue'))
|
||||||
Vue.component('history', () => import(/* webpackChunkName: "history" */ './components/history.vue'))
|
Vue.component('history', () => import(/* webpackChunkName: "history" */ './components/history.vue'))
|
||||||
Vue.component('login', () => import(/* webpackPrefetch: true, webpackChunkName: "login" */ './components/login.vue'))
|
Vue.component('login', () => import(/* webpackPrefetch: true, webpackChunkName: "login" */ './components/login.vue'))
|
||||||
Vue.component('nav-footer', () => import(/* webpackMode: "eager" */ './components/common/nav-footer.vue'))
|
|
||||||
Vue.component('nav-header', () => import(/* webpackMode: "eager" */ './components/common/nav-header.vue'))
|
Vue.component('nav-header', () => import(/* webpackMode: "eager" */ './components/common/nav-header.vue'))
|
||||||
Vue.component('nav-sidebar', () => import(/* webpackMode: "eager" */ './components/common/nav-sidebar.vue'))
|
|
||||||
Vue.component('page', () => import(/* webpackChunkName: "theme-page" */ './themes/' + process.env.CURRENT_THEME + '/components/app.vue'))
|
|
||||||
Vue.component('page-selector', () => import(/* webpackPrefetch: true, webpackChunkName: "ui-extra" */ './components/common/page-selector.vue'))
|
Vue.component('page-selector', () => import(/* webpackPrefetch: true, webpackChunkName: "ui-extra" */ './components/common/page-selector.vue'))
|
||||||
Vue.component('profile', () => import(/* webpackChunkName: "profile" */ './components/profile.vue'))
|
Vue.component('profile', () => import(/* webpackChunkName: "profile" */ './components/profile.vue'))
|
||||||
Vue.component('v-card-chin', () => import(/* webpackPrefetch: true, webpackChunkName: "ui-extra" */ './components/common/v-card-chin.vue'))
|
Vue.component('v-card-chin', () => import(/* webpackPrefetch: true, webpackChunkName: "ui-extra" */ './components/common/v-card-chin.vue'))
|
||||||
|
|
||||||
|
Vue.component('nav-footer', () => import(/* webpackChunkName: "theme-page" */ './themes/' + process.env.CURRENT_THEME + '/components/nav-footer.vue'))
|
||||||
|
Vue.component('nav-sidebar', () => import(/* webpackChunkName: "theme-page" */ './themes/' + process.env.CURRENT_THEME + '/components/nav-sidebar.vue'))
|
||||||
|
Vue.component('page', () => import(/* webpackChunkName: "theme-page" */ './themes/' + process.env.CURRENT_THEME + '/components/page.vue'))
|
||||||
|
|
||||||
let bootstrap = () => {
|
let bootstrap = () => {
|
||||||
// ====================================
|
// ====================================
|
||||||
// Notifications
|
// Notifications
|
||||||
@ -202,6 +203,12 @@ let bootstrap = () => {
|
|||||||
|
|
||||||
window.boot.notify('vue')
|
window.boot.notify('vue')
|
||||||
|
|
||||||
|
// ====================================
|
||||||
|
// Load theme-specific code
|
||||||
|
// ====================================
|
||||||
|
|
||||||
|
import(/* webpackChunkName: "theme-page" */ './themes/' + process.env.CURRENT_THEME + '/js/app.js')
|
||||||
|
|
||||||
// ====================================
|
// ====================================
|
||||||
// Load Icons
|
// Load Icons
|
||||||
// ====================================
|
// ====================================
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
@keyup.enter='searchEnter'
|
@keyup.enter='searchEnter'
|
||||||
)
|
)
|
||||||
v-menu(open-on-hover, offset-y, bottom, left, min-width='250')
|
v-menu(open-on-hover, offset-y, bottom, left, min-width='250')
|
||||||
v-toolbar-side-icon(slot='activator')
|
v-toolbar-side-icon.btn-animate-app(slot='activator')
|
||||||
v-icon view_module
|
v-icon view_module
|
||||||
v-list(dense, :light='!$vuetify.dark').py-0
|
v-list(dense, :light='!$vuetify.dark').py-0
|
||||||
v-list-tile(avatar, href='/')
|
v-list-tile(avatar, href='/')
|
||||||
@ -84,12 +84,12 @@
|
|||||||
)
|
)
|
||||||
v-icon(color='grey') search
|
v-icon(color='grey') search
|
||||||
v-tooltip(bottom)
|
v-tooltip(bottom)
|
||||||
v-btn(icon, href='/a', slot='activator')
|
v-btn.btn-animate-rotate(icon, href='/a', slot='activator')
|
||||||
v-icon(color='grey') settings
|
v-icon(color='grey') settings
|
||||||
span Admin
|
span Admin
|
||||||
v-menu(offset-y, min-width='300')
|
v-menu(offset-y, min-width='300')
|
||||||
v-tooltip(bottom, slot='activator')
|
v-tooltip(bottom, slot='activator')
|
||||||
v-btn(icon, slot='activator')
|
v-btn.btn-animate-grow(icon, slot='activator', outline, color='grey darken-3')
|
||||||
v-icon(color='grey') account_circle
|
v-icon(color='grey') account_circle
|
||||||
span Account
|
span Account
|
||||||
v-list.py-0(:light='!$vuetify.dark')
|
v-list.py-0(:light='!$vuetify.dark')
|
||||||
@ -212,4 +212,5 @@ export default {
|
|||||||
.navHeaderLoading { // To avoid search bar jumping
|
.navHeaderLoading { // To avoid search bar jumping
|
||||||
width: 22px;
|
width: 22px;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
@ -142,6 +142,10 @@ export default {
|
|||||||
initContent: {
|
initContent: {
|
||||||
type: String,
|
type: String,
|
||||||
default: null
|
default: null
|
||||||
|
},
|
||||||
|
pageId: {
|
||||||
|
type: Number,
|
||||||
|
default: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -158,6 +162,7 @@ export default {
|
|||||||
notificationState: sync('notification@isActive')
|
notificationState: sync('notification@isActive')
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
this.$store.commit('page/SET_ID', this.pageId)
|
||||||
this.$store.commit('page/SET_DESCRIPTION', this.description)
|
this.$store.commit('page/SET_DESCRIPTION', this.description)
|
||||||
this.$store.commit('page/SET_IS_PUBLISHED', this.isPublished)
|
this.$store.commit('page/SET_IS_PUBLISHED', this.isPublished)
|
||||||
this.$store.commit('page/SET_LOCALE', this.locale)
|
this.$store.commit('page/SET_LOCALE', this.locale)
|
||||||
@ -212,16 +217,16 @@ export default {
|
|||||||
mutation: createPageMutation,
|
mutation: createPageMutation,
|
||||||
variables: {
|
variables: {
|
||||||
content: this.$store.get('editor/content'),
|
content: this.$store.get('editor/content'),
|
||||||
description: this.$store.get('editor/description'),
|
description: this.$store.get('page/description'),
|
||||||
editor: 'markdown',
|
editor: 'markdown',
|
||||||
locale: this.$store.get('editor/locale'),
|
locale: this.$store.get('page/locale'),
|
||||||
isPrivate: false,
|
isPrivate: false,
|
||||||
isPublished: this.$store.get('editor/isPublished'),
|
isPublished: this.$store.get('page/isPublished'),
|
||||||
path: this.$store.get('editor/path'),
|
path: this.$store.get('page/path'),
|
||||||
publishEndDate: this.$store.get('editor/publishEndDate'),
|
publishEndDate: this.$store.get('page/publishEndDate'),
|
||||||
publishStartDate: this.$store.get('editor/publishStartDate'),
|
publishStartDate: this.$store.get('page/publishStartDate'),
|
||||||
tags: this.$store.get('editor/tags'),
|
tags: this.$store.get('page/tags'),
|
||||||
title: this.$store.get('editor/title')
|
title: this.$store.get('page/title')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
resp = _.get(resp, 'data.pages.create', {})
|
resp = _.get(resp, 'data.pages.create', {})
|
||||||
@ -244,18 +249,18 @@ export default {
|
|||||||
let resp = await this.$apollo.mutate({
|
let resp = await this.$apollo.mutate({
|
||||||
mutation: updatePageMutation,
|
mutation: updatePageMutation,
|
||||||
variables: {
|
variables: {
|
||||||
id: this.$store.get('editor/id'),
|
id: this.$store.get('page/id'),
|
||||||
content: this.$store.get('editor/content'),
|
content: this.$store.get('editor/content'),
|
||||||
description: this.$store.get('editor/description'),
|
description: this.$store.get('page/description'),
|
||||||
editor: 'markdown',
|
editor: 'markdown',
|
||||||
locale: this.$store.get('editor/locale'),
|
locale: this.$store.get('page/locale'),
|
||||||
isPrivate: false,
|
isPrivate: false,
|
||||||
isPublished: this.$store.get('editor/isPublished'),
|
isPublished: this.$store.get('page/isPublished'),
|
||||||
path: this.$store.get('editor/path'),
|
path: this.$store.get('page/path'),
|
||||||
publishEndDate: this.$store.get('editor/publishEndDate'),
|
publishEndDate: this.$store.get('page/publishEndDate'),
|
||||||
publishStartDate: this.$store.get('editor/publishStartDate'),
|
publishStartDate: this.$store.get('page/publishStartDate'),
|
||||||
tags: this.$store.get('editor/tags'),
|
tags: this.$store.get('page/tags'),
|
||||||
title: this.$store.get('editor/title')
|
title: this.$store.get('page/title')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
resp = _.get(resp, 'data.pages.update', {})
|
resp = _.get(resp, 'data.pages.update', {})
|
||||||
|
@ -206,7 +206,7 @@ export default {
|
|||||||
self.$parent.save()
|
self.$parent.save()
|
||||||
})
|
})
|
||||||
|
|
||||||
cm.setSize(null, 'calc(100vh - 100px)')
|
cm.setSize(null, 'calc(100vh - 112px)')
|
||||||
cm.setOption('extraKeys', keyBindings)
|
cm.setOption('extraKeys', keyBindings)
|
||||||
cm.on('cursorActivity', cm => {
|
cm.on('cursorActivity', cm => {
|
||||||
this.toolbarSync(cm)
|
this.toolbarSync(cm)
|
||||||
@ -270,7 +270,7 @@ export default {
|
|||||||
background-color: darken(mc('grey', '900'), 4.5%);
|
background-color: darken(mc('grey', '900'), 4.5%);
|
||||||
flex: 1 1 50%;
|
flex: 1 1 50%;
|
||||||
display: block;
|
display: block;
|
||||||
height: calc(100vh - 96px);
|
height: calc(100vh - 112px);
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
&-title {
|
&-title {
|
||||||
@ -300,7 +300,7 @@ export default {
|
|||||||
flex: 1 1 50%;
|
flex: 1 1 50%;
|
||||||
background-color: mc('grey', '100');
|
background-color: mc('grey', '100');
|
||||||
position: relative;
|
position: relative;
|
||||||
height: calc(100vh - 100px);
|
height: calc(100vh - 112px);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
||||||
@include until($tablet) {
|
@include until($tablet) {
|
||||||
@ -321,7 +321,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
&-content {
|
&-content {
|
||||||
height: calc(100vh - 100px);
|
height: calc(100vh - 112px);
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
padding: 30px 1rem 1rem 1rem;
|
padding: 30px 1rem 1rem 1rem;
|
||||||
width: calc(100% + 1rem + 17px)
|
width: calc(100% + 1rem + 17px)
|
||||||
|
@ -207,14 +207,14 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
mode: get('editor/mode'),
|
mode: get('editor/mode'),
|
||||||
title: sync('editor/title'),
|
title: sync('page/title'),
|
||||||
description: sync('editor/description'),
|
description: sync('page/description'),
|
||||||
locale: sync('editor/locale'),
|
locale: sync('page/locale'),
|
||||||
tags: sync('editor/tags'),
|
tags: sync('page/tags'),
|
||||||
path: sync('editor/path'),
|
path: sync('page/path'),
|
||||||
isPublished: sync('editor/isPublished'),
|
isPublished: sync('page/isPublished'),
|
||||||
publishStartDate: sync('editor/publishStartDate'),
|
publishStartDate: sync('page/publishStartDate'),
|
||||||
publishEndDate: sync('editor/publishEndDate')
|
publishEndDate: sync('page/publishEndDate')
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.isShown = true
|
this.isShown = true
|
||||||
|
@ -1,3 +1,44 @@
|
|||||||
.v-btn.is-icon {
|
.v-btn.is-icon {
|
||||||
min-width: auto;
|
min-width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn-animate-rotate {
|
||||||
|
i {
|
||||||
|
transition: all 4s ease;
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
&:hover i {
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-animate-grow {
|
||||||
|
i {
|
||||||
|
transition: all 2s ease;
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
&:hover i {
|
||||||
|
transform: scale(1.25);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-animate-edit {
|
||||||
|
i {
|
||||||
|
transition: all .7s cubic-bezier(0.68, -0.55, 0.265, 1.55);
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
&:hover i {
|
||||||
|
transform: rotate(-45deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-animate-app {
|
||||||
|
i {
|
||||||
|
transition: all .6s ease;
|
||||||
|
transform: translate3d(0,0,0);
|
||||||
|
transform-style: preserve-3d;
|
||||||
|
}
|
||||||
|
&:hover i {
|
||||||
|
transform: scale(.7) rotateX(-180deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,17 +1,8 @@
|
|||||||
import { make } from 'vuex-pathify'
|
import { make } from 'vuex-pathify'
|
||||||
|
|
||||||
const state = {
|
const state = {
|
||||||
id: 0,
|
|
||||||
content: '',
|
content: '',
|
||||||
description: '',
|
mode: 'create'
|
||||||
isPublished: true,
|
|
||||||
locale: 'en',
|
|
||||||
mode: 'create',
|
|
||||||
path: '',
|
|
||||||
publishEndDate: '',
|
|
||||||
publishStartDate: '',
|
|
||||||
tags: [],
|
|
||||||
title: ''
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -47,7 +47,7 @@
|
|||||||
.caption.grey--text.text--darken-1 {{ updatedAt | moment('calendar') }}
|
.caption.grey--text.text--darken-1 {{ updatedAt | moment('calendar') }}
|
||||||
v-spacer
|
v-spacer
|
||||||
v-tooltip(left)
|
v-tooltip(left)
|
||||||
v-btn(icon, slot='activator', :href='"/e/" + path')
|
v-btn.btn-animate-edit(icon, slot='activator', :href='"/e/" + path')
|
||||||
v-icon(color='grey') edit
|
v-icon(color='grey') edit
|
||||||
span Edit Page
|
span Edit Page
|
||||||
v-divider
|
v-divider
|
@ -87,16 +87,28 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
code {
|
code {
|
||||||
background-color: transparent;
|
background-color: rgba(mc('pink', '500'), .1);
|
||||||
|
padding: 0 5px;
|
||||||
|
color: mc('pink', '800');
|
||||||
font-family: 'Source Code Pro', monospace;
|
font-family: 'Source Code Pro', monospace;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
|
box-shadow: none;
|
||||||
|
|
||||||
&::before, &::after {
|
&::before, &::after {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ol, ul {
|
||||||
|
padding: 1rem 24px 0 24px;
|
||||||
|
list-style-position: inside;
|
||||||
|
|
||||||
|
li + li {
|
||||||
|
margin-top: .5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.prismjs{
|
.prismjs{
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
@ -106,6 +118,9 @@
|
|||||||
margin: 1rem 24px;
|
margin: 1rem 24px;
|
||||||
|
|
||||||
> code {
|
> code {
|
||||||
|
background-color: transparent;
|
||||||
|
padding: 0;
|
||||||
|
color: #FFF;
|
||||||
box-shadow: initial;
|
box-shadow: initial;
|
||||||
display: block;
|
display: block;
|
||||||
font-size: .85rem;
|
font-size: .85rem;
|
||||||
|
@ -37,6 +37,15 @@ module.exports = {
|
|||||||
case 'mariadb':
|
case 'mariadb':
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
dbClient = 'mysql2'
|
dbClient = 'mysql2'
|
||||||
|
|
||||||
|
// Fix mysql boolean handling...
|
||||||
|
dbConfig.typeCast = (field, next) => {
|
||||||
|
if (field.type === 'TINY' && field.length === 1) {
|
||||||
|
let value = field.string()
|
||||||
|
return value ? (value === '1') : null
|
||||||
|
}
|
||||||
|
return next()
|
||||||
|
}
|
||||||
break
|
break
|
||||||
case 'mssql':
|
case 'mssql':
|
||||||
dbClient = 'mssql'
|
dbClient = 'mssql'
|
||||||
|
@ -4,6 +4,7 @@ const getos = Promise.promisify(require('getos'))
|
|||||||
const os = require('os')
|
const os = require('os')
|
||||||
const filesize = require('filesize')
|
const filesize = require('filesize')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
const fs = require('fs-extra')
|
||||||
|
|
||||||
/* global WIKI */
|
/* global WIKI */
|
||||||
|
|
||||||
@ -76,6 +77,10 @@ module.exports = {
|
|||||||
const osInfo = await getos()
|
const osInfo = await getos()
|
||||||
osLabel = `${os.type()} - ${osInfo.dist} (${osInfo.codename || os.platform()}) ${osInfo.release || os.release()} ${os.arch()}`
|
osLabel = `${os.type()} - ${osInfo.dist} (${osInfo.codename || os.platform()}) ${osInfo.release || os.release()} ${os.arch()}`
|
||||||
}
|
}
|
||||||
|
const isDockerized = await fs.pathExists('/.dockerenv')
|
||||||
|
if (isDockerized) {
|
||||||
|
osLabel = `${osLabel} (Docker Container)`
|
||||||
|
}
|
||||||
return osLabel
|
return osLabel
|
||||||
},
|
},
|
||||||
hostname() {
|
hostname() {
|
||||||
|
@ -23,6 +23,7 @@ module.exports = class PageHistory extends Model {
|
|||||||
publishStartDate: {type: 'string'},
|
publishStartDate: {type: 'string'},
|
||||||
publishEndDate: {type: 'string'},
|
publishEndDate: {type: 'string'},
|
||||||
content: {type: 'string'},
|
content: {type: 'string'},
|
||||||
|
contentType: {type: 'string'},
|
||||||
|
|
||||||
createdAt: {type: 'string'}
|
createdAt: {type: 'string'}
|
||||||
}
|
}
|
||||||
@ -87,6 +88,7 @@ module.exports = class PageHistory extends Model {
|
|||||||
pageId: opts.id,
|
pageId: opts.id,
|
||||||
authorId: opts.authorId,
|
authorId: opts.authorId,
|
||||||
content: opts.content,
|
content: opts.content,
|
||||||
|
contentType: opts.contentType,
|
||||||
description: opts.description,
|
description: opts.description,
|
||||||
editorKey: opts.editorKey,
|
editorKey: opts.editorKey,
|
||||||
hash: opts.hash,
|
hash: opts.hash,
|
||||||
|
@ -4,6 +4,7 @@ block body
|
|||||||
#root
|
#root
|
||||||
v-app
|
v-app
|
||||||
editor(
|
editor(
|
||||||
|
:page-id=page.id
|
||||||
locale=page.localeCode
|
locale=page.localeCode
|
||||||
path=page.path
|
path=page.path
|
||||||
title=page.title
|
title=page.title
|
||||||
|
@ -14,6 +14,6 @@ block body
|
|||||||
updated-at=page.updatedAt
|
updated-at=page.updatedAt
|
||||||
author-name=page.authorName
|
author-name=page.authorName
|
||||||
:author-id=page.authorId
|
:author-id=page.authorId
|
||||||
is-published=page.isPublished
|
:is-published=page.isPublished
|
||||||
)
|
)
|
||||||
template(slot='contents')!= page.render
|
template(slot='contents')!= page.render
|
||||||
|
Loading…
x
Reference in New Issue
Block a user