Start page / Plug-In Development / ContentCreator Extensions / Management Extensions / Loading Client Resources
Loading Client Resources
ContentCreator offers two means of loading client resources such as JavaScript and CSS files so that these resources become available in the ContentCreator preview pane. This allows project and module developers to connect editorial interactive features in the preview with interactive features in the ContentCreator user interface, e.g. by loading a JavaScript controller which synchronizes Multi Perspective Preview (→Documentation FirstSpirit SiteArchitect) settings between the preview and the MPP toolbar without the need to include JavaScript for this purpose in the Media store or in FirstSpirit templates.
- Client resource plug-ins
This plug-in kind may be used to register resources as a ContentCreator client session is instantiated. - Client resource operation
This operation, available through the OperationAgent, may be used by interactive plug-ins to load client resources on an ad-hoc, one-time basis.
The URLs which reference resource files are relative to the root directory of the project-specific ContentCreator directory, such as [SERVER_ROOT]/web/fs5webedit_[PROJECT_ID]. |
The order in which resources are loaded is not guaranteed. Registering resources in any particular order will not necessarily cause these resources to be loaded in that order. |
Client Resource Plug-Ins
Interface: de.espirit.firstspirit.webedit.plugin.ClientResourcePlugin
Developer API documentation: ClientResourcePlugin
Analogous to permanent plug-ins, a client resource plug-in is instantiated as a ContentCreator client session is created. This provides project developers with an opportunity to register URLs of JavaScript and CSS files. These files will be loaded once the ContentCreator user interface (including the preview pane) is ready and before the initial preview page is loaded inside the preview pane. The client resources loaded will be available for use by the HTML documents displayed in the preview.
Client Resource Operation
Interface: de.espirit.firstspirit.webedit.server.ClientResourceOperation
Developer API documentation: ClientResourceOperation
This operation may be obtained using the OperationAgent in various contexts and enables module developers to load client resource files just-in-time as needed by a module component. It allows specification of URLs of JavaScript and CSS files which will be loaded upon a call of the method perform(boolean), where the boolean parameter specifies if the method should wait for all client resources to be loaded or to return immediately without waiting.