Content-Link Feature
CoreMedia CMS manages its resources in so-called Contents, where each Content may either be a Document or a Folder.
The Content-Link Feature adds transparent support to
CKEditor’s Link Feature by especially extending
LinkFormView
to be able to hold references to Contents.
Integration
Top | Integration | Design | RichText |
import LinkTarget from "@coremedia/ckeditor5-coremedia-link/contentlink/ContentLinks";
ClassicEditor
.create(document.querySelector("#editor"), {
plugins: {
// ...
ContentLinks,
},
// ...
})
.then(...)
.catch(...);
Service Agent
Top | Up | Service Agent |
To resolve the name and other properties of a linked content, the Content-Link
feature uses the Service Agent architecture as introduced in context of
CoreMedia Studio. This also applies to Drag and Drop support of contents
into LinkFormView
or directly into the text.
This requires the client integrating CKEditor with Content-Link feature to implement some required interfaces and register them at the service agent:
-
ContentDisplayService
Resolves the display name of a content (which may as well be a placeholder text, in case for unreadable content for example), the representation for the content-type and other data required for displaying a content.
-
RichtextConfigurationService
Used to configure the behavior for content-links, especially, which content-types are allowed to by linked into a given RichText property, and, which are not.
You will find these interfaces in @coremedia/ckeditor5-coremedia-studio-integration
.
For integration into the example application mocks may be registered as provided
by @coremedia/ckeditor5-coremedia-studio-integration-mock
.
Design
Top | Integration | Design | RichText |
Representation for Root-Folder
While in general it is expected, that folders are not allowed to be referenced within standard RichText properties, clients like Studio-Client can be configured, to allow links to folders — including the root folder.
The root-folder, though, is the only content, which has/may have an empty name, which again provides a challenge when a name is required for editing purpose.
In context of the Content-Links feature, we decided:
- To use an artificial name/placeholder
<root>
when a name has to be written to the text (on drag and drop or for creating links for a collapsed selection) . - To display an empty name in preview scenarios (
LinkActionsView
,LinkFormView
).
If we experience the need to officially support links to root-folder these decisions are subject to change.
CoreMedia RichText 1.0 Integration
Top | Integration | Design | RichText |
For easier integration with CKEditor’s Link Feature it
is required, that content-links are represented in href
attribute with
content:
scheme syntax:
<a href="content:42">Some Content</a>
This requires:
-
Mapping
xlink:href
tohref
duringtoView
transformation in data-processing. -
Transforming
xlink:href
attributes referring to contents tocontent:<numeric ID>
.
In context of CoreMedia Studio, you may expect, that the REST backend already
transformed more verbose content URIs from coremedia:///cap/content/42
to a
shorter form: content/42
. Thus, data-processing just needs to replace the
slash by a colon.