Merged in bugfix/undo-delete-and-tooltips (pull request #12)

Bugfix/undo delete and tooltips

* Fix undo delete: restore NodeModel original-like implementation

* Fix empty tooltips (no text)


Approved-by: Paulo Veiga
This commit is contained in:
Matias Arriola 2021-12-20 21:21:39 +00:00 committed by Paulo Veiga
parent f8156fcf85
commit 60771b2ded
2 changed files with 14 additions and 6 deletions

View File

@ -122,7 +122,16 @@ class NodeModel extends INodeModel {
* @return {mindplot.model.NodeModel} an identical clone of the NodeModel
*/
clone() {
return cloneDeep(this);
const result = new NodeModel(this.getType(), this._mindmap);
result._children = this._children.map((node) => {
const cnode = node.clone();
cnode._parent = result;
return cnode;
});
result._properties = cloneDeep(this._properties);
result._feature = cloneDeep(this._feature);
return result;
}
/**

View File

@ -31,20 +31,19 @@ class KeyboardShortcutTooltip extends FloatingTip {
buttonElem.append(tipDiv);
super(tipDiv, {
// Content can also be a function of the target element!
content: KeyboardShortcutTooltip._buildContent(),
// content can be a function or string
content: KeyboardShortcutTooltip._buildContent(text),
html: true,
placement: 'bottom',
className: 'keyboardShortcutTip',
template: '<div class="popover popoverBlack" role="tooltip"><div class="arrow arrowBlack"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>',
});
this._text = text;
tipDiv.on('click', (e) => {
tipDiv.trigger('mouseleave', e);
});
}
static _buildContent() {
static _buildContent(text) {
const result = $('<div></div>');
result.css({
padding: '3px 0px',
@ -52,7 +51,7 @@ class KeyboardShortcutTooltip extends FloatingTip {
color: 'white',
});
const textContainer = $('<div></div>').text(this._text);
const textContainer = $('<div></div>').text(text);
textContainer.css({
width: '100%',
'font-size': '90%',