mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-12-04 22:31:33 +09:00
fix: insert properly from marketplace (#4725)
Fixes https://github.com/webstudio-is/webstudio/issues/4723 We removed body from template data but didn't fix roots. Later insertion logic started to rely on these roots.
This commit is contained in:
1 parent
91e6b23bdf
commit
387530b84d
1 file changed
+9
-2
@@ -45,9 +45,16 @@ const insertSection = ({
|
||||
instanceId: string;
|
||||
}) => {
|
||||
const fragment = extractWebstudioFragment(data, instanceId);
|
||||
fragment.instances = fragment.instances.filter(
|
||||
(instance) => instance.component !== "Body"
|
||||
const body = fragment.instances.find(
|
||||
(instance) => instance.component === "Body"
|
||||
);
|
||||
// remove body and use its children as root insrances
|
||||
if (body) {
|
||||
fragment.instances = fragment.instances.filter(
|
||||
(instance) => instance.component !== "Body"
|
||||
);
|
||||
fragment.children = body.children;
|
||||
}
|
||||
const insertable = findClosestInsertable(fragment);
|
||||
if (insertable) {
|
||||
insertWebstudioFragmentAt(fragment, insertable);
|
||||
|
||||
Reference in new issue
Block a user