For example, I have a dashboard box to the right of my markdown editor with saved plots as pngs. I want to reference the file on drag over and set  in the markdown editor. The files are base64.
I tried writing the following JS code but no luck as of yet.
tags$head(tags$link(rel = "icon", type = "image/png", href = "logo.png"),
tags$title(""),
tags$script("
/* Add event listener for drag and drop images */
$('#' + 'myEditor' + '_editor').on('drop', function(e) {
e.preventDefault();
e.stopPropagation();
const files = e.originalEvent.dataTransfer.files;
if (files.length === 0) {
return;
}
const file = files[0];
if (file.type.match(/^image/)) {
const reader = new FileReader();
reader.onload = function(evt) {
const dataURL = evt.target.result;
myEditor_editor.insertImage(dataURL);
};
reader.readAsDataURL(file);
}
});
For example, I have a dashboard box to the right of my markdown editor with saved plots as pngs. I want to reference the file on drag over and set
in the markdown editor. The files are base64.I tried writing the following JS code but no luck as of yet.