It looks like your frontend ComponentDesignDelegate should implement and return designerComponent(), and then we’ll automatically use a different component when you switch to/from design mode:
Where to implement this? the ComponentMeta doesnt seem to be the right place xd
My next guess is web/packages/designer/ … unfortunatly there seems to be no example from this xd
So i came up with something like this… components.forEach((c: ComponentDesignDelegate) => InteractionRegistry.registerInteractionDelegates(c));
similar to the registry of componentMetas, but this doesnt seem to do anything
Ah, yeah, that might be it. DesignerHook for the Perspective module has getDesignerComponentRegistry(), which is essentially identical to the common ComponentRegistry; maybe try using that too.
Hmm those seem to be already registering, with the same decriptor as the component tho…
Im able to put a designer delegate there just like the rad tagcounter, so it gotta be registered in java correct too…
but im not getting the designer web component
I am not sure victors original specific reason for identifying scope, but I ended up here trying to figure out how to disable specific event handlers in the design vs preview scopes. I figured I would throw this question here incase someone got here for the same reason.
I had a button with an onClick event of onActionPerformed, and it was firing when clicking the button regardless of being in design or preview mode in the designer.
I managed to fix it through the use of this.props.eventsEnabled, but I'd like to confirm is this the correct way to handle that?
export class Button extends Component<ComponentProps<ButtonProps>, any> {
onActionPerformed = () => {
if (!this.props.eventsEnabled) {
console.log("Button is disabled in the design-scope");
return;
}
this.props.componentEvents.fireComponentEvent("onActionPerformed", {});
}
render() {
const { props: { text, enabled }, emit } = this.props;
return (
<button
onClick={this.onActionPerformed}
disabled={!enabled}
>
{text}
</button>
);
}
}