Adding a Property annotation to signify that a property should not be displayed in UIs

Hi,

Context:

Proposal:

Introduce a new Property annotation to signify that a property should not be displayed in UIs. Specifically in the WYSIWYG macro dialog editor for the Include macro use case.

I’m proposing:

@PropertyDisplayHidden

Other options:

  • @PropertyDisplayVisibility(true|false)
  • @PropertyDisplaySkip
  • @PropertyDisplayEnabled/Disabled

@mflorea On the CKEditor side, I’m proposing to modify MacroService.xml to skip the JSON portion for properties that are hidden, so that they are not displayed.

I’m going to start implementing this now so please let me know ASAP if you have doubt or comments about this proposal.

Thanks!

JIRAs:

+1

That is not good for 2 reasons:

  • if that macro parameter is set (from wiki syntax) then the WYSIWYG editor still needs to display it when editing the macro. The WYSIWYG editor has to display all parameters that have a value set (which is not the default one). For this the editor needs to know the proper label, description or even picker (hidden doesn’t mean it cannot have a picker associated due to its Java type)
  • if the hidden parameter is part of a group then it needs to be there, even if hidden, as otherwise the WYSIWYG editor can’t set its value. Choosing a reference for the include macro means setting 2 parameters. Even if you hide the type parameter, it still needs to be there so that the WYSIWYG editor can set it when the user picks a reference, because the reference parameter doesn’t hold the type information. The reference picker sets 2 parameters. The same applies to any group of parameters that use a single picker.

Thanks,
Marius

Ok, I get this is because on save we need to go from HTML to XDOM and thus reconstruct the macro and thus if we don’t output the parameter in the HTML then it’s going to be lost, right?

So the idea is to output it but mark it hidden with CSS, right?

First the MacroService needs to mark the parameter as hidden https://github.com/xwiki-contrib/application-ckeditor/blob/master/ui/src/main/resources/CKEditor/MacroService.xml#L185 and then the macroEditor needs to keep the parameter hidden if it comes from the descriptor https://github.com/xwiki-contrib/application-ckeditor/blob/master/plugins/src/main/resources/xwiki-macro/macroEditor.js#L285

parameter.hidden = parameter.hidden || ...

Thanks,
Marius

Done! :slight_smile: