-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Make sure all data parsing or schema related checks use proper/actual root #20026
Copy link
Copy link
Open
Copy link
Labels
squad:coreIssue to be handled by the Core team.Issue to be handled by the Core team.type:taskThis issue reports a chore (non-production change) and other types of "todos".This issue reports a chore (non-production change) and other types of "todos".
Description
Describe the task
CKEditor 5 contains numerous places where '$root' is hardcoded as the schema context for validation, data parsing, and command enable-state checks.
This works today because $root is the only root element name in use. However, once #20029 lands - allowing config.root.modelElement to configure a custom root element name - all those hardcoded references will silently operate against the wrong schema context, causing:
- Commands being incorrectly enabled/disabled in editors with a custom root
DataController.parse()/toModel()validating content against$rootschema rules instead of the actual configured root's rules, potentially dropping valid content- Schema
allowIn: '$root'registrations not covering the custom root, breaking content insertion
Definition of Done
- Audit complete - all literal
'$root'usages inpackages/*/src/are categorized as: (a) schema definition (intentional, defines the$rootelement itself), (b) schema context check (needs fixing), or (c) safe (e.g. clipboard's$clipboardHolderpattern - a different context). - Commands are context-aware -
refresh()/isEnabledlogic in all commands reads the actual root element name from the selection or document instead of hardcoding'$root'. A shared utility or accessor is used to avoid divergence. - Data parsing calls pass explicit context - every call to
DataController.parse()andtoModel()outside of the engine core passes the actualModelRootElement(or its name) as the context, not relying on the'$root'default. - Schema
allowInregistrations are root-agnostic - features that registerallowIn: '$root'either use the schema's generic$container/$blockinheritance chain where applicable, or dynamically read the configured root name fromconfig.root.modelElement(introduced in Allow passing config.root.modelElement etc. in the configuration to define the model root #20029). - No regression on the
$rootdefault - editors that do not configureconfig.root.modelElementcontinue to behave identically to today. - Automated tests cover all changed command
refresh()paths and data parsing paths with a non-$rootroot context.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
squad:coreIssue to be handled by the Core team.Issue to be handled by the Core team.type:taskThis issue reports a chore (non-production change) and other types of "todos".This issue reports a chore (non-production change) and other types of "todos".