Skip to content

qyhever/tinymce-imgupload

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

tinymce-imgupload

A image upload plugin for tinymce.

Installation

npm install tinymce-imgupload --save

Example

When using with webpack: In the file that initialed tinymce

import 'tinymce-imgupload'
window.tinymce.init({
  selector: '#tinymceEditor',
  plugins: ['imgupload'],
  toolbar: ['imgupload'],
  imageSelectorCallback(file, success) {
    // mock the file upload
    const formData = new FormData()
    formData.append('file', file)
    axios({
      method: 'post',
      url: 'xxx',
      data: formData
    }).then(res => {
      if (res.success) {
        success(res.url)
      } else {
        console.log('upload filed!')
      }
    }).catch(err => {
      console.log('upload filed!', err)
    })
  }
})

License

None (public domain)

About

A image upload plugin for tinymce

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published