Content Editor module

Edition DX Core

License

MLA

Issues

CONTEDIT

Maven site

Content Editor

Latest

2.0.2

The Content Editor module provides a platform for handling well-defined blocks of content in Magnolia.

The core of the platform is the Magnolia Content Editor submodule, implemented as the stories-app submodule, which allows editors to create and edit stories in the Author instance using the Stories app.

Compatibility note

Magnolia 6 UI framework is implemented in version 2 of the Content Editor module. Custom content editor and block definitions created in the Magnolia 5 UI framework are not compatible with this version of the module and must be migrated.

If you wish to keep using the existing 5 UI block and custom content editor definitions, you must install version 1.3.9 of the Content Editor module and use them with this version.

Module structure

artifactID

content-editor-parent

Parent reactor.

magnolia-content-editor

Provides a free-form content editor.

magnolia-content-editor-widgetset-v2

Provides a custom widgetset for the Content Editor.

stories-app

Provides the Stories app, the default Magnolia editor implementation.

The app is not bundled with preconfigured Magnolia webapps.

magnolia-block-api

Provides a basic API for the blocks (content sections).

magnolia-block-templating

Provides the functionality to render the blocks.

magnolia-link-unfurl

Provides utilities for unfurling external web links.

Unfurling means fetching and displaying metadata for a given URL, for example, a preview image, a title and description.

Installing

Demo modules decorate the stories-app.

If you want to build your own custom implementation, add this dependency to your webapp:

<dependency>
  <groupId>info.magnolia.editor</groupId>
  <artifactId>magnolia-content-editor</artifactId>
  <version>2.0.2</version>
</dependency>

If you intend to build custom blocks, add this dependency to your webapp:

<dependency>
  <groupId>info.magnolia.editor</groupId>
  <artifactId>magnolia-block-templating</artifactId>
  <version>2.0.2</version>
</dependency>

Content editor modules in Magnolia webapps and bundles

In the 6.2 branch of Magnolia, preconfigured Magnolia DX Core bundles or webapps contain version 1.3.9 of the module, which is compatible with the 5 UI framework.

If you wish to use the 6 UI-native version (2.0.2), you must remove the 1.3.9 module first.

Content internationalization (i18n)

Internationalization (i18n) of content is not supported in the 1.3.x and 2.0.x versions of the Content Editor module and its Stories app submodule.

The feature will only be enabled in version 2.1. Until it is released for production-ready use, you cen test it out in version 2.1-beta. This version is available on Magnolia Nexus under the following coordinates:

<dependency>
  <groupId>info.magnolia.editor</groupId>
  <artifactId>content-editor-parent</artifactId>
  <version>2.1-beta</version>
</dependency>

Before adding this beta into your webapp, you must remove the bundled version of the module.

Compatibility of content and block definitions

Flat vs nested content structure

The data model for the internationalized Content Editor stories is different in the beta version. Whereas in 1.3.x and 2.0.x the mgnl:block elements are stored in a flat node structure,

stories
└── story1
    ├── 0
    └── 1

in the i18n-supported version, the nodes are locale-nested under intermediate nodes of type mgnl:contentNode, named custom_de and custom in this example:

stories
└── story1
    └── custom_de
    │   ├── 0_de
    │   └── 1_de
    └── custom
        ├── 0
        └── 1

This must be reflected in your MultiJcrBlockDefinition, where you need to add and enable the i18n property.

Instead of the CurrentItemProvider, the CompatibleBlockProvider is set as the default provider, which can resolve both flat and nested block nodes. You do not need to declare it in your block definition.

Example definition
custom:
  label: Blocks
  $type: multiJcrBlock
  i18n: true
  blocks:
    - text
This applies only to the 2.0.x block definitions. Block definitions created for version 1.3.x (5 UI) of the module are not compatible with the 2.1-beta version and must be fully migrated.

Migrating content to 2.1-beta

There are two ways you can migrate the non-i18n blocks to the i18n-compatible hierarchy: using a version handler or a Groovy script.

Version handler

When upgrading the Stories app submodule to version 2.1-beta (or 2.1 once available), all block nodes in the stories workspace will be moved to intermediate nodes, see the MigrateBlockToIntermediateParentTask task.

Groovy script

You can run the migration task in the Groovy app, especially in case a block node is stored in another workspace.

Example Groovy script
import info.magnolia.editor.setup.MigrateBlockToIntermediateParentTask
import info.magnolia.module.InstallContextImpl
import info.magnolia.module.ModuleRegistryImpl
import info.magnolia.objectfactory.Components
import javax.jcr.Session


Session session =  MgnlContext.getJCRSession("stories");
task = new MigrateBlockToIntermediateParentTask("stories", "/", "custom");
task.execute(Components.newInstance(InstallContextImpl.class));
session.save();

The parameters in the MigrateBlockToIntermediateParentTask:

Editing and publishing aspects
Locale selector is disabled

The locale selector combo box is disabled in the following cases:

  • The multiJcrBlock field is configured with i18n: true but the story structure has not been migrated yet.

  • The story complies with the new i18n structure but the multiJcrBlock field is configured with i18n: false.

Publishing stories with multilanguage content

When you publish a story where multilanguage content is enabled and present, the whole story node is published, that is all language variants of the blocks in the story are always published.

Feedback