Changes for page Writing XWiki Rendering Macros in wiki pages
Last modified by Simon Urli on 2023/10/10
Change comment:
Rollback to version 81.3
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -99,18 +99,12 @@ 99 99 100 100 1.1.1 Special code for WYSIWYG edit mode 101 101 102 -Even in edit mode, the WYSIWYG editor will execute the macro and feed the result back into the document. If your macro use some JSX, these willnot beloaded. But, if your macro produceomeJavascript that use thoseJSX ormanipulate the document's DOM (injecting new elements, moving existing elements, removing elements, etc.), you may want to protect the content in WYSIWYG edit mode in order to prevent the performed transformation to get saved. Here is how you can prevent this behavior:102 +Even in edit mode, the WYSIWYG editor will execute the macro and feed the result back into the document. If your macro includes a JavaScript extension that manipulate the document's DOM (injecting new elements, moving existing elements, removing elements, etc.), you may want to protect the content in WYSIWYG edit mode in order to prevent the performed transformation to get saved. Here is how you can prevent this behavior: 103 103 104 104 {code} 105 -{{velocity}} 105 +{{velocity output="no"}} 106 106 #if("$xcontext.action" != "edit") 107 -{{html}} 108 - <script type=${dq}text/javascript${dq}> 109 -//<![CDATA[ 110 -... some javascript ... 111 -// ]]> 112 -</script> 113 -{{/html}} 107 + #set($ok = $xwiki.jsx.use("My.Extension")) 114 114 #end 115 115 ## 116 116 ## Rest of the code. ... ... @@ -117,6 +117,8 @@ 117 117 {{velocity}} 118 118 {code} 119 119 114 +Check for example the [Lightbox Macro code>extensions:Extension.Lightbox Macro]. 115 + 120 120 1.1 Scripting Tips 121 121 122 122 Following are few useful hints if you plan to do advanced scripting inside your wiki macros: ... ... @@ -197,3 +197,4 @@ 197 197 #set($greetUser="$!xcontext.macro.params.greetUser") 198 198 {code} 199 199 196 +