1 // Module that implements main WYSIWIG edit area
7 'libs/text!./template.html'], function($, canvas3, commands, template) {
11 return function(sandbox) {
13 var canvas = canvas3.fromXMLDocument(null, sandbox.publish);
14 var canvasWrapper = $(template);
15 var shownAlready = false;
16 var scrollbarPosition = 0,
19 canvasWrapper.onShow = function() {
22 canvas.setCurrentElement(canvas.doc().getVerticallyFirstTextElement());
24 canvas.setCursorPosition(cursorPosition);
25 this.find('#rng-module-documentCanvas-contentWrapper').scrollTop(scrollbarPosition);
29 canvasWrapper.onHide = function() {
30 scrollbarPosition = this.find('#rng-module-documentCanvas-contentWrapper').scrollTop();
31 cursorPosition = canvas.getCursor().getPosition();
36 start: function() { sandbox.publish('ready'); },
40 setDocument: function(wlxmlDocument) {
41 canvas.loadWlxmlDocument(wlxmlDocument);
42 canvasWrapper.find('#rng-module-documentCanvas-content').empty().append(canvas.view());
44 highlightElement: function(node) {
45 canvas.toggleElementHighlight(node, true);
47 dimElement: function(node) {
48 canvas.toggleElementHighlight(node, false);
50 jumpToElement: function(node) {
51 canvas.setCurrentElement(node);
53 command: function(command, params) {
54 commands.run(command, params, canvas, sandbox.getConfig().user);