sanity-plugin-latex-input 0.0.2 → 0.3.0-v3-studio.0
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 +21 -0
- package/README.md +98 -1
- package/lib/cjs/index.js +83 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/esm/index.js +75 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/types/index.d.ts +11 -0
- package/lib/types/index.d.ts.map +1 -0
- package/package.json +84 -34
- package/sanity.json +2 -18
- package/src/components/LatexPreview.tsx +41 -0
- package/src/index.tsx +34 -0
- package/v2-incompatible.js +11 -0
- package/.babelrc +0 -7
- package/.eslintrc +0 -11
- package/lib/components/LatexInput.js +0 -165
- package/lib/components/Preview.css +0 -13
- package/lib/components/Preview.js +0 -105
- package/lib/components/Slider.js +0 -103
- package/lib/components/latexInput.css +0 -111
- package/lib/components/slider.css +0 -105
- package/lib/config.js +0 -15
- package/lib/index.js +0 -16
- package/lib/schema.js +0 -27
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Sanity.io
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,100 @@
|
|
|
1
1
|
# LaTeX input for Sanity
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **NOTE**
|
|
4
|
+
>
|
|
5
|
+
> This is the **Sanity Studio v3 version** of sanity-plugin-latex-input.
|
|
6
|
+
>
|
|
7
|
+
> For the v2 version, please refer to the [v2-branch](https://github.com/sanity-io/latex-input).
|
|
8
|
+
|
|
9
|
+
## What is it?
|
|
10
|
+
|
|
11
|
+
sanity-plugin-latex-input adds support for `latex` schema type, so it can be used in Portable Text Editor (PTE) in Sanity Studio.
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
npm install --save sanity-plugin-latex-input@studio-v3
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
or
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
yarn add sanity-plugin-latex-input@studio-v3
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
Import and add the plugin to your studio config in sanity.config.ts (or .js):
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { latexBlock } from "sanity-plugin-latex-input";
|
|
34
|
+
|
|
35
|
+
export default createConfig({
|
|
36
|
+
/* ... */
|
|
37
|
+
|
|
38
|
+
plugins: [
|
|
39
|
+
latexInput()
|
|
40
|
+
]
|
|
41
|
+
})
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
You may now use the type name `latex` in your schema, such as in portable text.
|
|
45
|
+
|
|
46
|
+
## Example schema definition for portable text
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
import React from 'react'
|
|
50
|
+
const mathInlineIcon = () => (
|
|
51
|
+
<span>
|
|
52
|
+
<span style={{ fontWeight: 'bold' }}>∑</span>b
|
|
53
|
+
</span>
|
|
54
|
+
)
|
|
55
|
+
const mathIcon = () => <span style={{ fontWeight: 'bold' }}>∑</span>
|
|
56
|
+
|
|
57
|
+
export default {
|
|
58
|
+
name: 'portableTextWithLatex',
|
|
59
|
+
type: 'array',
|
|
60
|
+
title: 'Body',
|
|
61
|
+
of: [
|
|
62
|
+
{
|
|
63
|
+
type: 'block',
|
|
64
|
+
title: 'Block',
|
|
65
|
+
of: [
|
|
66
|
+
{ type: 'latex', icon: mathInlineIcon, title: 'Inline math' },
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
{ type: 'latex', icon: mathIcon, title: 'Math block' },
|
|
70
|
+
],
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The Portable Text editor will render a preview of the contents with KaTeX.
|
|
75
|
+
|
|
76
|
+
## License
|
|
77
|
+
|
|
78
|
+
MIT-licensed. See LICENSE.
|
|
79
|
+
|
|
80
|
+
## Develop & test
|
|
81
|
+
|
|
82
|
+
Make sure to run `npm run build` once, then run
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
npm run link-watch
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
In another shell, `cd` to your test studio and run:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
npx yalc add sanity-plugin-latex-input --link && yarn install
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Now, changes in this repo will be automatically built and pushed to the studio,
|
|
95
|
+
triggering hotreload. Yalc avoids issues with react-hooks that are typical when using yarn/npm link.
|
|
96
|
+
|
|
97
|
+
### About build & watch
|
|
98
|
+
|
|
99
|
+
This plugin uses [@sanity/plugin-sdk](https://github.com/sanity-io/plugin-sdk)
|
|
100
|
+
with default configuration for build & watch scripts.
|
package/lib/cjs/index.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
var $dyHF6$sanity = require("sanity");
|
|
2
|
+
var $dyHF6$reactjsxruntime = require("react/jsx-runtime");
|
|
3
|
+
var $dyHF6$react = require("react");
|
|
4
|
+
var $dyHF6$katex = require("katex");
|
|
5
|
+
require("katex/dist/katex.min.css");
|
|
6
|
+
|
|
7
|
+
function $parcel$export(e, n, v, s) {
|
|
8
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
9
|
+
}
|
|
10
|
+
function $parcel$interopDefault(a) {
|
|
11
|
+
return a && a.__esModule ? a.default : a;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
$parcel$export(module.exports, "latexInput", () => $329a1cedcedb1349$export$17b0a661cd4afef9);
|
|
15
|
+
$parcel$export(module.exports, "LatexPreview", () => $a18100092750648b$export$2e2bcd8739ae039);
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
const $a18100092750648b$var$LatexPreview = (props)=>{
|
|
21
|
+
const latex = props.value && props.value.body || "";
|
|
22
|
+
const isInline = props.layout === "inline";
|
|
23
|
+
const [html, setHtml] = (0, $dyHF6$react.useState)("");
|
|
24
|
+
const createHtml = ()=>{
|
|
25
|
+
setHtml((0, ($parcel$interopDefault($dyHF6$katex))).renderToString(latex, {
|
|
26
|
+
displayMode: !isInline,
|
|
27
|
+
throwOnError: false
|
|
28
|
+
}));
|
|
29
|
+
};
|
|
30
|
+
(0, $dyHF6$react.useMemo)(createHtml, [
|
|
31
|
+
latex,
|
|
32
|
+
isInline
|
|
33
|
+
]);
|
|
34
|
+
return /*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)((0, $dyHF6$reactjsxruntime.Fragment), {
|
|
35
|
+
children: isInline ? // eslint-disable-next-line react/no-danger
|
|
36
|
+
/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)("span", {
|
|
37
|
+
dangerouslySetInnerHTML: {
|
|
38
|
+
__html: html
|
|
39
|
+
}
|
|
40
|
+
}) : // eslint-disable-next-line react/no-danger
|
|
41
|
+
/*#__PURE__*/ (0, $dyHF6$reactjsxruntime.jsx)("div", {
|
|
42
|
+
dangerouslySetInnerHTML: {
|
|
43
|
+
__html: html
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
var $a18100092750648b$export$2e2bcd8739ae039 = $a18100092750648b$var$LatexPreview;
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
const $329a1cedcedb1349$export$17b0a661cd4afef9 = (0, $dyHF6$sanity.createPlugin)({
|
|
53
|
+
name: "latex-block-plugin",
|
|
54
|
+
schema: {
|
|
55
|
+
types: [
|
|
56
|
+
(0, $dyHF6$sanity.defineType)({
|
|
57
|
+
type: "object",
|
|
58
|
+
name: "latex",
|
|
59
|
+
components: {
|
|
60
|
+
preview: (0, $a18100092750648b$export$2e2bcd8739ae039)
|
|
61
|
+
},
|
|
62
|
+
fields: [
|
|
63
|
+
{
|
|
64
|
+
title: "LaTeX content",
|
|
65
|
+
name: "body",
|
|
66
|
+
type: "text"
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
preview: {
|
|
70
|
+
select: {
|
|
71
|
+
body: "body"
|
|
72
|
+
},
|
|
73
|
+
prepare (selection) {
|
|
74
|
+
return selection;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}),
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;ACAA;;;;AAaA,MAAM,kCAAY,GAAG,CAAC,KAAwB,GAAK;IACjD,MAAM,KAAK,GAAG,AAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,IAAK,EAAE,AAAC;IACtD,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,KAAK,QAAQ,AAAC;IAC3C,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAA,GAAA,qBAAQ,CAAA,CAAS,EAAE,CAAC,AAAC;IAC7C,MAAM,UAAU,GAAG,IAAM;QACvB,OAAO,CACL,CAAA,GAAA,sCAAK,CAAA,CAAC,cAAc,CAAC,KAAK,EAAE;YAC1B,WAAW,EAAE,CAAC,QAAQ;YACtB,YAAY,EAAE,KAAK;SACpB,CAAC,CACH,CAAC;KACH,AAAC;IAEF,CAAA,GAAA,oBAAO,CAAA,CAAC,UAAU,EAAE;QAAC,KAAK;QAAE,QAAQ;KAAC,CAAC,CAAC;IACvC,qBACE;kBACG,QAAQ,GACP,2CAA2C;sBAC3C,gCAAC,MAAI;YAAC,uBAAuB,EAAE;gBAAE,MAAM,EAAE,IAAI;aAAE;UAAI,GAEnD,2CAA2C;sBAC3C,gCAAC,KAAG;YAAC,uBAAuB,EAAE;gBAAE,MAAM,EAAE,IAAI;aAAE;UAAI,AACnD;MACA,CACH;CACH,AAAC;IAEF,wCAA4B,GAAb,kCAAY;;ADxC3B;;AAKO,MAAM,yCAAU,GAAG,CAAA,GAAA,0BAAY,CAAA,CAAC;IACrC,IAAI,EAAE,oBAAoB;IAC1B,MAAM,EAAE;QACN,KAAK,EAAE;YACL,CAAA,GAAA,wBAAU,CAAA,CAAC;gBACT,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,OAAO;gBACb,UAAU,EAAE;oBACV,OAAO,EAAE,CAAA,GAAA,wCAAY,CAAA;iBACtB;gBACD,MAAM,EAAE;oBACN;wBACE,KAAK,EAAE,eAAe;wBACtB,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,MAAM;qBACb;iBACF;gBACD,OAAO,EAAE;oBACP,MAAM,EAAE;wBACN,IAAI,EAAE,MAAM;qBACb;oBACD,OAAO,EAAC,SAAuB,EAAE;wBAC/B,OAAO,SAAS,CAAC;qBAClB;iBACF;aACF,CAAC;SACH;KACF;CACF,CAAC,AAAC","sources":["src/index.tsx","src/components/LatexPreview.tsx"],"sourcesContent":["import LatexPreview, { LatexPreviewProps } from './components/LatexPreview';\nimport { createPlugin, defineType, type PreviewValue } from 'sanity';\n\nexport { LatexPreview, type LatexPreviewProps };\n\nexport const latexInput = createPlugin({\n name: 'latex-block-plugin',\n schema: {\n types: [\n defineType({\n type: 'object',\n name: 'latex',\n components: {\n preview: LatexPreview,\n },\n fields: [\n {\n title: 'LaTeX content',\n name: 'body',\n type: 'text',\n },\n ],\n preview: {\n select: {\n body: 'body',\n },\n prepare(selection: PreviewValue) {\n return selection;\n },\n },\n }),\n ],\n },\n});\n","import React, { useMemo, useState } from 'react';\nimport KaTeX from 'katex';\nimport 'katex/dist/katex.min.css';\n\ntype SchemaDefinition = {\n body?: string;\n};\n\nexport type LatexPreviewProps = {\n value?: SchemaDefinition;\n layout?: string;\n};\n\nconst LatexPreview = (props: LatexPreviewProps) => {\n const latex = (props.value && props.value.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\nexport default LatexPreview;\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../../"}
|
package/lib/esm/index.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import {createPlugin as $7XdDa$createPlugin, defineType as $7XdDa$defineType} from "sanity";
|
|
2
|
+
import {jsx as $7XdDa$jsx, Fragment as $7XdDa$Fragment} from "react/jsx-runtime";
|
|
3
|
+
import {useState as $7XdDa$useState, useMemo as $7XdDa$useMemo} from "react";
|
|
4
|
+
import $7XdDa$katex from "katex";
|
|
5
|
+
import "katex/dist/katex.min.css";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const $7dfe52883a1c33dd$var$LatexPreview = (props)=>{
|
|
12
|
+
const latex = props.value && props.value.body || "";
|
|
13
|
+
const isInline = props.layout === "inline";
|
|
14
|
+
const [html, setHtml] = (0, $7XdDa$useState)("");
|
|
15
|
+
const createHtml = ()=>{
|
|
16
|
+
setHtml((0, $7XdDa$katex).renderToString(latex, {
|
|
17
|
+
displayMode: !isInline,
|
|
18
|
+
throwOnError: false
|
|
19
|
+
}));
|
|
20
|
+
};
|
|
21
|
+
(0, $7XdDa$useMemo)(createHtml, [
|
|
22
|
+
latex,
|
|
23
|
+
isInline
|
|
24
|
+
]);
|
|
25
|
+
return /*#__PURE__*/ (0, $7XdDa$jsx)((0, $7XdDa$Fragment), {
|
|
26
|
+
children: isInline ? // eslint-disable-next-line react/no-danger
|
|
27
|
+
/*#__PURE__*/ (0, $7XdDa$jsx)("span", {
|
|
28
|
+
dangerouslySetInnerHTML: {
|
|
29
|
+
__html: html
|
|
30
|
+
}
|
|
31
|
+
}) : // eslint-disable-next-line react/no-danger
|
|
32
|
+
/*#__PURE__*/ (0, $7XdDa$jsx)("div", {
|
|
33
|
+
dangerouslySetInnerHTML: {
|
|
34
|
+
__html: html
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
var $7dfe52883a1c33dd$export$2e2bcd8739ae039 = $7dfe52883a1c33dd$var$LatexPreview;
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
const $357f50a17451fe9f$export$17b0a661cd4afef9 = (0, $7XdDa$createPlugin)({
|
|
44
|
+
name: "latex-block-plugin",
|
|
45
|
+
schema: {
|
|
46
|
+
types: [
|
|
47
|
+
(0, $7XdDa$defineType)({
|
|
48
|
+
type: "object",
|
|
49
|
+
name: "latex",
|
|
50
|
+
components: {
|
|
51
|
+
preview: (0, $7dfe52883a1c33dd$export$2e2bcd8739ae039)
|
|
52
|
+
},
|
|
53
|
+
fields: [
|
|
54
|
+
{
|
|
55
|
+
title: "LaTeX content",
|
|
56
|
+
name: "body",
|
|
57
|
+
type: "text"
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
preview: {
|
|
61
|
+
select: {
|
|
62
|
+
body: "body"
|
|
63
|
+
},
|
|
64
|
+
prepare (selection) {
|
|
65
|
+
return selection;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}),
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
export {$357f50a17451fe9f$export$17b0a661cd4afef9 as latexInput, $7dfe52883a1c33dd$export$2e2bcd8739ae039 as LatexPreview};
|
|
75
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;;ACAA;;;;AAaA,MAAM,kCAAY,GAAG,CAAC,KAAwB,GAAK;IACjD,MAAM,KAAK,GAAG,AAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,IAAK,EAAE,AAAC;IACtD,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,KAAK,QAAQ,AAAC;IAC3C,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAA,GAAA,eAAQ,CAAA,CAAS,EAAE,CAAC,AAAC;IAC7C,MAAM,UAAU,GAAG,IAAM;QACvB,OAAO,CACL,CAAA,GAAA,YAAK,CAAA,CAAC,cAAc,CAAC,KAAK,EAAE;YAC1B,WAAW,EAAE,CAAC,QAAQ;YACtB,YAAY,EAAE,KAAK;SACpB,CAAC,CACH,CAAC;KACH,AAAC;IAEF,CAAA,GAAA,cAAO,CAAA,CAAC,UAAU,EAAE;QAAC,KAAK;QAAE,QAAQ;KAAC,CAAC,CAAC;IACvC,qBACE;kBACG,QAAQ,GACP,2CAA2C;sBAC3C,gBAAC,MAAI;YAAC,uBAAuB,EAAE;gBAAE,MAAM,EAAE,IAAI;aAAE;UAAI,GAEnD,2CAA2C;sBAC3C,gBAAC,KAAG;YAAC,uBAAuB,EAAE;gBAAE,MAAM,EAAE,IAAI;aAAE;UAAI,AACnD;MACA,CACH;CACH,AAAC;IAEF,wCAA4B,GAAb,kCAAY;;ADxC3B;;AAKO,MAAM,yCAAU,GAAG,CAAA,GAAA,mBAAY,CAAA,CAAC;IACrC,IAAI,EAAE,oBAAoB;IAC1B,MAAM,EAAE;QACN,KAAK,EAAE;YACL,CAAA,GAAA,iBAAU,CAAA,CAAC;gBACT,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,OAAO;gBACb,UAAU,EAAE;oBACV,OAAO,EAAE,CAAA,GAAA,wCAAY,CAAA;iBACtB;gBACD,MAAM,EAAE;oBACN;wBACE,KAAK,EAAE,eAAe;wBACtB,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,MAAM;qBACb;iBACF;gBACD,OAAO,EAAE;oBACP,MAAM,EAAE;wBACN,IAAI,EAAE,MAAM;qBACb;oBACD,OAAO,EAAC,SAAuB,EAAE;wBAC/B,OAAO,SAAS,CAAC;qBAClB;iBACF;aACF,CAAC;SACH;KACF;CACF,CAAC,AAAC","sources":["src/index.tsx","src/components/LatexPreview.tsx"],"sourcesContent":["import LatexPreview, { LatexPreviewProps } from './components/LatexPreview';\nimport { createPlugin, defineType, type PreviewValue } from 'sanity';\n\nexport { LatexPreview, type LatexPreviewProps };\n\nexport const latexInput = createPlugin({\n name: 'latex-block-plugin',\n schema: {\n types: [\n defineType({\n type: 'object',\n name: 'latex',\n components: {\n preview: LatexPreview,\n },\n fields: [\n {\n title: 'LaTeX content',\n name: 'body',\n type: 'text',\n },\n ],\n preview: {\n select: {\n body: 'body',\n },\n prepare(selection: PreviewValue) {\n return selection;\n },\n },\n }),\n ],\n },\n});\n","import React, { useMemo, useState } from 'react';\nimport KaTeX from 'katex';\nimport 'katex/dist/katex.min.css';\n\ntype SchemaDefinition = {\n body?: string;\n};\n\nexport type LatexPreviewProps = {\n value?: SchemaDefinition;\n layout?: string;\n};\n\nconst LatexPreview = (props: LatexPreviewProps) => {\n const latex = (props.value && props.value.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\nexport default LatexPreview;\n"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../../"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type SchemaDefinition = {
|
|
2
|
+
body?: string;
|
|
3
|
+
};
|
|
4
|
+
export type LatexPreviewProps = {
|
|
5
|
+
value?: SchemaDefinition;
|
|
6
|
+
layout?: string;
|
|
7
|
+
};
|
|
8
|
+
export default LatexPreview;
|
|
9
|
+
export const latexInput: import("sanity").Plugin<void>;
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAIA,wBAAwB;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,gCAAgC;IAC9B,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AA6BF,4BAA4B;ACnC5B,OAAO,MAAM,yCA4BX,CAAC","sources":["src/src/components/LatexPreview.tsx","src/src/index.tsx","src/index.tsx"],"sourcesContent":[null,null,"import LatexPreview, { LatexPreviewProps } from './components/LatexPreview';\nimport { createPlugin, defineType, type PreviewValue } from 'sanity';\n\nexport { LatexPreview, type LatexPreviewProps };\n\nexport const latexInput = createPlugin({\n name: 'latex-block-plugin',\n schema: {\n types: [\n defineType({\n type: 'object',\n name: 'latex',\n components: {\n preview: LatexPreview,\n },\n fields: [\n {\n title: 'LaTeX content',\n name: 'body',\n type: 'text',\n },\n ],\n preview: {\n select: {\n body: 'body',\n },\n prepare(selection: PreviewValue) {\n return selection;\n },\n },\n }),\n ],\n },\n});\n"],"names":[],"version":3,"file":"index.d.ts.map","sourceRoot":"../../"}
|
package/package.json
CHANGED
|
@@ -1,47 +1,97 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sanity-plugin-latex-input",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
3
|
+
"author": "Sanity.io <hello@sanity.io>",
|
|
4
|
+
"version": "0.3.0-v3-studio.0",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/sanity-io/v3-temp--latex-input.git"
|
|
9
|
+
},
|
|
10
|
+
"source": "./src/index.tsx",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"require": "./lib/cjs/index.js",
|
|
14
|
+
"default": "./lib/esm/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"main": "./lib/cjs/index.js",
|
|
18
|
+
"module": "./lib/esm/index.js",
|
|
19
|
+
"types": "./lib/types/index.d.ts",
|
|
20
|
+
"files": [
|
|
21
|
+
"src",
|
|
22
|
+
"lib",
|
|
23
|
+
"v2-incompatible.js",
|
|
24
|
+
"sanity.json"
|
|
13
25
|
],
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
"bugs": {
|
|
17
|
-
"url": "https://github.com/sanity-io/latex-input/issues"
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=14.0.0"
|
|
18
28
|
},
|
|
19
29
|
"scripts": {
|
|
20
|
-
"
|
|
21
|
-
"
|
|
30
|
+
"clean": "rimraf lib",
|
|
31
|
+
"prebuild": "npm run clean && plugin-kit verify-package --silent",
|
|
32
|
+
"build": "parcel build --no-cache",
|
|
33
|
+
"watch": "parcel watch",
|
|
34
|
+
"link-watch": "plugin-kit link-watch",
|
|
35
|
+
"prepublishOnly": "npm run build",
|
|
36
|
+
"compile": "tsc --noEmit",
|
|
37
|
+
"lint": "eslint .",
|
|
38
|
+
"lint:fix": "eslint . --fix",
|
|
39
|
+
"format": "prettier src -w",
|
|
40
|
+
"prepare": "husky install"
|
|
22
41
|
},
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
42
|
+
"prettier": {
|
|
43
|
+
"printWidth": 80,
|
|
44
|
+
"semi": true,
|
|
45
|
+
"singleQuote": true,
|
|
46
|
+
"trailingComma": "es5"
|
|
26
47
|
},
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"babel-eslint": "^7.2.3",
|
|
30
|
-
"babel-plugin-syntax-class-properties": "^6.13.0",
|
|
31
|
-
"babel-plugin-transform-class-properties": "^6.24.1",
|
|
32
|
-
"babel-preset-es2015": "^6.24.1",
|
|
33
|
-
"babel-preset-react": "^6.24.1",
|
|
34
|
-
"eslint": "^4.3.0",
|
|
35
|
-
"eslint-config-sanity": "^2.1.4",
|
|
36
|
-
"eslint-plugin-react": "^7.1.0"
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/sanity-io/latex-input"
|
|
37
50
|
},
|
|
51
|
+
"keywords": [
|
|
52
|
+
"sanity",
|
|
53
|
+
"plugin",
|
|
54
|
+
"latex"
|
|
55
|
+
],
|
|
56
|
+
"homepage": "https://github.com/sanity-io/latex-input#readme",
|
|
38
57
|
"peerDependencies": {
|
|
39
|
-
"react": "
|
|
58
|
+
"react": "^17.0.0 || ^18.0.0",
|
|
59
|
+
"react-dom": "^17.0.0 || ^18.0.0",
|
|
60
|
+
"sanity": "dev-preview",
|
|
61
|
+
"styled-components": "^5.3.5"
|
|
40
62
|
},
|
|
41
63
|
"dependencies": {
|
|
42
|
-
"@sanity/
|
|
43
|
-
"katex": "^0.
|
|
44
|
-
"
|
|
45
|
-
"
|
|
64
|
+
"@sanity/incompatible-plugin": "^0.0.1-studio-v3.1",
|
|
65
|
+
"@types/katex": "^0.11.0",
|
|
66
|
+
"@types/styled-components": "^5.1.25",
|
|
67
|
+
"katex": "^0.11.1"
|
|
68
|
+
},
|
|
69
|
+
"devDependencies": {
|
|
70
|
+
"@commitlint/cli": "^16.1.0",
|
|
71
|
+
"@commitlint/config-conventional": "^15.0.0",
|
|
72
|
+
"@parcel/packager-ts": "^2.6.0",
|
|
73
|
+
"@parcel/transformer-typescript-types": "^2.6.0",
|
|
74
|
+
"@sanity/plugin-kit": "^0.1.0-v3-studio.1",
|
|
75
|
+
"@types/jest": "^27.5.0",
|
|
76
|
+
"@types/react": "^17.0.0 || ^18.0.0",
|
|
77
|
+
"@types/react-dom": "^17.0.0 || ^18.0.0",
|
|
78
|
+
"@typescript-eslint/eslint-plugin": "^5.12.0",
|
|
79
|
+
"@typescript-eslint/parser": "^5.12.0",
|
|
80
|
+
"eslint": "^8.7.0",
|
|
81
|
+
"eslint-config-prettier": "^8.3.0",
|
|
82
|
+
"eslint-config-sanity": "^5.1.0",
|
|
83
|
+
"eslint-plugin-prettier": "4.0.0",
|
|
84
|
+
"eslint-plugin-react": "^7.28.0",
|
|
85
|
+
"husky": "^7.0.4",
|
|
86
|
+
"lint-staged": "^12.3.3",
|
|
87
|
+
"parcel": "^2.6.0",
|
|
88
|
+
"prettier": "^2.5.1",
|
|
89
|
+
"react": "^17.0.0 || ^18.0.0",
|
|
90
|
+
"react-dom": "^17.0.0 || ^18.0.0",
|
|
91
|
+
"rimraf": "^3.0.2",
|
|
92
|
+
"sanity": "^3.0.0-dev-preview.8",
|
|
93
|
+
"standard-version": "^9.3.2",
|
|
94
|
+
"styled-components": "^5.3.5",
|
|
95
|
+
"typescript": "^4.6.4"
|
|
46
96
|
}
|
|
47
97
|
}
|
package/sanity.json
CHANGED
|
@@ -1,24 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"paths": {
|
|
3
|
-
"source": "./src",
|
|
4
|
-
"compiled": "./lib"
|
|
5
|
-
},
|
|
6
2
|
"parts": [
|
|
7
3
|
{
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
"implements": "part:@sanity/form-builder/input/latex",
|
|
13
|
-
"path": "components/index.js"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"name": "part:@sanity/form-builder/input/latex/schema",
|
|
17
|
-
"description": "An editor for code in sanity"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
"implements": "part:@sanity/form-builder/input/latex/schema",
|
|
21
|
-
"path": "schema.js"
|
|
4
|
+
"implements": "part:@sanity/base/sanity-root",
|
|
5
|
+
"path": "./v2-incompatible.js"
|
|
22
6
|
}
|
|
23
7
|
]
|
|
24
8
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { useMemo, useState } from 'react';
|
|
2
|
+
import KaTeX from 'katex';
|
|
3
|
+
import 'katex/dist/katex.min.css';
|
|
4
|
+
|
|
5
|
+
type SchemaDefinition = {
|
|
6
|
+
body?: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type LatexPreviewProps = {
|
|
10
|
+
value?: SchemaDefinition;
|
|
11
|
+
layout?: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const LatexPreview = (props: LatexPreviewProps) => {
|
|
15
|
+
const latex = (props.value && props.value.body) || '';
|
|
16
|
+
const isInline = props.layout === 'inline';
|
|
17
|
+
const [html, setHtml] = useState<string>('');
|
|
18
|
+
const createHtml = () => {
|
|
19
|
+
setHtml(
|
|
20
|
+
KaTeX.renderToString(latex, {
|
|
21
|
+
displayMode: !isInline,
|
|
22
|
+
throwOnError: false,
|
|
23
|
+
})
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
useMemo(createHtml, [latex, isInline]);
|
|
28
|
+
return (
|
|
29
|
+
<>
|
|
30
|
+
{isInline ? (
|
|
31
|
+
// eslint-disable-next-line react/no-danger
|
|
32
|
+
<span dangerouslySetInnerHTML={{ __html: html }} />
|
|
33
|
+
) : (
|
|
34
|
+
// eslint-disable-next-line react/no-danger
|
|
35
|
+
<div dangerouslySetInnerHTML={{ __html: html }} />
|
|
36
|
+
)}
|
|
37
|
+
</>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default LatexPreview;
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import LatexPreview, { LatexPreviewProps } from './components/LatexPreview';
|
|
2
|
+
import { createPlugin, defineType, type PreviewValue } from 'sanity';
|
|
3
|
+
|
|
4
|
+
export { LatexPreview, type LatexPreviewProps };
|
|
5
|
+
|
|
6
|
+
export const latexInput = createPlugin({
|
|
7
|
+
name: 'latex-block-plugin',
|
|
8
|
+
schema: {
|
|
9
|
+
types: [
|
|
10
|
+
defineType({
|
|
11
|
+
type: 'object',
|
|
12
|
+
name: 'latex',
|
|
13
|
+
components: {
|
|
14
|
+
preview: LatexPreview,
|
|
15
|
+
},
|
|
16
|
+
fields: [
|
|
17
|
+
{
|
|
18
|
+
title: 'LaTeX content',
|
|
19
|
+
name: 'body',
|
|
20
|
+
type: 'text',
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
preview: {
|
|
24
|
+
select: {
|
|
25
|
+
body: 'body',
|
|
26
|
+
},
|
|
27
|
+
prepare(selection: PreviewValue) {
|
|
28
|
+
return selection;
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const {showIncompatiblePluginDialog} = require('@sanity/incompatible-plugin')
|
|
2
|
+
const {name, version, sanityExchangeUrl} = require('./package.json')
|
|
3
|
+
|
|
4
|
+
export default showIncompatiblePluginDialog({
|
|
5
|
+
name: name,
|
|
6
|
+
versions: {
|
|
7
|
+
v3: version,
|
|
8
|
+
v2: '^2.30.0',
|
|
9
|
+
},
|
|
10
|
+
sanityExchangeUrl,
|
|
11
|
+
})
|
package/.babelrc
DELETED
package/.eslintrc
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
8
|
-
|
|
9
|
-
var _react = require('react');
|
|
10
|
-
|
|
11
|
-
var _react2 = _interopRequireDefault(_react);
|
|
12
|
-
|
|
13
|
-
var _propTypes = require('prop-types');
|
|
14
|
-
|
|
15
|
-
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
16
|
-
|
|
17
|
-
var _reactAce = require('react-ace');
|
|
18
|
-
|
|
19
|
-
var _reactAce2 = _interopRequireDefault(_reactAce);
|
|
20
|
-
|
|
21
|
-
var _lodash = require('lodash');
|
|
22
|
-
|
|
23
|
-
var _PatchEvent = require('@sanity/form-builder/PatchEvent');
|
|
24
|
-
|
|
25
|
-
var _PatchEvent2 = _interopRequireDefault(_PatchEvent);
|
|
26
|
-
|
|
27
|
-
var _default = require('part:@sanity/components/formfields/default');
|
|
28
|
-
|
|
29
|
-
var _default2 = _interopRequireDefault(_default);
|
|
30
|
-
|
|
31
|
-
var _default3 = require('part:@sanity/components/fieldsets/default');
|
|
32
|
-
|
|
33
|
-
var _default4 = _interopRequireDefault(_default3);
|
|
34
|
-
|
|
35
|
-
var _latexInput = require('./latexInput.css');
|
|
36
|
-
|
|
37
|
-
var _latexInput2 = _interopRequireDefault(_latexInput);
|
|
38
|
-
|
|
39
|
-
var _config = require('../config');
|
|
40
|
-
|
|
41
|
-
require('brace/mode/latex');
|
|
42
|
-
|
|
43
|
-
require('brace/theme/github');
|
|
44
|
-
|
|
45
|
-
require('brace/theme/monokai');
|
|
46
|
-
|
|
47
|
-
require('brace/theme/terminal');
|
|
48
|
-
|
|
49
|
-
require('brace/theme/tomorrow');
|
|
50
|
-
|
|
51
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
52
|
-
|
|
53
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
54
|
-
|
|
55
|
-
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
56
|
-
|
|
57
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
58
|
-
|
|
59
|
-
var CodeInput = function (_PureComponent) {
|
|
60
|
-
_inherits(CodeInput, _PureComponent);
|
|
61
|
-
|
|
62
|
-
function CodeInput() {
|
|
63
|
-
var _ref;
|
|
64
|
-
|
|
65
|
-
var _temp, _this, _ret;
|
|
66
|
-
|
|
67
|
-
_classCallCheck(this, CodeInput);
|
|
68
|
-
|
|
69
|
-
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
70
|
-
args[_key] = arguments[_key];
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = CodeInput.__proto__ || Object.getPrototypeOf(CodeInput)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
|
|
74
|
-
hasFocus: false
|
|
75
|
-
}, _this.handleContentChange = function (content) {
|
|
76
|
-
var _this$props = _this.props,
|
|
77
|
-
type = _this$props.type,
|
|
78
|
-
onChange = _this$props.onChange;
|
|
79
|
-
|
|
80
|
-
var path = ['body'];
|
|
81
|
-
|
|
82
|
-
onChange(_PatchEvent2.default.from([(0, _PatchEvent.setIfMissing)({ _type: type.name }), content ? (0, _PatchEvent.set)(content, path) : (0, _PatchEvent.unset)(path)]));
|
|
83
|
-
}, _this.handleGutterMouseDown = function (event) {
|
|
84
|
-
var target = event.domEvent.target;
|
|
85
|
-
if (target.classList.contains('ace_gutter-cell')) {
|
|
86
|
-
var row = event.getDocumentPosition().row;
|
|
87
|
-
_this.handleToggleSelectLine(row + 1); // Ace starts at row 0
|
|
88
|
-
}
|
|
89
|
-
}, _this.handleEditorLoad = function (editor) {
|
|
90
|
-
_this.editor = editor;
|
|
91
|
-
_this.editor.focus();
|
|
92
|
-
_this.editor.on('guttermousedown', _this.handleGutterMouseDown);
|
|
93
|
-
}, _this.renderEditor = function () {
|
|
94
|
-
var value = _this.props.value;
|
|
95
|
-
|
|
96
|
-
return _react2.default.createElement(_reactAce2.default, {
|
|
97
|
-
mode: 'latex',
|
|
98
|
-
theme: _this.getTheme(),
|
|
99
|
-
width: '100%',
|
|
100
|
-
onChange: _this.handleContentChange,
|
|
101
|
-
name: _this._inputId + '__aceEditor',
|
|
102
|
-
value: value && value.code || '',
|
|
103
|
-
onLoad: _this.handleEditorLoad,
|
|
104
|
-
tabSize: 2,
|
|
105
|
-
setOptions: _config.ACE_SET_OPTIONS,
|
|
106
|
-
editorProps: _config.ACE_EDITOR_PROPS
|
|
107
|
-
});
|
|
108
|
-
}, _temp), _possibleConstructorReturn(_this, _ret);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
_createClass(CodeInput, [{
|
|
112
|
-
key: 'componentWillUnmount',
|
|
113
|
-
value: function componentWillUnmount() {
|
|
114
|
-
this.editor.removeListener('guttermousedown', this.handleGutterMouseDown);
|
|
115
|
-
}
|
|
116
|
-
}, {
|
|
117
|
-
key: 'getTheme',
|
|
118
|
-
value: function getTheme() {
|
|
119
|
-
var preferredTheme = (0, _lodash.get)(this.props.type, 'options.theme');
|
|
120
|
-
return preferredTheme && _config.SUPPORTED_THEMES.find(function (theme) {
|
|
121
|
-
return theme === preferredTheme;
|
|
122
|
-
}) ? preferredTheme : _config.DEFAULT_THEME;
|
|
123
|
-
}
|
|
124
|
-
}, {
|
|
125
|
-
key: 'render',
|
|
126
|
-
value: function render() {
|
|
127
|
-
var _props = this.props,
|
|
128
|
-
type = _props.type,
|
|
129
|
-
level = _props.level;
|
|
130
|
-
|
|
131
|
-
return _react2.default.createElement(
|
|
132
|
-
_default4.default,
|
|
133
|
-
{ legend: type.title, description: type.description },
|
|
134
|
-
_react2.default.createElement(
|
|
135
|
-
_default2.default,
|
|
136
|
-
{ label: type.title, level: level + 1 },
|
|
137
|
-
this.renderEditor()
|
|
138
|
-
)
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
}]);
|
|
142
|
-
|
|
143
|
-
return CodeInput;
|
|
144
|
-
}(_react.PureComponent);
|
|
145
|
-
|
|
146
|
-
CodeInput.propTypes = {
|
|
147
|
-
level: _propTypes2.default.number.isRequired,
|
|
148
|
-
value: _propTypes2.default.shape({
|
|
149
|
-
_type: _propTypes2.default.string,
|
|
150
|
-
latex: _propTypes2.default.string
|
|
151
|
-
}),
|
|
152
|
-
type: _propTypes2.default.shape({
|
|
153
|
-
name: _propTypes2.default.string,
|
|
154
|
-
title: _propTypes2.default.string,
|
|
155
|
-
description: _propTypes2.default.string,
|
|
156
|
-
fields: _propTypes2.default.arrayOf(_propTypes2.default.shape({
|
|
157
|
-
name: _propTypes2.default.string.isRequired
|
|
158
|
-
}))
|
|
159
|
-
}).isRequired,
|
|
160
|
-
onChange: _propTypes2.default.func
|
|
161
|
-
};
|
|
162
|
-
CodeInput.defaultProps = {
|
|
163
|
-
onChange: function onChange() {}
|
|
164
|
-
};
|
|
165
|
-
exports.default = CodeInput;
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
8
|
-
|
|
9
|
-
var _react = require('react');
|
|
10
|
-
|
|
11
|
-
var _react2 = _interopRequireDefault(_react);
|
|
12
|
-
|
|
13
|
-
var _propTypes = require('prop-types');
|
|
14
|
-
|
|
15
|
-
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
16
|
-
|
|
17
|
-
var _Preview = require('./Preview.css');
|
|
18
|
-
|
|
19
|
-
var _Preview2 = _interopRequireDefault(_Preview);
|
|
20
|
-
|
|
21
|
-
require('brace/mode/latex');
|
|
22
|
-
|
|
23
|
-
require('brace/theme/github');
|
|
24
|
-
|
|
25
|
-
require('brace/theme/monokai');
|
|
26
|
-
|
|
27
|
-
require('brace/theme/terminal');
|
|
28
|
-
|
|
29
|
-
require('brace/theme/tomorrow');
|
|
30
|
-
|
|
31
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
32
|
-
|
|
33
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
34
|
-
|
|
35
|
-
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
36
|
-
|
|
37
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
38
|
-
|
|
39
|
-
var CodePreview = function (_PureComponent) {
|
|
40
|
-
_inherits(CodePreview, _PureComponent);
|
|
41
|
-
|
|
42
|
-
function CodePreview() {
|
|
43
|
-
_classCallCheck(this, CodePreview);
|
|
44
|
-
|
|
45
|
-
return _possibleConstructorReturn(this, (CodePreview.__proto__ || Object.getPrototypeOf(CodePreview)).apply(this, arguments));
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
_createClass(CodePreview, [{
|
|
49
|
-
key: 'render',
|
|
50
|
-
value: function render() {
|
|
51
|
-
var layout = this.props.layout;
|
|
52
|
-
|
|
53
|
-
return layout === 'block' ? this.renderBlockPreview() : this.renderDefaultPreview();
|
|
54
|
-
}
|
|
55
|
-
}, {
|
|
56
|
-
key: 'renderDefaultPreview',
|
|
57
|
-
value: function renderDefaultPreview() {
|
|
58
|
-
var value = this.props.value;
|
|
59
|
-
|
|
60
|
-
return _react2.default.createElement(
|
|
61
|
-
'div',
|
|
62
|
-
{ className: _Preview2.default.defaultPreviewContainer },
|
|
63
|
-
_react2.default.createElement(
|
|
64
|
-
'div',
|
|
65
|
-
null,
|
|
66
|
-
'renderDefaultPreview ',
|
|
67
|
-
value && value.body
|
|
68
|
-
)
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
}, {
|
|
72
|
-
key: 'renderBlockPreview',
|
|
73
|
-
value: function renderBlockPreview() {
|
|
74
|
-
var value = this.props.value;
|
|
75
|
-
|
|
76
|
-
return _react2.default.createElement(
|
|
77
|
-
'div',
|
|
78
|
-
{ className: _Preview2.default.root },
|
|
79
|
-
_react2.default.createElement(
|
|
80
|
-
'h3',
|
|
81
|
-
null,
|
|
82
|
-
'renderBlockPreview ',
|
|
83
|
-
value && value.body
|
|
84
|
-
),
|
|
85
|
-
_react2.default.createElement(
|
|
86
|
-
'div',
|
|
87
|
-
{ className: _Preview2.default.aceWrapper },
|
|
88
|
-
'studd'
|
|
89
|
-
)
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
}]);
|
|
93
|
-
|
|
94
|
-
return CodePreview;
|
|
95
|
-
}(_react.PureComponent);
|
|
96
|
-
|
|
97
|
-
CodePreview.propTypes = {
|
|
98
|
-
type: _propTypes2.default.object,
|
|
99
|
-
layout: _propTypes2.default.string,
|
|
100
|
-
value: _propTypes2.default.shape({
|
|
101
|
-
_type: _propTypes2.default.string,
|
|
102
|
-
body: _propTypes2.default.string
|
|
103
|
-
})
|
|
104
|
-
};
|
|
105
|
-
exports.default = CodePreview;
|
package/lib/components/Slider.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
8
|
-
|
|
9
|
-
var _propTypes = require('prop-types');
|
|
10
|
-
|
|
11
|
-
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
12
|
-
|
|
13
|
-
var _react = require('react');
|
|
14
|
-
|
|
15
|
-
var _react2 = _interopRequireDefault(_react);
|
|
16
|
-
|
|
17
|
-
var _default = require('part:@sanity/components/formfields/default');
|
|
18
|
-
|
|
19
|
-
var _default2 = _interopRequireDefault(_default);
|
|
20
|
-
|
|
21
|
-
var _PatchEvent = require('@sanity/form-builder/PatchEvent');
|
|
22
|
-
|
|
23
|
-
var _PatchEvent2 = _interopRequireDefault(_PatchEvent);
|
|
24
|
-
|
|
25
|
-
var _slider = require('./slider.css');
|
|
26
|
-
|
|
27
|
-
var _slider2 = _interopRequireDefault(_slider);
|
|
28
|
-
|
|
29
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
30
|
-
|
|
31
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
32
|
-
|
|
33
|
-
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
34
|
-
|
|
35
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
36
|
-
|
|
37
|
-
var Slider = function (_React$Component) {
|
|
38
|
-
_inherits(Slider, _React$Component);
|
|
39
|
-
|
|
40
|
-
function Slider() {
|
|
41
|
-
var _ref;
|
|
42
|
-
|
|
43
|
-
var _temp, _this, _ret;
|
|
44
|
-
|
|
45
|
-
_classCallCheck(this, Slider);
|
|
46
|
-
|
|
47
|
-
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
48
|
-
args[_key] = arguments[_key];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Slider.__proto__ || Object.getPrototypeOf(Slider)).call.apply(_ref, [this].concat(args))), _this), _this.handleChange = function (event) {
|
|
52
|
-
var inputValue = event.target.value;
|
|
53
|
-
var patch = inputValue === '' ? (0, _PatchEvent.unset)() : (0, _PatchEvent.set)(Number(inputValue));
|
|
54
|
-
_this.props.onChange(_PatchEvent2.default.from(patch));
|
|
55
|
-
}, _temp), _possibleConstructorReturn(_this, _ret);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
_createClass(Slider, [{
|
|
59
|
-
key: 'render',
|
|
60
|
-
value: function render() {
|
|
61
|
-
var _props = this.props,
|
|
62
|
-
type = _props.type,
|
|
63
|
-
value = _props.value,
|
|
64
|
-
level = _props.level;
|
|
65
|
-
var _type$options$range = type.options.range,
|
|
66
|
-
min = _type$options$range.min,
|
|
67
|
-
max = _type$options$range.max,
|
|
68
|
-
step = _type$options$range.step;
|
|
69
|
-
|
|
70
|
-
return _react2.default.createElement(
|
|
71
|
-
_default2.default,
|
|
72
|
-
{ label: type.title, level: level, description: type.description },
|
|
73
|
-
_react2.default.createElement('input', {
|
|
74
|
-
type: 'range',
|
|
75
|
-
className: _slider2.default.slider,
|
|
76
|
-
min: min,
|
|
77
|
-
max: max,
|
|
78
|
-
step: step,
|
|
79
|
-
value: value === undefined ? '' : value,
|
|
80
|
-
onChange: this.handleChange
|
|
81
|
-
})
|
|
82
|
-
);
|
|
83
|
-
}
|
|
84
|
-
}]);
|
|
85
|
-
|
|
86
|
-
return Slider;
|
|
87
|
-
}(_react2.default.Component);
|
|
88
|
-
|
|
89
|
-
Slider.propTypes = {
|
|
90
|
-
type: _propTypes2.default.shape({
|
|
91
|
-
title: _propTypes2.default.string
|
|
92
|
-
}).isRequired,
|
|
93
|
-
level: _propTypes2.default.number,
|
|
94
|
-
value: _propTypes2.default.number,
|
|
95
|
-
onChange: _propTypes2.default.func.isRequired
|
|
96
|
-
};
|
|
97
|
-
exports.default = Slider;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
Slider.defaultProps = {
|
|
101
|
-
level: 1,
|
|
102
|
-
value: null
|
|
103
|
-
};
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
.slider {
|
|
2
|
-
-webkit-appearance: none;
|
|
3
|
-
width: 100%;
|
|
4
|
-
margin: 8.35px 0;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.slider:focus {
|
|
8
|
-
outline: none;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.slider::-webkit-slider-runnable-track {
|
|
12
|
-
width: 100%;
|
|
13
|
-
height: 13.3px;
|
|
14
|
-
cursor: pointer;
|
|
15
|
-
box-shadow: 1.4px 1.4px 1.7px #ffb2df, 0px 0px 1.4px #ffccea;
|
|
16
|
-
background: #ffbae6;
|
|
17
|
-
border-radius: 25px;
|
|
18
|
-
//border: 2.3px solid #dbd58f;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.slider::before::-webkit-slider-thumb {
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.slider::-webkit-slider-thumb {
|
|
25
|
-
border: 5px solid #ffcdff;
|
|
26
|
-
height: 30px;
|
|
27
|
-
width: 30px;
|
|
28
|
-
border-radius: 12px;
|
|
29
|
-
cursor: pointer;
|
|
30
|
-
-webkit-appearance: none;
|
|
31
|
-
margin-top: -8px;
|
|
32
|
-
background-size: 20px;
|
|
33
|
-
background: #ffff7d
|
|
34
|
-
url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' height='20px' width='20px'><text x='0' y='18' font-size='18'>🦄</text></svg>")
|
|
35
|
-
no-repeat;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.slider:focus::-webkit-slider-thumb {
|
|
39
|
-
box-shadow: 4.1px 4.1px 7.2px #27aaff, 0px 0px 4.1px #41b4ff;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.slider:focus::-webkit-slider-runnable-track {
|
|
43
|
-
background: #ff91d8;
|
|
44
|
-
box-shadow: 4.1px 4.1px 7.2px #27aaff, 0px 0px 4.1px #41b4ff;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.slider::-moz-range-track {
|
|
48
|
-
content: '🦄';
|
|
49
|
-
width: 100%;
|
|
50
|
-
height: 13.3px;
|
|
51
|
-
cursor: pointer;
|
|
52
|
-
box-shadow: 1.4px 1.4px 1.7px #ffb2df, 0px 0px 1.4px #ffccea;
|
|
53
|
-
background: #ffbae6;
|
|
54
|
-
border-radius: 25px;
|
|
55
|
-
border: 2.3px solid #dbd58f;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.slider::-moz-range-thumb {
|
|
59
|
-
box-shadow: 4.1px 4.1px 7.2px #27aaff, 0px 0px 4.1px #41b4ff;
|
|
60
|
-
border: 5px solid #ffcdff;
|
|
61
|
-
height: 30px;
|
|
62
|
-
width: 30px;
|
|
63
|
-
border-radius: 12px;
|
|
64
|
-
cursor: pointer;
|
|
65
|
-
background: #ffff7d
|
|
66
|
-
url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' height='20px' width='20px'><text x='0' y='18' font-size='18'>🦄</text></svg>")
|
|
67
|
-
no-repeat;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.slider::-ms-track {
|
|
71
|
-
width: 100%;
|
|
72
|
-
height: 13.3px;
|
|
73
|
-
cursor: pointer;
|
|
74
|
-
background: transparent;
|
|
75
|
-
border-color: transparent;
|
|
76
|
-
color: transparent;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.slider::-ms-fill-lower {
|
|
80
|
-
background: #ff68ca;
|
|
81
|
-
border: 2.3px solid #dbd58f;
|
|
82
|
-
border-radius: 50px;
|
|
83
|
-
box-shadow: 1.4px 1.4px 1.7px #ffb2df, 0px 0px 1.4px #ffccea;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.slider::-ms-fill-upper {
|
|
87
|
-
background: #ff91d8;
|
|
88
|
-
border: 2.3px solid #dbd58f;
|
|
89
|
-
border-radius: 50px;
|
|
90
|
-
box-shadow: 1.4px 1.4px 1.7px #ffb2df, 0px 0px 1.4px #ffccea;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.slider::-ms-thumb {
|
|
94
|
-
box-shadow: 4.1px 4.1px 7.2px #27aaff, 0px 0px 4.1px #41b4ff;
|
|
95
|
-
border: 5px solid #ffcdff;
|
|
96
|
-
width: 30px;
|
|
97
|
-
border-radius: 12px;
|
|
98
|
-
cursor: pointer;
|
|
99
|
-
height: 13.3px;
|
|
100
|
-
background: #ffff7d
|
|
101
|
-
url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' height='20px' width='20px'><text x='0' y='18' font-size='18'>🦄</text></svg>")
|
|
102
|
-
no-repeat;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.slider:focus::-ms-fill-lower {
|
|
106
|
-
background: #ff91d8;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.slider:focus::-ms-fill-upper {
|
|
110
|
-
background: #ffbae6;
|
|
111
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
.slider {
|
|
2
|
-
-webkit-appearance: none;
|
|
3
|
-
width: 100%;
|
|
4
|
-
margin: 8.35px 0;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.slider:focus {
|
|
8
|
-
outline: none;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.slider::-webkit-slider-runnable-track {
|
|
12
|
-
width: 100%;
|
|
13
|
-
height: 13.3px;
|
|
14
|
-
cursor: pointer;
|
|
15
|
-
box-shadow: 1.4px 1.4px 1.7px #ffb2df, 0px 0px 1.4px #ffccea;
|
|
16
|
-
background: #ffbae6;
|
|
17
|
-
border-radius: 25px;
|
|
18
|
-
//border: 2.3px solid #dbd58f;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.slider::before::-webkit-slider-thumb {
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.slider::-webkit-slider-thumb {
|
|
25
|
-
border: 5px solid #ffcdff;
|
|
26
|
-
height: 30px;
|
|
27
|
-
width: 30px;
|
|
28
|
-
border-radius: 12px;
|
|
29
|
-
cursor: pointer;
|
|
30
|
-
-webkit-appearance: none;
|
|
31
|
-
margin-top: -8px;
|
|
32
|
-
background-size: 20px;
|
|
33
|
-
background: #ffff7d url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' height='20px' width='20px'><text x='0' y='18' font-size='18'>🦄</text></svg>") no-repeat;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.slider:focus::-webkit-slider-thumb {
|
|
37
|
-
box-shadow: 4.1px 4.1px 7.2px #27aaff, 0px 0px 4.1px #41b4ff;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.slider:focus::-webkit-slider-runnable-track {
|
|
41
|
-
background: #ff91d8;
|
|
42
|
-
box-shadow: 4.1px 4.1px 7.2px #27aaff, 0px 0px 4.1px #41b4ff;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.slider::-moz-range-track {
|
|
46
|
-
content: '🦄';
|
|
47
|
-
width: 100%;
|
|
48
|
-
height: 13.3px;
|
|
49
|
-
cursor: pointer;
|
|
50
|
-
box-shadow: 1.4px 1.4px 1.7px #ffb2df, 0px 0px 1.4px #ffccea;
|
|
51
|
-
background: #ffbae6;
|
|
52
|
-
border-radius: 25px;
|
|
53
|
-
border: 2.3px solid #dbd58f;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.slider::-moz-range-thumb {
|
|
57
|
-
box-shadow: 4.1px 4.1px 7.2px #27aaff, 0px 0px 4.1px #41b4ff;
|
|
58
|
-
border: 5px solid #ffcdff;
|
|
59
|
-
height: 30px;
|
|
60
|
-
width: 30px;
|
|
61
|
-
border-radius: 12px;
|
|
62
|
-
cursor: pointer;
|
|
63
|
-
background: #ffff7d url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' height='20px' width='20px'><text x='0' y='18' font-size='18'>🦄</text></svg>") no-repeat;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.slider::-ms-track {
|
|
67
|
-
width: 100%;
|
|
68
|
-
height: 13.3px;
|
|
69
|
-
cursor: pointer;
|
|
70
|
-
background: transparent;
|
|
71
|
-
border-color: transparent;
|
|
72
|
-
color: transparent;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.slider::-ms-fill-lower {
|
|
76
|
-
background: #ff68ca;
|
|
77
|
-
border: 2.3px solid #dbd58f;
|
|
78
|
-
border-radius: 50px;
|
|
79
|
-
box-shadow: 1.4px 1.4px 1.7px #ffb2df, 0px 0px 1.4px #ffccea;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
.slider::-ms-fill-upper {
|
|
83
|
-
background: #ff91d8;
|
|
84
|
-
border: 2.3px solid #dbd58f;
|
|
85
|
-
border-radius: 50px;
|
|
86
|
-
box-shadow: 1.4px 1.4px 1.7px #ffb2df, 0px 0px 1.4px #ffccea;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.slider::-ms-thumb {
|
|
90
|
-
box-shadow: 4.1px 4.1px 7.2px #27aaff, 0px 0px 4.1px #41b4ff;
|
|
91
|
-
border: 5px solid #ffcdff;
|
|
92
|
-
width: 30px;
|
|
93
|
-
border-radius: 12px;
|
|
94
|
-
cursor: pointer;
|
|
95
|
-
height: 13.3px;
|
|
96
|
-
background: #ffff7d url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' version='1.1' height='20px' width='20px'><text x='0' y='18' font-size='18'>🦄</text></svg>") no-repeat;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.slider:focus::-ms-fill-lower {
|
|
100
|
-
background: #ff91d8;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.slider:focus::-ms-fill-upper {
|
|
104
|
-
background: #ffbae6;
|
|
105
|
-
}
|
package/lib/config.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
var SUPPORTED_THEMES = exports.SUPPORTED_THEMES = ['github', 'monokai', 'terminal', 'tomorrow'];
|
|
7
|
-
|
|
8
|
-
var DEFAULT_THEME = exports.DEFAULT_THEME = 'tomorrow';
|
|
9
|
-
|
|
10
|
-
var ACE_SET_OPTIONS = exports.ACE_SET_OPTIONS = {
|
|
11
|
-
useSoftTabs: true,
|
|
12
|
-
navigateWithinSoftTabs: true /* note only supported by ace v1.2.7 or higher */
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
var ACE_EDITOR_PROPS = exports.ACE_EDITOR_PROPS = { $blockScrolling: true };
|
package/lib/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var _LatexInput = require('./components/LatexInput');
|
|
8
|
-
|
|
9
|
-
Object.defineProperty(exports, 'default', {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: function get() {
|
|
12
|
-
return _interopRequireDefault(_LatexInput).default;
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/lib/schema.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
|
|
7
|
-
var _Preview = require('./components/Preview');
|
|
8
|
-
|
|
9
|
-
var _Preview2 = _interopRequireDefault(_Preview);
|
|
10
|
-
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
|
-
|
|
13
|
-
exports.default = {
|
|
14
|
-
name: 'latex',
|
|
15
|
-
type: 'object',
|
|
16
|
-
fields: [{
|
|
17
|
-
title: 'Latex',
|
|
18
|
-
name: 'body',
|
|
19
|
-
type: 'text'
|
|
20
|
-
}],
|
|
21
|
-
preview: {
|
|
22
|
-
select: {
|
|
23
|
-
body: 'body'
|
|
24
|
-
},
|
|
25
|
-
component: _Preview2.default
|
|
26
|
-
}
|
|
27
|
-
};
|