Show More
@@ -73,6 +73,21 function($, | |||
|
73 | 73 | // Setting the file's initial value creates a history entry, |
|
74 | 74 | // which we don't want. |
|
75 | 75 | cm.clearHistory(); |
|
76 | that._set_mode_for_model(model); | |
|
77 | that.save_enabled = true; | |
|
78 | that.generation = cm.changeGeneration(); | |
|
79 | that.events.trigger("file_loaded.Editor", model); | |
|
80 | }, | |
|
81 | function(error) { | |
|
82 | cm.setValue("Error! " + error.message + | |
|
83 | "\nSaving disabled."); | |
|
84 | that.save_enabled = false; | |
|
85 | } | |
|
86 | ); | |
|
87 | }; | |
|
88 | ||
|
89 | Editor.prototype._set_mode_for_model = function (model) { | |
|
90 | /** Set the CodeMirror mode based on the file model */ | |
|
76 | 91 | |
|
77 | 92 |
|
|
78 | 93 |
|
@@ -87,18 +102,8 function($, | |||
|
87 | 102 |
|
|
88 | 103 |
|
|
89 | 104 |
|
|
90 |
|
|
|
105 | this.set_codemirror_mode(modeinfo); | |
|
91 | 106 |
|
|
92 | that.save_enabled = true; | |
|
93 | that.generation = cm.changeGeneration(); | |
|
94 | that.events.trigger("file_loaded.Editor", model); | |
|
95 | }, | |
|
96 | function(error) { | |
|
97 | cm.setValue("Error! " + error.message + | |
|
98 | "\nSaving disabled."); | |
|
99 | that.save_enabled = false; | |
|
100 | } | |
|
101 | ); | |
|
102 | 107 | }; |
|
103 | 108 | |
|
104 | 109 | Editor.prototype.set_codemirror_mode = function (modeinfo) { |
@@ -120,9 +125,10 function($, | |||
|
120 | 125 | var parent = utils.url_path_split(this.file_path)[0]; |
|
121 | 126 | var new_path = utils.url_path_join(parent, new_name); |
|
122 | 127 | return this.contents.rename(this.file_path, new_path).then( |
|
123 |
function ( |
|
|
124 |
that.file_path = |
|
|
125 |
that.events.trigger('file_renamed.Editor', |
|
|
128 | function (model) { | |
|
129 | that.file_path = model.path; | |
|
130 | that.events.trigger('file_renamed.Editor', model); | |
|
131 | that._set_mode_for_model(model); | |
|
126 | 132 | } |
|
127 | 133 | ); |
|
128 | 134 | }; |
General Comments 0
You need to be logged in to leave comments.
Login now