add server upload buttons and Ctrl-S bindings to mode_editor
in combination with PUT support in ./static.py (or whatever other web server) this allows people to save both the highlighting rules and the demo documents right from the mode editor for a better workflow.
This commit is contained in:
parent
ded43d9d69
commit
8919b113d1
4 changed files with 73 additions and 2 deletions
|
|
@ -22,6 +22,19 @@ exports.get = function (url, callback) {
|
|||
xhr.send(null);
|
||||
};
|
||||
|
||||
exports.put = function (url, data, callback) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('PUT', url, true);
|
||||
xhr.onreadystatechange = function () {
|
||||
//Do not explicitly handle errors, those should be
|
||||
//visible via console output in the browser.
|
||||
if (xhr.readyState === 4) {
|
||||
callback(xhr.responseText);
|
||||
}
|
||||
};
|
||||
xhr.send(data);
|
||||
};
|
||||
|
||||
exports.loadScript = function(path, callback) {
|
||||
var head = dom.getDocumentHead();
|
||||
var s = document.createElement('script');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue