sanity-plugin-markdown

9.0.29.0.3
dist/commonExports.js
dist/commonExports.jsDeleted
−104
Index: package/dist/commonExports.js
===================================================================
--- package/dist/commonExports.js
+++ package/dist/commonExports.js
@@ -1,104 +0,0 @@
-import { PatchEvent, definePlugin, defineType, set, unset, useClient } from "sanity";
-import { c } from "react/compiler-runtime";
-import { Box, Text } from "@sanity/ui";
-import { Suspense, lazy, useEffect, useImperativeHandle, useRef, useState } from "react";
-import { styled } from "styled-components";
-import { jsx } from "react/jsx-runtime";
-const SimpleMdeReact = lazy(() => import("react-simplemde-editor")), MarkdownInputStyles = styled(Box).withConfig({
-	displayName: "MarkdownInputStyles",
-	componentId: "sc-xfwgdd-0"
-})`& .CodeMirror.CodeMirror{color:${({ theme }) => theme.sanity.color.card.enabled.fg};border-color:${({ theme }) => theme.sanity.color.card.enabled.border};background-color:inherit;}& .cm-s-easymde .CodeMirror-cursor{border-color:${({ theme }) => theme.sanity.color.card.enabled.fg};}& .editor-toolbar,.editor-preview-side{border-color:${({ theme }) => theme.sanity.color.card.enabled.border};}& .CodeMirror-focused .CodeMirror-selected.CodeMirror-selected.CodeMirror-selected{background-color:${({ theme }) => theme.sanity.color.selectable?.primary?.hovered?.bg};}& .CodeMirror-selected.CodeMirror-selected.CodeMirror-selected{background-color:${({ theme }) => theme.sanity.color.card.enabled.bg};}& .editor-toolbar > *{color:${({ theme }) => theme.sanity.color.card.enabled.fg};}& .editor-toolbar > .active,.editor-toolbar > button:hover,.editor-preview pre,.cm-s-easymde .cm-comment{background-color:${({ theme }) => theme.sanity.color.card.enabled.bg};}& .editor-preview{background-color:${({ theme }) => theme.sanity.color.card.enabled.bg};& h1,h2,h3,h4,h5,h6{font-size:revert;}& ul,li{list-style:revert;padding:revert;}& a{text-decoration:revert;}}`, defaultMdeTools = [
-	"heading",
-	"bold",
-	"italic",
-	"|",
-	"quote",
-	"unordered-list",
-	"ordered-list",
-	"|",
-	"link",
-	"image",
-	"code",
-	"|",
-	"preview",
-	"side-by-side"
-];
-function MarkdownInput(props) {
-	let $ = c(29), { value: t0, onChange, elementProps: t1, reactMdeProps: t2, schemaType, focused } = props, value = t0 === void 0 ? "" : t0, { onBlur, onFocus, ref: elementRef } = t1, t3;
-	$[0] === t2 ? t3 = $[1] : (t3 = t2 === void 0 ? {} : t2, $[0] = t2, $[1] = t3);
-	let mdeCustomOptions, reactMdeProps;
-	$[2] === t3 ? (mdeCustomOptions = $[3], reactMdeProps = $[4]) : ({options: mdeCustomOptions, ...reactMdeProps} = t3, $[2] = t3, $[3] = mdeCustomOptions, $[4] = reactMdeProps);
-	let t4;
-	$[5] === Symbol.for("react.memo_cache_sentinel") ? (t4 = { apiVersion: "2022-01-01" }, $[5] = t4) : t4 = $[5];
-	let client = useClient(t4), t5;
-	$[6] === schemaType.options ? t5 = $[7] : (t5 = schemaType.options ?? {}, $[6] = schemaType.options, $[7] = t5);
-	let { imageUrl } = t5, [shouldAutoFocus, setShouldAutoFocus] = useState(!1), ref = useRef(null), t6;
-	$[8] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => ref.current, $[8] = t6) : t6 = $[8], useImperativeHandle(elementRef, t6);
-	let t7;
-	$[9] !== client || $[10] !== imageUrl ? (t7 = (file, onSuccess, onError) => {
-		client.assets.upload("image", file).then((doc) => onSuccess(imageUrl ? imageUrl(doc) : `${doc.url}?w=450`)).catch((e) => {
-			console.error(e), onError(e.message);
-		});
-	}, $[9] = client, $[10] = imageUrl, $[11] = t7) : t7 = $[11];
-	let imageUpload = t7, t8;
-	$[12] !== imageUpload || $[13] !== mdeCustomOptions || $[14] !== shouldAutoFocus ? (t8 = {
-		spellChecker: !1,
-		sideBySideFullscreen: !1,
-		uploadImage: !0,
-		imageUploadFunction: imageUpload,
-		toolbar: defaultMdeTools,
-		status: !1,
-		...mdeCustomOptions,
-		autofocus: shouldAutoFocus
-	}, $[12] = imageUpload, $[13] = mdeCustomOptions, $[14] = shouldAutoFocus, $[15] = t8) : t8 = $[15];
-	let mdeOptions = t8, t10, t9;
-	$[16] !== focused || $[17] !== shouldAutoFocus ? (t9 = () => {
-		let node = ref.current;
-		if (node) {
-			if (focused && !shouldAutoFocus) {
-				let raf = requestAnimationFrame(() => setShouldAutoFocus(!node.contains(document.activeElement)));
-				return () => cancelAnimationFrame(raf);
-			}
-			if (!focused && shouldAutoFocus) {
-				let raf_0 = requestAnimationFrame(() => setShouldAutoFocus(node.contains(document.activeElement)));
-				return () => cancelAnimationFrame(raf_0);
-			}
-		}
-	}, t10 = [focused, shouldAutoFocus], $[16] = focused, $[17] = shouldAutoFocus, $[18] = t10, $[19] = t9) : (t10 = $[18], t9 = $[19]), useEffect(t9, t10);
-	let t11;
-	$[20] === onChange ? t11 = $[21] : (t11 = (newValue) => {
-		onChange(PatchEvent.from(newValue ? set(newValue) : unset()));
-	}, $[20] = onChange, $[21] = t11);
-	let handleChange = t11, t12;
-	return $[22] !== handleChange || $[23] !== mdeOptions || $[24] !== onBlur || $[25] !== onFocus || $[26] !== reactMdeProps || $[27] !== value ? (t12 = /* @__PURE__ */ jsx(MarkdownInputStyles, { children: /* @__PURE__ */ jsx(Suspense, {
-		fallback,
-		children: /* @__PURE__ */ jsx(SimpleMdeReact, {
-			...reactMdeProps,
-			ref,
-			value,
-			onChange: handleChange,
-			onBlur,
-			onFocus,
-			options: mdeOptions,
-			spellCheck: !1
-		})
-	}) }), $[22] = handleChange, $[23] = mdeOptions, $[24] = onBlur, $[25] = onFocus, $[26] = reactMdeProps, $[27] = value, $[28] = t12) : t12 = $[28], t12;
-}
-const fallback = /* @__PURE__ */ jsx(Box, {
-	padding: 3,
-	children: /* @__PURE__ */ jsx(Text, { children: "Loading editor..." })
-}), markdownSchemaType = defineType({
-	type: "string",
-	name: "markdown",
-	title: "Markdown",
-	components: { input: MarkdownInput }
-}), markdownSchema = definePlugin((config) => ({
-	name: "markdown-editor",
-	schema: { types: [config && config.input ? {
-		...markdownSchemaType,
-		components: { input: config.input }
-	} : markdownSchemaType] }
-}));
-export { defaultMdeTools as i, markdownSchemaType as n, MarkdownInput as r, markdownSchema as t };
-
-//# sourceMappingURL=commonExports.js.map
\ No newline at end of file