parent Configuration
The configuration that was applied just before this builder via EditorConfiguration.Companion.remember or EditorConfiguration.then. This property should be used to delegate invocations from this builder.
For instance, you can access callbacks and components, override and modify them, extend behavior before or after:
onCreate = {
// Does additional stuff before parent configuration's onCreate.
...
// parentConfiguration?.onCreate invocation can be skipped too.
parentConfiguration?.onCreate?.invoke(this)
// Waits for parent configuration onCreate to finish, then does additional stuff.
...
}
// Extend dock behavior only and only if parent defines dock.
dock = impl@{
val parentDock = parentConfiguration?.dock as? Dock ?: return@impl null
val updatedListBuilder = parentDock.listBuilder.modify {
addFirst { Dock.Button.rememberElementsLibrary() }
}
remember(parentDock, updatedListBuilder) {
parentDock.copy(listBuilder = updatedListBuilder)
}
}
// Add inspector bar no matter parent defines or not. If it is defined, then extend it.
inspectorBar = {
// If parent configuration does not have an inspector bar, create an empty one as source.
val sourceInspectorBar = parentConfiguration?.inspectorBar as? InspectorBar ?: InspectorBar.remember()
val updatedListBuilder = sourceInspectorBar.listBuilder.modify {
addLast { InspectorBar.Button.rememberCrop() }
}
remember(sourceInspectorBar, updatedListBuilder) {
sourceInspectorBar.copy(listBuilder = updatedListBuilder)
}
}Content copied to clipboard
Note that all null properties in EditorConfigurationBuilder are automatically delegated to corresponding properties in parentConfiguration. For instance, if EditorConfigurationBuilder.onCreate is null then the final EditorConfiguration.onCreate will match with EditorConfiguration.onCreate of parentConfiguration.