aboutsummaryrefslogtreecommitdiff
path: root/js/mediators
diff options
context:
space:
mode:
Diffstat (limited to 'js/mediators')
-rw-r--r--js/mediators/io-mediator.js22
1 files changed, 21 insertions, 1 deletions
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js
index f2f2f642..630b0aa2 100644
--- a/js/mediators/io-mediator.js
+++ b/js/mediators/io-mediator.js
@@ -87,7 +87,13 @@ exports.IoMediator = Montage.create(Component, {
87 //Creating and formatting result object for callbak 87 //Creating and formatting result object for callbak
88 result = read.file.details; 88 result = read.file.details;
89 //TODO: Add handling for converting HTML to Ninja format 89 //TODO: Add handling for converting HTML to Ninja format
90 result.content = read.file.content; 90 if (result.extension !== 'html' && result.extension !== 'htm') {
91 result.content = read.file.content;
92 } else {
93 //
94 result.content = this.parseHtmlToNinjaTemplate(read.file.content);
95 }
96
91 result.status = read.status; 97 result.status = read.status;
92 // 98 //
93 if (callback) callback(result); 99 if (callback) callback(result);
@@ -140,6 +146,20 @@ exports.IoMediator = Montage.create(Component, {
140 value: function (file, copy, callback) { 146 value: function (file, copy, callback) {
141 // 147 //
142 } 148 }
149 },
150 ////////////////////////////////////////////////////////////////////
151 //
152 parseHtmlToNinjaTemplate: {
153 enumerable: false,
154 value: function (html) {
155 var doc = window.document.implementation.createHTMLDocument(), template;
156 //
157 doc.getElementsByTagName('html')[0].innerHTML = html;
158 template = {head: doc.head, body: doc.body, document: doc};
159 doc = null;
160 //
161 return template;
162 }
143 } 163 }
144 //////////////////////////////////////////////////////////////////// 164 ////////////////////////////////////////////////////////////////////
145}); 165});