-
Notifications
You must be signed in to change notification settings - Fork 940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@builder.io/sdk-vue: Editing fails for empty/unpublished content #3653
Comments
After some digging, it seems there is an issue when enabling the editor. The Work around example of the patch (mounted method of the mounted() {
var e, t;
if (I()) {
// Calling manually the method works
this.elementRef_onIniteditingbldr()
// This will not dispatchEvent as elementRef is undefined
if (R() && this.$refs.elementRef && this.$refs.elementRef.dispatchEvent(
new CustomEvent("initeditingbldr")
), this.builderContextSignal.content && G(this.canTrack)) {
const o = (e = this.builderContextSignal.content) == null ? void 0 : e.testVariationId, r = (t = this.builderContextSignal.content) == null ? void 0 : t.id, i = this.apiKey;
ue({
type: "impression",
canTrack: true,
contentId: r,
apiKey: i,
variationId: o !== r ? o : void 0
});
}
Mt() && !R() && this.$refs.elementRef && this.$refs.elementRef.dispatchEvent(
new CustomEvent("initpreviewingbldr")
);
}
}, It seems that there are some issues with the core components but by overriding them with custom ones resolves the issues. Example with a simple text:
|
After digging more in Builder.io source code, the generated EnableEditor component template is the following: <template>
<template v-if="builderContextSignal.content">
<component
ref="elementRef"
:onClick="(event) => onClick(event)"
:builder-content-id="builderContextSignal.content?.id"
:builder-model="model"
:className="getWrapperClassName(content?.testVariationId || content?.id)"
:is="ContentWrapper"
:onIniteditingbldr="(event) => elementRef_onIniteditingbldr(event)"
:onInitpreviewingbldr="(event) => elementRef_onInitpreviewingbldr(event)"
v-bind="{ ...{}, ...{}, ...showContentProps, ...contentWrapperProps }"
><slot
/></component>
</template>
</template> As when previewing Symbols we do not pass any By giving a random defined value as <template>
<Content
model="symbol"
:content="true"
/>
</template> |
@kerwanp Appreciate you creating an issue and a PR to fix it. We actually have a better solution in mind: to render the this will allow us to keep the event listener approach, which is better for performance. |
Describe the bug
When following the documentation on how to Add Symbol editing to your app it results in a blank page on the editor.
To Reproduce
Steps to reproduce the behavior:
npx nuxi@latest init <my-app>
/edit-symbol
page (depend on the page you created)Expected behavior
The Symbol should be shown on the editor preview.
Screenshots
Editor screenshot
Iframe content
Additional context
All Symbols that were tested are working properly on Next.js as we were thinking about migrating to Nuxt (and this is the only blocking point).
This as been tested with and without API key on the
Content
component.When looking at the console, there is no error emitted by Builder package. And there is no requests made to builder domains.
The text was updated successfully, but these errors were encountered: