Skip to content
Discussion options

You must be logged in to vote

Okay, I solved this problem. In case anyone needs this, this is what I did.

// propagate.ts

import type { Component } from "grapesjs";

const events = ["removed", "remove", "render", "add"];

export function initPropagate(component: Component) {
    events.forEach((eventName) => {
        component.on(eventName, (...props) => {
            component.find("*").forEach((c: Component) => c.trigger(eventName, props));
        });
    });

    return component;
}

// some component

init() {
    initPropagate(this);
}

I am manually firing the events I need in every component and calling this function in container-like components that I use.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by whit3st
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant