mirror of
https://github.com/jupyter/notebook.git
synced 2024-12-21 04:10:17 +08:00
Merge pull request #1965 from ivanov/fix-1678
fix for #1678, undo no longer clears cells With these changes, Ctrl-Z inside of codemirror cells will only undo up to the text that was in the cell when it was loaded from JSON. closes #1678
This commit is contained in:
commit
643837dff3
@ -267,6 +267,9 @@ var IPython = (function (IPython) {
|
||||
if (data.cell_type === 'code') {
|
||||
if (data.input !== undefined) {
|
||||
this.set_text(data.input);
|
||||
// make this value the starting point, so that we can only undo
|
||||
// to this state, instead of a blank cell
|
||||
this.code_mirror.clearHistory();
|
||||
}
|
||||
if (data.prompt_number !== undefined) {
|
||||
this.set_input_prompt(data.prompt_number);
|
||||
|
@ -602,6 +602,9 @@ var IPython = (function (IPython) {
|
||||
text = '';
|
||||
}
|
||||
target_cell.set_text(text);
|
||||
// make this value the starting point, so that we can only undo
|
||||
// to this state, instead of a blank cell
|
||||
target_cell.code_mirror.clearHistory();
|
||||
source_element.remove();
|
||||
this.dirty = true;
|
||||
};
|
||||
@ -623,6 +626,9 @@ var IPython = (function (IPython) {
|
||||
// The edit must come before the set_text.
|
||||
target_cell.edit();
|
||||
target_cell.set_text(text);
|
||||
// make this value the starting point, so that we can only undo
|
||||
// to this state, instead of a blank cell
|
||||
target_cell.code_mirror.clearHistory();
|
||||
source_element.remove();
|
||||
this.dirty = true;
|
||||
};
|
||||
@ -645,6 +651,9 @@ var IPython = (function (IPython) {
|
||||
// The edit must come before the set_text.
|
||||
target_cell.edit();
|
||||
target_cell.set_text(text);
|
||||
// make this value the starting point, so that we can only undo
|
||||
// to this state, instead of a blank cell
|
||||
target_cell.code_mirror.clearHistory();
|
||||
source_element.remove();
|
||||
this.dirty = true;
|
||||
};
|
||||
@ -667,6 +676,9 @@ var IPython = (function (IPython) {
|
||||
// The edit must come before the set_text.
|
||||
target_cell.edit();
|
||||
target_cell.set_text(text);
|
||||
// make this value the starting point, so that we can only undo
|
||||
// to this state, instead of a blank cell
|
||||
target_cell.code_mirror.clearHistory();
|
||||
source_element.remove();
|
||||
this.dirty = true;
|
||||
};
|
||||
@ -693,6 +705,9 @@ var IPython = (function (IPython) {
|
||||
target_cell.set_level(level);
|
||||
target_cell.edit();
|
||||
target_cell.set_text(text);
|
||||
// make this value the starting point, so that we can only undo
|
||||
// to this state, instead of a blank cell
|
||||
target_cell.code_mirror.clearHistory();
|
||||
source_element.remove();
|
||||
this.dirty = true;
|
||||
};
|
||||
|
@ -158,6 +158,9 @@ var IPython = (function (IPython) {
|
||||
if (data.cell_type === this.cell_type) {
|
||||
if (data.source !== undefined) {
|
||||
this.set_text(data.source);
|
||||
// make this value the starting point, so that we can only undo
|
||||
// to this state, instead of a blank cell
|
||||
this.code_mirror.clearHistory();
|
||||
this.set_rendered(data.rendered || '');
|
||||
this.rendered = false;
|
||||
this.render();
|
||||
|
Loading…
Reference in New Issue
Block a user