Skip to content

trantorLiu/bootstrap-editor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bootstrap-editor

bootstrap-editor extends bootstrap-wysihtml5 with image upload feature by using jQuery-File-Upload.

Files to reference

<script src="lib/js/wysihtml5-0.3.0.js"></script>
<script src="lib/js/jquery-1.7.2.min.js"></script>
<script src="lib/js/prettify.js"></script>
<script src="lib/js/bootstrap.min.js"></script>
<script src="lib/js/bootstrap-wysihtml5.js"></script>
<script src="lib/js/jquery.ui.widget.js"></script>
<script src="lib/js/jquery.iframe-transport.js"></script>
<script src="lib/js/jquery.fileupload.js"></script>
<script src="src/bootstrap-editor.js"></script>

Usage

$('.textarea').bootstrapEditor({
  fileupload: {
    url: 'http://localhost:8888/',
    dataType: 'json',
    done: function(e, data) {
      var imgs = [];
      $.each(data.result.files, function(index, file) {
        imgs.push({
          src: file.url,
          alt: file.name
        });
      });
      return imgs;
    }
  }
});

Init the editor with the fileupload options. See jQuery-File-Upload's Wiki for more details.

The done callback should return an object or an array of objects with the following format:

{
  src: '/path/to/the/image',
  alt: 'some alt text'    // optional
}

All other options are same as bootstrap-wysihtml5.

Server

There are some server side support avaliable on https://github.com/blueimp/jQuery-File-Upload/wiki/Setup.

For example, node users can simply type:

npm install blueimp-file-upload-node
./node_modules/blueimp-file-upload-node/server.js

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •