scrivito.on 'content', (content) -> return unless scrivito.in_editable_view() fields = $(content).find('[data-scrivito-field-type=binary]:not([data-editor])') scrivito.editors._file_dropzone fields, (el, file) -> el.scrivito('save', file).then(-> el.scrivito('reload')), 'image-editor-dragover' fields.filter('[data-scrivito-editors-allow-delete]').each -> setup_delete_btn $(this) setup_delete_btn = (el) -> return unless el.scrivito('content') container = if el.prop('tagName') is 'IMG' css_class = 'scrivito-editor-image-container' el.wrap("
") unless el.parent(".#{css_class}").length el.parent(".#{css_class}") else el return if container.find('.delete-binary').length $(" ") .prependTo(container) .click -> el.scrivito('save', null).then(-> el.scrivito('reload')) and off