wip: storing wlxmlNode-canvasNode references
[fnpeditor.git] / src / editor / modules / data / data.js
index 9b2f163..5e45b26 100644 (file)
@@ -1,28 +1,19 @@
-define(['./saveDialog'], function(saveDialog) {
+define([
+    './saveDialog',
+    'wlxml/wlxml'
+
+], function(saveDialog, wlxml) {
 
 'use strict';
 
 return function(sandbox) {
 
 
 'use strict';
 
 return function(sandbox) {
 
-    var doc = sandbox.getBootstrappedData().document;
     var document_id = sandbox.getBootstrappedData().document_id;
     var document_version = sandbox.getBootstrappedData().version;
     var history = sandbox.getBootstrappedData().history;
 
     var document_id = sandbox.getBootstrappedData().document_id;
     var document_version = sandbox.getBootstrappedData().version;
     var history = sandbox.getBootstrappedData().history;
 
-    
-    if(doc === '') {
-        doc = '<section\n\
-        xmlns="http://nowoczesnapolska.org.pl/sst#"\n\
-        xmlns:xlink="http://www.w3.org/1999/xlink"\n\
-        xmlns:dc="http://purl.org/dc/elements/1.1/"\n\
-        xmlns:dcterms="http://purl.org/dc/terms/"\n\
-    >\n\
-        <metadata>\n\
-        </metadata>\n\
-        <div class="p"></div>\n\
-    </section>';
-    }
-    
+    var wlxmlDocument = wlxml.WLXMLDocumentFromXML(sandbox.getBootstrappedData().document);
+     
     
     function readCookie(name) {
         var nameEQ = escape(name) + "=";
     
     function readCookie(name) {
         var nameEQ = escape(name) + "=";
@@ -60,11 +51,11 @@ return function(sandbox) {
             sandbox.publish('ready');
         },
         getDocument: function() {
             sandbox.publish('ready');
         },
         getDocument: function() {
-            return doc;
+            return wlxmlDocument;
         },
         commitDocument: function(newDocument, reason) {
         },
         commitDocument: function(newDocument, reason) {
-            doc = newDocument;
-            sandbox.publish('documentChanged', doc, reason);
+            // doc = newDocument;
+            // sandbox.publish('documentChanged', doc, reason);
         },
         saveDocument: function() {
 
         },
         saveDocument: function() {