editor-modal-editorselect.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template lang='pug'>
  2. v-dialog(v-model='isShown', persistent, max-width='700', no-click-animation)
  3. v-btn(fab, fixed, bottom, right, color='grey darken-3', dark, @click='goBack', style='width: 50px;'): v-icon mdi-undo-variant
  4. v-card.radius-7(color='blue darken-3', dark)
  5. v-card-text.text-center.py-4
  6. .subtitle-1.white--text {{$t('editor:select.title')}}
  7. v-container(grid-list-lg, fluid)
  8. v-layout(row, wrap, justify-center)
  9. v-flex(xs4)
  10. v-card.radius-7.animated.fadeInUp.wait-p2s(
  11. hover
  12. light
  13. ripple
  14. )
  15. v-card-text.text-center(@click='selectEditor("code")')
  16. img(src='/_assets-legacy/svg/editor-icon-code.svg', alt='Code', style='width: 36px;')
  17. .body-2.primary--text.mt-2 Code
  18. .caption.grey--text Raw HTML
  19. v-flex(xs4)
  20. v-card.radius-7.animated.fadeInUp.wait-p1s(
  21. hover
  22. light
  23. ripple
  24. )
  25. v-card-text.text-center(@click='selectEditor("markdown")')
  26. img(src='/_assets-legacy/svg/editor-icon-markdown.svg', alt='Markdown', style='width: 36px;')
  27. .body-2.primary--text.mt-2 Markdown
  28. .caption.grey--text Plain Text Formatting
  29. v-flex(xs4)
  30. v-card.radius-7.animated.fadeInUp.wait-p3s(
  31. hover
  32. light
  33. ripple
  34. )
  35. v-card-text.text-center(@click='selectEditor("ckeditor")')
  36. img(src='/_assets-legacy/svg/editor-icon-ckeditor.svg', alt='Visual Editor', style='width: 36px;')
  37. .body-2.mt-2.primary--text Visual Editor
  38. .caption.grey--text Rich-text WYSIWYG
  39. </template>
  40. <script>
  41. import _ from 'lodash'
  42. import { sync, get } from 'vuex-pathify'
  43. export default {
  44. props: {
  45. value: {
  46. type: Boolean,
  47. default: false
  48. }
  49. },
  50. data() {
  51. return {
  52. templateDialogIsShown: false
  53. }
  54. },
  55. computed: {
  56. isShown: {
  57. get() { return this.value },
  58. set(val) { this.$emit('input', val) }
  59. },
  60. currentEditor: sync('editor/editor'),
  61. locale: get('page/locale'),
  62. path: get('page/path')
  63. },
  64. methods: {
  65. selectEditor (name) {
  66. this.currentEditor = `editor${_.startCase(name)}`
  67. this.isShown = false
  68. },
  69. goBack () {
  70. window.history.go(-1)
  71. },
  72. fromTemplate () {
  73. this.templateDialogIsShown = true
  74. },
  75. fromTemplateHandle ({ id }) {
  76. this.templateDialogIsShown = false
  77. this.isShown = false
  78. this.$nextTick(() => {
  79. window.location.assign(`/e/${this.locale}/${this.path}?from=${id}`)
  80. })
  81. }
  82. }
  83. }
  84. </script>
  85. <style lang='scss'>
  86. </style>