How to use wangeditor - 10 common examples

To help you get started, we’ve selected a few wangeditor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Coldairarrow / Colder.Admin.AntdVue / src / Coldairarrow.Web / src / components / WangEditor / WangEditor.vue View on Github external
initEditor() {
      this.editor = new WEditor(this.$refs.editor)

      this.editor.customConfig.uploadImgShowBase64 = true // base 64 存储图片
      this.editor.customConfig.uploadImgServer = `${this.$rootUrl}/Base_Manage/Upload/UploadFileByForm` // 配置服务器端地址
      this.editor.customConfig.uploadFileName = 'file' // 后端接受上传文件的参数名
      this.editor.customConfig.uploadImgMaxSize = 10 * 1024 * 1024 // 将图片大小限制为 2M
      this.editor.customConfig.uploadImgMaxLength = 1 // 限制一次最多上传 1 张图片
      this.editor.customConfig.uploadImgTimeout = 3 * 60 * 1000 // 设置超时时间
      this.editor.customConfig.uploadImgHooks = {
        customInsert: function(insertImg, result, editor) {
          insertImg(result.url)
        }
      }
      this.editor.customConfig.onchange = html => {
        this.isChange = true
        this.$emit('input', html)
      }
github Weibozzz / next-blog / components / WangEdit / index.js View on Github external
componentDidMount() {
    const {originContent=''} = this.props;
    const elem = this.refs.editorElem
    const editor = new E(elem)
    // 使用 onchange 函数监听内容的变化,并实时更新到 state 中
    editor.customConfig.onchange = html => {
      this.setState({
        editorContent: html
      })
    }
    editor.create()
    editor.txt.html(originContent)
  }
  clickHandle() {
github wangfupeng1988 / wangEditor / example / demo / in-react / src / App.js View on Github external
componentDidMount() {
    const elem = this.refs.editorElem
    const editor = new E(elem)
    // 使用 onchange 函数监听内容的变化,并实时更新到 state 中
    editor.customConfig.onchange = html => {
      this.setState({
        editorContent: html
      })
    }
    editor.create()
  }
  clickHandle() {
github maodouio / meteor-react-redux-base / maodou / posts / client / containers / admin / postsEdit.js View on Github external
},
              'Error': function(up, err, errTip) {
                //上传出错时,处理相关的事情
              },
              'UploadComplete': function() {
                  //队列文件处理完毕后,处理相关的事情

                  // 隐藏进度条
                  editor.hideUploadProgress();
                }
            }
          });
        }
      });
    }
    this.editor = new wangEditor('editor');
    this.editor.config.customUpload = true;
    this.editor.config.customUploadInit = uploadInit;
    this.editor.config.menuFixed = false;
    this.editor.create();
  }
};
github 1024-lab / smart-admin / smart-admin-web / src / views / email / send-mail.vue View on Github external
initEditor() {
      let g = this;
      g.editor = new WangEditor('#editor');
      g.editor.customConfig = {
        // 功能键
        menus: [
          'head', // 标题
          'bold', // 粗体
          'fontSize', // 字号
          'fontName', // 字体
          'italic', // 斜体
          'underline', // 下划线
          'strikeThrough', // 删除线
          'foreColor', // 文字颜色
          'backColor', // 背景颜色
          'list', // 列表
          'justify', // 对齐方式
          'emoticon', // 表情
          'image', // 插入图片
github maodouio / meteor-react-redux-base / maodou / events / client / containers / admin / eventsEdit.js View on Github external
},
              'Error': function(up, err, errTip) {
                //上传出错时,处理相关的事情
              },
              'UploadComplete': function() {
                  //队列文件处理完毕后,处理相关的事情

                  // 隐藏进度条
                  editor.hideUploadProgress();
                }
            }
          });
        }
      });
    }
    this.editor = new wangEditor('editor');
    this.editor.config.customUpload = true;
    this.editor.config.customUploadInit = uploadInit;
    this.editor.config.menuFixed = false;
    this.editor.create();
  }
};
github sls-admin / sls-admin-vue / src / components / form-data / fields / SlsEditor.vue View on Github external
initWangEditor () {
        this.editor = new WangEditor('#' + this.id)
        this.editor.customConfig = {}
        this.editor.customConfig.menus = this.menus
        this.editor.customConfig = Object.assign(this.editor.customConfig, this.attrs, this.config.attrs)
        this.editor.customConfig.uploadImgHooks = {}
        this.editor.customConfig.uploadImgHooks = Object.assign(this.editor.customConfig.uploadImgHooks, this.config.events)
        this.editor.customConfig.onchange = (html) => {
          this.submit_data[this.data.key] = html
          this.submit_info[this.data.key] = this.editor.txt.text()
          this.config.onchange && this.config.onchange({
            value: this.submit_data[this.data.key],
            info: this.submit_info[this.data.key]
          })
        }
        this.editor.create()

        console.log(this.editor.txt.html)
github GeekPark / gpk_admin / src / tools / index.js View on Github external
const createEditor = (onchange) => {
  let editor = new WangEditor('#editor')
  editor.customConfig.onchange = onchange
  editor.create()
  return editor
}
github phpdish / phpdish / assets / modules / editor.js View on Github external
'eraser',
            'quote',
            '|',
            'emotion',
            'img',
            'video',
            'location',
            '|',
            'insertcode',
        ],
        element: $element,
        upload: true
    }, options);

    //公共配置
    const editor = new WangEditor(options.element);
    editor.customConfig.menus = options.toolbar;
    //配置上传
    editor.customConfig.uploadImgUrl = '/attachments/add?src=wangeditor';
    editor.customConfig.uploadParams = {
        token: util.getToken(),
        user: util.getAuthUser()
    };
    editor.customConfig.uploadImgFileName = 'upfile';
    //配置emotion
    editor.customConfig.emotions = {
        baiduPaoPao: {
            title: "泡泡",
            data: convertEmotions(Emotions.getEmotion('baidu.pp'))
        },
        baiduTuzik: {
            title: "兔斯基",

wangeditor

wangEditor - 轻量级 web 富文本编辑器,配置方便,使用简单,开源免费

MIT
Latest version published 2 years ago

Package Health Score

56 / 100
Full package analysis

Popular wangeditor functions