InputEditor.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <div class='input_editor'>
  3. <modal-window name='thread_editor--link'>
  4. <div style='padding: 1rem;'>
  5. <p style='margin-top: 0;'>
  6. Enter the web address in the input box below
  7. </p>
  8. <fancy-input placeholder='Web address for link' width='100%' v-model='linkURL'></fancy-input>
  9. <fancy-input placeholder='Text for link' width='100%' v-model='linkText'></fancy-input>
  10. <button class='button' @click='addLink'>
  11. OK
  12. </button>
  13. <button class='button' @click='hideModal("thread_editor--link")'>
  14. Cancel
  15. </button>
  16. </div>
  17. </modal-window>
  18. <modal-window name='thread_editor--picture'></modal-window>
  19. <div class='input_editor__format_bar'>
  20. <div class='input_editor__format_button'>B</div>
  21. <div class='input_editor__format_button'>I</div>
  22. <div class='input_editor__spacer'></div>
  23. <div class='input_editor__format_button' @click='showModal("thread_editor--link")'><span class='fa fa-link'></span></div>
  24. <div class='input_editor__format_button'><span class='fa fa-code'></span></div>
  25. <div class='input_editor__format_button' @click='showModal("thread_editor--picture")'><span class='fa fa-picture-o'></span></div>
  26. </div>
  27. <textarea class='input_editor__input'></textarea>
  28. </div>
  29. </template>
  30. <script>
  31. import ModalWindow from './ModalWindow'
  32. import FancyInput from './FancyInput'
  33. export default {
  34. name: 'InputEditor',
  35. components: {
  36. ModalWindow,
  37. FancyInput
  38. },
  39. data () {
  40. return {
  41. linkText: '',
  42. linkURL: ''
  43. }
  44. },
  45. methods: {
  46. showModal (name) {
  47. this.$store.commit('showModal', name);
  48. },
  49. hideModal (name) {
  50. this.$store.commit('hideModal', name);
  51. },
  52. addLink () {
  53. this.$store.commit('hideModal', 'thread_editor--link');
  54. }
  55. }
  56. }
  57. </script>
  58. <style lang='scss' scoped>
  59. @import '../assets/scss/variables.scss';
  60. .input_editor {
  61. width: 35rem;
  62. border: 0.125rem solid $color__gray--primary;
  63. &:hover {
  64. border-color: $color__gray--darker;
  65. }
  66. &:focus {
  67. border-color: $color__gray--darkest;
  68. }
  69. @at-root #{&}__format_bar {
  70. width: 100%;
  71. height: 2rem;
  72. background-color: $color__darkgray--primary;
  73. display: flex;
  74. align-items: center;
  75. padding: 0 0.25rem;
  76. }
  77. @at-root #{&}__format_button {
  78. height: 1.5rem;
  79. width: 1.5rem;
  80. text-align: center;
  81. font-weight: bold;
  82. line-height: 1.4rem;
  83. cursor: pointer;
  84. @include user-select(none);
  85. color: $color__lightgray--primary;
  86. border: thin solid $color__lightgray--primary;
  87. transition: background-color 0.2s;
  88. margin: 0 0.2rem;
  89. &:hover {
  90. background-color: $color__darkgray--darker;
  91. }
  92. &:active {
  93. background-color: $color__darkgray--darkest;
  94. }
  95. }
  96. @at-root #{&}__spacer {
  97. width: 0.6rem;
  98. }
  99. @at-root #{&}__input {
  100. width: 100%;
  101. height: 8rem;
  102. border: 0;
  103. padding: 0.5rem;
  104. @include text;
  105. outline: none;
  106. resize: none;
  107. }
  108. }
  109. </style>