Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't store default editable/deletable metadata #1865

Merged
merged 2 commits into from
Nov 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions notebook/static/notebook/js/cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,15 @@ define([
var data = {};
// deepcopy the metadata so copied cells don't share the same object
data.metadata = JSON.parse(JSON.stringify(this.metadata));
if (data.metadata.deletable) {
delete data.metadata.deletable;
}
if (data.metadata.editable) {
delete data.metadata.editable;
}
if (data.metadata.collapsed === false) {
delete data.metadata.collapsed;
}
data.cell_type = this.cell_type;
return data;
};
Expand All @@ -501,14 +510,6 @@ define([
if (data.metadata !== undefined) {
this.metadata = data.metadata;
}
// upgrade cell's editable metadata if not defined
if (this.metadata.editable === undefined) {
this.metadata.editable = this.is_editable();
}
// upgrade cell's deletable metadata if not defined
if (this.metadata.deletable === undefined) {
this.metadata.deletable = this.is_deletable();
}
};


Expand Down
6 changes: 5 additions & 1 deletion notebook/static/notebook/js/codecell.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,11 @@ define([
var outputs = this.output_area.toJSON();
data.outputs = outputs;
data.metadata.trusted = this.output_area.trusted;
data.metadata.collapsed = this.output_area.collapsed;
if (this.output_area.collapsed) {
data.metadata.collapsed = this.output_area.collapsed;
} else {
delete data.metadata.collapsed;
}
if (this.output_area.scroll_state === 'auto') {
delete data.metadata.scrolled;
} else {
Expand Down