-
Notifications
You must be signed in to change notification settings - Fork 20
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
preventClicks: true is not working #258
Comments
I have the same issue with a React + Next.js project |
Hi Storyblok. Can i get a confirmation if this issue is originating from one of the modules or from the app itself? |
Ive got a solution that works for now btw since this seems to not be fixed any time soon. |
Hi @SebbeJohansson sorry for the super late response. I asked the team and they shared this with me:
Screen.Recording.2023-08-09.at.15.43.02.mov |
@fgiuliani Hi! It could be that im misunderstanding the video and the text, but in my case the links are within the storyblok component (same for both a text-link and a div that has a link around it) and they go to links that are in storyblok in the same application (not sure that matters). We have worked around this issue by programmatically changing any links into divs when in the editor. |
@SebbeJohansson thanks for the quick response! |
@fgiuliani Sure! Here is the code (a nuxt3 project), with some parts redacted. <script setup lang="ts">
import { type ISbStoryData } from 'storyblok-js-client';
import { type StoryblokPage } from '~/typings/page-types';
import { type CmsPreview } from '~/utils/get-is-cms-preview-from-route';
const isCmsPreview = inject<ComputedRef<CmsPreview>>('isCmsPreview');
const props = defineProps<{
page: StoryblokPage;
}>();
const story = ref<ISbStoryData>(props.page.storyblokPage);
const contentPageData = computed(() => ({
...story.value?.content,
component:
// Blog category should be rendered with blog page component
story.value?.content.component === 'blog-category'
? 'blog-page'
: story.value?.content.component,
}));
onMounted(() => {
if (!isCmsPreview?.value.storyblok) return;
window.storyblokRegisterEvent(() => {
const { StoryblokBridge } = window;
if (StoryblokBridge) {
const storyblokInstance = new StoryblokBridge({
preventClicks: true,
});
storyblokInstance.on(['published', 'change', 'input'], (event) => {
story.value = event.story;
});
}
});
});
</script>
<template>
<div v-if="story" v-editable="contentPageData">
<StoryblokComponent :blok="contentPageData" :raw="story" />
</div>
</template> |
Thanks @SebbeJohansson ! |
Doing { preventClicks: true, } in bridge options is not working. It is still following clicks.
Expected Behavior
I expect preventClicks to result in me not going to any of the links i click on a page when in the editor.
Current Behavior
Links to other pages (both internal and external) behaves the same as without the option.
Steps to Reproduce
{ preventClicks: true, }
I have tested this both with a vue project and a nuxt project.
The text was updated successfully, but these errors were encountered: