editor-modal-editorselect.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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(xs6)
  10. v-card.radius-7.animated.fadeInUp.wait-p1s(
  11. hover
  12. light
  13. ripple
  14. )
  15. v-card-text.text-center(@click='selectEditor("markdown")')
  16. img(src='/_assets/svg/editor-icon-markdown.svg', alt='Markdown', style='width: 36px;')
  17. .body-2.primary--text.mt-2 Markdown
  18. .caption.grey--text Plain Text Formatting
  19. v-flex(xs6)
  20. v-card.radius-7.animated.fadeInUp.wait-p2s(
  21. hover
  22. light
  23. ripple
  24. )
  25. v-card-text.text-center(@click='selectEditor("ckeditor")')
  26. img(src='/_assets/svg/editor-icon-ckeditor.svg', alt='Visual Editor', style='width: 36px;')
  27. .body-2.mt-2.primary--text Visual Editor
  28. .caption.grey--text Rich-text WYSIWYG
  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("asciidoc")')
  36. img(src='/_assets/svg/editor-icon-asciidoc.svg', alt='AsciiDoc', style='width: 36px;')
  37. .body-2.primary--text.mt-2 AsciiDoc
  38. .caption.grey--text Plain Text Formatting
  39. v-flex(xs4)
  40. v-card.radius-7.animated.fadeInUp.wait-p4s(
  41. hover
  42. light
  43. ripple
  44. )
  45. v-card-text.text-center(@click='selectEditor("code")')
  46. img(src='/_assets/svg/editor-icon-code.svg', alt='Code', style='width: 36px;')
  47. .body-2.primary--text.mt-2 Code
  48. .caption.grey--text Raw HTML
  49. v-flex(xs4)
  50. v-card.radius-7.animated.fadeInUp.wait-p5s(
  51. hover
  52. light
  53. ripple
  54. )
  55. v-card-text.text-center(@click='fromTemplate')
  56. img(src='/_assets/svg/icon-cube.svg', alt='From Template', style='width: 42px; opacity: .5;')
  57. .body-2.mt-1.teal--text From Template
  58. .caption.grey--text Use an existing page...
  59. page-selector(mode='select', v-model='templateDialogIsShown', :open-handler='fromTemplateHandle', :path='path', :locale='locale', must-exist)
  60. </template>
  61. <script>
  62. import _ from 'lodash'
  63. import { sync, get } from 'vuex-pathify'
  64. export default {
  65. props: {
  66. value: {
  67. type: Boolean,
  68. default: false
  69. }
  70. },
  71. data() {
  72. return {
  73. templateDialogIsShown: false
  74. }
  75. },
  76. computed: {
  77. isShown: {
  78. get() { return this.value },
  79. set(val) { this.$emit('input', val) }
  80. },
  81. currentEditor: sync('editor/editor'),
  82. locale: get('page/locale'),
  83. path: get('page/path')
  84. },
  85. methods: {
  86. selectEditor (name) {
  87. this.currentEditor = `editor${_.startCase(name)}`
  88. this.isShown = false
  89. },
  90. goBack () {
  91. window.history.go(-1)
  92. },
  93. fromTemplate () {
  94. this.templateDialogIsShown = true
  95. },
  96. fromTemplateHandle ({ id }) {
  97. this.templateDialogIsShown = false
  98. this.isShown = false
  99. this.$nextTick(() => {
  100. window.location.assign(`/e/${this.locale}/${this.path}?from=${id}`)
  101. })
  102. }
  103. }
  104. }
  105. </script>
  106. <style lang='scss'>
  107. </style>