Hi, there,
I add a custom rule for shape.append
, but it doesn’t work. I have checked related topics and tried some methods but none worked.
Is the below code has something wrong?
import inherits from 'inherits';
import RuleProvider from 'diagram-js/lib/features/rules/RuleProvider';
const HIGH_PRIORITY = 2000;
function CustomRules(eventBus) {
RuleProvider.call(this, eventBus);
}
inherits(CustomRules, RuleProvider);
CustomRules.$inject = [ 'eventBus' ];
CustomRules.prototype.init = function() {
this.addRule('shape.append', HIGH_PRIORITY, function(context) {
return false;
});
};
const customRulesModule = {
__init__: [
'customRules'
],
customRules: [ 'type', CustomRules ]
};
const modeler = new Modeler({
additionalModules: [
customRulesModule
]
});