Custom Rules doesn't work

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
    ]
});

I find the solution. The custom rule for shape.append doesn’t work because the rule is not used anywhere. When I call rules.allowed('shape.append', { elements: [ element ] }) in custom context pad, the rule worked.