Grafikart / JS-Markdown-Editor

An easy to use markdown editor with live preview and Image uploading
MIT License
225 stars 44 forks source link

Error when upload image #11

Closed jdebetaz closed 3 years ago

jdebetaz commented 7 years ago

When i upload an image with the MDEditor, the alert box notify me that the csrf token was not present, so i look at the request header and i see that the uploaderData was not added to the formData

Configuration form the MDEditor

var token = $("meta[name='csrf-token']").attr("content");
var md = new MdEditor('#mdeditor', {
    uploader: "#{admin_attachments_path}",
    uploaderData: { 
        authenticity_token: token,
        attachable_type: 'Post',
        attachable_id: "#{@post.id}"
    }, 
    preview: true 
});

Request Header can be found here Error log can be found here