Macro Inline Editing Content

Last modified by Vincent Massol on 2024/02/26 17:54

 XWiki
 Implementation
 Completed

Description

This proposal is about allowing user to edit content of the macro directly in the WYSIWYG editor without having to open back the macro contextual window.

After discussion we propose to do the following changes.

ContentDescriptor

Add the new following method:

public default Type getType() {
 return Object;

 // for current document syntax: return List<Block>;
}

The idea of this method is to know type of the content to be edited inline with the WYSIWYG editor.

By default, it's an object and won't be edited inline.
In order to specify that the WYSIWYG should use the current document syntax, the type must be a list of block.
This method is static in order to be retrieved immediately by the WYSIWYG editor before any parameters are typed.

When a contributor creates a new macro she can overrides this method to define the proper type to use.

MetaDataBlock

We need to specify which parts of the macro content might be editable or not.
For backward compatibility reason, we will consider that the content is not editable.

So, we should define a new MetaDataBlock type, to specify a part of the content that can be edited by the user.
The work for making most of the macro editable won't be a problem as it should mainly be to add the new MetaDataBlock in the DefaultMacroContentParser. 

WikiMacroClass

All the changes presented above only concerns directly Java macro and not Wiki macro.
In order to allow defined the syntax in Wiki macro, we plan to add a new select input with the two following entries: WikiContent (which is "the current wiki content syntax", or List<Block>), or "Other" (which would mean Plain Text for the WYSIWYG or Object for the type).

Then we should give a way to specify a part of the content that is editable in a WikiMacro: we cannot use the MetaDataBlock there, as it cannot be output.
We propose to use GroupBlock and FormatBlock with specific values for this case, such as: 

<div class="box">
<div class="title">Some fixed title</div>
<div class="content">
Some fixed content.
<span data-wysiwyg-editable-content="true">my editable content</span>
</div>
</div>

The WYSIWYG editor would then have to retrieve both MetaDataBlock and block with the right attribute to know what is editable and what isn't.


 

Tags:
    

Get Connected