X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/e64e37a2fbe6d64b2513133d34370f0d1a63f7b9..84eba72af147a175fb93b7305c1d42b0a4987a8c:/modules/documentCanvas/documentCanvas.js?ds=sidebyside diff --git a/modules/documentCanvas/documentCanvas.js b/modules/documentCanvas/documentCanvas.js index cc4964b..4ca0a4d 100644 --- a/modules/documentCanvas/documentCanvas.js +++ b/modules/documentCanvas/documentCanvas.js @@ -3,16 +3,15 @@ define([ 'libs/underscore-min', './transformations', -'./wlxmlNode', './canvas', './canvasManager', -'libs/text!./template.html'], function(_, transformations, wlxmlNode, Canvas, CanvasManager, template) { +'libs/text!./template.html'], function(_, transformations, Canvas, CanvasManager, template) { 'use strict'; return function(sandbox) { - var canvas = new Canvas.Canvas(); + var canvas = Canvas.create(); var manager = new CanvasManager(canvas, sandbox); /* public api */ @@ -22,11 +21,11 @@ return function(sandbox) { return canvas.dom; }, setDocument: function(xml) { - canvas.setXML(xml); + canvas.setHTML(transformations.fromXML.getHTMLTree(xml)); sandbox.publish('documentSet'); }, getDocument: function() { - return canvas.toXML(); + return transformations.toXML.getXML(canvas.getContent()) }, modifyCurrentNode: function(attr, value) { if(manager.currentNode) { @@ -34,15 +33,15 @@ return function(sandbox) { sandbox.publish('contentChanged'); } }, - highlightNode: function(wlxmlNode) { - manager.highlightNode(wlxmlNode); + highlightNode: function(canvasNode) { + manager.highlightNode(canvasNode); }, - dimNode: function(wlxmlNode) { - manager.dimNode(wlxmlNode); + dimNode: function(canvasNode) { + manager.dimNode(canvasNode); }, - selectNode: function(wlxmlNode) { - if(!wlxmlNode.is(manager.currentNode)) - manager.selectNode(wlxmlNode, {movecaret: true}); + selectNode: function(canvasNode) { + if(!canvasNode.isSame(manager.currentNode)) + manager.selectNode(canvasNode, {movecaret: true}); }, toggleGrid: function(toggle) { manager.toggleGrid(toggle); @@ -50,9 +49,6 @@ return function(sandbox) { insertNewNode: function(wlxmlTag, wlxmlClass) { manager.insertNewNode(wlxmlTag, wlxmlClass); }, - wrapSelectionWithNewNode: function(wlxmlTag, wlxmlClass) { - manager.wrapSelectionWithNewNode(wlxmlTag, wlxmlClass); - }, command: function(command, meta) { manager.command(command, meta); }