diff --git a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/editors/dataeditors.js b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/editors/dataeditors.js index 3602d8da739f..d30d7f29c33f 100644 --- a/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/editors/dataeditors.js +++ b/xwiki-platform-core/xwiki-platform-web/xwiki-platform-web-war/src/main/webapp/resources/js/xwiki/editors/dataeditors.js @@ -533,9 +533,9 @@ $.post(ref).done(function(data) { $('#xclassContent').append(data); let insertedPropertyElt = $('#xclassContent > div.xproperty:last-child'); - // Expand the newly inserted property, since the user will probably want to edit it once it was added - self.expandCollapseMetaProperty(insertedPropertyElt); - // Make teh newly added property sortable + // Make the newly added property collapsable since the user will probably want to edit it + self.expandCollapseMetaProperty(insertedPropertyElt, true); + // Make the newly added property sortable self.makeSortable(insertedPropertyElt); self.ajaxPropertyDeletion(insertedPropertyElt); self.makeDisableVisible(insertedPropertyElt); @@ -683,15 +683,20 @@ // ------------------------------------ // Class editor: expand-collapse meta properties - expandCollapseMetaProperty(property) { + expandCollapseMetaProperty(property, startExpanded = false) { let propertyTitle = property.find('.xproperty-title'); if (!propertyTitle) { // No such object... return; } property.addClass('collapsable'); - property.addClass('collapsed'); - propertyTitle.on('click', function() { + // By default, the property is collapsed when made collapsable. + if(!startExpanded) { + property.addClass('collapsed'); + } + // The click event is catched only on the icon and title to avoid breaking behaviour when using actions, + // especially the move action which is dragAndDrop. + propertyTitle.find('.toggle-collapsable, h2').on('click', function() { propertyTitle.parent().toggleClass('collapsed'); }); }