fix popover not updated when updating notes

This commit is contained in:
Ezequiel Bergamaschi 2014-12-27 00:09:01 -03:00
parent 91f85139ca
commit 15c13a8f4f
2 changed files with 28 additions and 11 deletions

View File

@ -44,7 +44,9 @@ mindplot.NoteIcon = new Class({
title: $msg('NOTE'),
container: 'body',
// Content can also be a function of the target element!
content: this._buildTooltipContent(),
content: function() {
return me._buildTooltipContent();
},
html:true,
placement:'bottom'
});
@ -52,16 +54,21 @@ mindplot.NoteIcon = new Class({
},
_buildTooltipContent: function() {
var result = $('<div></div>').css({padding:'5px'});
if ($("body").find("#textPopoverNote").length == 1) {
var text = $("body").find("#textPopoverNote");
text.text(this._linksModel.getText());
} else {
var result = $('<div id="textPopoverNote"></div>').css({padding:'5px'});
var text = $('<div></div>').text(this._linksModel.getText())
.css({
'white-space':'pre-wrap',
'word-wrap':'break-word'
}
);
result.append(text);
return result;
var text = $('<div></div>').text(this._linksModel.getText())
.css({
'white-space':'pre-wrap',
'word-wrap':'break-word'
}
);
result.append(text);
return result;
}
},
getModel:function () {

View File

@ -34,7 +34,17 @@ mindplot.widget.FloatingTip = new Class({
initialize: function (element, options) {
this.setOptions(options);
this.element = element;
element.popover(this.options);
this._createPopover();
},
//FIXME: find a better way to do that...
_createPopover: function() {
this.element.popover(this.options);
var me = this;
this.element.one('hidden.bs.popover', function() {
me.element.popover('destroy');
me._createPopover();
});
},
show: function () {