问题标签 [react-simple-code-editor]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
340 浏览

reactjs - 如何让 React styleguidist 正确安装并通过 react-simple-code-editor: React 16 & 17 解决对等依赖问题?

我正在通过阅读Fullstack React 书来学习 React 。


我的设置:


按照我运行的styleguidist 安装指南:

这个安装:

  • webpack v5.11.0
  • react-styleguidist 11.1.5

之间似乎存在某种冲突:

这似乎归结为 React 16 基线上的 react-simple-code-editor 中的对等依赖性,而 react-styleguidist 使用 React 17。

react-simple-code-editorpackage.json

我在这里提出了这个问题,但从未收到回复。

所以我想知道这里是否有人对 React 16 到 17 的增强有更深入的了解可以回答 react-simple-code-editor 中的 react/react-dom 是否可以放宽以使用 16+?如果是这样,语法是什么?

更多关于 Peer Dependencies的信息在这里

0 投票
0 回答
42 浏览

javascript - Code editor not displaying text correctly with react-live library

I am new to react js and trying to develop a website full of technical tutorials. As a part of it I am creating tutorials for react js with live preview of some code snippets in each tutorial. I am using react-live for this purpose. Here is the link to demo of react-live click here

When I am trying to use this code editor it is displaying the text incorrectly with wrong spacing and cursor position. below is the snapshot of it. Code editor text with wrong spacing and cursor position

Does Anybody has any idea why is it displaying this text in code editor incorrectly when I am trying to use it instead it is displaying it correctly in demo link.

0 投票
1 回答
93 浏览

reactjs - 是否可以将 simple-react-code-editor 作为 Formik 字段组件?

试图让这个表单字段组件采用简单的反应代码编辑器:

不确定我是否通过尝试从useField钩子中传递道具来以正确的方式解决这个问题,但它适用于文本字段标签,所以认为同样的方法也适用于此。虽然,我觉得回调与该组件没有的onValueChange回调不同。onChange有没有办法以某种方式添加它?

编辑器组件:

使用字段组件作为 MyEditor 的表单(尝试使用 useField 挂钩):

组件呈现没有错误,但是当我键入文本时没有出现。