Hello everyone, when creating a new element from the context pad menu next to the selected block, the focus is on the newly created element, the question is, can I make it so that when creating a new element, the focus goes to the arrow leading to this element, and not to the element itself?
desired behavior in screenshot:
The behaviour responsible for this is AutoPlaceSelectionBehavior
. To achieve this you can:
disable this behaviour:
additionalModules: [{
autoPlaceSelectionBehavior: ['value', null]
}]
create a similar behaviour that selects the connection instead
1 Like
I have to connect the module I wrote through moddleExtensions ?
moddleExtensions: {
custom: customModdleExtension,
},
Ultimately, my solution looks like this
I created a file with the name Customautoplaceselectionbehavior and inserted the following code into it
export default function AutoPlaceSelectionBehavior(eventBus, selection) {
eventBus.on('autoPlace.end', 500, (e) => {
selection.select(e.shape.incoming)
})
}
AutoPlaceSelectionBehavior.$inject = ['eventBus', 'selection']
Then wrapped everything in the index file
import CustomAutoPlaceSelectionBehavior from './CustomAutoPlaceSelectionBehavior'
export default {
__init__: [ 'customAutoPlaceSelectionBehavior'],
customAutoPlaceSelectionBehavior: ['type', CustomAutoPlaceSelectionBehavior],
}
and then imported into my modeller
*Do not forget to disable the standard service behavior
bpmnViewerRef.current = new Modeler({
container,
keyboard: {
bindTo: document,
},
moddleExtensions: {
custom: customModdleExtension,
},
additionalModules: [{ autoPlaceSelectionBehavior: ['value', null] }], // here
})
Thanks for the help, I hope this turns out to be useful to someone!
You should add it to additionalModules
. moddleExtensions
should be used for meta-model extensions.
system
Closed
December 9, 2022, 12:50pm
6
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.