sanity-plugin-markdown
9.0.99.0.10
dist/commonExports-Cm7g7Ikz.d.ts+
dist/commonExports-Cm7g7Ikz.d.tsNew file+96
Index: package/dist/commonExports-Cm7g7Ikz.d.ts
===================================================================
--- package/dist/commonExports-Cm7g7Ikz.d.ts
+++ package/dist/commonExports-Cm7g7Ikz.d.ts
@@ -0,0 +1,96 @@
+import { Plugin, StringDefinition, StringInputProps } from "sanity";
+import { SanityImageAssetDocument } from "@sanity/client";
+import { Options } from "easymde";
+import { SimpleMDEReactProps } from "react-simplemde-editor";
+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;
+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";
+ title: string;
+ components: {
+ input: typeof MarkdownInput;
+ };
+};
+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 { MarkdownInput as a, markdownSchemaType as i, markdownSchema as n, MarkdownInputProps as o, MarkdownDefinition as r, defaultMdeTools as s, MarkdownConfig as t };
+//# sourceMappingURL=commonExports-Cm7g7Ikz.d.ts.map
\ No newline at end of file