Skip to content

Allow passing config.root.modelElement etc. in the configuration to define the model root #20029

Description

@niegowski

Describe the task

Currently the model root element name is always $root — it is hardcoded throughout the engine and cannot be changed by the integrator. This task introduces a config.root.modelElement option (and potentially other config.root.* options) that allows configuring the root element name used when the editor is initialized.

This is a prerequisite for editors that need a custom root schema — for example, a root that restricts or extends what content is allowed at the top level differently from the default $root. It is also the foundation that makes #20026 meaningful: fixing hardcoded $root checks is only useful once the root name can actually differ.

Definition of Done

  • config.root.modelElement is accepted — the editor reads this option during initialization and uses it as the model root element name instead of $root.
  • Editor constructor uses the configured root name — the editor constructor reads config.root.modelElement and passes it when creating the model root, instead of hardcoding '$root'.
    • This one applies to all editors (classic, …).
  • Backward compatible — omitting config.root.modelElement results in identical behavior to today ($root is used).
  • Documented — the new config option is described in the API docs with a usage example.
  • Automated tests cover initialization with a custom root name, schema registration, and data round-trip.

Activity

  1. added
    type:taskThis issue reports a chore (non-production change) and other types of "todos".
    on Mar 31, 2026
  2. self-assigned this
    on Mar 31, 2026
  3. added theissue type on Apr 1, 2026
  4. niegowski commented on Apr 8, 2026

    @niegowski
    ContributorAuthor

    All points from this ticket are already covered in #20028.
    That PR also includes:

    • registers $inlineRoot in schema and updates schema deep dive guide to cover it.
    • Adds some $root fixes from Make sure all data parsing or schema related checks use proper/actual root #20026, as development started from that ticket, but for easier testing, I switched to actual modelElement config handling.
    • introduces verification whether the provided modelElement is registered in the schema as isLimit, as this is a requirement for many features.
    • changes promise chaining to async/await in editor classes (as it gets over-complicated to read when adding another chained call).

    As in the above PR, the code combines this issue and #20026, so it may already have been reviewed, and the rest of the $root cleaning could be handled in a separate PR.

  5. added this to the iteration 98 milestone on Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

squad:coreIssue to be handled by the Core team.type:taskThis issue reports a chore (non-production change) and other types of "todos".

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions