Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.5k views
in Technique[技术] by (71.8m points)

compiler errors - ReactJS markdown editor component fails to render

I'm learning React at the moment, and I am currently trying out the Slate Markdown Editor in CodeSandbox. I am trying to initialize a Slate Editor instance like this:

import React from "react";
import ReactDOM from "react-dom";
import "./styles.css";

import Editor from "slate-md-editor";
const MdEditor = Editor();

<MdEditor />;

However, CodeSandbox displays the following error when I attempt to compile my code:

at evaluate (https://oxxbg.csb.app/node_modules/canner/slate-icon-codeblock/lib/index.js:80:45z
https://codesandbox.io/static/js/sandbox.cddc3c052.js:1:98419
X.evaluate
https://codesandbox.io/static/js/sandbox.cddc3c052.js:1:110543
ye.evaluateTranspiledModule
https://codesandbox.io/static/js/sandbox.cddc3c052.js:1:120123
c
https://codesandbox.io/static/js/sandbox.cddc3c052.js:1:110289
evaluate
https://oxxbg.csb.app/node_modules/slate-md-editor/lib/index.js:34:27
z
https://codesandbox.io/static/js/sandbox.cddc3c052.js:1:98419
X.evaluate
https://codesandbox.io/static/js/sandbox.cddc3c052.js:1:110543
ye.evaluateTranspiledModule
https://codesandbox.io/static/js/sandbox.cddc3c052.js:1:120123
c
https://codesandbox.io/static/js/sandbox.cddc3c052.js:1:110289
evaluate
/src/index.js:5
  2 | import ReactDOM from "react-dom";
  3 | import "./styles.css";
  4 | 
> 5 | import Editor from "slate-md-editor";
  6 | const MdEditor = Editor();
  7 | 
  8 | <MdEditor />;

I have not experienced this previously, and I am at a loss of knowing what to do.

I would greatly appreciate it if someone more experienced has some idea of this issue. Thank you in advance.

Link to the Sandbox

This is my package.json:

{
  "name": "slate-editor",
  "version": "1.0.0",
  "description": "React testing project",
  "keywords": [
    "react",
    "starter"
  ],
  "main": "src/index.js",
  "dependencies": {
    "antd": "4.10.2",
    "immutable": "4.0.0-rc.12",
    "react": "17.0.0",
    "react-dom": "17.0.0",
    "react-scripts": "3.4.3",
    "slate": "0.59.0",
    "slate-md-editor": "1.5.4",
    "slate-react": "0.59.0",
    "slate-schema-violations": "0.1.39"
  },
  "devDependencies": {
    "typescript": "3.8.3"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  },
  "browserslist": [
    ">0.2%",
    "not dead",
    "not ie <= 11",
    "not op_mini all"
  ]
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...