Comments (16)
<Form.Item
name="editor"
+ initialValue="test"
>
<MDEditor value={"sample value"} autoFocus={0} />
</Form.Item>
from react-md-editor.
Got the same issue when upgrade to 2.1.8
from 2.1.2
. Also using with antd
form component.
Solved by providing an initialValue
.
from react-md-editor.
@Formalibus Upgrade v2.1.8
from react-md-editor.
@Formalibus Upgrade
v2.1.8
I was actually at v2.1.8 then this error occured
I am on v2.1.2 it's working
from react-md-editor.
Can you provide an example?
@Formalibus
from react-md-editor.
here I call it
<div className="row markdownEditor">
<div className="col-sm">
<MDEditor preview="edit" height="730" onChange={setContent} />
</div>
<div className="col-sm">
<MDEditor.Markdown source={content} />
</div>
</div>
now it working on v2.1.2
from react-md-editor.
now I updated md editor
and got this
TypeError: text is undefined
matchGrammar
C:/Users/Udodelighed/react_lessons/destination_pamir/node_modules/prismjs/prism.js:887
884 |
885 | var str = currentNode.value;
886 |
887 | if (tokenList.length > text.length) {
| ^ 888 | // Something went terribly wrong, ABORT, ABORT!
889 | return;
890 | }
tokenize
C:/Users/Udodelighed/react_lessons/destination_pamir/node_modules/prismjs/prism.js:655
652 | var tokenList = new LinkedList();
653 | addAfter(tokenList, tokenList.head, text);
654 |
655 | matchGrammar(text, tokenList, grammar, tokenList.head, 0);
| ^ 656 |
657 | return toArray(tokenList);
658 | },
highlight
C:/Users/Udodelighed/react_lessons/destination_pamir/node_modules/prismjs/prism.js:613
610 | language: language
611 | };
612 | _.hooks.run('before-tokenize', env);
613 | env.tokens = _.tokenize(env.code, env.grammar);
| ^ 614 | .hooks.run('after-tokenize', env);
615 | return Token.stringify(.util.encode(env.tokens), env.language);
616 | },
highlight
C:/src/components/TextArea/index.tsx:36
33 | const [value, setValue] = useState(props.value);
34 | const highlight = () => {
35 | const pre = preElm.current;
36 | const html = Prism.highlight(value as string, Prism.languages.markdown, 'markdown');
| ^ 37 | pre!.innerHTML =${html}<br />
;
38 | };
39 | useEffect(() => {
./node_modules/@uiw/react-md-editor/lib/esm/components/TextArea/index.js/webpack_exports.default</<
C:/src/components/TextArea/index.tsx:51
48 | }
49 | }, [props.value]);
50 |
51 | useEffect(() => highlight(), [value]);
| ^ 52 | useEffect(() => {
53 | if (props.autoFocus && textElm.current) {
54 | textElm.current.focus();
from react-md-editor.
@Formalibus I cannot help you resolve the error.
Project example ? Put it in the repositories?
from react-md-editor.
no need, thanks )))
just wanted to notify about issue
if you want I can close an issue
from react-md-editor.
:(
from react-md-editor.
Hi, I'm also getting this error on 2.1.8
, react v. 16.14.0
.
Usage:
import MDEditor from '@uiw/react-md-editor';
<MDEditor value={"sample value"} autoFocus={0} />
from react-md-editor.
@ifbarrera https://codesandbox.io/s/markdown-editor-for-react-forked-2fzdr
from react-md-editor.
@jaywcjlove updated your code sandbox: https://codesandbox.io/s/markdown-editor-for-react-forked-19hfr?file=/index.js
Seems to be related to having MDEditor
as part of a form, and setting its value with React.useEffect
.
In my app, I use React.useEffect
to pre-populate a previously saved value.
from react-md-editor.
You can't dynamically change initialValue
or defaultValue
on forms based on state. https://ant.design/docs/react/faq#It-doesn't-work-when-I-change-defaultValue-dynamically
This is why I use the React.useEffect
hook.
from react-md-editor.
@ifbarrera https://ant.design/components/form/#components-form-demo-customized-form-controls
from react-md-editor.
btw, for 2.1.8
version, the props autoFocus
seems not working. It always auto focus even autoFocus={false}
is set. @jaywcjlove
from react-md-editor.
Related Issues (20)
- skipHtml not working
- Controlled toolbar? HOT 1
- Bug: When I push (option+ ₩) + (option + Enter) in MacOS, the cursor is broken HOT 1
- blinking cursor not showing inside md editor when placed in overflows modal HOT 1
- THIS IS NOT AN ISSUE: HACK to Paste Image directly from clipboard HOT 2
- The editor is stuck When value is large HOT 1
- 工具栏提示如何设置中文 HOT 2
- Spell Checker/ Auto Correct? HOT 1
- 预览标题的时候可以屏蔽链接标识吗 HOT 1
- Missing Source Map Files for parse5 in hast-util-raw Dependencies HOT 4
- How can i set textarea(.w-md-editor-text-input)'s parent <div> height style? HOT 4
- IMPORTANT MISSING FEATURE: Prop to limit the character length - maxLength and minLength attributes HOT 2
- [BUG] numbered list can't render number in preview panel HOT 3
- How to have hashtags render as links? HOT 3
- 预览模式下换行符显示问题 HOT 2
- 自适应高度时,切到preview模式,高度没了 HOT 6
- Change font size of editor HOT 1
- css variables 藏在哪里了找不到 HOT 1
- code highlight and rendering style seems not to work well in mac m1 HOT 1
- I need to check why my text is not being properly converted to markdown
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-md-editor.