Rovak / InlineAttachment

Easily paste and upload files/images in plain textareas
http://git.razko.nl/InlineAttachment
MIT License
619 stars 77 forks source link

How to use with Backbone? #35

Closed kramer65 closed 9 years ago

kramer65 commented 10 years ago

I'm currently building my first website with Backbone and I would like to use InlineAttachement. I'm kinda lost in how I should use this though.

Does anybody have an example of how to use this in a Backbone view? All tips are welcome!

Rovak commented 10 years ago

Hi Kramer65,

I have no experience with Backbone, but i think that this should be done in the render method of a Backbone.View.

(Example code taken from Backbone.js documentation)

var Bookmark = Backbone.View.extend({
  template: _.template(…),
  render: function() {
    // init here
    this.$el.find('textarea').inlineattach({
        uploadUrl: 'upload.php'
    });
    return this;
  }
});
Rovak commented 9 years ago

@kramer65 did the above suggestion solve the issue?

kramer65 commented 9 years ago

Excuse, yes it did! Thanks a million!