Merge pull request #5928 from mishaschwartz/persist-cell-id

Ensure that cell ids persist after save
This commit is contained in:
Kevin Bates 2021-01-11 17:19:11 -08:00 committed by GitHub
commit 57db70979b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -490,6 +490,9 @@ define([
var data = {};
// deepcopy the metadata so copied cells don't share the same object
data.metadata = JSON.parse(JSON.stringify(this.metadata));
if (this.id !== undefined) {
data.id = this.id;
}
if (data.metadata.deletable) {
delete data.metadata.deletable;
}
@ -511,6 +514,9 @@ define([
if (data.metadata !== undefined) {
this.metadata = data.metadata;
}
if (data.id !== undefined) {
this.id = data.id;
}
};

View File

@ -1648,6 +1648,9 @@ define([
if (cell_json.metadata.deletable !== undefined) {
delete cell_json.metadata.deletable;
}
if (cell_json.id !== undefined) {
delete cell_json.id;
}
this.clipboard.push(cell_json);
}
this.enable_paste();