This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Our app should never allow for internal links that has a language prefix (since we dont use that) | |
export const removeLanguageFromLink = (link) => { | |
if (!link) return link; | |
const linkWithoutLanguage = link.replace(/^[a-z]{2}\/|[a-z]{2}-[a-z]{2}\//, ''); | |
return linkWithoutLanguage; | |
}; | |
// Our app has specific prefix for some channels, these should be added to internal links. | |
export const addChannelRootPathToLink = (link, channelRootPath) => { | |
const linkWithRootPath = `${channelRootPath}${link || ''}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useStoryblokApi, useStoryblokBridge } from "@storyblok/vue"; | |
import type { ISbStoriesParams, StoryblokBridgeConfigV2, ISbStoryData, ISbError, ISbResult } from '@storyblok/vue'; | |
export const useCustomAsyncStoryblok = async ( | |
url: string, | |
apiOptions: ISbStoriesParams = {}, | |
bridgeOptions: StoryblokBridgeConfigV2 = {}, | |
) => { | |
const uniqueKey = `${JSON.stringify(apiOptions)}${url}`; | |
const story = useState<ISbStoryData>(`${uniqueKey}-state`, () => ({} as ISbStoryData)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import { mapState } from 'vuex'; | |
import { renderStoryblokRichText } from '~/utils/storyblok/rich-text-helpers'; | |
export default { | |
props: { | |
blok: { | |
type: Object, | |
required: true, | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Example page --> | |
<script setup lang="ts"> | |
import { ISbStoryData } from '@storyblok/vue/dist'; | |
const route = useRoute(); | |
const { locale } = useI18n(); | |
let story = {} as ISbStoryData; | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- This is not needed anymore, just using useStoryblok() or useAsyncStoryblok() should work. --> | |
<!-- https://github.com/storyblok/storyblok-nuxt/issues/155 --> | |
<script setup lang="ts"> | |
import { SbBlokData } from '@storyblok/vue/dist'; | |
const props = defineProps({ | |
blok: { | |
type: Object, | |
required: true, | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://nuxt.com/docs/api/configuration/nuxt-config | |
export default defineNuxtConfig({ | |
modules: [ | |
'@nuxt-alt/auth', // https://www.npmjs.com/package/@nuxt-alt/auth | |
'@pinia/nuxt', | |
], | |
auth: { | |
redirect: { | |
login: '/auth/login', | |
logout: '/auth/logout', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script setup lang="ts"> | |
import { StoryData } from '@storyblok/vue/dist'; | |
const route = useRoute(); | |
const isPreview = !!(route.query._storyblok && route.query._storyblok !== ''); | |
const version = isPreview ? 'draft' : 'published'; | |
const story = ref({} as StoryData); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script setup lang="ts"> | |
import { Richtext } from 'storyblok-js-client'; | |
const props = defineProps({ blok: Object }); | |
const nuxtApp = useNuxtApp(); | |
const textObject = { ...props.blok.text }; | |
const nodes = []; | |
// Proof of concept for custom handling of inline blok nodes. | |
Object.entries(textObject.content).forEach(([key, node]) => { | |
if (node.type === 'blok') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script setup lang="ts"> | |
const props = defineProps({ | |
gistId: { | |
type: String, | |
required: true, | |
}, | |
file: { | |
type: String, | |
required: false, | |
default: '', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Fieldtype = { | |
template: ` | |
<div> | |
<div class="image__wrap uk-margin-small-bottom"> | |
<input type="datetime-local" id="date" name="date" v-model="model.date"> | |
</div> | |
</div> | |
`, | |
mixins: [window.Storyblok.plugin], | |
methods: { |
NewerOlder