Hi devs,
ATM if you want to use a RequireJS module you have to know its path. Some known RequireJS modules are defined globally in javascript.vm
and thus can be used without knowing their path (e.g. jquery
, bootstrap
). The idea is to make the list of globally known RequireJS modules extensible, i.e. to allow extensions to “publish” RequireJS modules that others can use.
I need this for the in-place edit: I know the id of the configured WYSIWYG editor (e.g. ckeditor
) and I want to load the corresponding RequireJS module without knowing its path or the extension that provides it. In other words I want to load CKEditor (the configured WYSIWYG editor) without depending on CKEditor.
For this I propose to add an UI extension point in javascript.vm
without content, supporting these parameters:
- id : the RequireJS module id
- path : maps to require.config.paths
- bundles : maps to require.config.bundles
- deps : maps to require.config.shim.deps
- exports : maps to require.config.shim.deps
- config : maps to require.config.config
As for the extension point id, I’m currently using
org.xwiki.platform.requirejs.module
but I know some of you will argue that it doesn’t follow the naming convention. javascript.vm
is currently in xwiki-platform-flamingo-skin-resources
but I don’t think the extension point should depend on the skin, I’m -1 to that. This extension point should be generic. It just happens that Flamingo skin customizes this Velocity template. Any other skin should provide this extension point.
Alternative:
org.xwiki.platform.web.requireJSModule
but I prefer the first. WDYT?
Thanks,
Marius