This file contains hidden or 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 Promise = require('bluebird') | |
const path = require('path') | |
exports.createPages = ({ graphql, boundActionCreators }) => { | |
const { createPage } = boundActionCreators | |
return new Promise((resolve, reject) => { | |
const storyblokEntry = path.resolve('src/templates/storyblok-entry.js') | |
graphql( |
This file contains hidden or 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
// About | |
// This script exports all stories as XML in a specific folder | |
// ------- | |
// How to install? | |
// 1. Create a folder for the project and inside a "data" folder | |
// 2. $ npm init | |
// 3. $ npm install storyblok-js-client --save | |
// 4. Exchange SPACE_ID and YOUR_OAUTH2_TOKEN and optionally startWith to export only one specific folder | |
// 5. $ node xml-export.js |
This file contains hidden or 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><div v-if="tinyLoaded"><plugin-mce :value=model.content @input=handleInput :config=config></plugin-mce></editor></div></div>`, | |
data() { | |
return { | |
config: { | |
plugins: 'fullscreen link lists code visualblocks', | |
menubar: false, | |
toolbar: 'styleselect | link | numlist bullist | removeformat code', | |
style_formats: [{ title: 'Block', items: [{ title: 'Paragraph', format: 'p' }, { title: 'Header 1', format: 'h1' }, { title: 'Header 2', format: 'h2' }, { title: 'Header 3', format: 'h3' }, { title: 'Header 4', format: 'h4' }, { title: 'Header 5', format: 'h5' }, { title: 'Header 6', format: 'h6' }, { title: 'Blockquote', format: 'blockquote' }] }, { title: 'Inline', items: [{ title: 'Bold', icon: 'bold', format: 'bold' }, { title: 'Italic', icon: 'italic', format: 'italic' }] }, { title: 'Alignment', items: [{ title: 'Text Right', icon: 'alignright', selector: 'p, div, blockquote', classes: 'text-right' } |
This file contains hidden or 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({ | |
oauthToken: 'YOUR_OAUTH_TOKEN' | |
}) | |
let start = async function() { | |
for (var i = 0; i < 20; i++) { | |
await Storyblok.get('spaces/YOUR_SPACE_ID/stories/YOUR_STORY_ID') | |
console.log(i) |
This file contains hidden or 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 class="uk-flex"> | |
<input class="uk-margin-right" v-model="model.color" type="color" /> | |
<input class="uk-width-1-1" v-model="model.color" /></div>`, | |
methods: { | |
initWith() { | |
return { | |
plugin: 'example_plugin', | |
color: '#f40000' |
This file contains hidden or 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
Single Story | |
- questions (type: Blocks) | |
-- [component]question | |
--- answers (type: Blocks) | |
---- [component]answer | |
----- name (type: text) | |
---- [component]answer | |
----- name (type: text) | |
---- [component]answer | |
----- name (type: text) |
This file contains hidden or 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="image"></sb-asset-selector> | |
<input type="text" class="uk-margin-top uk-width-1-1" v-model="model.image" /> | |
</div>`, | |
methods: { | |
initWith() { | |
return { | |
plugin: 'example_plugin', |
This file contains hidden or 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
fetch( | |
`https://mapi.storyblok.com/v1/spaces/${SPACE_ID}/stories`, | |
{ | |
method: "POST", | |
mode: "cors", | |
headers: { | |
"Content-Type": "application/json", | |
"Authorization": POWER_TOKEN | |
}, | |
body: JSON.stringify({ |
This file contains hidden or 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> | |
<div class="uk-margin-bottom uk-text-center" v-if="model.icon"> | |
Current icon: <i :class="model.type + ' ' + model.icon"></i> | |
<small style="cursor:pointer;" @click="removeIcon">(remove)</small> | |
</div> | |
<input class="uk-width-1-1 uk-margin-bottom" v-model="search" placeholder="Search icons" /> | |
<span class="icon-link" @click="setIcon(icon)" :key="icon.icon" v-for="icon in filteredIcons" style="margin: 5px; display: inline-block;"> | |
<i style="cursor:pointer;" :class="icon.type + ' ' + icon.icon"></i> |
This file contains hidden or 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> | |
<div class="uk-margin-bottom uk-text-center" v-if="model.icon"> | |
Current icon: <i :class="model.type + ' ' + model.icon"></i> | |
<small style="cursor:pointer;" @click="removeIcon">(remove)</small> | |
</div> | |
<input class="uk-width-1-1 uk-margin-bottom" v-model="search" placeholder="Search icons" /> | |
<span class="icon-link" @click="setIcon(icon)" :key="icon.icon" v-for="icon in filteredIcons" style="margin: 5px; display: inline-block;"> | |
<i style="cursor:pointer;" :class="icon.type + ' ' + icon.icon"></i> |