sanity-plugin-markdown
9.0.29.0.3
dist/_chunks-dts/commonExports.d.ts+
dist/_chunks-dts/commonExports.d.tsNew file+173
Index: package/dist/_chunks-dts/commonExports.d.ts
===================================================================
--- package/dist/_chunks-dts/commonExports.d.ts
+++ package/dist/_chunks-dts/commonExports.d.ts
@@ -0,0 +1,173 @@
+/// <reference path="operators/index.d.ts" />
+/// <reference path="testing/index.d.ts" />
+import { Plugin, StringDefinition, StringInputProps } from "sanity";
+import { Options } from "easymde";
+import { SimpleMDEReactProps } from "react-simplemde-editor";
+/**
+ * Note: This will add Symbol.observable globally for all TypeScript users,
+ * however, we are no longer polyfilling Symbol.observable
+ */
+declare global {
+ interface SymbolConstructor {
+ readonly observable: symbol;
+ }
+}
+/**
+ * Used to tag types that is set to `any` as a temporary measure, but should be replaced with proper typings in the future
+ * @internal
+ */
+declare type Any = any;
+/** @internal */
+declare interface SanityAssetDocument extends SanityDocument {
+ url: string;
+ path: string;
+ size: number;
+ assetId: string;
+ mimeType: string;
+ sha1hash: string;
+ extension: string;
+ uploadId?: string;
+ originalFilename?: string;
+}
+/** @internal */
+declare type SanityDocument<T extends Record<string, Any> = Record<string, Any>> = { [P in keyof T]: T[P]; } & {
+ _id: string;
+ _rev: string;
+ _type: string;
+ _createdAt: string;
+ _updatedAt: string;
+ /**
+ * Present when `perspective` is set to `previewDrafts`
+ */
+ _originalId?: string;
+};
+/** @internal */
+declare interface SanityImageAssetDocument extends SanityAssetDocument {
+ metadata: {
+ _type: 'sanity.imageMetadata';
+ hasAlpha: boolean;
+ isOpaque: boolean;
+ lqip?: string;
+ blurHash?: string;
+ thumbHash?: string;
+ dimensions: {
+ _type: 'sanity.imageDimensions';
+ aspectRatio: number;
+ height: number;
+ width: number;
+ };
+ palette?: {
+ _type: 'sanity.imagePalette';
+ darkMuted?: SanityImagePalette;
+ darkVibrant?: SanityImagePalette;
+ dominant?: SanityImagePalette;
+ lightMuted?: SanityImagePalette;
+ lightVibrant?: SanityImagePalette;
+ muted?: SanityImagePalette;
+ vibrant?: SanityImagePalette;
+ };
+ image?: {
+ _type: 'sanity.imageExifTags';
+ [key: string]: Any;
+ };
+ exif?: {
+ _type: 'sanity.imageExifMetadata';
+ [key: string]: Any;
+ };
+ };
+}
+/** @internal */
+declare interface SanityImagePalette {
+ background: string;
+ foreground: string;
+ population: number;
+ title: string;
+}
+declare const markdownTypeName = "markdown";
+interface MarkdownOptions {
+ /**
+ * Used to create image url for any uploaded image.
+ * The function will be invoked whenever an image is pasted or dragged into the
+ * markdown editor, after upload completes.
+ *
+ * The default implementation uses
+ * ```js
+ * imageAsset => `${imageAsset.url}?w=450`
+ * ```
+ * ## Example
+ * ```js
+ * {
+ * imageUrl: imageAsset => `${imageAsset.url}?w=400&h=400`
+ * }
+ * ```
+ * @param imageAsset
+ */
+ imageUrl?: (imageAsset: SanityImageAssetDocument) => string;
+}
+/**
+ * @public
+ */
+interface MarkdownDefinition extends Omit<StringDefinition, 'type' | 'fields' | 'options'> {
+ type: typeof markdownTypeName;
+ options?: MarkdownOptions;
+}
+declare module 'sanity' {
+ interface IntrinsicDefinitions {
+ markdown: MarkdownDefinition;
+ }
+}
+declare const markdownSchemaType: {
+ type: "string";
+ name: "markdown";
+} & Omit<StringDefinition, "preview">;
+interface MarkdownInputProps extends StringInputProps {
+ /**
+ * These are passed along directly to
+ *
+ * Note: MarkdownInput sets certain reactMdeProps.options by default.
+ * These will be merged with any custom options.
+ */
+ reactMdeProps?: Omit<SimpleMDEReactProps, 'value' | 'onChange'>;
+}
+declare const defaultMdeTools: Options['toolbar'];
+declare function MarkdownInput(props: MarkdownInputProps): React.JSX.Element;
+interface MarkdownConfig {
+ /**
+ * When provided, will replace the default input component.
+ *
+ * Use this to customize MarkdownInput by wrapping it in a custom component,
+ * and provide any custom props for https://github.com/RIP21/react-simplemde-editor#react-simplemde-easymde-markdown-editor
+ * via the `reactMdeProps` prop.
+ *
+ * ### Example
+ *
+ * ```tsx
+ * // CustomMarkdownInput.tsx
+ * import { MarkdownInput, MarkdownInputProps } from 'sanity-plugin-markdown'
+ *
+ * export function CustomMarkdownInput(props) {
+ * const reactMdeProps: MarkdownInputProps['reactMdeProps'] =
+ * useMemo(() => {
+ * return {
+ * options: {
+ * toolbar: ['bold', 'italic'],
+ * // more options available, see:
+ * // https://github.com/Ionaru/easy-markdown-editor#options-list
+ * },
+ * // more props available, see:
+ * // https://github.com/RIP21/react-simplemde-editor#react-simplemde-easymde-markdown-editor
+ * }
+ * }, [])
+ *
+ * return <MarkdownInput {...props} reactMdeProps={reactMdeProps} />
+ * }
+ *
+ * // studio.config.ts
+ * markdownSchema({input: CustomMarkdownInput})
+ * ```
+ */
+ input?: (props: StringInputProps) => React.ReactElement;
+}
+declare const markdownSchema: Plugin<MarkdownConfig | void>;
+export { defaultMdeTools as a, MarkdownInputProps as i, markdownSchema as n, MarkdownDefinition as o, MarkdownInput as r, markdownSchemaType as s, MarkdownConfig as t };
+//# sourceMappingURL=commonExports.d.ts.map
\ No newline at end of file