Änderungen von Dokument Expand

Zuletzt geändert von xwikiadmin am 2025/12/11 07:39

Von Version 6.1
bearbeitet von xwikiadmin
am 2025/05/21 10:53
Änderungskommentar: Install extension [com.xwiki.pro:xwiki-pro-macros-ui/1.26.19]
Auf Version 8.1
bearbeitet von xwikiadmin
am 2025/12/11 07:39
Änderungskommentar: Install extension [com.xwiki.pro:xwiki-pro-macros-ui/1.28.5]

Zusammenfassung

Details

XWiki.WikiMacroClass[0]
Makro-Code
... ... @@ -1,54 +1,82 @@
1 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)
2 +#macro (exportMode $escapedTitle)
3 + ## Use a different structure when exporting to make sure that the pagedjs can properly parse the content.
4 +
27 27   {{html clean="false" wiki="true"}}
28 - <details class="confluence-expand-macro panel panel-default" #if ($opened)open#end>
29 - <summary>
6 + <div class = "panel panel-default confluence-expand-macro">
7 + <div class>
30 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
9 + <span class="glyphicon glyphicon-menu-down" aria-hidden="true"></span>
39 39   <span class="title-text">
40 - $services.rendering.escape($escapetool.xml($title), $xwiki.currentContentSyntaxId)
11 + $escapedTitle
41 41   </span>
42 42   </span>
43 - </summary>
14 + </div>
44 44   <div class="panel-body">
45 45  
46 46   {{wikimacrocontent /}}
47 47  
48 48   </div>
49 - </details>
20 + </div>
50 50   {{/html}}
22 +
23 +#end
24 +
25 +#macro (executeMacro)
26 +
27 + #set ($discard = $xwiki.ssx.use('Confluence.Macros.Expand'))
28 + #set ($title = $wikimacro.parameters.title)
29 + #if ("$!title" == "")
30 + #set ($title = $services.promacroexpand.getAutoTitle($wikimacro.content, $xwiki.currentContentSyntaxId))
51 51   #end
32 + #if ("$!title" == "")
33 + #set ($title = $services.localization.render("rendering.macro.expand.defaultexpandtitle"))
34 + #end
35 + #set ($escapedTitle = $services.rendering.escape($escapetool.xml($title), $xwiki.currentContentSyntaxId))
36 + #if ($xcontext.action == 'export')
37 + #exportMode($escapedTitle)
38 + #else
39 + ## To avoid an issue regarding {{wikimacroparameter}} and {{wikimacrocontent}} that fail to render when in
40 + ## edit mode while inside a HTML macro, we need to manually write the HTML by using XWiki syntax. This way,
41 + ## while the macro will always be expanded when in edit mode, the user will be able to modify the text inline.
42 + #set ($targetSyntaxId = $wikimacro.context.transformationContext.targetSyntax.type.id)
43 + #if ($targetSyntaxId == 'annotatedhtml' || $targetSyntaxId == 'annotatedxhtml' || $request.outputSyntax == 'annotatedhtml')
44 + (% class="confluence-expand-macro panel panel-default" %)
45 + (((
46 + (((
47 + (% class="panel-title" %)
48 + (((
49 + (% class="glyphicon glyphicon-menu-down" aria-hidden="true" %)
50 + ((()))
51 + {{wikimacroparameter name='title' /}}
52 + )))
53 + )))
54 + (% class="panel-body" %)
55 + (((
56 + {{wikimacrocontent /}}
57 + )))
58 + )))
59 + #else
60 + #set ($opened = $xcontext.action == 'edit'|| $wikimacro.parameters.expanded)
61 + {{html clean="false" wiki="true"}}
62 + <details class="confluence-expand-macro panel panel-default" #if ($opened)open#end>
63 + <summary>
64 + <span class="panel-title">
65 + <span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span>
66 + <span class="title-text">
67 + $escapedTitle
68 + </span>
69 + </span>
70 + </summary>
71 + <div class="panel-body">
72 +
73 + {{wikimacrocontent /}}
74 +
75 + </div>
76 + </details>
77 + {{/html}}
78 + #end
79 + #end
52 52  #end
53 53  {{/velocity}}
54 54