From: Aleksander Ɓukasz Date: Wed, 14 May 2014 14:10:25 +0000 (+0200) Subject: editor: show comment tip next to blocks containing comments X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/fa35a2ccd01eccad357d79258de134a4e0f9d6ea editor: show comment tip next to blocks containing comments --- diff --git a/src/editor/modules/documentCanvas/canvas/genericElement.js b/src/editor/modules/documentCanvas/canvas/genericElement.js index 8d0ba87..4f4da9b 100644 --- a/src/editor/modules/documentCanvas/canvas/genericElement.js +++ b/src/editor/modules/documentCanvas/canvas/genericElement.js @@ -31,6 +31,14 @@ $.extend(generic, { this._container().append(el.dom); } }.bind(this)); + + this.commentTip = $('
'); + this.addWidget(this.commentTip); + + if(!this.wlxmlNode.hasChild({klass: 'comment'})) { + this.commentTip.hide(); + } + this.refresh(); }, @@ -119,8 +127,13 @@ $.extend(generic, { } referenceElement[referenceAction](actionArg); + + if(event.meta.node.is('comment')) { + this.commentTip.show(); + } }, onNodeDetached: function(event) { + var isComment = event.meta.node.is('comment'); if(event.meta.node.sameNode(this)) { this.detach(); } else { @@ -130,6 +143,9 @@ $.extend(generic, { return true; } }); + if(isComment && !this.wlxmlNode.hasChild({klass: 'comment'})) { + this.commentTip.hide(); + } } }, onNodeTextChange: function(event) { diff --git a/src/editor/modules/documentCanvas/canvas/genericElement.less b/src/editor/modules/documentCanvas/canvas/genericElement.less index c935a79..dcc23f4 100644 --- a/src/editor/modules/documentCanvas/canvas/genericElement.less +++ b/src/editor/modules/documentCanvas/canvas/genericElement.less @@ -13,4 +13,15 @@ font-family: monospace; z-index:9999; white-space: nowrap; +} + +.comment-tip { + position:absolute; + left:-15px; + top:3px; + opacity: 0.25; +} + +.current-node-element > .canvas-widgets > .comment-tip { + opacity: 1; } \ No newline at end of file