refactory-id / bootstrap-markdown

Bootstrap plugin for markdown editing
Apache License 2.0
1.99k stars 371 forks source link

Add ability to upload image #182

Closed gouthambs closed 7 years ago

gouthambs commented 9 years ago

Currently the image support is only for URLs. It would be nice to have an upload capability as well to do file upload, and use that URL in the image.

mthhk commented 9 years ago

好顶赞。 如果能增加对于上传图片的支持,那真是好极了。

gouthambs commented 9 years ago

The callback function for name: 'cmdImage' shows a prompt. Instead we could create a bootstrap panel or bootbox with ability to accept image hyperlink or a file select option with an attached action to perform file upload on the server side.

lodev09 commented 9 years ago

take a look at this demo: http://embed.plnkr.co/atyuBnVNktl8YSfdfPJT/preview it has custom code for uploading image like this comment box in github :)

gouthambs commented 9 years ago

@lodev09 This is awesome! Is there any interest to incorporate this by default?

lodev09 commented 9 years ago

I created that demo using another plugin for uploading so I'm not sure. Maybe @toopay can decide

toopay commented 9 years ago

There is an issue regarding the usage of native browser prompt dialog at #177 So i guess bootstrap dialog would be proper solution in the future.

@lodev09 if you have time to tighten your code for upload, we may could use it. Please make a branch if you decide to do so, i'll happy to review it.

jacargentina commented 8 years ago

I can start working on this (i need it). I'm thinking on using this http://www.dropzonejs.com/ so there is no need to "reinvent the wheel"

@toopay what do u think?

toopay commented 8 years ago

@jacargentina be my guest. We can continue the discussion in your PR.

sams commented 8 years ago

Just found this repo and its really cool. Like the idea of a image handling found this also http://benfoster.io/blog/pagedown-markdown-editor-custom-image-dialog

might help in not reinventing the wheel. It might have some ideas. Really liked the simplicity of that demo

jacargentina commented 8 years ago

Hey, anybody want to look at my PR? Any suggestion is welcome

duolaaa commented 7 years ago

@lodev09 HI, when i use http://embed.plnkr.co/atyuBnVNktl8YSfdfPJT/preview , always failed with Error uploading filename- Bad Request

i hava changed the url: "static-uploads.php", to my post uri and the uploadFinished: function(i, file, response, time) response .

can u help me ? thank you.

lodev09 commented 7 years ago

Try to print_r($_FILES); if you're on PHP inside your post url see if it's sending something. Also, one way to debug is through chrome dev tools (F12) and inspect the data sent through the network tab.

Hope that helps :)

brxue commented 7 years ago

Hi @jacargentina and @toopay , could you please share some information on how do you insert the uploaded image to the CURSOR position inside text area?

lodev09 commented 7 years ago

@brxue check the plugin's source code.. you'll find code example in there to manipulate content by cursor position. Also, $textarea property is available for you to manipulate the content and insert your custom text.

lodev09 commented 7 years ago

It's probably time to close this thread :)