Browse Source

refactor: client structure + editor preview logic

pull/621/head
NGPixel 6 years ago
parent
commit
4fa7ed4e93
19 changed files with 26 additions and 8 deletions
  1. 2
      client/app.js
  2. 24
      client/components/editor-code.vue
  3. 0
      client/components/editor-modal-access.vue
  4. 0
      client/components/editor-modal-properties.vue
  5. 0
      client/components/editor.vue
  6. 4
      client/components/login.vue
  7. 0
      client/components/navigator.vue
  8. 0
      client/components/setup.vue
  9. 0
      client/components/toggle.vue
  10. 0
      client/constants/graphql.js
  11. 0
      client/constants/index.js
  12. 0
      client/helpers/compatibility.js
  13. 0
      client/helpers/index.js
  14. 4
      client/index.js
  15. 0
      client/modules/boot.js
  16. 0
      client/modules/localization.js
  17. 0
      client/polyfills/array-from.js
  18. 0
      client/store/index.js
  19. 0
      client/store/modules/navigator.js

client/js/app.js → client/app.js

@ -137,7 +137,7 @@ let bootstrap = () => {
// Load Icons // Load Icons
// ==================================== // ====================================
import(/* webpackChunkName: "icons" */ '../svg/icons.svg').then(icons => {
import(/* webpackChunkName: "icons" */ './svg/icons.svg').then(icons => {
document.body.insertAdjacentHTML('beforeend', icons) document.body.insertAdjacentHTML('beforeend', icons)
}) })
} }

client/js/components/editor-code.vue → client/components/editor-code.vue

@ -62,9 +62,10 @@
.editor-code-main .editor-code-main
.editor-code-editor .editor-code-editor
.editor-code-editor-title Editor .editor-code-editor-title Editor
codemirror(ref='cm', v-model='code', :options='cmOptions', @ready="onCmReady")
codemirror(ref='cm', v-model='code', :options='cmOptions', @ready='onCmReady', @input='onCmInput')
.editor-code-preview .editor-code-preview
.editor-code-preview-title Preview .editor-code-preview-title Preview
.editor-code-preview-content(v-html='previewHTML')
v-speed-dial(v-model='fabInsertMenu', :open-on-hover='true', direction='top', transition='slide-y-reverse-transition', :fixed='true', :right='!isMobile', :left='isMobile', :bottom='true') v-speed-dial(v-model='fabInsertMenu', :open-on-hover='true', direction='top', transition='slide-y-reverse-transition', :fixed='true', :right='!isMobile', :left='isMobile', :bottom='true')
v-btn(color='blue', fab, dark, v-model='fabInsertMenu', slot='activator') v-btn(color='blue', fab, dark, v-model='fabInsertMenu', slot='activator')
v-icon add_circle v-icon add_circle
@ -87,6 +88,8 @@
</template> </template>
<script> <script>
import _ from 'lodash'
import { codemirror } from 'vue-codemirror' import { codemirror } from 'vue-codemirror'
import 'codemirror/lib/codemirror.css' import 'codemirror/lib/codemirror.css'
@ -106,6 +109,16 @@ import 'codemirror/addon/search/matchesonscrollbar.js'
import 'codemirror/addon/search/searchcursor.js' import 'codemirror/addon/search/searchcursor.js'
import 'codemirror/addon/search/match-highlighter.js' import 'codemirror/addon/search/match-highlighter.js'
// Markdown-it
import MarkdownIt from 'markdown-it'
const md = new MarkdownIt({
html: true,
breaks: true,
linkify: true,
typography: true
})
export default { export default {
components: { components: {
codemirror codemirror
@ -127,7 +140,8 @@ export default {
annotateScrollbar: true annotateScrollbar: true
}, },
viewportMargin: 50 viewportMargin: 50
}
},
previewHTML: ''
} }
}, },
computed: { computed: {
@ -156,7 +170,11 @@ export default {
self.$parent.save() self.$parent.save()
} }
}) })
}
this.onCmInput(this.code)
},
onCmInput: _.debounce(function (newContent) {
this.previewHTML = md.render(newContent)
}, 500)
} }
} }
</script> </script>

client/js/components/editor-modal-access.vue → client/components/editor-modal-access.vue

client/js/components/editor-modal-properties.vue → client/components/editor-modal-properties.vue

client/js/components/editor.vue → client/components/editor.vue

client/js/components/login.vue → client/components/login.vue

@ -199,7 +199,7 @@ export default {
<style lang="scss"> <style lang="scss">
.login { .login {
background-color: mc('blue', '800'); background-color: mc('blue', '800');
background-image: url('../../static/svg/login-bg-motif.svg');
background-image: url('../static/svg/login-bg-motif.svg');
background-repeat: repeat; background-repeat: repeat;
background-size: 200px; background-size: 200px;
width: 100%; width: 100%;
@ -221,7 +221,7 @@ export default {
&::before { &::before {
content: ''; content: '';
position: absolute; position: absolute;
background-image: url('../../static/svg/login-bg.svg');
background-image: url('../static/svg/login-bg.svg');
background-position: center bottom; background-position: center bottom;
background-size: cover; background-size: cover;
top: 0; top: 0;

client/js/components/navigator.vue → client/components/navigator.vue

client/js/components/setup.vue → client/components/setup.vue

client/js/components/toggle.vue → client/components/toggle.vue

client/js/constants/graphql.js → client/constants/graphql.js

client/js/constants/index.js → client/constants/index.js

client/js/compatibility.js → client/helpers/compatibility.js

client/js/helpers/index.js → client/helpers/index.js

4
client/index.js

@ -2,6 +2,6 @@
require('vuetify/src/stylus/main.styl') require('vuetify/src/stylus/main.styl')
require('./scss/app.scss') require('./scss/app.scss')
require('./js/compatibility.js')
require('./helpers/compatibility.js')
require('offline-plugin/runtime').install() require('offline-plugin/runtime').install()
require('./js/app.js')
require('./app.js')

client/js/modules/boot.js → client/modules/boot.js

client/js/modules/localization.js → client/modules/localization.js

client/js/polyfills/array-from.js → client/polyfills/array-from.js

client/js/store/index.js → client/store/index.js

client/js/store/modules/navigator.js → client/store/modules/navigator.js

Loading…
Cancel
Save