@lowdefy/blocks-markdown 3.22.0 → 4.0.0-alpha.1
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/dist/blocks/DangerousMarkdown/DangerousMarkdown.js +45 -0
- package/dist/blocks/DangerousMarkdown/index.js +15 -0
- package/dist/blocks/DangerousMarkdown/schema.json +30 -0
- package/dist/blocks/Markdown/Markdown.js +34 -0
- package/dist/blocks/Markdown/index.js +15 -0
- package/dist/blocks/Markdown/schema.json +28 -0
- package/dist/blocks/MarkdownWithCode/MarkdownWithCode.js +68 -0
- package/dist/blocks/MarkdownWithCode/index.js +15 -0
- package/dist/blocks/MarkdownWithCode/schema.json +28 -0
- package/dist/index.js +29 -0
- package/dist/style.less +483 -0
- package/package.json +27 -39
- package/dist/106.js +0 -1
- package/dist/327.js +0 -1
- package/dist/328.js +0 -2
- package/dist/328.js.LICENSE.txt +0 -1
- package/dist/336.js +0 -1
- package/dist/443.js +0 -1
- package/dist/453.js +0 -2
- package/dist/453.js.LICENSE.txt +0 -15
- package/dist/466.js +0 -2
- package/dist/466.js.LICENSE.txt +0 -8
- package/dist/523.js +0 -2
- package/dist/523.js.LICENSE.txt +0 -43
- package/dist/621.js +0 -2
- package/dist/621.js.LICENSE.txt +0 -6
- package/dist/757.js +0 -2
- package/dist/757.js.LICENSE.txt +0 -14
- package/dist/830.js +0 -1
- package/dist/909.js +0 -1
- package/dist/main.js +0 -1
- package/dist/meta/DangerousMarkdown.json +0 -1
- package/dist/meta/Markdown.json +0 -1
- package/dist/meta/MarkdownWithCode.json +0 -1
- package/dist/remoteEntry.js +0 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
*/ import React from 'react';
|
|
17
|
+
import DOMPurify from 'dompurify';
|
|
18
|
+
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
19
|
+
import ReactMarkdown from 'react-markdown';
|
|
20
|
+
import gfm from 'remark-gfm';
|
|
21
|
+
let DangerousMarkdown = class DangerousMarkdown extends React.Component {
|
|
22
|
+
render() {
|
|
23
|
+
const { blockId , properties , methods } = this.props;
|
|
24
|
+
return(/*#__PURE__*/ _jsx("div", {
|
|
25
|
+
id: blockId,
|
|
26
|
+
className: methods.makeCssClass(properties.style),
|
|
27
|
+
children: /*#__PURE__*/ _jsx(ReactMarkdown, {
|
|
28
|
+
className: "markdown-body",
|
|
29
|
+
plugins: [
|
|
30
|
+
gfm
|
|
31
|
+
],
|
|
32
|
+
allowDangerousHtml: true,
|
|
33
|
+
skipHtml: false,
|
|
34
|
+
children: DOMPurify.sanitize(this.props.properties.content, this.DOMPurifyOptions)
|
|
35
|
+
})
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
constructor(props){
|
|
39
|
+
super(props);
|
|
40
|
+
// we do not revaluate DOMPurifyOptions improve options safety by not making options dynamic.
|
|
41
|
+
this.DOMPurifyOptions = props.properties.DOMPurifyOptions;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
DangerousMarkdown.defaultProps = blockDefaultProps;
|
|
45
|
+
export default DangerousMarkdown;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"properties": {
|
|
7
|
+
"content": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Content in markdown format.",
|
|
10
|
+
"docs": {
|
|
11
|
+
"displayType": "text-area"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"DOMPurifyOptions": {
|
|
15
|
+
"type": "object",
|
|
16
|
+
"description": "Customize DOMPurify options. Options are only applied when the block is mounted, thus any parsed settings is only applied at first render.",
|
|
17
|
+
"docs": {
|
|
18
|
+
"displayType": "yaml"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"style": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"description": "Style to apply to Markdown div.",
|
|
24
|
+
"docs": {
|
|
25
|
+
"displayType": "yaml"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
*/ import React from 'react';
|
|
17
|
+
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
18
|
+
import ReactMarkdown from 'react-markdown';
|
|
19
|
+
import gfm from 'remark-gfm';
|
|
20
|
+
const Markdown = ({ blockId , properties , methods })=>/*#__PURE__*/ _jsx("div", {
|
|
21
|
+
id: blockId,
|
|
22
|
+
className: methods.makeCssClass(properties.style),
|
|
23
|
+
children: /*#__PURE__*/ _jsx(ReactMarkdown, {
|
|
24
|
+
className: "markdown-body",
|
|
25
|
+
plugins: [
|
|
26
|
+
gfm
|
|
27
|
+
],
|
|
28
|
+
skipHtml: properties.skipHtml,
|
|
29
|
+
children: properties.content
|
|
30
|
+
})
|
|
31
|
+
})
|
|
32
|
+
;
|
|
33
|
+
Markdown.defaultProps = blockDefaultProps;
|
|
34
|
+
export default Markdown;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"properties": {
|
|
7
|
+
"content": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Content in markdown format.",
|
|
10
|
+
"docs": {
|
|
11
|
+
"displayType": "text-area"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"skipHtml": {
|
|
15
|
+
"type": "boolean",
|
|
16
|
+
"default": false,
|
|
17
|
+
"description": "By default, HTML in markdown is escaped. When true all HTML code in the markdown will not be rendered."
|
|
18
|
+
},
|
|
19
|
+
"style": {
|
|
20
|
+
"type": "object",
|
|
21
|
+
"description": "Style to apply to Markdown div.",
|
|
22
|
+
"docs": {
|
|
23
|
+
"displayType": "yaml"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
*/ import React from 'react';
|
|
17
|
+
import { Light as SyntaxHighlighter } from 'react-syntax-highlighter';
|
|
18
|
+
import { blockDefaultProps } from '@lowdefy/block-utils';
|
|
19
|
+
import ReactMarkdown from 'react-markdown';
|
|
20
|
+
import gfm from 'remark-gfm';
|
|
21
|
+
import github from 'react-syntax-highlighter/dist/cjs/styles/hljs/github';
|
|
22
|
+
import javascript from 'react-syntax-highlighter/dist/cjs/languages/hljs/javascript';
|
|
23
|
+
import typescript from 'react-syntax-highlighter/dist/cjs/languages/hljs/typescript';
|
|
24
|
+
import python from 'react-syntax-highlighter/dist/cjs/languages/hljs/python';
|
|
25
|
+
import java from 'react-syntax-highlighter/dist/cjs/languages/hljs/java';
|
|
26
|
+
import xml from 'react-syntax-highlighter/dist/cjs/languages/hljs/xml';
|
|
27
|
+
import json from 'react-syntax-highlighter/dist/cjs/languages/hljs/json';
|
|
28
|
+
import yaml from 'react-syntax-highlighter/dist/cjs/languages/hljs/yaml';
|
|
29
|
+
import markdown from 'react-syntax-highlighter/dist/cjs/languages/hljs/markdown';
|
|
30
|
+
import handlebars from 'react-syntax-highlighter/dist/cjs/languages/hljs/handlebars';
|
|
31
|
+
SyntaxHighlighter.registerLanguage('javascript', javascript);
|
|
32
|
+
SyntaxHighlighter.registerLanguage('js', javascript);
|
|
33
|
+
SyntaxHighlighter.registerLanguage('jsx', javascript);
|
|
34
|
+
SyntaxHighlighter.registerLanguage('typescript', typescript);
|
|
35
|
+
SyntaxHighlighter.registerLanguage('ts', typescript);
|
|
36
|
+
SyntaxHighlighter.registerLanguage('python', python);
|
|
37
|
+
SyntaxHighlighter.registerLanguage('py', python);
|
|
38
|
+
SyntaxHighlighter.registerLanguage('java', java);
|
|
39
|
+
SyntaxHighlighter.registerLanguage('xml', xml);
|
|
40
|
+
SyntaxHighlighter.registerLanguage('json', json);
|
|
41
|
+
SyntaxHighlighter.registerLanguage('yaml', yaml);
|
|
42
|
+
SyntaxHighlighter.registerLanguage('markdown', markdown);
|
|
43
|
+
SyntaxHighlighter.registerLanguage('handlebars', handlebars);
|
|
44
|
+
SyntaxHighlighter.registerLanguage('nunjucks', handlebars);
|
|
45
|
+
SyntaxHighlighter.registerLanguage('html', handlebars);
|
|
46
|
+
const renderers = {
|
|
47
|
+
code: ({ language , value })=>/*#__PURE__*/ _jsx(SyntaxHighlighter, {
|
|
48
|
+
style: github,
|
|
49
|
+
language: language,
|
|
50
|
+
children: value
|
|
51
|
+
})
|
|
52
|
+
};
|
|
53
|
+
const MarkdownWithCode = ({ blockId , properties , methods })=>/*#__PURE__*/ _jsx("div", {
|
|
54
|
+
id: blockId,
|
|
55
|
+
className: methods.makeCssClass(properties.style),
|
|
56
|
+
children: /*#__PURE__*/ _jsx(ReactMarkdown, {
|
|
57
|
+
className: "markdown-body",
|
|
58
|
+
renderers: renderers,
|
|
59
|
+
plugins: [
|
|
60
|
+
gfm
|
|
61
|
+
],
|
|
62
|
+
skipHtml: properties.skipHtml,
|
|
63
|
+
children: properties.content
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
;
|
|
67
|
+
MarkdownWithCode.defaultProps = blockDefaultProps;
|
|
68
|
+
export default MarkdownWithCode;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"type": "object",
|
|
5
|
+
"additionalProperties": false,
|
|
6
|
+
"properties": {
|
|
7
|
+
"content": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Content in markdown format.",
|
|
10
|
+
"docs": {
|
|
11
|
+
"displayType": "text-area"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"skipHtml": {
|
|
15
|
+
"type": "boolean",
|
|
16
|
+
"default": false,
|
|
17
|
+
"description": "By default, HTML in markdown is escaped. When true all HTML code in the markdown will not be rendered."
|
|
18
|
+
},
|
|
19
|
+
"style": {
|
|
20
|
+
"type": "object",
|
|
21
|
+
"description": "Style to apply to Markdown div.",
|
|
22
|
+
"docs": {
|
|
23
|
+
"displayType": "yaml"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import DangerousMarkdown from './blocks/DangerousMarkdown';
|
|
16
|
+
import Markdown from './blocks/Markdown';
|
|
17
|
+
import MarkdownWithCode from './blocks/MarkdownWithCode';
|
|
18
|
+
export default {
|
|
19
|
+
blocks: {
|
|
20
|
+
DangerousMarkdown,
|
|
21
|
+
Markdown,
|
|
22
|
+
MarkdownWithCode
|
|
23
|
+
},
|
|
24
|
+
import: {
|
|
25
|
+
styles: [
|
|
26
|
+
'style.less'
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
};
|