Änderungen von Dokument Expand

Zuletzt geändert von Daniel Herrmann am 2026/02/04 20:25

Von Version Icon 3.1 Icon
bearbeitet von Daniel Herrmann
am 2025/06/23 20:08
Änderungskommentar: Install extension [com.xwiki.pro:xwiki-pro-macros-ui/1.26.20]
Auf Version Icon 8.1
bearbeitet von Daniel Herrmann
am 2026/02/04 20:25
Änderungskommentar: Install extension [com.xwiki.pro:xwiki-pro-macros-ui/1.29.1]

Zusammenfassung

Details

Icon XWiki.WikiMacroClass[0]
Makro-Code
... ... @@ -1,54 +1,83 @@
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 ($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))
51 51   #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
52 52  #end
53 53  {{/velocity}}
54 54  
... ... @@ -56,7 +56,7 @@
56 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 57  ## on the macro definition page. See XWIKI-14828: Rendering macros defined in wiki pages are available to users that
58 58  ## don't have view right on those pages.
59 -#if ($services.licensing.licensor.hasLicensureForEntity($xcontext.macro.doc.documentReference))
88 +#if ($services.promacrolicensing.hasLicensureForEntity($xcontext.macro.doc.documentReference))
60 60   #executeMacro
61 61  #else
62 62   {{missingLicenseMessage extensionName="proMacros.extension.name"/}}
Icon XWiki.JavaScriptExtension[0]
Pufferstrategie
... ... @@ -1,0 +1,1 @@
1 +long
Code
... ... @@ -1,0 +1,29 @@
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,0 +1,1 @@
1 +Nein
Benutze diese Erweiterung
... ... @@ -1,0 +1,1 @@
1 +currentPage