From: Aleksander Ɓukasz Date: Tue, 27 May 2014 08:09:14 +0000 (+0200) Subject: editor: comments wip - inserting information about author X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/c29d2f9290ba801c3f89e8034512f2cfc2655f8d?ds=sidebyside editor: comments wip - inserting information about author --- diff --git a/src/editor/modules/documentCanvas/canvas/canvas.js b/src/editor/modules/documentCanvas/canvas/canvas.js index ab31ee1..8ca71ac 100644 --- a/src/editor/modules/documentCanvas/canvas/canvas.js +++ b/src/editor/modules/documentCanvas/canvas/canvas.js @@ -60,7 +60,8 @@ $.extend(TextHandler.prototype, { }); -var Canvas = function(wlxmlDocument, elements) { +var Canvas = function(wlxmlDocument, elements, metadata) { + this.metadata = metadata || {}; this.elementsRegister = new ElementsRegister(documentElement.DocumentNodeElement, nullElement); elements = [ @@ -614,8 +615,8 @@ $.extend(Cursor.prototype, { }); return { - fromXMLDocument: function(wlxmlDocument, elements) { - return new Canvas(wlxmlDocument, elements); + fromXMLDocument: function(wlxmlDocument, elements, metadata) { + return new Canvas(wlxmlDocument, elements, metadata); } }; diff --git a/src/editor/modules/documentCanvas/canvas/genericElement.js b/src/editor/modules/documentCanvas/canvas/genericElement.js index d3debb2..878e140 100644 --- a/src/editor/modules/documentCanvas/canvas/genericElement.js +++ b/src/editor/modules/documentCanvas/canvas/genericElement.js @@ -33,7 +33,7 @@ $.extend(generic, { } }.bind(this)); - this.commentsView = new CommentsView(this.wlxmlNode, {}); + this.commentsView = new CommentsView(this.wlxmlNode, this.canvas.metadata.user); this.addToGutter(this.commentsView); this.commentTip = $('
'); this.addWidget(this.commentTip); diff --git a/src/editor/modules/documentCanvas/documentCanvas.js b/src/editor/modules/documentCanvas/documentCanvas.js index 651788e..7e70f7f 100644 --- a/src/editor/modules/documentCanvas/documentCanvas.js +++ b/src/editor/modules/documentCanvas/documentCanvas.js @@ -20,7 +20,9 @@ return function(sandbox) { canvasElements = canvasElements.concat(plugin.canvasElements || []); }); - var canvas = canvas3.fromXMLDocument(null, canvasElements); + var canvas = canvas3.fromXMLDocument(null, canvasElements, { + user: sandbox.getConfig().user + }); var canvasWrapper = $(template); var shownAlready = false; var scrollbarPosition = 0,