If the custom editor that you need to add to your editor registry has the same name as an existing editor in your application, you can create a unique namespace for your custom editor. This lets you override an existing editor in the Experience Manager installation with a custom editor.
You do not need to edit every occurrence of the existing editor in cartridge templates to refer to the custom editor. Once the existing Experience Manager editor is overridden with a custom editor, all the mappings that exist in cartridge templates work as if the custom editor has been mapped in place of an editor in the Experience Manager installation.
Follow these steps to override an existing editor.
Run the following command to export the editor registry of your deployed application:
runcommand.bat|sh IFCR exportContent editors <directory>
, where<directory>
indicates the directory on the file system to which the editors registry should be exported.For example:
runcommand.bat IFCR exportContent editors D:\backup\editors
If you have not done so already, create a namespace folder for your custom editors that have the same names as existing editors in your registry.
For example,
\editors\custom
In the namespace folder, create a folder for your custom editor. Remember the folder must have the custom editor's name.
For example if you want to override StringEditor in Experience Manager (
editors\StringEditor)
with a custom StringEditor then create a folder namededitors\custom\StringEditor
Add a JSON file,
_.JSON
with your editor's configuration to the folder. Theecr:type
must be editor;config
is optional.For example:
{ "ecr:type":"editor", }
Add the
editor.js
andeditor.html
files for your editor to the custom editor folder.Copy the
editor.js
,editor.html
, and_.json
files from the custom editor foldereditors/<namespace>/<custom editor>
and paste them into the existing editor foldereditors/<editor>
.For example, copy the
editor.js
,editor.html
, and_.json
files from the<app dir>/config/import/editors/custom/StringEditor
folder to the<app dir >/config/import/editors/StringEditor
folder.Run the following command to import the updated editor registry of your deployed application:
runcommand.bat|sh IFCR importContent editors <directory>
, where<directory>
indicates the directory on the file system from which editors registry should be imported.For example:
runcommand.bat IFCR importContent editors D:\backup\editors
Clear the browser cache and restart Experience Manager. The system begins using the custom editor in place of the existing editor.
For example, the system starts picking custom StringEditor in place of the existing StringEditor.