Änderungen von Dokument Expand
Zuletzt geändert von xwikiadmin am 2025/12/11 07:27
Von Version 8.1
bearbeitet von xwikiadmin
am 2025/12/11 07:27
am 2025/12/11 07:27
Änderungskommentar:
Install extension [com.xwiki.pro:xwiki-pro-macros-ui/1.28.5]
Auf Version 2.1
bearbeitet von xwikiadmin
am 2023/10/26 09:24
am 2023/10/26 09:24
Änderungskommentar:
Migrated property [type] from class [XWiki.WikiMacroParameterClass]
Zusammenfassung
-
Seiteneigenschaften (2 geändert, 0 hinzugefügt, 0 gelöscht)
-
Objekte (3 geändert, 0 hinzugefügt, 1 gelöscht)
Details
- Seiteneigenschaften
-
- Übergeordnete Seite
-
... ... @@ -1,1 +1,1 @@ 1 - WebHome1 +Confluence.Macros - 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.StyleSheetExtension[0]
-
- Code
-
... ... @@ -1,45 +1,38 @@ 1 -.confluence-expand-macro .glyphicon { 2 - margin-right: 0.5rem; 3 - transform: rotate(0deg); 4 - transition: transform 0.3s; 5 -} 1 +.confluence-expand-macro { 6 6 7 -.confluence-expand-macro[open] > summary .glyphicon { 8 - transform: rotate(90deg); 9 -} 3 + .panel-heading { 4 + padding: 0; 5 + .panel-title { 6 + font-size: 1em; 10 10 11 -.confluence-expand-macro .panel-title{ 12 - padding: @panel-heading-padding; 13 - display: flex; 14 -} 8 + a { 9 + display: block; 10 + padding: @panel-heading-padding; 15 15 16 - .confluence-expand-macro.panel-body{17 - transition: linear 0.3s;18 -} 12 + p { 13 + display: inline; 14 + } 19 19 20 -.confluence-expand-macro summary { 21 - font-size: 1em; 22 -} 16 + .glyphicon { 17 + margin-right: 0.5rem; 18 + transform: rotate(0deg); 19 + transition: transform 0.1s; 20 + } 21 + &[aria-expanded="true"] .glyphicon { 22 + transform: rotate(90deg); 23 + } 24 + } 25 + } 26 + } 23 23 24 -.confluence-expand-macro summary:hover { 25 - cursor: pointer; 26 -} 28 + .panel-collapse { 29 + .panel-body { 30 + display: block; 31 + &::before { content: none; } 32 + &::after { content: none; } 27 27 28 -.panel-title:hover .title-text { 29 - cursor: pointer; 30 - text-decoration: underline; 34 + & > *:first-child { margin-top: 0; } 35 + & > *:last-child { margin-bottom: 0; } 36 + } 37 + } 31 31 } 32 - 33 -.confluence-expand-macro.panel > .panel-body, .confluence-expand-macro > summary { 34 - background: unset; 35 - border: none; 36 -} 37 - 38 -.confluence-expand-macro.panel.panel-default .panel-body ul { 39 - list-style-type: revert; 40 - padding-left: revert; 41 -} 42 - 43 -.confluence-expand-macro.panel { 44 - background: unset; 45 -}
- XWiki.WikiMacroClass[0]
-
- Makro-Code
-
... ... @@ -1,92 +1,53 @@ 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. 2 +#macro (executeMacro) 3 + $xwiki.ssx.use('Confluence.Macros.Expand') 4 + #if (!$expandMacroColllapseId) 5 + #set ($expandMacroColllapseId = 0) 6 + #else 7 + #set ($expandMacroColllapseId = $expandMacroColllapseId + 1) 8 + #end 9 + #set ($opened = $xcontext.action == 'edit') 10 + #set ($accordionId = "accordion-$escapetool.xml($expandMacroColllapseId)") 11 + #set ($toggleId = "toggle-$expandMacroColllapseId") 12 + #set ($expandId = "collapse-$expandMacroColllapseId") 4 4 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> 15 + <div class="panel-group confluence-expand-macro" id="${accordionId}" role="tablist"> 16 + <div class="panel panel-default"> 17 + <div class="panel-heading" role="tab" id="${toggleId}"> 18 + <h4 class="panel-title"> 19 + <a 20 + role="button" 21 + data-toggle="collapse" 22 + data-parent="#${accordionId}" 23 + href="#${expandId}" 24 + #if($opened)aria-expanded="true"#end 25 + aria-controls="${expandId}" 26 + ><span class="glyphicon glyphicon-menu-right" aria-hidden="true"></span>{{wikimacroparameter name="title" /}}</a> 27 + </h4> 28 + </div> 29 + <div id="${expandId}" class="panel-collapse collapse #if($opened)in#end" role="tabpanel" aria-labelledby="${toggleId}"> 30 + <div class="panel-body"> 31 + {{wikimacrocontent /}} 32 + </div> 33 + </div> 14 14 </div> 15 - <div class="panel-body"> 16 - 17 - {{wikimacrocontent /}} 18 - 19 - </div> 20 - </div> 35 + </div> 21 21 {{/html}} 22 - 23 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)) 31 - #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 80 -#end 81 81 {{/velocity}} 82 82 40 +{{include reference="Licenses.Code.VelocityMacros"/}} 41 + 83 83 {{velocity}} 84 84 ## We need to check if there is a valid license because the macro is registered even if the user doesn't have view right 85 85 ## on the macro definition page. See XWIKI-14828: Rendering macros defined in wiki pages are available to users that 86 86 ## don't have view right on those pages. 87 -#if ($services. promacrolicensing.hasLicensureForEntity($xcontext.macro.doc.documentReference))46 +#if ($services.licensing.licensor.hasLicensureForEntity($xcontext.macro.doc.documentReference)) 88 88 #executeMacro 89 89 #else 90 - {{missingLicenseMessage extensionName="proMacros.extension.name"/}} 49 + {{error}} 50 + #getMissingLicenseMessage('proMacros.extension.name') 51 + {{/error}} 91 91 #end 92 92 {{/velocity}} - Verfügbarkeit von Makroinhalten
-
... ... @@ -1,1 +1,1 @@ 1 - Mandatory1 +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