Wiki-Quellcode von ContentSheet

Zuletzt geändert von admin am 2025/02/23 19:33

Zeige letzte Bearbeiter
1 {{include reference="CKEditor.VelocityMacros" /}}
2
3 {{velocity output="false"}}
4 #**
5 * Includes the specified template without empty or blank lines. This is useful when the empty/blank lines have no value
6 * for the WYSIWYG editor as it reduces the size of the edited content and thus speeds up the editing.
7 *#
8 #macro (ckeditor_templateWithoutEmptyLines $templateName)
9 #set ($macro.templateOutput = "#template($templateName)")
10 $macro.templateOutput.replaceAll('(?m)^\s*\n', '')##
11 #end
12 {{/velocity}}
13
14 {{velocity}}
15 #if ($doc.fullName == 'CKEditor.ContentSheet')
16 This is the sheet used to obtain the content that is passed to the [[CKEditor>>http://ckeditor.com/]].
17 #else
18 {{html clean="false"}}
19 #if ($services.wysiwyg.HTMLSyntax.version.startsWith("5"))
20 <!DOCTYPE html>
21 #else
22 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
23 #end
24 <html xmlns="http://www.w3.org/1999/xhtml" lang="$xcontext.locale.toLanguageTag()" xml:lang="$xcontext.locale.toLanguageTag()">
25 <head>
26 <meta http-equiv="Content-Type" content="text/html; charset=$xwiki.encoding" />
27 ## Add HTML tags inside the page's head element, provided by UI Extensions implementing the
28 ## "org.xwiki.platform.html.head" Extension Point. This extension point is also used in XWiki.XWikiPreferences
29 #foreach($uix in $services.uix.getExtensions('org.xwiki.platform.html.head', {'sortByParameter' : 'order'}))
30 $services.rendering.render($uix.execute(), 'xhtml/1.0')
31 #end
32 ## Hook for inserting Link extensions. This will be replaced with the pulled link references.
33 <!-- com.xpn.xwiki.plugin.skinx.LinkExtensionPlugin -->
34 ## Fix some issues caused by the fact that we put the content directly under the BODY element.
35 #set ($discard = $xwiki.ssx.use('CKEditor.ContentSheet'))
36 ## Include the stylesheets that affect the content in view mode.
37 #ckeditor_templateWithoutEmptyLines("stylesheets.vm")
38 #if ($xwiki.getDocument('CKEditor.Config').getValue('loadJavaScriptSkinExtensions') == 1)
39 #ckeditor_templateWithoutEmptyLines("javascript.vm")
40 #end
41 </head>
42 #if (!$source)
43 #set ($source = $tdoc)
44 #end
45 #set ($serializedSpaceReference = $services.model.serialize($source.documentReference.parent, 'local'))
46 <body id="body" class="skin-flamingo viewbody main wiki-$xcontext.database
47 space-$escapetool.xml($serializedSpaceReference.replaceAll(' ', '_'))">##
48 #ckeditor_getRenderedContent($source)
49 ## Escape {{ in the rendered content to be sure that the HTML macro is not closed unintentionally.
50 ## The result must be unescaped before being passed to the CKEditor as input.
51 ## CKEDITOR-134: Unclosed {{html}} results in addition of closing tag even when macro isn't actually evaluated
52 $!html.replace('{{', '&amp;#123;&amp;#123;')##
53 </body>
54 </html>
55 {{/html}}
56 #end
57 {{/velocity}}