fix(components): wrap draggable in client-only

This commit is contained in:
☙◦ The Tablet ❀ GamerGirlandCo ◦❧ 2024-03-16 15:29:21 -04:00
parent 85169dba3e
commit b10928fcf7
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

View File

@ -12,6 +12,8 @@
import singleChapter from "./singleChapter.vue"; import singleChapter from "./singleChapter.vue";
import icon from "~/components/icon.vue"; import icon from "~/components/icon.vue";
const router = useRouter();
const props = defineProps<{ const props = defineProps<{
canDraft?: boolean; canDraft?: boolean;
endpoint: string; endpoint: string;
@ -47,6 +49,9 @@
method: "post", method: "post",
body: values, body: values,
}); });
if (dat.success) {
await router.push(`/story/${dat.story._id}/1`);
}
} }
} else { } else {
await autoEdit(values, props.endpoint, props.endpointMethod); await autoEdit(values, props.endpoint, props.endpointMethod);
@ -107,8 +112,9 @@
<a-divider /> <a-divider />
<!-- <test1/> --> <!-- <test1/> -->
<field-array name="chapters" v-slot="{ fields, push, remove, move }"> <field-array name="chapters" v-slot="{ fields, push, remove, move }">
<client-only>
<div> <div>
<div v-for="(element, index) in values.chapters"> <div v-for="(element, index) in data.chapters">
<client-only> <client-only>
<Teleport :to="`#chapter-\\[${element.uuidKey}\\]`"> <Teleport :to="`#chapter-\\[${element.uuidKey}\\]`">
<a-collapse v-model:active-key="expandos" collapsible="icon"> <a-collapse v-model:active-key="expandos" collapsible="icon">
@ -143,6 +149,8 @@
</client-only> </client-only>
</div> </div>
</div> </div>
</client-only>
<client-only>
<draggable <draggable
:component-data="{ type: 'transtion-group', 'data-testid': 'storyform.chapters' }" :component-data="{ type: 'transtion-group', 'data-testid': 'storyform.chapters' }"
@start="drag = true" @start="drag = true"
@ -171,6 +179,7 @@
<a-button data-testid="storyform.addChapter" :onClick="pushHOF(push)"> Add chapter </a-button> <a-button data-testid="storyform.addChapter" :onClick="pushHOF(push)"> Add chapter </a-button>
</template> </template>
</draggable> </draggable>
</client-only>
</field-array> </field-array>
<a-button type="primary" html-type="submit">{{ submitText || "Post" }}</a-button> <a-button type="primary" html-type="submit">{{ submitText || "Post" }}</a-button>
<a-button html-type="submit" v-if="canDraft" @click="() => (otherBtnInvoked = true)"> Save for Later </a-button> <a-button html-type="submit" v-if="canDraft" @click="() => (otherBtnInvoked = true)"> Save for Later </a-button>