Changing htmlprocessor in experience manager document editor

Hello bloomreach community and Jasper,

We’ve created a custom rich text CKEditor plugin and a new custom htmlprocessor that goes along with it.
The plugin saves some data in a non-standard attribute (e.g. extraData) of a link tag, so we created an htmlprocessor to prevent it from being filtered and applied it to the compound containing the rich-text editor.

This plugin works perfectly when using the content document editor and saves the new attribute extraData correctly, but when we try to use the plugin in the experience manager document editor (right side panel), the new attribute get filtered after saving.

So I wonder if there are different configurations for the document editor in the experience manager.
For e.g. something needs to be added to the hipposysedit:prototypes as well.

This is what we use in the template of the compound:

      /editor:templates:
        jcr:primaryType: editor:templateset
        /_default_:
          jcr:primaryType: frontend:plugincluster
          frontend:properties: [ mode ]
          frontend:references: [ wicket.model, model.compareTo, engine, validator.id ]
          frontend:services: [ wicket.id, validator.id ]
          htmlprocessor.id: richtext-custom
          /root:
            jcr:primaryType: frontend:plugin
            item: ${cluster.id}.field
            plugin.class: org.hippoecm.frontend.service.render.ListViewPlugin
          /text:
            jcr:primaryType: frontend:plugin
            caption: Text
            field: text
            plugin.class: org.hippoecm.frontend.editor.plugins.field.NodeFieldPlugin
            wicket.id: ${cluster.id}.field
            /cluster.options:
              jcr:primaryType: frontend:pluginconfig
              ckeditor.config.overlayed.json: '{
                "toolbar": [
                  { "name": "lists",
                    "items": [ "NumberedList", "BulletedList" ] },
                  { "name": "clipboard",
                    "items": [ "Undo", "Redo" ] },
                  { "name": "customlink",
                    "items": [ "LinkCustomLink", "UnlinkCustomLink" ] }
                  ],
                  "enterMode": 2,
                  "autoParagraph": false,
                  "extraPlugins": "wordcount,customlink",
                  "removePlugins": "autolink,link",
                  "wordcount": { "showCharCount": true, "countSpacesAsChars": true }
                }'

(We remove autolink and link because our new plugin also catches the on double click event on links, so they conflict.)

Could you try setting the htmlprocessor.id at:

/hippo:namespaces/hippostd/html/editor:templates/_default_

Lovely, that fixes it. Thanks Jasper!
Just to be sure, by applying this under /hippo:namespaces/hippostd/html/editor:templates/default, it means that all richtext editors that don’t override the htmlprocessor.id will now use this htmlprocessor, correct?
If so, it also means that we won’t need to configure the htmlprocessor inside the compound, correct?
Thanks in advance for the reply! Best wishes.

Yes, this will effect all richtext editors. I was thinking that maybe this is not what you wanted, but if this is acceptable then we can leave it at this.

After further testing, I think I found the solution I was looking for.

By adding htmlprocessor.id: richtext-custom into /editor:templates/default of the compound, it applied the htmlprocessor to the content document editor (which is what we already did).

But by adding htmlprocessor.id: richtext-custom into /editor:templates/default/text (so into the rich text field), it applied the htmlprocessor to the experience manager document editor.

So by adding htmlprocessor.id: richtext-custom into both the compound and field template default, the htmlprocessor is applied in both places.
Thank you anyways for the help and insight, happy Easter!

1 Like