rng.modules.visualEditor = function(sandbox) {\r
+ var transformations = rng.modules.visualEditor.transformations;\r
\r
var view = $(sandbox.getTemplate('main')());\r
var isDirty = false;\r
\r
- var document2html = function(document) {\r
- return document;\r
- }\r
- \r
- var html2document = function() {\r
- return $('#rng-visualEditor-content').text();\r
- }\r
\r
$('#rng-visualEditor-content', view).on('keyup', function() {\r
isDirty = true;\r
getView: function() {\r
return view;\r
},\r
- setDocument: function(document) {\r
- $('#rng-visualEditor-content', view).html(document2html(document));\r
+ setDocument: function(xml) {\r
+ var transformed = transformations.fromXML.getDocumentDescription(xml);\r
+ $('#rng-visualEditor-content', view).html(transformed.HTMLTree);\r
isDirty = false;\r
},\r
getDocument: function() {\r
- return html2document();\r
+ return transformations.toXML.getXML({HTMLTree: $('#rng-visualEditor-content').text(), metadata: {}});\r
},\r
isDirty: function() {\r
return isDirty;\r