SHARE
TWEET

Untitled

a guest Jun 19th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * This is the schema definition for the rich text fields used for
  3.  * for this blog studio. When you import it in schemas.js it can be
  4.  * reused in other parts of the studio with:
  5.  *  {
  6.  *    name: 'someName',
  7.  *    title: 'Some title',
  8.  *    type: 'blockContent'
  9.  *  }
  10.  */
  11.  
  12. import React from 'react'
  13.  
  14. import { FaImages } from 'react-icons/fa'
  15. import { IconContext } from 'react-icons'
  16.  
  17. export default {
  18.   title: 'Block Content',
  19.   name: 'blockContent',
  20.   type: 'array',
  21.   of: [
  22.     {
  23.       title: 'Block',
  24.       type: 'block',
  25.       // Styles let you set what your user can mark up blocks with. These
  26.       // corrensponds with HTML tags, but you can set any title or value
  27.       // you want and decide how you want to deal with it where you want to
  28.       // use your content.
  29.       styles: [
  30.         { title: 'Normal', value: 'normal' },
  31.         { title: 'Titel', value: 'h2' },
  32.       ],
  33.       lists: [{ title: 'Bullet', value: 'bullet' }],
  34.       // Marks let you mark up inline text in the block editor.
  35.       marks: {
  36.         // Decorators usually describe a single property – e.g. a typographic
  37.         // preference or highlighting by editors.
  38.         decorators: [
  39.           { title: 'Strong', value: 'strong' },
  40.           { title: 'Emphasis', value: 'em' },
  41.         ],
  42.         // Annotations can be any object structure – e.g. a link or a footnote.
  43.         annotations: [
  44.           {
  45.             title: 'Internal link',
  46.             name: 'internalLink',
  47.             type: 'object',
  48.             blockEditor: {
  49.               icon: () => 'πŸ”—',
  50.             },
  51.             fields: [
  52.               {
  53.                 name: 'page',
  54.                 type: 'string',
  55.                 options: {
  56.                   list: [
  57.                     { title: 'Homepage', value: '/' },
  58.                     { title: 'Über uns', value: '/ΓΌber-uns' },
  59.                     { title: 'Rezepte', value: '/rezepte' },
  60.                     { title: 'Aktuelles', value: '/aktuelles' },
  61.                     { title: 'Depotstandorte', value: '/depotstandorte' },
  62.                   ],
  63.                 },
  64.               },
  65.             ],
  66.           },
  67.           {
  68.             title: 'External Link',
  69.             name: 'link',
  70.             type: 'object',
  71.             blockEditor: {
  72.               icon: () => '🌍',
  73.             },
  74.             fields: [
  75.               {
  76.                 title: 'URL',
  77.                 name: 'href',
  78.                 type: 'url',
  79.               },
  80.             ],
  81.           },
  82.           {
  83.             title: 'Link zu Rezept',
  84.             name: 'linkRecipe',
  85.             type: 'object',
  86.             blockEditor: {
  87.               icon: () => 'πŸ‘©β€πŸ³',
  88.             },
  89.             fields: [
  90.               {
  91.                 name: 'reference',
  92.                 type: 'reference',
  93.                 to: [{ type: 'recipe' }],
  94.               },
  95.             ],
  96.           },
  97.         ],
  98.       },
  99.     },
  100.     // You can add additional types here. Note that you can't use
  101.     // primitive types such as 'string' and 'number' in the same array
  102.     // as a block type.
  103.     {
  104.       type: 'object',
  105.       title: 'Gallery',
  106.       name: 'gallery',
  107.       icon: FaImages,
  108.             /* preview: {
  109.         component: () => <h2>πŸ“· Gallery</h2>,
  110.       }, */
  111.       preview: {
  112.         select: {
  113.           photos: 'photos',
  114.         },
  115.         component: ({ value }) => (
  116.           <IconContext.Provider
  117.             value={{
  118.               style: { verticalAlign: 'middle', fontSize: '32px' },
  119.             }}
  120.           >
  121.             <strong>
  122.               <FaImages /> Foto-Gallery mit {value.photos.length}
  123.               Foto(s)
  124.             </strong>
  125.           </IconContext.Provider>
  126.         ),
  127.       },
  128.       fields: [
  129.         {
  130.           name: 'photos',
  131.           type: 'array',
  132.           title: 'Fotos',
  133.  
  134.           of: [{ type: 'photo' }],
  135.           options: {
  136.             layout: 'grid',
  137.           },
  138.         },
  139.       ],
  140.     },
  141.   ],
  142. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top