Label complete api

Hi, i need create Task with certain default label and without possible to edit it immediately (there shouldn’t be input field after task created). So i do this

import BpmnModeler from 'bpmn-js/dist/bpmn-modeler.production.min';
....
const modeler = new BpmnModeler({ container: '.bpmn-editor' });
modeler.importXML(bpmnString);

const eventBus = modeler.get('eventBus');
eventBus.on('commandStack.shape.create.postExecute', (event) => {
  if (event.context.shape.type === 'bpmn:Task') {
    const modeling = modeler.get('modeling');
    modeling.updateProperties(event.context.shape, {
      name: 'New name',
    });
    const directEditing = modeler.get('directEditing');
    console.log(directEditing.isActive());  // always false
    directEditing.complete();
  }
});

This is not working. What wrong with my code?

Welcome to our forum!

Direct editing activation is controlled via the LabelEditingProvider.

I suggest you to dig into that component to understand how editing is triggered in the first place and ensure that that does not happen. Completing direct editing right away reads like a big hack for me if you can prevent direct editing in the first place.

For further support, please share a CodeSandbox that clearly illustrates your usage.