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
å | |
alle | |
andre | |
at | |
av | |
både | |
båe | |
bare | |
begge | |
ble |
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
import { toPlainText } from "@portabletext/react" | |
import { BlockEditor as DefaultBlockEditor } from "sanity" | |
import { handlePaste } from "~/studio/components/blockEditor/handlePaste" | |
const wordsPerMinute = 200 | |
export default function BlockEditor(props: any, ref) { | |
const value = props.value ?? [] | |
const plainText = toPlainText(value) | |
const characterCount = plainText.length |
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
import S from '@sanity/desk-tool/structure-builder' | |
import eachDayOfInterval from 'date-fns/eachDayOfInterval' | |
import startOfYear from 'date-fns/startOfYear' | |
import startOfDay from 'date-fns/startOfDay' | |
import endOfDay from 'date-fns/endOfDay' | |
let now = new Date() | |
export default () => S.listItem() | |
.title('Entries by day this year') | |
.child( |
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
import React, { useState } from "react" | |
import { TextInput, Stack } from "@sanity/ui" | |
import { set, unset } from "sanity" | |
interface LinkedInEmbed { | |
_key: string | |
_type: string | |
postUrl: string | |
height: number | |
} |
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
import React, { Component, Fragment } from 'react' | |
import { BlockEditor } from 'part:@sanity/form-builder' | |
import Switch from 'part:@sanity/components/toggles/switch' | |
import css from './BlockEditor.module.css' | |
import { handlePaste } from './handlePaste' | |
export default class CustomEditor extends Component { | |
state = { | |
customPaste: false | |
} |
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
/** | |
* CUSTOM SANITY STUDIO INPUT COMPONENT FOR FONT-AWESOME | |
* | |
* This is a proof of concept custom input component that loads the whole free library of font awesome icons and makes them | |
* searchable in a downshift component. If they're selected the font name will be saved as a string on the document. | |
* | |
* Install dependencies in your studio folder with: | |
* yarn add @fortawesome/fontawesome-svg-core @fortawesome/react-fontawesome @fortawesome/free-solid-svg-icons downshift | |
* | |
* Use as a custom input component in your shcema: |
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
/* eslint-disable no-console */ | |
import client from 'part:@sanity/base/client' | |
// Run this script with: `sanity exec --with-user-token migrations/renameField.js` | |
// | |
// This example shows how you may write a migration script that sets all drafts to published version | |
// and deletes the draft version | |
// This will migrate documents in batches of 100 and continue patching until no more documents are | |
// returned from the query. | |
// |
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
import { redirect } from "next/navigation" | |
import { createClient } from "next-sanity" | |
const client = createClient({ | |
apiVersion: "vX", | |
dataset: process.env.NEXT_PUBLIC_SANITY_DATASET, | |
projectId: process.env.NEXT_PUBLIC_SANITY_PROJECT_ID, | |
token: process.env.SANITY_WRITE_TOKEN, | |
useCdn: true, | |
}) |
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
export default { | |
name: 'department', | |
type: 'document', | |
title: 'Department', | |
fields: [ | |
{ | |
name: 'title', | |
type: 'string', | |
title: 'Title', | |
}, |
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
/* | |
$ sanity init | |
# Follow steps, choose the clean template | |
# go to schemas/schema.js and paste this in | |
*/ | |
// First, we must import the schema creator | |
import createSchema from 'part:@sanity/base/schema-creator' |
NewerOlder