Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
filesById[file.link] = file
const isImage = file.type.match(/^image/)
var content
if (isImage) {
content = h('img', {
src: `http://localhost:8989/blobs/get/${encodeURIComponent(file.link)}`,
alt: file.name
})
} else {
content = h('a', { href: file.link }, file.name)
}
// TODO - insert where the mouse is yo
var editor = MediumEditor.getEditorFromElement(composer)
composer.insertBefore(
h('p', content),
editor.currentEl || null
)
saveDraft({ composer, meta, api })
console.log('added:', file)
})