yimo-vue-editor

基于 wangeditor2.5.11 封装的 vue-editor 富文本编辑器组件
6,326 31
Install
npm install yimo-vue-editor
Latest Version:1.1.7
Vue:2
License:MIT
Last Updated:Jul 1, 2021
Links: GitHub  ·  npm
Maintainer: yimogit

yimo-vue-editor

Demo address: https://vue-editor.yimo.link/example/html/index.html

Vue-editor component based on wangeditor2.5.11 wrapper wangEditor docs:https://www.kancloud.cn/wangfupeng/wangeditor2/113961

Used in vue projects

npm install yimo-vue-editor --save

<template>
  <yimo-vue-editor v-model="text></yimo-vue-editor>
</template>

import YimoVueEditor from 'yimo-vue-editor'
export default {
  components: {
    YimoVueEditor
  }
}

Global introduction and configuration

import YimoVueEditor from 'yimo-vue-editor'

Vue.use(YimoVueEditor, {
  name: 'v-editor-app',//Custom name
  config: {
    uploadImgUrl:'/api/upload', // upload api
    printLog: false, // disabled console.log
    lang: YimoVueEditor.E.langs.en // lang config
  },//wagnEditor config
  uploadHandler: (type, resTxt) => {//Upload processing hook
    if (type === 'success') {
      var res = JSON.parse(resTxt)//Do not process the default look at the return value bit image path
      if (res.status !== 1) {
        return null
      }
      return res.data
    } else if (type === 'error') {
      //todo toast
    } else if (type === 'timeout') {
      //todo toast
    }
    return 'upload failed__'
  }
})

Parameter

  • value v-model Binding editor value
  • config wangEditor2.0 config ,wangEditor docs
  • uploadHandler The processing of the return value after the image is uploaded, successfully returns the url to be inserted, fails to return an error prompt or prompts in the hook, etc.
    var uploadHandler = (type, resTxt) => {
      if (type === 'success') {
        var res = JSON.parse(resTxt)
        if (res.status !== 1) {
          return null
        }
        return res.data.fileUrl
      } else if (type === 'error') {
        //todo toast
      } else if (type === 'timeout') {
        //todo toast
      }
      return 'upload failed__'
    }
    

Modification

  • delete Map menu code
  • hide Emoticon menu
  • fix Upload multiple image insertion order issues (replace after tag placement)
  • add Link open state setting
  • add Hook after uploading
  • add upload append filename no null
  • add fullscreen scroll bar

Points to pay attention to

  • ie9 upload image, upload using form+iframe, can't cross domain, and the return type needs to be text/html
  • The log is printed as a global parameter, subject to the last setting

Related Packages

vue-wangeditor

an editor component of vue2.0 depended on wangeditor

1,725
vue3-wangeditor

基于Wangeditor富文本编辑器,用于Vue3.x的组件

1,043
@wangeditor/editor-for-vue

wangEditor component for vue2.x

1,589,331 152

Version History

Version Released Vue License
1.1.7 ^2.5.11 MIT
1.1.6 ^2.5.11 MIT
1.1.5 ^2.5.11 MIT
1.1.4 ^2.5.11 MIT
1.1.3 ^2.5.11 MIT