Skip to content

Instantly share code, notes, and snippets.

@kmelve
kmelve / BlockEditor.js
Created September 14, 2019 11:56
Custom portable text / block editor for Sanity with markdown paste and stats
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
}
@bjoerge
bjoerge / recover-schema.md
Last active October 4, 2024 15:04
How to recover lost schema from *.sanity.studio.md

First, go to https://<yourname>.sanity.studio (or to the url of your studio if it's hosted elsewhere). Then open the developer console (usually by one of the keyboard shortcuts Command+Option+I, F12 or Control+Shift+I depending on what browser/platform you are using)

Steps

  1. Open the Sources tab
  2. Find the app.bundle.js file in the sidebar tree view.
  3. Hit the pretty print source button
  4. Locate your schema types by searching (e.g. try searching for one of your custom types) it in the source view.
import "@kickstartds/core/lib/container-queries";
import { Component, define } from "@kickstartds/core/lib/core";
import { windowEvents } from "@kickstartds/core/lib/utils";
const desktopImageOffsetAngle = 60;
const mobileImageOffsetAngle = 75;
const mobileOffsetRotateAngle = 45;
const backgroundRotateFactor = -0.25;
const maxBlur = 4;
@nkgentile
nkgentile / SplitViewLink.tsx
Last active March 15, 2023 21:43
Duplicate the current pane, switching to provided view ID