You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add root and roots editor config options to the EditorConfig interface.
The root key would be just an alias for roots.main and internally normalize it to such a structure for easier access later.
Prepare config normalization helper for root-related options (probably in the core package). Or should it be implemented in the Editor base class constructor?
It should check which options are set in the editor config (root.initialData, initialData, placeholder, root.placehoder, roots.XYZ.initialData, etc) and set the roots.XYZ structure (in the editor config) with root-related options (initialData, placeholder, label), the default root name is main. It should also take the sourceElementOrData editor constructor parameter in case the initialData is provided there, but it should (as currently) be used as the latest option. Note that it is a record (root name keyed) in the multi-root editor.
The lazyRoots, and rootsAttributes options should not use a legacy fallback. Those would be renamed in the new structure to lazyLoad and modelElement.attributes.
The old lazyRoots and rootsAttributes configuration keys should be removed.
The new modelElement.attributes key would replace the old rootsAttributes.
The new lazyLoad flag in the new per-root configuration should be marked as deprecated.
The old initialData, placeholder configuration keys should be marked as deprecated.
The above helper should be used in all editor constructors, and later root-related options should be retrieved from normalized config keys, for example, config.get( 'root.main.placeholder' ), config.get( 'root.main.initialData' ).
All editor.config.get() calls to altered config options should be modified to the normalized path (for example roots.XYZ.placeholder)
Example normalized config:
{
roots: {
main: {
initialData: '...', // Previously config.initialData or config.initialData.main in multi-root
placeholder: '...', // Previously config.placeholder or config.placeholder.main in multi-root
label: '...', // Previously config.label or config.label.main in multi-root
modelElement: {
attributes: {} // Previously config.rootsAttributes.main
},
lazyLoad: false // Previously config.lazyRoots array
}
}
}
The multi-root addRoot() and createEditable() methods should get new declarations (the old ones should be marked as deprecated). New variants of those methods should accept structures similar to the above normalized config (only keys that are related to the specific method).
Note that addRoot() accepts elementName - the model root element name; this should be changed to modelElement.
To implement decisions from the RFC we need to:
rootandrootseditor config options to theEditorConfiginterface.rootkey would be just an alias forroots.mainand internally normalize it to such a structure for easier access later.Editorbase class constructor?root.initialData,initialData,placeholder,root.placehoder,roots.XYZ.initialData, etc) and set theroots.XYZstructure (in the editor config) with root-related options (initialData,placeholder,label), the default root name ismain. It should also take thesourceElementOrDataeditor constructor parameter in case theinitialDatais provided there, but it should (as currently) be used as the latest option. Note that it is a record (root name keyed) in the multi-root editor.lazyRoots, androotsAttributesoptions should not use a legacy fallback. Those would be renamed in the new structure tolazyLoadandmodelElement.attributes.lazyRootsandrootsAttributesconfiguration keys should be removed.modelElement.attributeskey would replace the oldrootsAttributes.lazyLoadflag in the new per-root configuration should be marked as deprecated.initialData,placeholderconfiguration keys should be marked as deprecated.config.get( 'root.main.placeholder' ),config.get( 'root.main.initialData' ).editor.config.get()calls to altered config options should be modified to the normalized path (for exampleroots.XYZ.placeholder)Example normalized config:
addRoot()andcreateEditable()methods should get new declarations (the old ones should be marked as deprecated). New variants of those methods should accept structures similar to the above normalized config (only keys that are related to the specific method).addRoot()acceptselementName- the model root element name; this should be changed tomodelElement.