Some basic emeditor scripts for formatting json and running builds.
This commit is contained in:
parent
093615aeab
commit
5c26c09815
2 changed files with 33 additions and 0 deletions
16
scripts/emeditor/format_json.js
Normal file
16
scripts/emeditor/format_json.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
var q;
|
||||
if (document.selection.text) {
|
||||
try {
|
||||
q = JSON.parse(document.selection.Text);
|
||||
document.selection.text = JSON.stringify(q, undefined, 2);
|
||||
} catch (err) {
|
||||
Window.OutputBar.writeln("Selected text couldnt have been formatted as json. Most likely it's not json: "
|
||||
+ err.message + " " + err.fileName + ":" + err.lineNumber);
|
||||
Window.OutputBar.Visible = true;
|
||||
}
|
||||
} else {
|
||||
// alert('There is no selection');
|
||||
// Window.prompt('There is no selection provided');
|
||||
Window.OutputBar.writeln('There is no selection provided. Please select text to formt it as json');
|
||||
Window.OutputBar.Visible = true;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue