Skip to content

Configuring IWE3#

Imperia Web Editor 3 (IWE3) is the Tiptap-based rich-text editor in imperia CMS. It is embedded in Editmode and stores HTML in the metafield specified by the id parameter.

Quick start#

Add the iwe3 processing instruction to an Editmode template:

<?imperia iwe3
    id: body
?>

The stored value can be rendered with <!--XX-body-->. In flexible or multilingual templates, use a unique ID, for example:

<?imperia iwe3
    id: text_<!--XX-FLEX_INDEX-->_<!--XX-FLEX_ID-->
?>

Configuration hierarchy#

IWE3 combines its configuration in this order:

  1. the default TIPTAP_CONFIG;
  2. an optional JavaScript module selected with customConfig;
  3. config.* parameters in the processing instruction.

The later source overrides earlier settings.

PI parameters#

Parameter Values / default Purpose
id string, required HTML metafield and part of the DOM ID
content one-line HTML initial content for an empty field
customConfig path to JS module loads a project-specific CUSTOM_CONFIG
config.width CSS length, 100% editor width
config.height CSS length, 600px editor height
config.resizable 1 or 0 allows the editor to be resized
config.spellcheck 1 or 0 enables native spell checking
config.canInspect 1 or 0 displays inspection controls
config.bundle bundle name, full selects the editor feature set
config.class CSS class names adds classes to the editor wrapper
config.bubbleMenu 1 or 0 enables contextual menus
config.dragHandle 1 or 0 enables the block handle and slash menu
config.style classic or notion selects the editor shell
config.export_md 0, 1, or field name stores an additional Markdown version
config.placeholder string placeholder for an empty editor

Boolean PI parameters

Use 1 and 0 for boolean values in the processing instruction. The words true and false are passed as strings. In JavaScript configuration files, use the native values true and false instead.

Bundles#

IWE3 includes four standard bundles:

Bundle Selected features
minimal bold, italic, lists, links, paragraph and heading formats, styles, undo/redo, plain paste
fallback common inline formats, lists, blockquotes, alignment, links, images, tables, source view, undo/redo
full the broadest classic toolset, including abbreviations, search and replace, advanced tables, spell check, and print
notion block-based interface with a block handle, slash menu, placeholders, MAM images and links, tables, and advanced content structures

Enable the Notion-style editor#

The notion bundle selects the block-based editor shell and activates its block handle:

<?imperia iwe3
    id: body
    config.bundle: notion
?>

The shell can also be selected independently with config.style: notion. The extensions in the active bundle continue to determine which block types are available.

Store Markdown in an additional field#

Markdown export does not replace the normal HTML field. With config.export_md: 1, IWE3 creates and updates an additional hidden field named md_<id>:

<?imperia iwe3
    id: article_content
    config.export_md: 1
?>

This stores HTML in article_content and Markdown in md_article_content. Render the Markdown with <!--XX-md_article_content-->.

To select a different field name, specify it directly:

config.export_md: article_content_markdown

The Markdown target field must differ from the HTML field.

Custom configuration#

A project-specific JavaScript module can add or replace bundles:

import { FEATURE_BUNDLES, MENUBAR_DEFINITIONS } from '/imperia/js/i-tiptap/config.js';

FEATURE_BUNDLES.ImperiaMinimal = {
  menubar: [MENUBAR_DEFINITIONS.Bold, MENUBAR_DEFINITIONS.Italic],
  extensions: { StarterKit: {} },
};

export const CUSTOM_CONFIG = {
  width: '100%',
  height: '400px',
  resizable: false,
  bundle: 'ImperiaMinimal',
  bundles: FEATURE_BUNDLES,
};

Load it from the template:

<?imperia iwe3
    id: teaser
    customConfig: /custom/iwe3_config.js
?>

Security considerations#

IWE3 stores HTML in document metadata. The active extensions determine which HTML structures and link types users can create. Review custom bundles and link configurations against the security rules of the project, and do not enable protocols or HTML structures that are not required.

Images selected through the MAMImage extension come from Media Asset Management and remain under central asset control.