sanity-plugin-latex-input 2.0.4 → 2.0.5
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/LICENSE +1 -1
- package/README.md +1 -1
- package/lib/index.esm.js +1 -2
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +1 -2
- package/lib/index.js.map +1 -1
- package/lib/src/index.d.ts +4 -3
- package/package.json +5 -8
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ yarn add sanity-plugin-latex-input
|
|
|
27
27
|
Import and add the plugin to your studio config in sanity.config.ts (or .js):
|
|
28
28
|
|
|
29
29
|
```ts
|
|
30
|
-
import {
|
|
30
|
+
import { latexInput } from "sanity-plugin-latex-input";
|
|
31
31
|
|
|
32
32
|
export default defineConfig({
|
|
33
33
|
/* ... */
|
package/lib/index.esm.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import{defineType as e,definePlugin as t}from"sanity";import{jsx as o,Fragment as r}from"react/jsx-runtime";import{useState as n,useMemo as i}from"react";import a from"katex";import"katex/dist/katex.min.css";const m=e=>{const t=(null==e?void 0:e.body)||"",m="inline"===e.layout,[l,p]=n("");return i((()=>{p(a.renderToString(t,{displayMode:!m,throwOnError:!1}))}),[t,m]),o(r,{children:o(m?"span":"div",{dangerouslySetInnerHTML:{__html:l}})})},l=e({type:"object",name:"latex",components:{preview:m},fields:[{title:"LaTeX content",name:"body",type:"text"}],preview:{select:{body:"body"}}}),p=t({name:"latex-block-plugin",schema:{types:[l]}});export{m as LatexPreview,p as latexInput,l as latexSchema}
|
|
2
|
-
//# sourceMappingURL=index.esm.js.map
|
|
1
|
+
import{defineType as e,definePlugin as t}from"sanity";import{jsx as o,Fragment as r}from"react/jsx-runtime";import{useState as n,useMemo as i}from"react";import a from"katex";import"katex/dist/katex.min.css";const m=e=>{const t=(null==e?void 0:e.body)||"",m="inline"===e.layout,[l,p]=n("");return i((()=>{p(a.renderToString(t,{displayMode:!m,throwOnError:!1}))}),[t,m]),o(r,{children:o(m?"span":"div",{dangerouslySetInnerHTML:{__html:l}})})},l=e({type:"object",name:"latex",components:{preview:m},fields:[{title:"LaTeX content",name:"body",type:"text"}],preview:{select:{body:"body"}}}),p=t({name:"latex-block-plugin",schema:{types:[l]}});export{m as LatexPreview,p as latexInput,l as latexSchema};//# sourceMappingURL=index.esm.js.map
|
package/lib/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/components/LatexPreview.tsx","../src/schema.ts","../src/plugin.tsx"],"sourcesContent":["import React, { useMemo, useState } from 'react';\nimport KaTeX from 'katex';\nimport 'katex/dist/katex.min.css';\n\nexport interface LatexPreviewProps {\n body?: string;\n layout?: string;\n}\n\nexport const LatexPreview = (props: LatexPreviewProps) => {\n const latex = props?.body || '';\n const isInline = props.layout === 'inline';\n const [html, setHtml] = useState<string>('');\n const createHtml = () => {\n setHtml(\n KaTeX.renderToString(latex, {\n displayMode: !isInline,\n throwOnError: false,\n })\n );\n };\n\n useMemo(createHtml, [latex, isInline]);\n return (\n <>\n {isInline ? (\n // eslint-disable-next-line react/no-danger\n <span dangerouslySetInnerHTML={{ __html: html }} />\n ) : (\n // eslint-disable-next-line react/no-danger\n <div dangerouslySetInnerHTML={{ __html: html }} />\n )}\n </>\n );\n};\n","import { defineType, ObjectDefinition } from 'sanity';\nimport { LatexPreview } from './components/LatexPreview';\n\nconst latexTypeName = 'latex' as const;\n\n/**\n * @public\n */\nexport interface LatexDefinition\n extends Omit<ObjectDefinition, 'type' | 'fields'> {\n type: typeof latexTypeName;\n}\n\ndeclare module '@sanity/types' {\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 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';\nimport { latexSchema } from './schema';\n\nexport const latexInput = definePlugin({\n name: 'latex-block-plugin',\n schema: {\n types: [latexSchema],\n },\n});\n"],"names":["
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/components/LatexPreview.tsx","../src/schema.ts","../src/plugin.tsx"],"sourcesContent":["import React, { useMemo, useState } from 'react';\nimport KaTeX from 'katex';\nimport 'katex/dist/katex.min.css';\n\nexport interface LatexPreviewProps {\n body?: string;\n layout?: string;\n}\n\nexport const LatexPreview = (props: LatexPreviewProps) => {\n const latex = props?.body || '';\n const isInline = props.layout === 'inline';\n const [html, setHtml] = useState<string>('');\n const createHtml = () => {\n setHtml(\n KaTeX.renderToString(latex, {\n displayMode: !isInline,\n throwOnError: false,\n })\n );\n };\n\n useMemo(createHtml, [latex, isInline]);\n return (\n <>\n {isInline ? (\n // eslint-disable-next-line react/no-danger\n <span dangerouslySetInnerHTML={{ __html: html }} />\n ) : (\n // eslint-disable-next-line react/no-danger\n <div dangerouslySetInnerHTML={{ __html: html }} />\n )}\n </>\n );\n};\n","import { defineType, ObjectDefinition } from 'sanity';\nimport { LatexPreview } from './components/LatexPreview';\n\nconst latexTypeName = 'latex' as const;\n\n/**\n * @public\n */\nexport interface LatexDefinition\n extends Omit<ObjectDefinition, 'type' | 'fields'> {\n type: typeof latexTypeName;\n}\n\ndeclare module '@sanity/types' {\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 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';\nimport { latexSchema } from './schema';\n\nexport const latexInput = definePlugin({\n name: 'latex-block-plugin',\n schema: {\n types: [latexSchema],\n },\n});\n"],"names":["defineType","definePlugin","jsx","Fragment","useState","useMemo","KaTeX","LatexPreview","props","latex","body","isInline","layout","html","setHtml","createHtml","renderToString","displayMode","throwOnError","children","dangerouslySetInnerHTML","__html","latexSchema","type","name","components","preview","fields","title","select","latexInput","schema","types"],"mappings":"qBASaA,kBAAAC,MAAA,uBAAAC,cAAAC,MAAA,uCAAAC,aAAAC,MAAA,eAAAC,MAAA,cAAA,2BAAA,MAAAC,EAAgBC,IACrB,MAAAC,SAAQD,WAAOE,OAAQ,GACvBC,EAA4B,WAAjBH,EAAMI,QAChBC,EAAMC,GAAWV,EAAiB,IAWzC,OADAC,GATmBU,KACjBD,EACER,EAAMU,eAAeP,EAAO,CAC1BQ,aAAcN,EACdO,cAAc,IAElB,GAGkB,CAACT,EAAOE,IAGvBT,EAAAC,EAAA,CAAAgB,WAAAR,EAEE,OAGA,MAHK,CAAAS,wBAAyB,CAAEC,OAAQR,MAK7C,ECZSS,EAActB,EAAW,CACpCuB,KAAM,SACNC,KAAM,QACNC,WAAY,CAAEC,QAASnB,GACvBoB,OAAQ,CACN,CACEC,MAAO,gBACPJ,KAAM,OACND,KAAM,SAGVG,QAAS,CACPG,OAAQ,CACNnB,KAAM,WC9BCoB,EAAa7B,EAAa,CACrCuB,KAAM,qBACNO,OAAQ,CACNC,MAAO,CAACV,aAEXf,kBAAAuB,gBAAAR"}
|
package/lib/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("sanity"),t=require("react/jsx-runtime"),r=require("react"),n=require("katex");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("katex/dist/katex.min.css");var i=a(n);const o=e=>{const n=(null==e?void 0:e.body)||"",a="inline"===e.layout,[o,s]=r.useState("");return r.useMemo((()=>{s(i.default.renderToString(n,{displayMode:!a,throwOnError:!1}))}),[n,a]),t.jsx(t.Fragment,{children:a?t.jsx("span",{dangerouslySetInnerHTML:{__html:o}}):t.jsx("div",{dangerouslySetInnerHTML:{__html:o}})})},s=e.defineType({type:"object",name:"latex",components:{preview:o},fields:[{title:"LaTeX content",name:"body",type:"text"}],preview:{select:{body:"body"}}}),l=e.definePlugin({name:"latex-block-plugin",schema:{types:[s]}});exports.LatexPreview=o,exports.latexInput=l,exports.latexSchema=s
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("sanity"),t=require("react/jsx-runtime"),r=require("react"),n=require("katex");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("katex/dist/katex.min.css");var i=a(n);const o=e=>{const n=(null==e?void 0:e.body)||"",a="inline"===e.layout,[o,s]=r.useState("");return r.useMemo((()=>{s(i.default.renderToString(n,{displayMode:!a,throwOnError:!1}))}),[n,a]),t.jsx(t.Fragment,{children:a?t.jsx("span",{dangerouslySetInnerHTML:{__html:o}}):t.jsx("div",{dangerouslySetInnerHTML:{__html:o}})})},s=e.defineType({type:"object",name:"latex",components:{preview:o},fields:[{title:"LaTeX content",name:"body",type:"text"}],preview:{select:{body:"body"}}}),l=e.definePlugin({name:"latex-block-plugin",schema:{types:[s]}});exports.LatexPreview=o,exports.latexInput=l,exports.latexSchema=s;//# sourceMappingURL=index.js.map
|
package/lib/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 React, { useMemo, useState } from 'react';\nimport KaTeX from 'katex';\nimport 'katex/dist/katex.min.css';\n\nexport interface LatexPreviewProps {\n body?: string;\n layout?: string;\n}\n\nexport const LatexPreview = (props: LatexPreviewProps) => {\n const latex = props?.body || '';\n const isInline = props.layout === 'inline';\n const [html, setHtml] = useState<string>('');\n const createHtml = () => {\n setHtml(\n KaTeX.renderToString(latex, {\n displayMode: !isInline,\n throwOnError: false,\n })\n );\n };\n\n useMemo(createHtml, [latex, isInline]);\n return (\n <>\n {isInline ? (\n // eslint-disable-next-line react/no-danger\n <span dangerouslySetInnerHTML={{ __html: html }} />\n ) : (\n // eslint-disable-next-line react/no-danger\n <div dangerouslySetInnerHTML={{ __html: html }} />\n )}\n </>\n );\n};\n","import { defineType, ObjectDefinition } from 'sanity';\nimport { LatexPreview } from './components/LatexPreview';\n\nconst latexTypeName = 'latex' as const;\n\n/**\n * @public\n */\nexport interface LatexDefinition\n extends Omit<ObjectDefinition, 'type' | 'fields'> {\n type: typeof latexTypeName;\n}\n\ndeclare module '@sanity/types' {\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 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';\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","latex","body","isInline","layout","html","setHtml","useState","useMemo","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/components/LatexPreview.tsx","../src/schema.ts","../src/plugin.tsx"],"sourcesContent":["import React, { useMemo, useState } from 'react';\nimport KaTeX from 'katex';\nimport 'katex/dist/katex.min.css';\n\nexport interface LatexPreviewProps {\n body?: string;\n layout?: string;\n}\n\nexport const LatexPreview = (props: LatexPreviewProps) => {\n const latex = props?.body || '';\n const isInline = props.layout === 'inline';\n const [html, setHtml] = useState<string>('');\n const createHtml = () => {\n setHtml(\n KaTeX.renderToString(latex, {\n displayMode: !isInline,\n throwOnError: false,\n })\n );\n };\n\n useMemo(createHtml, [latex, isInline]);\n return (\n <>\n {isInline ? (\n // eslint-disable-next-line react/no-danger\n <span dangerouslySetInnerHTML={{ __html: html }} />\n ) : (\n // eslint-disable-next-line react/no-danger\n <div dangerouslySetInnerHTML={{ __html: html }} />\n )}\n </>\n );\n};\n","import { defineType, ObjectDefinition } from 'sanity';\nimport { LatexPreview } from './components/LatexPreview';\n\nconst latexTypeName = 'latex' as const;\n\n/**\n * @public\n */\nexport interface LatexDefinition\n extends Omit<ObjectDefinition, 'type' | 'fields'> {\n type: typeof latexTypeName;\n}\n\ndeclare module '@sanity/types' {\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 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';\nimport { latexSchema } from './schema';\n\nexport const latexInput = definePlugin({\n name: 'latex-block-plugin',\n schema: {\n types: [latexSchema],\n },\n});\n"],"names":["Object","defineProperty","exports","value","sanity","require","jsxRuntime","react","KaTeX","_interopDefaultCompat","e","default","KaTeX__default","LatexPreview","props","latex","body","isInline","layout","html","setHtml","useState","useMemo","createHtml","renderToString","displayMode","throwOnError","jsx","Fragment","children","dangerouslySetInnerHTML","__html","latexSchema","defineType","type","name","components","preview","fields","title","select","latexInput","definePlugin","schema","types"],"mappings":"AASa,aAAAA,OAAAC,eAAAC,QAAA,aAAA,CAAAC,OAAA,IAAA,IAAAC,EAAAC,QAAA,UAAAC,EAAAD,QAAA,qBAAAE,EAAAF,QAAA,SAAAG,EAAAH,QAAA,SAAA,SAAAI,EAAAC,GAAA,OAAAA,GAAA,iBAAAA,GAAA,YAAAA,EAAAA,EAAA,CAAAC,QAAAD,EAAA,CAAAL,QAAA,4BAAA,IAAAO,EAAAH,EAAAD,GAAA,MAAAK,EAAgBC,IACrB,MAAAC,SAAQD,WAAOE,OAAQ,GACvBC,EAA4B,WAAjBH,EAAMI,QAChBC,EAAMC,GAAWC,WAAiB,IAWzC,OADAC,EAAAA,SATmBC,KACjBH,EACEZ,EAAAG,QAAMa,eAAeT,EAAO,CAC1BU,aAAcR,EACdS,cAAc,IAElB,GAGkB,CAACX,EAAOE,IAGvBU,MAAAC,EAAAA,SAAA,CAAAC,SAAAZ,QAEE,OAAK,CAAAa,wBAAyB,CAAEC,OAAQZ,WAGxC,MAAI,CAAAW,wBAAyB,CAAEC,OAAQZ,MAE5C,ECZSa,EAAcC,EAAAA,WAAW,CACpCC,KAAM,SACNC,KAAM,QACNC,WAAY,CAAEC,QAASxB,GACvByB,OAAQ,CACN,CACEC,MAAO,gBACPJ,KAAM,OACND,KAAM,SAGVG,QAAS,CACPG,OAAQ,CACNxB,KAAM,WC9BCyB,EAAaC,eAAa,CACrCP,KAAM,qBACNQ,OAAQ,CACNC,MAAO,CAACZ,MAEX9B,QAAAW,aAAAA,EAAAX,QAAAuC,WAAAA,EAAAvC,QAAA8B,YAAAA"}
|
package/lib/src/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
|
|
3
1
|
import { ObjectDefinition } from 'sanity';
|
|
4
2
|
import { Plugin as Plugin_2 } from 'sanity';
|
|
5
3
|
import { PreviewConfig } from 'sanity';
|
|
4
|
+
import { default as React_2 } from 'react';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* @public
|
|
@@ -14,7 +13,9 @@ export declare interface LatexDefinition
|
|
|
14
13
|
|
|
15
14
|
export declare const latexInput: Plugin_2<void>;
|
|
16
15
|
|
|
17
|
-
export declare const LatexPreview: (
|
|
16
|
+
export declare const LatexPreview: (
|
|
17
|
+
props: LatexPreviewProps
|
|
18
|
+
) => React_2.JSX.Element;
|
|
18
19
|
|
|
19
20
|
export declare interface LatexPreviewProps {
|
|
20
21
|
body?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sanity-plugin-latex-input",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "Latex input for Portable Text Editor in Sanity Studio V3.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity",
|
|
@@ -58,14 +58,13 @@
|
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@sanity/incompatible-plugin": "^1.0.4",
|
|
61
|
-
"@types/katex": "^0.
|
|
62
|
-
"
|
|
63
|
-
"katex": "^0.11.1"
|
|
61
|
+
"@types/katex": "^0.16.0",
|
|
62
|
+
"katex": "^0.16.0"
|
|
64
63
|
},
|
|
65
64
|
"devDependencies": {
|
|
66
65
|
"@commitlint/cli": "^17.2.0",
|
|
67
66
|
"@commitlint/config-conventional": "^17.2.0",
|
|
68
|
-
"@sanity/pkg-utils": "^
|
|
67
|
+
"@sanity/pkg-utils": "^2.4.9",
|
|
69
68
|
"@sanity/plugin-kit": "^2.1.19",
|
|
70
69
|
"@sanity/semantic-release-preset": "^2.0.2",
|
|
71
70
|
"@types/jest": "^27.5.0",
|
|
@@ -88,14 +87,12 @@
|
|
|
88
87
|
"rimraf": "^3.0.2",
|
|
89
88
|
"sanity": "^3.0.1",
|
|
90
89
|
"standard-version": "^9.3.2",
|
|
91
|
-
"styled-components": "^5.3.5",
|
|
92
90
|
"typescript": "^4.8.4"
|
|
93
91
|
},
|
|
94
92
|
"peerDependencies": {
|
|
95
93
|
"react": "^18",
|
|
96
94
|
"react-dom": "^18",
|
|
97
|
-
"sanity": "^3.0.0"
|
|
98
|
-
"styled-components": "^5.3.5"
|
|
95
|
+
"sanity": "^3.0.0"
|
|
99
96
|
},
|
|
100
97
|
"engines": {
|
|
101
98
|
"node": ">=14"
|