shell.js 586 B

1234567891011121314151617181920212223242526
  1. define(['durandal/app', 'knockout', 'highlightjs'], function (app, ko) {
  2. var type = ko.observable(),
  3. content = ko.observable();
  4. var sub = app.on('filebrowser:open_file').then(function(message) {
  5. type(message.type);
  6. if( message.type === "json" ) {
  7. content(ko.utils.stringifyJson(message.content));
  8. } else {
  9. content(message.content);
  10. }
  11. hljs.highlightBlock($('#editor')[0]);
  12. }, this);
  13. return {
  14. attached: function () {
  15. hljs.configure({
  16. tabReplace: ' '
  17. });
  18. hljs.initHighlighting();
  19. },
  20. type: type,
  21. content: content
  22. };
  23. });