nhn / toast-ui.vue-editor

This repository is DEPRECATED! GO TO 👉 https://github.com/nhn/tui.editor/tree/master/apps/vue-editor
MIT License
229 stars 47 forks source link

How to get markdownit ? #32

Open lhuangjs opened 5 years ago

lhuangjs commented 5 years ago

Version

"@toast-ui/vue-editor": "^1.1.1"

Test Environment

Current Behavior

I wanted to get markdownit to do some pretreatment(replace some html tag, reformat html ... ) before preview. So I used invoke(getMarkdownitRenderer). However, I get null.

reference: https://nhn.github.io/tui.editor/api/latest/Convertor.html#.getMarkdownitRenderer

<template>
  <div class="editor">
    <Editor
      ref="editor"
      v-model="editorContent"
      :options="editorOptions"
      height="100%"
      previewStyle="vertical"
      :visible="true"
      mode="markdown"
      @change="mdContentChanged"
    ></Editor>
  </div>
</template>

<script>
import 'tui-editor/dist/tui-editor.css'
import 'tui-editor/dist/tui-editor-contents.css'
import 'codemirror/lib/codemirror.css'
import { Editor } from '@toast-ui/vue-editor'

export default {

  name: 'MDEditor',

  props: ['markdownContent', 'imgPath', 'filePath'],

  components: { Editor },

  created () {
    console.log(this.imgPath)
  },

  mounted: function () {
    console.log(this.$refs.editor.invoke('getMarkdownitRenderer'))
 }
}
</script>

Expected Behavior

sohee-lee7 commented 5 years ago

Currently, we do not provide a function to take a markdownit instance in vue wrapper. So getMarkdownitRenderer does not work in vue wrapper. We are planning to provide this feature, so please wait a little.