@uiw/react-md-editor 3.25.6 → 4.0.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/README.md +21 -11
- package/dist/mdeditor.css +1 -1
- package/dist/mdeditor.js +33885 -32579
- package/dist/mdeditor.min.css +1 -1
- package/dist/mdeditor.min.js +1 -1
- package/dist/mdeditor.min.js.LICENSE.txt +0 -17
- package/esm/components/TextArea/Markdown.js +4 -1
- package/esm/components/TextArea/index.js +2 -2
- package/esm/components/TextArea/index.nohighlight.js +2 -2
- package/esm/components/Toolbar/index.css +1 -1
- package/esm/components/Toolbar/index.less +1 -1
- package/lib/components/TextArea/Markdown.js +4 -1
- package/lib/components/TextArea/index.js +2 -2
- package/lib/components/TextArea/index.nohighlight.js +2 -2
- package/lib/components/Toolbar/index.less +1 -1
- package/markdown-editor.css +1 -1
- package/package.json +3 -3
- package/src/components/TextArea/Markdown.tsx +2 -0
- package/src/components/Toolbar/index.less +1 -1
package/README.md
CHANGED
|
@@ -718,16 +718,26 @@ const randomid = () => parseInt(String(Math.random() * 1e15), 10).toString(36);
|
|
|
718
718
|
const Code = ({ inline, children = [], className, ...props }) => {
|
|
719
719
|
const demoid = useRef(`dome${randomid()}`);
|
|
720
720
|
const [container, setContainer] = useState(null);
|
|
721
|
-
const isMermaid =
|
|
722
|
-
|
|
721
|
+
const isMermaid =
|
|
722
|
+
className && /^language-mermaid/.test(className.toLocaleLowerCase());
|
|
723
|
+
const code = children
|
|
724
|
+
? getCodeString(props.node.children)
|
|
725
|
+
: children[0] || "";
|
|
726
|
+
|
|
723
727
|
useEffect(() => {
|
|
724
|
-
if (container && isMermaid) {
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
728
|
+
if (container && isMermaid && demoid.current && code) {
|
|
729
|
+
mermaid
|
|
730
|
+
.render(demoid.current, code)
|
|
731
|
+
.then(({ svg, bindFunctions }) => {
|
|
732
|
+
console.log("svg:", svg);
|
|
733
|
+
container.innerHTML = svg;
|
|
734
|
+
if (bindFunctions) {
|
|
735
|
+
bindFunctions(container);
|
|
736
|
+
}
|
|
737
|
+
})
|
|
738
|
+
.catch((error) => {
|
|
739
|
+
console.log("error:", error);
|
|
740
|
+
});
|
|
731
741
|
}
|
|
732
742
|
}, [container, isMermaid, code, demoid]);
|
|
733
743
|
|
|
@@ -741,11 +751,11 @@ const Code = ({ inline, children = [], className, ...props }) => {
|
|
|
741
751
|
return (
|
|
742
752
|
<Fragment>
|
|
743
753
|
<code id={demoid.current} style={{ display: "none" }} />
|
|
744
|
-
<code ref={refElement} data-name="mermaid" />
|
|
754
|
+
<code className={className} ref={refElement} data-name="mermaid" />
|
|
745
755
|
</Fragment>
|
|
746
756
|
);
|
|
747
757
|
}
|
|
748
|
-
return <code>{children}</code>;
|
|
758
|
+
return <code className={className}>{children}</code>;
|
|
749
759
|
};
|
|
750
760
|
|
|
751
761
|
export default function App() {
|
package/dist/mdeditor.css
CHANGED
|
@@ -1183,7 +1183,7 @@ body[data-color-mode*='light'] {
|
|
|
1183
1183
|
.w-md-editor-toolbar {
|
|
1184
1184
|
border-bottom: 1px solid var(--md-editor-box-shadow-color);
|
|
1185
1185
|
background-color: var(--md-editor-background-color);
|
|
1186
|
-
padding:
|
|
1186
|
+
padding: 3px;
|
|
1187
1187
|
display: flex;
|
|
1188
1188
|
justify-content: space-between;
|
|
1189
1189
|
align-items: center;
|