\r
var doc = sandbox.getBootstrappedData().document;\r
var document_id = sandbox.getBootstrappedData().document_id;\r
+ var history = sandbox.getBootstrappedData().history;\r
\r
\r
if(doc === '') {\r
}\r
});\r
\r
+ var reloadHistory = function() {\r
+ $.ajax({\r
+ method: 'get',\r
+ url: '/' + gettext('editor') + '/' + document_id + '/history',\r
+ success: function(data) {\r
+ history = data; \r
+ sandbox.publish('historyItemAdded', data.slice(-1)[0]);\r
+ },\r
+ });\r
+ }\r
+ \r
return {\r
start: function() {\r
sandbox.publish('ready');\r
method: 'post',\r
url: '/' + gettext('editor') + '/' + document_id,\r
data: JSON.stringify({document:doc}),\r
- success: function() {sandbox.publish('savingEnded', 'success');},\r
+ success: function() {sandbox.publish('savingEnded', 'success'); reloadHistory();},\r
error: function() {sandbox.publish('savingEnded', 'error');}\r
});\r
- } \r
+ },\r
+ getHistory: function() {\r
+ return history;\r
+ }\r
}\r
};\r
\r