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
... | |
init(): void { | |
if (!this.client) { | |
this.initClient(); | |
} | |
this.initTranslationsFetching(); | |
this.listenToRouteChange(); | |
if (window.location != window.parent.location) { |
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 = { | |
mixins: [window.Storyblok.plugin], | |
template: `<div> | |
<sb-asset-selector :uid="uid" field="example"> | |
</sb-asset-selector> | |
{{model.example}} | |
</div>`, | |
methods: { | |
initWith() { | |
return { |
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 = { | |
mixins: [window.Storyblok.plugin], | |
template: `<div><input class="uk-width-1-1" v-model="model.example" /></div>`, | |
methods: { | |
initWith() { | |
return { | |
plugin: 'example_plugin', | |
example: 'Hello world!' | |
} | |
}, |
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 StoryblokClient = require('storyblok-js-client') | |
const Storyblok = new StoryblokClient({ | |
accessToken: 'YOUR_TOKEN' | |
}) | |
Storyblok.setComponentResolver((component, blok) => { | |
switch(component) { | |
case 'my_button': | |
return `<button>${blok.button_text}</button>` | |
break; |
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
Vue.directive('my-editable', { | |
bind: function(el, binding) { | |
if (typeof binding.value._editable === 'undefined') { | |
return | |
} | |
var options = JSON.parse(binding.value._editable.replace('<!--#storyblok#', '').replace('-->', '')) | |
if (options.id != window.storyblok.getParam('_storyblok')) { | |
return |
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
// For Nuxtjs and Gridsome: | |
<template> | |
<div> | |
<div v-html="richtext"></div> | |
</div> | |
</template> | |
<script> | |
export default { | |
props: ['text'], |
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 = { | |
mixins: [window.Storyblok.plugin], | |
template: `<div><select v-model="model.example"><option :value="item.uuid" :key="item.uuid" v-for="item in stories">{{item.name}}</option></select></div>`, | |
data() { | |
return {stories: []} | |
}, | |
methods: { | |
initWith() { | |
return { |
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 = { | |
mixins: [window.Storyblok.plugin], | |
data() { | |
return { | |
loading: true, | |
open: false, | |
colors: ['#F64272', '#F6648B', '#F493A7', '#F891A6', '#FFCCD5', ''] | |
} | |
}, | |
template: `<div> |
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
export default function replaceAll(tree) { | |
var traverse = function (jtree) { | |
if (jtree.constructor === String) { | |
jtree = jtree.replace(new RegExp('a.storyblok.com', 'g'), 'img2.storyblok.com') | |
} else (jtree.constructor === Array) { | |
for (var item = 0; item < jtree.length; item++) { | |
traverse(jtree[item]) | |
} | |
} else if (jtree.constructor === Object) { | |
for (var treeItem in jtree) { |
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
class PagesController < ApplicationController | |
def index | |
response.headers['X-FRAME-OPTIONS'] = 'ALLOWALL' | |
client = Storyblok::Client.new( | |
logger: logger, | |
cache_version: Time.now.to_i, | |
token: 'Dv2ok3DqODzzb8QUuN2XCgtt', | |
version: 'draft' | |
) |