sanity-plugin-latex-input 3.0.0 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/dist/index.d.ts +4 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# sanity-plugin-latex-input
|
|
2
2
|
|
|
3
|
-
> For the v2 version, please refer to the [v2-branch](https://github.com/sanity-io/latex-input/tree/studio-v2).
|
|
4
|
-
|
|
5
3
|
## What is it?
|
|
6
4
|
|
|
7
5
|
sanity-plugin-latex-input adds support for `latex` schema type, so it can be used in Portable Text Editor (PTE) in Sanity Studio.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import * as _$sanity from "sanity";
|
|
2
1
|
import { ObjectDefinition } from "sanity";
|
|
3
|
-
|
|
4
|
-
declare const latexInput: _$sanity.Plugin<void>;
|
|
2
|
+
declare const latexInput: import("sanity").Plugin<void>;
|
|
5
3
|
interface LatexPreviewProps {
|
|
6
4
|
body?: string;
|
|
7
5
|
layout?: string;
|
|
8
6
|
}
|
|
9
|
-
declare const LatexPreview: (props: LatexPreviewProps) =>
|
|
10
|
-
declare const latexTypeName:
|
|
7
|
+
declare const LatexPreview: (props: LatexPreviewProps) => import("react").JSX.Element;
|
|
8
|
+
declare const latexTypeName: 'latex';
|
|
11
9
|
/**
|
|
12
10
|
* @public
|
|
13
11
|
*/
|
|
@@ -23,7 +21,7 @@ declare const latexSchema: {
|
|
|
23
21
|
type: "object";
|
|
24
22
|
name: "latex";
|
|
25
23
|
} & Omit<ObjectDefinition, "preview"> & {
|
|
26
|
-
preview?:
|
|
24
|
+
preview?: import("sanity").PreviewConfig<{
|
|
27
25
|
body: string;
|
|
28
26
|
}, Record<"body", any>> | undefined;
|
|
29
27
|
};
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/plugin.tsx","../src/components/LatexPreview.tsx","../src/schema.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/plugin.tsx","../src/components/LatexPreview.tsx","../src/schema.ts"],"mappings":";cAIa,UAAA,mBAAU,MAAA;AAAA,UCCN,iBAAA;EACf,IAAA;EACA,MAAM;AAAA;AAAA,cAKK,YAAA,GAAY,KAAA,EAAW,iBAAiB,qBAAA,GAAA,CAAA,OAAA;AAAA,cCR/C,aAAA;;AFAN;;UEKiB,eAAA,SAAwB,IAAA,CAAK,gBAAA;EAC5C,IAAA,SAAa,aAAA;AAAA;AAAA;EAAA,UAKI,oBAAA;IACf,KAAA,EAAO,eAAe;EAAA;AAAA;AAAA,cAIb,WAAA"}
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { defineType, definePlugin } from "sanity";
|
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { c } from "react/compiler-runtime";
|
|
4
4
|
import { renderToString } from "katex";
|
|
5
|
+
import "react";
|
|
5
6
|
import "katex/dist/katex.min.css";
|
|
6
7
|
const LatexPreview = (props) => {
|
|
7
8
|
const $ = c(6), latex = props?.body || "", isInline = props.layout === "inline", t0 = !isInline;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/components/LatexPreview.tsx","../src/schema.ts","../src/plugin.tsx"],"sourcesContent":["import {renderToString} from 'katex'\nimport {useMemo} from 'react'\n\nimport 'katex/dist/katex.min.css'\n\nexport interface LatexPreviewProps {\n body?: string\n layout?: string\n}\n\n// KaTeX's renderToString sanitizes its output and does not execute scripts,\n// making it safe to use with dangerouslySetInnerHTML for trusted LaTeX source content.\nexport const LatexPreview = (props: LatexPreviewProps) => {\n const latex = props?.body || ''\n const isInline = props.layout === 'inline'\n\n const html = useMemo(\n () =>\n renderToString(latex, {\n displayMode: !isInline,\n throwOnError: false,\n }),\n [latex, isInline],\n )\n\n return isInline ? (\n <span dangerouslySetInnerHTML={{__html: html}} />\n ) : (\n <div dangerouslySetInnerHTML={{__html: html}} />\n )\n}\n","import {defineType, type ObjectDefinition} from 'sanity'\n\nimport {LatexPreview} from './components/LatexPreview'\n\nconst latexTypeName = 'latex' as const\n\n/**\n * @public\n */\nexport interface LatexDefinition extends Omit<ObjectDefinition, 'type' | 'fields'> {\n type: typeof latexTypeName\n}\n\ndeclare module 'sanity' {\n // makes type: 'latex' narrow correctly when using defineType/defineField/defineArrayMember\n export interface IntrinsicDefinitions {\n latex: LatexDefinition\n }\n}\n\nexport const latexSchema = defineType({\n title: 'Latex',\n type: 'object',\n name: 'latex',\n components: {preview: LatexPreview},\n fields: [\n {\n title: 'LaTeX content',\n name: 'body',\n type: 'text',\n },\n ],\n preview: {\n select: {\n body: 'body',\n },\n },\n})\n","import {definePlugin} from 'sanity'\n\nimport {latexSchema} from './schema'\n\nexport const latexInput = definePlugin({\n name: 'latex-block-plugin',\n schema: {\n types: [latexSchema],\n },\n})\n"],"names":["LatexPreview","props","$","_c","latex","body","isInline","layout","t0","t1","renderToString","displayMode","throwOnError","html","t2","__html","latexSchema","defineType","title","type","name","components","preview","fields","select","latexInput","definePlugin","schema","types"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/components/LatexPreview.tsx","../src/schema.ts","../src/plugin.tsx"],"sourcesContent":["import {renderToString} from 'katex'\nimport {useMemo} from 'react'\n\nimport 'katex/dist/katex.min.css'\n\nexport interface LatexPreviewProps {\n body?: string\n layout?: string\n}\n\n// KaTeX's renderToString sanitizes its output and does not execute scripts,\n// making it safe to use with dangerouslySetInnerHTML for trusted LaTeX source content.\nexport const LatexPreview = (props: LatexPreviewProps) => {\n const latex = props?.body || ''\n const isInline = props.layout === 'inline'\n\n const html = useMemo(\n () =>\n renderToString(latex, {\n displayMode: !isInline,\n throwOnError: false,\n }),\n [latex, isInline],\n )\n\n return isInline ? (\n <span dangerouslySetInnerHTML={{__html: html}} />\n ) : (\n <div dangerouslySetInnerHTML={{__html: html}} />\n )\n}\n","import {defineType, type ObjectDefinition} from 'sanity'\n\nimport {LatexPreview} from './components/LatexPreview'\n\nconst latexTypeName = 'latex' as const\n\n/**\n * @public\n */\nexport interface LatexDefinition extends Omit<ObjectDefinition, 'type' | 'fields'> {\n type: typeof latexTypeName\n}\n\ndeclare module 'sanity' {\n // makes type: 'latex' narrow correctly when using defineType/defineField/defineArrayMember\n export interface IntrinsicDefinitions {\n latex: LatexDefinition\n }\n}\n\nexport const latexSchema = defineType({\n title: 'Latex',\n type: 'object',\n name: 'latex',\n components: {preview: LatexPreview},\n fields: [\n {\n title: 'LaTeX content',\n name: 'body',\n type: 'text',\n },\n ],\n preview: {\n select: {\n body: 'body',\n },\n },\n})\n","import {definePlugin} from 'sanity'\n\nimport {latexSchema} from './schema'\n\nexport const latexInput = definePlugin({\n name: 'latex-block-plugin',\n schema: {\n types: [latexSchema],\n },\n})\n"],"names":["LatexPreview","props","$","_c","latex","body","isInline","layout","t0","t1","renderToString","displayMode","throwOnError","html","t2","__html","latexSchema","defineType","title","type","name","components","preview","fields","select","latexInput","definePlugin","schema","types"],"mappings":";;;;;;AAYO,MAAMA,eAAeC,CAAAA,UAAA;AAAA,QAAAC,IAAAC,EAAA,CAAA,GAC1BC,QAAcH,OAAKI,QAAL,IACdC,WAAiBL,MAAKM,WAAY,UAKfC,MAACF;AAAQ,MAAAG;AAAAP,IAAA,CAAA,MAAAE,SAAAF,SAAAM,MADxBC,KAAAC,eAAeN,OAAO;AAAA,IAAAO,aACPH;AAAAA,IAASI,cACR;AAAA,EAAA,CACf,GAACV,OAAAE,OAAAF,OAAAM,IAAAN,OAAAO,MAAAA,KAAAP,EAAA,CAAA;AALN,QAAAW,OAEIJ;AAKH,MAAAK;AAAA,SAAAZ,EAAA,CAAA,MAAAW,QAAAX,SAAAI,YAEMQ,KAAAR,WACL,oBAAA,QAAA,EAA+B,yBAAA;AAAA,IAAAS,QAASF;AAAAA,EAAAA,EAAI,CAAC,IAE7C,oBAAA,OAAA,EAA8B,yBAAA;AAAA,IAAAE,QAASF;AAAAA,EAAAA,GAAK,GAC7CX,OAAAW,MAAAX,OAAAI,UAAAJ,OAAAY,MAAAA,KAAAZ,EAAA,CAAA,GAJMY;AAIN,GCTUE,cAAcC,WAAW;AAAA,EACpCC,OAAO;AAAA,EACPC,MAAM;AAAA,EACNC,MAAM;AAAA,EACNC,YAAY;AAAA,IAACC,SAAStB;AAAAA,EAAAA;AAAAA,EACtBuB,QAAQ,CACN;AAAA,IACEL,OAAO;AAAA,IACPE,MAAM;AAAA,IACND,MAAM;AAAA,EAAA,CACP;AAAA,EAEHG,SAAS;AAAA,IACPE,QAAQ;AAAA,MACNnB,MAAM;AAAA,IAAA;AAAA,EACR;AAEJ,CAAC,GCjCYoB,aAAaC,aAAa;AAAA,EACrCN,MAAM;AAAA,EACNO,QAAQ;AAAA,IACNC,OAAO,CAACZ,WAAW;AAAA,EAAA;AAEvB,CAAC;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sanity-plugin-latex-input",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "LaTeX input for Portable Text Editor in Sanity Studio.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"latex",
|
|
@@ -31,15 +31,15 @@
|
|
|
31
31
|
"katex": "^0.17.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@sanity/pkg-utils": "^10.
|
|
35
|
-
"@
|
|
34
|
+
"@sanity/pkg-utils": "^10.9.0",
|
|
35
|
+
"@sanity/tsconfig": "^2.1.0",
|
|
36
|
+
"@types/react": "^19.2.17",
|
|
36
37
|
"@types/react-dom": "^19.2.3",
|
|
37
38
|
"babel-plugin-react-compiler": "^1.0.0",
|
|
38
|
-
"react": "^19.2.
|
|
39
|
-
"react-dom": "^19.2.
|
|
40
|
-
"sanity": "^
|
|
41
|
-
"@repo/package.config": "0.0.0"
|
|
42
|
-
"@repo/tsconfig": "0.0.0"
|
|
39
|
+
"react": "^19.2.7",
|
|
40
|
+
"react-dom": "^19.2.7",
|
|
41
|
+
"sanity": "^6.3.0",
|
|
42
|
+
"@repo/package.config": "0.0.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"react": "^19.2",
|