Hi Marius, all,

On 09/05/2019 09:29, Simon Urli wrote:
Hi Marius, all,

On 08/05/2019 14:09, Marius Dumitru Florea wrote:
Hi Simon,

As I commented on https://github.com/xwiki/xwiki-platform/pull/1109 I think
that most of the time you will want to use a scripting macro + HTML macro
like this:

{{velocity}}
{{html clean="false"}}
<div ...><!-- Some wrapping around the content that may depend on the macro
parameters  -->
   ...
   <!-- Output the macro content here so that it can be edited in-line in
the WYSIWYG editor. -->
   ...
</div>
{{/html}}
{{/velocity}}

An example of such a macro could be:

{{figure src="someImage.png"}}some description{{/figure}}

The macro code would look like this:

{{velocity}}
{{html clean="false"}}
<div class="figure">
   <div class="figure-image-wrapper">
     <img src="..." class="figure-image" />
   </div>
   <div class="figure-caption">
     <!-- Output the figure caption here so that it can be edited in-line in
the WYSIWYG editor. -->
   </div>
</div>
{{/html}}
{{/velocity}}

I know you can output DIVs with wiki syntax but that's not the point. The
point is that we want to use HTML for the UI and leave the wiki syntax for the user content. So I don't think ``wikimacrocontent`` is that useful (if it's only purpose is to help you output the ``non-generated-content`` DIV).

so as Thomas mentioned in order to allow inline editing I also perform transformation on the generated list of blocks in DefaultWikiMacroRenderer to remove the macro marker that can cause troubles for inline editing. So the wikimacrocontent is used both to insert content, and to detect where to remove the macro markers during the transformation.

Now right now even with this solution it's not possible to inline edit html macro because of the way it's designed: the HTML macro only create a raw blocks that contains all the html, so I cannot easily transform it for inline editing. IMO it requires a change in the HTML macro.

so, re the subject of HTML macro and the handle of inline editing I was actually wrong to assume that it was linked to the raw block. It's actually linked to the metadata that are currently not handled in the custom HTML renderer of HTML macro. I created a dedicated issue for it (https://jira.xwiki.org/browse/XRENDERING-563), it's actually easy to fix since the mechanism already exist in AnnotatedHTMLRenderer. So I've been able to successfully create a very simple inline editing wiki macro like this:

{{html wiki="true"}}
<div style="border: 1px solid red">
((({{wikimacrocontent/}})))
</div>
{{/html}}

I had to put the ((( ))) to avoid having the wikimacrocontent rendered inline, maybe there's a way to do it cleaner, but I just wanted to check that it's working there. IMO it should really be the next priority in terms of usability of inline editing, to find a way to allow inline editing of inline macro.

Simon

Simon

Thanks,
Marius


On Tue, May 7, 2019 at 9:21 AM Simon Urli <[email protected]> wrote:

Hi everyone,

I'm currently working on allowing inline editing on new wikimacros.
My first challenge right now is to cope with the problem of inserting
the macro content and allowing to inline edit it.

In order to do so, I propose to create two new dedicated macro:
    - wikimacrocontent: would allow to insert and inline edit a wiki
macro content
    - wikimacroparameter: the same for a parameter.

The idea would be to be able to write something such as:

{{velocity}}
{{wikimacrocontent/}}
This is a content of $xcontext.macro.content.length() characters.
{{/velocity}}

So the purpose of those macros would be twofold:
    1. to ease the insertion of macro content/parameters (no need to
always use {{velocity}}$xcontext.macro.content{{/velocity}}
    2. to create the dedicated metadata around the content and to be
processed during wikimacro rendering to allow inline editing

Of course those macro would be only to be used inside a wikimacro.
I started to develop the wikimacroccontent, so I have a first working
POC, but I'd like to know WDYT about this.

I would also be really happy if you could give me some wikimacro
examples where the inline editing would make sense, so I could use it in
my tests.

Thanks,
Simon
--
Simon Urli
Software Engineer at XWiki SAS
[email protected]
More about us at http://www.xwiki.com



--
Simon Urli
Software Engineer at XWiki SAS
[email protected]
More about us at http://www.xwiki.com

Reply via email to