Changes for page Icon Picker Macro

Last modified by Sebastian Marsching on 2023/08/13 16:14

From version 6.1
edited by Sebastian Marsching
on 2023/03/23 13:35
Change comment: Install extension [org.xwiki.platform:xwiki-platform-icon-ui/14.10.6]
To version 3.1
edited by Sebastian Marsching
on 2022/08/02 11:45
Change comment: Migrated property [defaultCategories] from class [XWiki.WikiMacroClass]

Summary

Details

XWiki.WikiMacroClass[0]
Cached
... ... @@ -1,1 +1,0 @@
1 -No
Asynchronous rendering
... ... @@ -1,1 +1,0 @@
1 -No
Macro code
... ... @@ -1,10 +1,10 @@
1 1  {{velocity output="false"}}
2 2   $xwiki.ssx.use('IconThemesCode.IconPicker')
3 - ## The icons themes may need some SSX, so we ask to load the resources of all icon sets to be able to display them
4 - ## in the picker.
3 + ## The icons themes may need some SSX, so we ask for a rendering of an icon of each icon theme, to be able to display
4 + ## all icon themes in the picker
5 5   ## ToDo: since it is a bit hacky, a better system would be to dynamically load the needed SSX on demand
6 6   #foreach($iconSetName in $services.icon.iconSetNames)
7 - $services.icon.use($iconSetName)
7 + $services.icon.render('wiki', $iconSetName)
8 8   #end
9 9  {{/velocity}}
10 10  
... ... @@ -19,13 +19,13 @@
19 19   require(['jquery', 'xwiki-icon-picker'], function($) {
20 20   var options = {};
21 21   #if($xcontext.macro.params.parameterNames.contains('prefix'))
22 - options['prefix'] = $jsontool.serialize($xcontext.macro.params.prefix);
22 + options['prefix'] = '$escapetool.javascript($xcontext.macro.params.prefix)';
23 23   #end
24 24   #if("$!xcontext.macro.params.id" != '')
25 - $($jsontool.serialize("#$escapetool.css($xcontext.macro.params.id)")).xwikiIconPicker(options);
25 + $('#${escapetool.javascript(${xcontext.macro.params.id})}').xwikiIconPicker(options);
26 26   #end
27 27   #if("$!xcontext.macro.params.get('class')" != '')
28 - $($jsontool.serialize(".$escapetool.css($xcontext.macro.params.get('class'))")).xwikiIconPicker(options);
28 + $('.${escapetool.javascript(${xcontext.macro.params.get('class')})}').xwikiIconPicker(options);
29 29   #end
30 30   });
31 31  </script>
Default categories
... ... @@ -1,1 +1,0 @@
1 -Development
Default category
... ... @@ -1,0 +1,1 @@
1 +Development