scrivito.on 'content', (content) -> return unless scrivito.in_editable_view() fields = $(content).find(''' [data-scrivito-field-type=binary]:not([data-editor]), [data-editor~=binary] ''') fields.each -> element = $(this) container = scrivito.editors._setup_binary_button_container(element, 'scrivito-editor-binary-button-container') scrivito.editors._file_dropzone container, (_, file) -> element.scrivito('save', file).then(-> element.scrivito('reload')), 'image-editor-dragover' if element.scrivito('content') && element.is('[data-scrivito-editors-allow-delete]') setup_delete_btn(container, element) setup_delete_btn = (container, element) -> if container && container.find('.delete-binary').length == 0 $(" ") .prependTo(container) .click -> element.scrivito('save', null).then(-> element.scrivito('reload')) and off