feat: page css + scripts
This commit is contained in:
@@ -111,6 +111,14 @@ export default {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
scriptCss: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
scriptJs: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
initEditor: {
|
||||
type: String,
|
||||
default: null
|
||||
@@ -185,15 +193,17 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.$store.commit('page/SET_ID', this.pageId)
|
||||
this.$store.commit('page/SET_DESCRIPTION', this.description)
|
||||
this.$store.commit('page/SET_IS_PUBLISHED', this.isPublished)
|
||||
this.$store.commit('page/SET_LOCALE', this.locale)
|
||||
this.$store.commit('page/SET_PATH', this.path)
|
||||
this.$store.commit('page/SET_TAGS', this.tags)
|
||||
this.$store.commit('page/SET_TITLE', this.title)
|
||||
this.$store.set('page/id', this.pageId)
|
||||
this.$store.set('page/description', this.description)
|
||||
this.$store.set('page/isPublished', this.isPublished)
|
||||
this.$store.set('page/locale', this.locale)
|
||||
this.$store.set('page/path', this.path)
|
||||
this.$store.set('page/tags', this.tags)
|
||||
this.$store.set('page/title', this.title)
|
||||
this.$store.set('page/scriptCss', this.scriptCss)
|
||||
this.$store.set('page/scriptJs', this.scriptJs)
|
||||
|
||||
this.$store.commit('page/SET_MODE', 'edit')
|
||||
this.$store.set('page/mode', 'edit')
|
||||
|
||||
this.setCurrentSavedState()
|
||||
|
||||
|
@@ -189,11 +189,11 @@
|
||||
|
||||
v-tab-item(:transition='false', :reverse-transition='false')
|
||||
.editor-props-codeeditor-title
|
||||
.overline {{$t('editor:props.js')}}
|
||||
.overline {{$t('editor:props.html')}}
|
||||
.editor-props-codeeditor
|
||||
textarea(ref='codejs')
|
||||
.editor-props-codeeditor-hint
|
||||
.caption {{$t('editor:props.jsHint')}}
|
||||
.caption {{$t('editor:props.htmlHint')}}
|
||||
|
||||
v-tab-item(transition='fade-transition', reverse-transition='fade-transition')
|
||||
v-card-text
|
||||
@@ -250,7 +250,7 @@ import gql from 'graphql-tag'
|
||||
|
||||
import CodeMirror from 'codemirror'
|
||||
import 'codemirror/lib/codemirror.css'
|
||||
import 'codemirror/mode/javascript/javascript.js'
|
||||
import 'codemirror/mode/htmlmixed/htmlmixed.js'
|
||||
import 'codemirror/mode/css/css.js'
|
||||
|
||||
/* global siteLangs, siteConfig */
|
||||
@@ -323,7 +323,7 @@ export default {
|
||||
if (newValue === 2) {
|
||||
this.$nextTick(() => {
|
||||
setTimeout(() => {
|
||||
this.loadEditor(this.$refs.codejs, 'javascript')
|
||||
this.loadEditor(this.$refs.codejs, 'html')
|
||||
}, 100)
|
||||
})
|
||||
} else if (newValue === 4) {
|
||||
@@ -363,7 +363,7 @@ export default {
|
||||
direction: 'ltr'
|
||||
})
|
||||
switch (mode) {
|
||||
case 'javascript':
|
||||
case 'html':
|
||||
this.cm.setValue(this.scriptJs)
|
||||
this.cm.on('change', c => {
|
||||
this.scriptJs = c.getValue()
|
||||
|
Reference in New Issue
Block a user