mirror of
https://github.com/jupyter/notebook.git
synced 2025-03-13 13:17:50 +08:00
BUG: Prevent users from undoing the initial document load with CTRL-Z.
Prior to this change, setting a document's initial content in the text editor created a history entry, which meant that hitting CTRL-Z repeatedly could clear the entire document. This change clears document history after loading so that repeated CTRL-Z applications return the document to its state at load time.
This commit is contained in:
parent
9fe4bcc817
commit
6a8dfa492e
@ -35,7 +35,11 @@ function($,
|
||||
this.contents.get(this.file_path, {type: 'file', format: 'text'})
|
||||
.then(function(model) {
|
||||
cm.setValue(model.content);
|
||||
|
||||
|
||||
// Setting the file's initial value creates a history entry,
|
||||
// which we don't want.
|
||||
cm.clearHistory();
|
||||
|
||||
// Find and load the highlighting mode
|
||||
var modeinfo = CodeMirror.findModeByMIME(model.mimetype);
|
||||
if (modeinfo) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user