F-loat / vue-simplemde

📝 Vue SimpleMDE - use simplemde with vue.js
https://F-loat.github.io/vue-simplemde/dist/demo.html
MIT License
770 stars 111 forks source link

Focusing Element needed #80

Closed 100kimch closed 4 years ago

100kimch commented 4 years ago

Thanks for making this cool element :) but I need focus() option and I found SimpleMDE.prototype.toTextArea() method. It works when I call SimpleMDE.prototype.toggleBlockquote(), for example, but toTextArea() not works well. Do you willing to support this method?

F-loat commented 4 years ago
<template>
  <vue-simplemde v-model="content" ref="markdownEditor" :configs="{ autofocus: true }" />
</template>

<script>
  import VueSimplemde from 'vue-simplemde'

  export default {
    components: {
      VueSimplemde
    },
    computed: {
      simplemde() {
        return this.$refs.markdownEditor.simplemde;
      },
    },
    methods: {
      toTextArea() {
        this.simplemde.toTextArea();
      }
    }
  }
</script>

<style>
  @import '~simplemde/dist/simplemde.min.css';
</style>