From d3192e9fbeafb71c30b6c89f25755c48d7d88946 Mon Sep 17 00:00:00 2001 From: jos Date: Sun, 26 Aug 2018 17:35:45 +0200 Subject: [PATCH] Fixed `transform` not creating/removing expand button when the type of a node changed --- HISTORY.md | 2 ++ src/js/Node.js | 19 +++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 36bb801..73ba530 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -9,6 +9,8 @@ https://github.com/josdejong/jsoneditor can overflow the borders of the editor. - Fixed #568: mode switcher disappearing when selecting the current mode again. +- Fixed `transform` not creating/removing expand button when the type + of a node changed. ## 2018-08-22, version 5.24.0 diff --git a/src/js/Node.js b/src/js/Node.js index c02bd99..c629d05 100644 --- a/src/js/Node.js +++ b/src/js/Node.js @@ -616,17 +616,16 @@ Node.prototype.setInternalValue = function(internalValue) { * Remove the DOM of this node and it's childs and recreate it again */ Node.prototype.recreateDom = function() { - // only recreate dom if there is a dom already - if (!this.dom || ! this.dom.tr || !this.dom.tr.parentNode) { - return; + if (this.dom && this.dom.tr && this.dom.tr.parentNode) { + var domAnchor = this._detachFromDom(); + + this.clearDom(); + + this._attachToDom(domAnchor); + } + else { + this.clearDom(); } - - var domAnchor = this._detachFromDom(); - - // delete the DOM - this.clearDom(); - - this._attachToDom(domAnchor); }; /**