2
0

editor-modal-editorselect.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. v-card.radius-7.mt-2(color='teal darken-3', dark)
  40. v-card-text.text-center.py-4
  41. .subtitle-1.white--text {{$t('editor:select.customView')}}
  42. v-container(grid-list-lg, fluid)
  43. v-layout(row, wrap, justify-center)
  44. v-flex(xs4)
  45. v-hover
  46. template(v-slot:default='{ hover }')
  47. v-card.radius-7.animated.fadeInUp(
  48. hover
  49. light
  50. ripple
  51. )
  52. v-card-text.text-center(@click='fromTemplate')
  53. img(src='/_assets-legacy/svg/icon-cube.svg', alt='From Template', style='width: 42px; opacity: .5;')
  54. .body-2.mt-1.teal--text From Template
  55. .caption.grey--text Use an existing page...
  56. page-selector(mode='select', v-model='templateDialogIsShown', :open-handler='fromTemplateHandle', :path='path', :locale='locale', must-exist)
  57. </template>
  58. <script>
  59. import _ from 'lodash'
  60. import { sync, get } from 'vuex-pathify'
  61. export default {
  62. props: {
  63. value: {
  64. type: Boolean,
  65. default: false
  66. }
  67. },
  68. data() {
  69. return {
  70. templateDialogIsShown: false
  71. }
  72. },
  73. computed: {
  74. isShown: {
  75. get() { return this.value },
  76. set(val) { this.$emit('input', val) }
  77. },
  78. currentEditor: sync('editor/editor'),
  79. locale: get('page/locale'),
  80. path: get('page/path')
  81. },
  82. methods: {
  83. selectEditor (name) {
  84. this.currentEditor = `editor${_.startCase(name)}`
  85. this.isShown = false
  86. },
  87. goBack () {
  88. window.history.go(-1)
  89. },
  90. fromTemplate () {
  91. this.templateDialogIsShown = true
  92. },
  93. fromTemplateHandle ({ id }) {
  94. this.templateDialogIsShown = false
  95. this.isShown = false
  96. this.$nextTick(() => {
  97. window.location.assign(`/e/${this.locale}/${this.path}?from=${id}`)
  98. })
  99. }
  100. }
  101. }
  102. </script>
  103. <style lang='scss'>
  104. </style>