Rovak / InlineAttachment

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

Support using a function instead of a plain string for urlText #61

Open nogweii opened 9 years ago

nogweii commented 9 years ago

I'd like to expand the syntax used for markdown in the urlText, like by specifying the height & width (an extension to normal markdown):

![file_name)(/imgs/123456789.png =120x60)

Though I don't want to hard-code a default size, and instead customize it based on data returned from the server. My thought is that a function could be set for urlText that will be passed in the data returned from the server. The function is expected to return a string that will be placed literally into the textarea (so if you opt to use the function, you must make sure to include the attachment's name in the string).

Rovak commented 9 years ago

I'll add another hook for it, i think it can be added to the onFileUploadResponse response and add another parameter in which the resulting text can be modified that will be inserted in the textarea

zilkey commented 8 years ago

Here's one way it can be done: https://github.com/Rovak/InlineAttachment/pull/70