Änderungen von Dokument Expand

Zuletzt geändert von Thorsten Seifert am 2026/03/05 08:39

Von Version 11.1
bearbeitet von Thorsten Seifert
am 2026/03/05 08:39
Änderungskommentar: Install extension [com.xwiki.pro:xwiki-pro-macros-ui/1.30.1]
Auf Version 3.1
bearbeitet von xwikiadmin
am 2024/06/24 14:35
Änderungskommentar: Install extension [com.xwiki.pro:xwiki-pro-macros-ui/1.19.4]

Zusammenfassung

Details

Seiteneigenschaften
Dokument-Autor
... ... @@ -1,1 +1,1 @@
1 -XWiki.seifertt
1 +XWiki.xwikiadmin
Inhalt
... ... @@ -3,13 +3,11 @@
3 3  = Parameters =
4 4  
5 5  |=Parameter|=Description|=Required|=Default
6 -|**title**|Text displayed on the collaspse toggle|No|(empty)
7 -|**expanded**|If selected the expand will be opened automatically when loading the page.|No|False
6 +|**title**|Text displayed on the collaspse toggle|No|Click here to expand...
8 8  
9 -Note: if no title is provided, the title of the first panel or the first header appearing in the content will be used. if there is no such header or panel title, "Click here to expand…" will be used.
10 10  
11 11  = Example Usage =
12 12  
13 -{{expand expanded="false"}}
14 -Hello
11 +{{expand}}
12 +Hello 👀
15 15  {{/expand}}
XWiki.JavaScriptExtension[0]
Pufferstrategie
... ... @@ -1,1 +1,0 @@
1 -long
Code
... ... @@ -1,29 +1,0 @@
1 -// The current versions of Safari don't bundle the latest version of WebKit, and because of this it lacks
2 -// a feature from the HTML standard where the details tag automatically expands when the URL fragment
3 -// targets an element inside it. Here is the WebKit bug report: https://bugs.webkit.org/show_bug.cgi?id=228843,
4 -// and we should follow it so we know when the fix reaches Safari. I also opened
5 -// https://github.com/xwikisas/xwiki-pro-macros/issues/682 on our side to keep track of the issue and avoid forgetting it.
6 -require(['jquery'], function ($) {
7 - var isSafari = navigator.vendor && navigator.vendor.includes('Apple');
8 -
9 - function handleFragment() {
10 - let hash = window.location.hash;
11 - if (!hash) return;
12 -
13 - let target = $(hash);
14 - if (target.length === 0) return;
15 -
16 - target.parents("details").each(function () {
17 - this.open = true;
18 - });
19 -
20 - target[0].scrollIntoView({ behavior: "auto", block: "start" });
21 - }
22 - if (isSafari) {
23 - console.log("Applying Safari fragment workaround");
24 - // On initial load
25 - $(document).ready(handleFragment);
26 - // On fragment updates
27 - $(window).on("hashchange", handleFragment);
28 - }
29 -});
Inhalt parsen
... ... @@ -1,1 +1,0 @@
1 -Nein
Benutze diese Erweiterung
... ... @@ -1,1 +1,0 @@
1 -currentPage
XWiki.StyleSheetExtension[0]
Code
... ... @@ -8,9 +8,8 @@
8 8   transform: rotate(90deg);
9 9  }
10 10  
11 -.confluence-expand-macro .panel-title{
11 +.confluence-expand-macro .panel-title {
12 12   padding: @panel-heading-padding;
13 - display: flex;
14 14  }
15 15  
16 16  .confluence-expand-macro .panel-body {
... ... @@ -23,10 +23,6 @@
23 23  
24 24  .confluence-expand-macro summary:hover {
25 25   cursor: pointer;
26 -}
27 -
28 -.panel-title:hover .title-text {
29 - cursor: pointer;
30 30   text-decoration: underline;
31 31  }
32 32  
... ... @@ -35,11 +35,6 @@
35 35   border: none;
36 36  }
37 37  
38 -.confluence-expand-macro.panel.panel-default .panel-body ul {
39 - list-style-type: revert;
40 - padding-left: revert;
41 -}
42 -
43 43  .confluence-expand-macro.panel {
44 44   background: unset;
45 45  }
XWiki.WikiMacroClass[0]
Makro-Code
... ... @@ -1,84 +1,23 @@
1 1  {{velocity output="false"}}
2 -#macro (exportMode $escapedTitle)
3 - ## Use a different structure when exporting to make sure that the pagedjs can properly parse the content.
4 -
2 +#macro (executeMacro)
3 + $xwiki.ssx.use('Confluence.Macros.Expand')
4 + #set ($opened = $xcontext.action == 'edit' || $request.getParameter('format') == "html-print")
5 5   {{html clean="false" wiki="true"}}
6 - <div class = "panel panel-default confluence-expand-macro">
7 - <div class>
8 - <span class="panel-title">
9 - <span class="glyphicon glyphicon-menu-down" aria-hidden="true"></span>
10 - <span class="title-text">
11 - $escapedTitle
12 - </span>
13 - </span>
14 - </div>
6 + <details class="confluence-expand-macro panel panel-default" #if ($opened)open#end>
7 + <summary>
8 + <div class="panel-title">
9 + <span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span>
10 + $services.rendering.escape($escapetool.xml("${wikimacro.parameters.title}"), 'xwiki/2.1')
11 + </div>
12 + </summary>
15 15   <div class="panel-body">
16 16  
17 17   {{wikimacrocontent /}}
18 18  
19 19   </div>
20 - </div>
18 + </details>
21 21   {{/html}}
22 -
23 23  #end
24 -
25 -#macro (executeMacro)
26 -
27 - #set ($discard = $xwiki.ssx.use('Confluence.Macros.Expand'))
28 - #set ($discard = $xwiki.jsx.use('Confluence.Macros.Expand'))
29 - #set ($title = $wikimacro.parameters.title)
30 - #if ("$!title" == "")
31 - #set ($title = $services.promacroexpand.getAutoTitle($wikimacro.content, $xwiki.currentContentSyntaxId))
32 - #end
33 - #if ("$!title" == "")
34 - #set ($title = $services.localization.render("rendering.macro.expand.defaultexpandtitle"))
35 - #end
36 - #set ($escapedTitle = $services.rendering.escape($escapetool.xml($title), $xwiki.currentContentSyntaxId))
37 - #if ($xcontext.action == 'export')
38 - #exportMode($escapedTitle)
39 - #else
40 - ## To avoid an issue regarding {{wikimacroparameter}} and {{wikimacrocontent}} that fail to render when in
41 - ## edit mode while inside a HTML macro, we need to manually write the HTML by using XWiki syntax. This way,
42 - ## while the macro will always be expanded when in edit mode, the user will be able to modify the text inline.
43 - #set ($targetSyntaxId = $wikimacro.context.transformationContext.targetSyntax.type.id)
44 - #if ($targetSyntaxId == 'annotatedhtml' || $targetSyntaxId == 'annotatedxhtml' || $request.outputSyntax == 'annotatedhtml')
45 - (% class="confluence-expand-macro panel panel-default" %)
46 - (((
47 - (((
48 - (% class="panel-title" %)
49 - (((
50 - (% class="glyphicon glyphicon-menu-down" aria-hidden="true" %)
51 - ((()))
52 - {{wikimacroparameter name='title' /}}
53 - )))
54 - )))
55 - (% class="panel-body" %)
56 - (((
57 - {{wikimacrocontent /}}
58 - )))
59 - )))
60 - #else
61 - #set ($opened = $xcontext.action == 'edit'|| $wikimacro.parameters.expanded)
62 - {{html clean="false" wiki="true"}}
63 - <details class="confluence-expand-macro panel panel-default" #if ($opened)open#end>
64 - <summary>
65 - <span class="panel-title">
66 - <span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span>
67 - <span class="title-text">
68 - $escapedTitle
69 - </span>
70 - </span>
71 - </summary>
72 - <div class="panel-body">
73 -
74 - {{wikimacrocontent /}}
75 -
76 - </div>
77 - </details>
78 - {{/html}}
79 - #end
80 - #end
81 -#end
82 82  {{/velocity}}
83 83  
84 84  {{velocity}}
Verfügbarkeit von Makroinhalten
... ... @@ -1,1 +1,1 @@
1 -Mandatory
1 +Optional
Makrobeschreibung
... ... @@ -1,0 +1,5 @@
1 +Add the Expand macro to your page to provide content in an expandable / collapsible section.
2 +
3 +This is one of Confluence's most popular macros. It's great for: visually reducing the amount of information on a page, breaking process information down into clickable steps, hiding background or obsolete information, while still keeping it on the page for future reference.
4 +
5 +The macro is collapsed by default, people need to click each one to expand it. There's no way to expand all macros on a page at once, however all Expand macros are automatically expanded when you print or export the page to PDF.
XWiki.WikiMacroParameterClass[0]
Parameter-Beschreibung
... ... @@ -1,0 +1,1 @@
1 +Defines the text that appears next to the expand/collapse icon.
XWiki.WikiMacroParameterClass[1]
Parameter-Vorgabe
... ... @@ -1,1 +1,0 @@
1 -0
Parameter-Name
... ... @@ -1,1 +1,0 @@
1 -expanded
Parameter-Typ
... ... @@ -1,1 +1,0 @@
1 -java.lang.Boolean
Parameter verpflichtend
... ... @@ -1,1 +1,0 @@
1 -Nein