Studio Developer Manual / Version 2301
Table Of Contents
As mentioned in the above list, property fields have to be registered in a global editorialCommentPropertyRegistryService
.
The Service lets you register PropertyRegistryModel
s based on any combination of a property name, a component's xtype or the CapType of a content in a document form.
Please note, that Editorial Comments have been enabled per default for a variety of property field, such as text areas, text fields and link lists. The xtypes
of these components are already registered in the editorialCommentPropertyRegistryService
.
Just like the registration of property fields, the registry service can also exclude property fields from the Editorial Comments feature. See the example below to understand how registration and exclusion is done:
import Config from "@jangaroo/runtime/Config"; import session from "@coremedia/studio-client.cap-rest-client/common/session"; import CapType from "@coremedia/studio-client.cap-rest-client/common/CapType"; import StudioPlugin from "@coremedia/studio-client.main.editor-components/configuration/StudioPlugin"; import IEditorContext from "@coremedia/studio-client.main.editor-components/sdk/IEditorContext"; import editorialCommentPropertyRegistryService from "@coremedia/studio-client.main.feedback-hub-editor-components/components/comments/service/propertyregistry/editorialCommentPropertyRegistryService"; import PropertyRegistryModel from "@coremedia/studio-client.main.feedback-hub-editor-components/components/comments/service/propertyregistry/PropertyRegistryModel"; import CoreMediaRichTextArea from "@coremedia/studio-client.main.ckeditor4-components/CoreMediaRichTextArea"; class EditorialCommentsStudioPluginBase extends StudioPlugin { constructor(config: Config<StudioPlugin> = null) { super(config); } override init(editorContext: IEditorContext): void { super.init(editorContext); // enable comments for title property in article document forms editorialCommentPropertyRegistryService.register( new PropertyRegistryModel(null, "title", this.#getCapType("CMArticle")) ); // enable comments for all richtext areas editorialCommentPropertyRegistryService.register( new PropertyRegistryModel(CoreMediaRichTextArea.xtype, null, null) ); // disable comments for detailText richtext property in pages editorialCommentPropertyRegistryService.exclude( new PropertyRegistryModel(null, "detailText", this.#getCapType("CMChannel")) ); } #getCapType(contentName: String): CapType { return session._.getConnection().getContentRepository() .getContentType(contentName); } } export default EditorialCommentsStudioPluginBase;
As you can see, the propertyName
must be passed without its "properties."
prefix. You can use the editorialCommentPropertyRegistryService
in your own Studio plugins to customize the default configuration.
Warning
Please note, that the order of registrations and exclusions is important, since excluded property fields might be registered again by a following registration.