')
+ .addClass('item-buttons pull-right')
+ .append(delete_btn)
+ )
+ );
+
+ attachments_list.append($('
')
+ .addClass('list_item row')
+ .append(row)
+ );
+ }
+ };
+ refresh_attachments_list();
+
+ var dialogform = $('
')
+ .attr('title', 'Edit attachments')
+ .append(message)
+ .append('
')
+ .append(attachments_list)
var modal_obj = modal({
title: "Edit " + options.name + " Attachments",
body: dialogform,
buttons: {
OK: { class : "btn-primary",
click: function() {
- /**
- * validate json and set it
- */
- var new_att;
- try {
- new_att = JSON.parse(editor.getValue());
- } catch(e) {
- console.log(e);
- error_div.text('WARNING: Could not save invalid JSON.');
- return false;
- }
- options.callback(new_att);
+ options.callback(options.attachments);
}
},
Cancel: {}
@@ -268,8 +298,6 @@ define(function(require) {
notebook: options.notebook,
keyboard_manager: options.keyboard_manager,
});
-
- modal_obj.on('shown.bs.modal', function(){ editor.refresh(); });
};
var insert_image = function (options) {
diff --git a/notebook/static/notebook/js/celltoolbarpresets/attachments.js b/notebook/static/notebook/js/celltoolbarpresets/attachments.js
index 93f5de7a9..d41638ce9 100644
--- a/notebook/static/notebook/js/celltoolbarpresets/attachments.js
+++ b/notebook/static/notebook/js/celltoolbarpresets/attachments.js
@@ -15,6 +15,9 @@ define([
attachments: cell.attachments,
callback: function(attachments) {
cell.attachments = attachments;
+ // Force cell refresh
+ cell.unrender();
+ cell.render();
},
name: 'cell',
notebook: cell.notebook,