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
|
|
@ -169,13 +169,30 @@ function loadDoc(name, callback) {
|
|||
});
|
||||
}
|
||||
|
||||
// callback is called with the error message from PUT (if any)
|
||||
function saveDoc(name, callback) {
|
||||
var doc = fileCache[name];
|
||||
if (!doc || !doc.session)
|
||||
return callback("Unknown document: " + name);
|
||||
|
||||
var path = doc.path;
|
||||
var parts = path.split("/");
|
||||
if (parts[0] == "docs")
|
||||
path = "demo/kitchen-sink/" + path;
|
||||
else if (parts[0] == "ace")
|
||||
path = "lib/" + path;
|
||||
|
||||
net.put(path, doc.session.getValue(), callback);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
fileCache: fileCache,
|
||||
docs: sort(prepareDocList(docs)),
|
||||
ownSource: prepareDocList(ownSource),
|
||||
hugeDocs: prepareDocList(hugeDocs),
|
||||
initDoc: initDoc,
|
||||
loadDoc: loadDoc
|
||||
loadDoc: loadDoc,
|
||||
saveDoc: saveDoc,
|
||||
};
|
||||
module.exports.all = {
|
||||
"Mode Examples": module.exports.docs,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue