X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/0add3b13ce4ef42557d9ca33342a159b80a4f42f..a22d30b71f012cf8653319e6743440abf7be52a8:/modules/visualEditor.js diff --git a/modules/visualEditor.js b/modules/visualEditor.js index b22aa7d..2fecfde 100644 --- a/modules/visualEditor.js +++ b/modules/visualEditor.js @@ -1,15 +1,9 @@ rng.modules.visualEditor = function(sandbox) { + var transformations = rng.modules.visualEditor.transformations; var view = $(sandbox.getTemplate('main')()); var isDirty = false; - var document2html = function(document) { - return document; - } - - var html2document = function() { - return $('#rng-visualEditor-content').text(); - } $('#rng-visualEditor-content', view).on('keyup', function() { isDirty = true; @@ -22,12 +16,13 @@ rng.modules.visualEditor = function(sandbox) { getView: function() { return view; }, - setDocument: function(document) { - $('#rng-visualEditor-content', view).html(document2html(document)); + setDocument: function(xml) { + var transformed = transformations.fromXML.getDocumentDescription(xml); + $('#rng-visualEditor-content', view).html(transformed.HTMLTree); isDirty = false; }, getDocument: function() { - return html2document(); + return transformations.toXML.getXML({HTMLTree: $('#rng-visualEditor-content').text(), metadata: {}}); }, isDirty: function() { return isDirty;