Hi,
i am trying to create a macro that allows me to edit the value of my macro parameters directly in the WYSIWYG editor (not in the macro pop up window).
So far i achieving it by adding a “<div>” tag with specific values while in edit mode around the parameter. I am able to edit my macro parameters directly in the WYSIWYG editor, but if i try to edit them again all line breaks are gone.
My goal is to be able to edit the content of the show/hide macro directly inside the WYSIWYG editor (not in the macro pop up window). I only render the show/hide macro when the context action is view or preview. As i mentioned everything works fine except that after a re-edit all line breaks are gone.
Any ideas what i could do?
{{velocity}}
#set ($text = $xcontext.macro.params.CommandBlockText )
## Add a wrapping div as a sample of the action of this macro
#set($edittext = '(% data-xwiki-non-generated-content="java.util.List<org.xwiki.rendering.block.Block>" data-xwiki-parameter-name="CommandBlockText" data-xwiki-wikimacrocontent="true" class="xwiki-metadata-container cke_widget_editable" data-cke-widget-editable="CommandBlockText" data-cke-enter-mode="1" data-cke-display-name="CommandBlockText" contenteditable="true" %)((('+ $text +')))')
#set($wikimacro.result = $services.rendering.parse($edittext, $xwiki.getCurrentContentSyntaxId()).getChildren())
{{/velocity}}
Thank you for your help!
I upgraded the CKEditor Integration extension to version 1.37 and integrated the suggest code into my macro code. Unfortunately the outcome is still the same and all line breaks will be removed, if I enter the edit mode a second time, like I posted before. Since it is working on the box macro I will try to implement a Java version of my macro with the given maven archetype for a macro, unless there is another solution.
Nevertheless, thank you for your help and time!
Sure,
i just created a macro class with the following content and a macroparameter class in a subwiki of a multiwiki enviroment:
macro class
Supports inline mode: no (tested yes same result)
Macro visibility: current wiki
Macro content availability: optional
Macro content type: wiki (tested unkown same result)
macro parameter:
Parameter mandatory: no
Parameter type: java.util.List
All parameter types now have the default type (macro still works if i change them to java.util.List)
Issues:
Editing a parameter in the WYSIWYG editor
Adding a info box via the macro selection in the WYSIWYG editor needs some tweaking but is mostly working. Sometimes the user needs to add extra line (especially in tables) after the info box
Adding a info box via the style selection in the WYSIWYG editor is broken and will result in:
2.1 rendering only the content of the info box not the box itself
2.2 removing the box with its content