0 Votes

Changes for page Expand

Last modified by Ryan C on 2025/04/30 07:54

From version 1.1
edited by Ryan C
on 2025/03/06 16:46
Change comment: Install extension [com.xwiki.pro:xwiki-pro-macros-ui/1.26.4]
To version 3.1
edited by Ryan C
on 2025/04/15 22:48
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -11,5 +11,5 @@
11 11  = Example Usage =
12 12  
13 13  {{expand expanded="false"}}
14 -Hello 👀
14 +Hello
15 15  {{/expand}}
XWiki.WikiMacroClass[0]
Macro code
... ... @@ -1,64 +1,7 @@
1 -{{velocity output="false"}}
2 -#macro (executeMacro)
3 - ## To avoid an issue regarding {{wikimacroparameter}} and {{wikimacrocontent}} that fail to render when in
4 - ## edit mode while inside a HTML macro, we need to manually write the HTML by using XWiki syntax. This way,
5 - ## while the macro will always be expanded when in edit mode, the user will be able to modify the text inline.
6 - #set ($targetSyntaxId = $wikimacro.context.transformationContext.targetSyntax.type.id)
7 - #set ($discard = $xwiki.ssx.use('Confluence.Macros.Expand'))
8 - #if ($targetSyntaxId == 'annotatedhtml' || $targetSyntaxId == 'annotatedxhtml' ||
9 - $request.outputSyntax == 'annotatedhtml')
10 - (% class="confluence-expand-macro panel panel-default" %)
11 - (((
12 - (((
13 - (% class="panel-title" %)
14 - (((
15 - (% class="glyphicon glyphicon-menu-down" aria-hidden="true" %)
16 - ((()))
17 - {{wikimacroparameter name='title' /}}
18 - )))
19 - )))
20 - (% class="panel-body" %)
21 - (((
22 - {{wikimacrocontent /}}
23 - )))
24 - )))
25 - #else
26 - #set ($opened = $xcontext.action == 'edit' || $xcontext.action == 'export' || $wikimacro.parameters.expanded)
27 - {{html clean="false" wiki="true"}}
28 - <details class="confluence-expand-macro panel panel-default" #if ($opened)open#end>
29 - <summary>
30 - <span class="panel-title">
31 - <span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span>
32 - #set ($title = $wikimacro.parameters.title)
33 - #if ("$!title" == "")
34 - #set ($title = $services.promacroexpand.getAutoTitle($wikimacro.content, $xwiki.currentContentSyntaxId))
35 - #if ("$!title" == "")
36 - #set ($title = $services.localization.render("rendering.macro.expand.defaultexpandtitle"))
37 - #end
38 - #end
39 - <span class="title-text">
40 - $services.rendering.escape($escapetool.xml($title), $xwiki.currentContentSyntaxId)
41 - </span>
42 - </span>
43 - </summary>
44 - <div class="panel-body">
1 +## Compatibility patch: redirect {{expand}} to {{expandable}}
2 +#set($start = ($expanded == "true") ? "expanded" : "collapsed")
45 45  
46 - {{wikimacrocontent /}}
4 +{{expandable title="$!title" start="$start"}}
5 +$!xcontext.macro.content
6 +{{/expandable}}
47 47  
48 - </div>
49 - </details>
50 - {{/html}}
51 - #end
52 -#end
53 -{{/velocity}}
54 -
55 -{{velocity}}
56 -## We need to check if there is a valid license because the macro is registered even if the user doesn't have view right
57 -## on the macro definition page. See XWIKI-14828: Rendering macros defined in wiki pages are available to users that
58 -## don't have view right on those pages.
59 -#if ($services.promacrolicensing.hasLicensureForEntity($xcontext.macro.doc.documentReference))
60 - #executeMacro
61 -#else
62 - {{missingLicenseMessage extensionName="proMacros.extension.name"/}}
63 -#end
64 -{{/velocity}}
XWiki.WikiMacroParameterClass[0]
Parameter type
... ... @@ -1,1 +1,0 @@
1 -java.lang.String
XWiki.WikiMacroParameterClass[1]
Parameter type
... ... @@ -1,1 +1,0 @@
1 -java.lang.Boolean