Modifications pour le document VelocityMacros
Modifié par Florent Charton le 2026/03/13 11:04
Depuis la version 3.1
modifié par Florent Charton
sur 2025/07/04 23:28
sur 2025/07/04 23:28
Commentaire de modification :
Install extension [org.xwiki.platform:xwiki-platform-ckeditor-ui/16.10.9]
À la version 5.1
modifié par Florent Charton
sur 2026/03/13 11:04
sur 2026/03/13 11:04
Commentaire de modification :
Install extension [org.xwiki.platform:xwiki-platform-ckeditor-ui/17.10.4]
Résumé
-
Propriétés de la Page (1 modifications, 0 ajouts, 0 suppressions)
Détails
- Propriétés de la Page
-
- Contenu
-
... ... @@ -23,9 +23,10 @@ 23 23 ## directly in the current page, e.g. when CKEditor is used in-line (no iframe). We still need to send back the 24 24 ## required style sheets and JavaScript files because some of them might not be available in the target page, e.g. 25 25 ## when a macro is inserted and it needs resource files not available on every page. 26 - #ckeditor_initRequiredSkinExtensions() 26 + #template('display_macros.vm') 27 + #initRequiredSkinExtensions() 27 27 #set ($output = "#ckeditor_getRenderedContent($source)$!html") 28 - #se t ($discard = $response.setHeader('X-XWIKI-HTML-HEAD', "#ckeditor_getRequiredSkinExtensions()"))29 + #sendRequiredSkinExtensions() 29 29 #else 30 30 ## Returns a full HTML page, including the HEAD tag with the style sheets and possibly the JavaScript includes. 31 31 ## This is needed when the edited content is loaded in an iframe, which is the case when CKEditor replaces a text ... ... @@ -34,11 +34,6 @@ 34 34 #end 35 35 #else 36 36 #set ($output = $services.wysiwyg.fromAnnotatedXHTML($text, $sourceSyntax.toIdString())) 37 - #if ("$!output" == '' && $output != '') 38 - ## $output is null, probably because $services.wysiwyg.fromAnnotatedXHTML() is not available (before 10.10RC1) 39 - #set ($xdom = $services.rendering.parse($text, 'xhtml/1.0')) 40 - #set ($output = $services.rendering.render($xdom, $sourceSyntax.toIdString())) 41 - #end 42 42 #end 43 43 #if ("$!output" != '' || $output == '') 44 44 $output## ... ... @@ -51,19 +51,6 @@ 51 51 #macro (ckeditor_renderContentSheet $source) 52 52 ## The $source variable is used inside the content sheet. 53 53 #set ($output = $services.wysiwyg.render('CKEditor.ContentSheet')) 54 - #if ("$!output" == '' && $output != '') 55 - ## $output is null, probably because $services.wysiwyg.render() is not available (before 7.4.1) 56 - #set ($output = $xwiki.getDocument('CKEditor.ContentSheet').getRenderedContent()) 57 - #set ($skinExtensionHooks = { 58 - 'ssx': 'CssSkinExtensionPlugin', 59 - 'ssfx': 'CssSkinFileExtensionPlugin', 60 - 'ssrx': 'CssResourceSkinExtensionPlugin' 61 - }) 62 - #foreach ($entry in $skinExtensionHooks.entrySet()) 63 - #set ($output = $output.replace("<!-- com.xpn.xwiki.plugin.skinx.$entry.value -->", 64 - $xwiki.get($entry.key).importString)) 65 - #end 66 - #end 67 67 ## Unescape {{ which happened in CKEditor.ContentSheet for protecting the {{html}} macro. 68 68 $!output.replace('&#123;&#123;', '{{')## 69 69 #end ... ... @@ -72,25 +72,11 @@ 72 72 ## Make sure the edited content is rendered for view because this is a WYSIWYG editor. 73 73 #set ($macro.previousDisplayMode = $xcontext.displayMode) 74 74 #set ($discard = $xcontext.setDisplayMode('view')) 75 - #if ($xcontext.displayMode != 'view') 76 - ## Before XWiki 14.0-rc-1, 13.4.7, 13.10.3 and 12.10.12 there's no API to get the current display mode so we can't 77 - ## restore the previous display mode properly. We assume the previous display mode is 'edit' because the WYSIWYG 78 - ## editor is used. 79 - #set ($macro.previousDisplayMode = 'edit') 80 - #end 81 81 #set ($restricted = "$!source.restricted" == 'true') 82 82 #if ($source.html) 83 83 #set ($html = $services.wysiwyg.parseAndRender($source.html, $source.syntax, $source.documentReference, $restricted)) 84 - #if ("$!html" == '' && $html != '') 85 - ## Before XWiki 11.9RC1 (see XWIKI-16737) 86 - #set ($html = $services.wysiwyg.parseAndRender($source.html, $source.syntax.toIdString())) 87 - #end 88 88 #else 89 89 #set ($html = $services.wysiwyg.toAnnotatedXHTML($source.content, $source.syntax, $source.documentReference, $restricted)) 90 - #if ("$!html" == '' && $html != '') 91 - ## Before XWiki 11.9RC1 (see XWIKI-16737) 92 - #set ($html = $services.wysiwyg.toAnnotatedXHTML($source.content, $source.syntax.toIdString())) 93 - #end 94 94 #end 95 95 #if ("$!html" == '') 96 96 ## Prevent Firefox from inserting bogus whitespace when the text area is empty. ... ... @@ -229,12 +229,11 @@ 229 229 </dl> 230 230 #end 231 231 201 +#** 202 + * Deprecated. Use #initRequiredSkinExtensions() from display_macros.vm instead. 203 +*# 232 232 #macro (ckeditor_initRequiredSkinExtensions) 233 233 #set ($requiredSkinExtensions = $collectiontool.orderedMap) 234 - #if ("$!requiredSkinExtensions" == '') 235 - ## For XWiki versions older than 12.1RC1 fallback on the old $collectionstool (available since 4.0M1). 236 - #set ($requiredSkinExtensions = $collectionstool.orderedMap) 237 - #end 238 238 ## Save the import string for each skin extension plugin in order to be able to remove the always used extensions 239 239 ## (they are aready available on the edit page so there's no need to load them). 240 240 #foreach ($pluginName in ['ssrx', 'ssfx', 'ssx', 'linkx', 'jsrx', 'jsfx', 'jsx']) ... ... @@ -242,6 +242,9 @@ 242 242 #end 243 243 #end 244 244 213 +#** 214 + * Deprecated. Use #getRequiredSkinExtensions() from display_macros.vm instead. 215 +*# 245 245 #macro (ckeditor_getRequiredSkinExtensions) 246 246 #foreach ($entry in $requiredSkinExtensions.entrySet()) 247 247 #set ($importString = $xwiki.get($entry.key).importString) ... ... @@ -249,20 +249,4 @@ 249 249 $!stringtool.removeStart($importString, $entry.value).trim()## 250 250 #end 251 251 #end 252 - 253 -#macro (ckeditor_defineSortTool $sortToolVariable) 254 - #set ($checkedExtension = "org.xwiki.commons:xwiki-commons-velocity") 255 - ## Because of an API collision, $collectionstool has been replaced by $collectiontool in XCOMMONS-1861 256 - #if ($services.extension.core.getCoreExtension($checkedExtension).id.version.compareTo("12.1-SNAPSHOT") >= 0) 257 - #setVariable ($sortToolVariable, $collectiontool) 258 - ## With the upgrade of Velocity $sorttool has been replaced by $collectionstool (XCOMMONS-1296) 259 - #elseif ($services.extension.core.getCoreExtension($checkedExtension).id.version.compareTo("12.0-SNAPSHOT") >= 0) 260 - #setVariable ($sortToolVariable, $collectionstool) 261 - ## Old API for sorting was $sorttool 262 - #else 263 - #setVariable ($sortToolVariable, $sorttool) 264 - #end 265 -#end 266 - 267 -#ckeditor_defineSortTool("$resolvedSortTool") 268 268 {{/velocity}}