From 8a39acbeb1ac9555ca3767cdb2cb1db5861a1f8b Mon Sep 17 00:00:00 2001 From: LucasC Date: Mon, 1 Dec 2025 16:08:35 +0100 Subject: [PATCH 1/2] XWIKI-17296: Inconsistent dropdown behaviour between object and class editor * Removed a minor bug from the `Add property` button. When there was no name set for the property it would submit the edit form and open the preview of the doc?? AFAIU the type on this button should have been `button` (action unrelated to the form) instead of `submit` (the button purpose is to submit the form -- here the edition of the page). * Removed a minor bug where clicking on the reordering handle would also expand/collapse the section. * Fixed the default state. --- .../src/main/resources/flamingo/editclass.vm | 2 +- .../resources/js/xwiki/editors/dataeditors.js | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/editclass.vm b/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/editclass.vm index 6dc8924d2de7..63f5866845fa 100644 --- a/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/editclass.vm +++ b/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/editclass.vm @@ -140,7 +140,7 @@ $xwiki.jsfx.use('js/xwiki/editors/dataeditors.js', true)## - + #end 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..13378dfa9282 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,18 @@ // ------------------------------------ // 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'); + } + propertyTitle.find('.toggle-collapsable, h2').on('click', function() { propertyTitle.parent().toggleClass('collapsed'); }); } From 6fb006bb297b9ad56ab0a03da4d81b98188c6fa6 Mon Sep 17 00:00:00 2001 From: LucasC Date: Tue, 9 Dec 2025 11:38:02 +0100 Subject: [PATCH 2/2] XWIKI-17296: Inconsistent dropdown behaviour between object and class editor * Removed unrelated change * Added a comment to explain an update. --- .../src/main/resources/flamingo/editclass.vm | 2 +- .../src/main/webapp/resources/js/xwiki/editors/dataeditors.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/editclass.vm b/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/editclass.vm index 63f5866845fa..6dc8924d2de7 100644 --- a/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/editclass.vm +++ b/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/xwiki-platform-flamingo-skin-resources/src/main/resources/flamingo/editclass.vm @@ -140,7 +140,7 @@ $xwiki.jsfx.use('js/xwiki/editors/dataeditors.js', true)## - + #end 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 13378dfa9282..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 @@ -694,6 +694,8 @@ 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'); });