uiwjs / react-md-editor Goto Github PK
View Code? Open in Web Editor NEWA simple markdown editor with preview, implemented with React.js and TypeScript.
Home Page: https://uiwjs.github.io/react-md-editor
License: MIT License
A simple markdown editor with preview, implemented with React.js and TypeScript.
Home Page: https://uiwjs.github.io/react-md-editor
License: MIT License
I checked some bugs during use.
please try below text in editor
- text
- (tab: 1)
- text
- (tab: 2)
- text
- (tab: 3)
- text
text2
- (tab: 1)
text (tab:2)
1. text
1. text
1. text
1. text
I think this problem cause of react-markdown.
could you fix this bug?
If you can't fix this bug, please tell me about how to customize it.
Spellcheck attribute does not propagate down to the TextArea and so it doesn't work.
If you go to the README.md file, and select the first link to open the code in Codesandbox
You will see on lines 3, 35 and 37 packages are being imported from MEDitor
vs MDEditor
.
import MEDitor from "@uiw/react-md-editor";
should be
import MDEditor from "@uiw/react-md-editor";
Would be useful to have a native html tooltip display when hovering over toolbar items, some icons don't clearly indicate what they do.
Is there a way to easily implement image uploading on drag & drop or paste? (Similar to GitHub's user experience)
I ran the script for KaTeX preview written in README and got inlineCode error when I inserted two back quotes into editor.
code (written in README): https://codesandbox.io/s/markdown-editor-katex-for-react-7v3vl
Inserted two back quotes like this:
Found two errors:
react-dom.development.js:14348 Uncaught Error: inlineCode(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.
The above error occurred in the <inlineCode> component:
at inlineCode (https://7v3vl.csb.app/index.js:29:25)
at p
at Root (https://7v3vl.csb.app/node_modules/react-markdown/lib/renderers.js:45:28)
at ReactMarkdown (https://7v3vl.csb.app/node_modules/react-markdown/lib/react-markdown.js:40:19)
at div
at MarkdownPreview (https://7v3vl.csb.app/node_modules/@uiw/react-md-editor/lib/esm/components/Markdown/index.js:47:33)
at div
at div
at MDEditor (https://7v3vl.csb.app/node_modules/@uiw/react-md-editor/lib/esm/MDEditor.js:42:33)
at App
I inserted the null check statement for children and got no errors.
const renderers = {
inlineCode: ({ children }) => {
if (/^\$\$(.*)\$\$/.test(children)) {
const html = katex.renderToString(children.replace(/^\$\$(.*)\$\$/, '$1'), {
throwOnError: false,
});
return <code dangerouslySetInnerHTML={{ __html: html }} />
}
if (children == null) {
return <code />;
}
return children;
},
code: ({ children, language, value }) => {
if (language.toLocaleLowerCase() === 'katex') {
const html = katex.renderToString(value, {
throwOnError: false
});
return (
<pre>
<code dangerouslySetInnerHTML={{ __html: html }} />
</pre>
);
}
if (children == null) {
return <code />;
}
return children;
}
}
I think it needs to update README and I wanna other solutions if you have.
Thanks:)
Hi.
I want to change the color on the textarea-text, and have tried using the prop
textareaProps={{ style: { color: "white" } }}, but something seems off. I am not that confident in passing props like this, so I do believe this may be a syntax-error.
I would be grateful if someone could have pointed me in the right direction
yarn start is running normally, but an error has occurred with the npm start run
Module parse failed: Unexpected token (443:21)
You may need an appropriate loader to handle this file type.
|
| return _context.abrupt("return", Promise.all(langs.map(function (key) {
> return import("prismjs/components/prism-".concat(key));
| })));
|
package.json
{
"name": "context",
"version": "0.1.0",
"private": true,
"dependencies": {
"@antv/g6": "^3.4.0",
"@babel/core": "7.4.3",
"@svgr/webpack": "4.1.0",
"@typescript-eslint/eslint-plugin": "1.6.0",
"@typescript-eslint/parser": "1.6.0",
"antd": "^3.19.2",
"axios": "^0.19.0",
"babel-eslint": "10.0.1",
"babel-jest": "^24.8.0",
"babel-loader": "8.0.5",
"babel-plugin-import": "^1.12.0",
"babel-plugin-named-asset-import": "^0.3.2",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-react-app": "^9.0.0",
"camelcase": "^5.2.0",
"case-sensitive-paths-webpack-plugin": "2.2.0",
"classnames": "^2.2.6",
"dotenv": "6.2.0",
"dotenv-expand": "4.2.0",
"dva": "^2.2.3",
"dva-loading": "^2.0.3",
"echarts": "^4.2.1",
"eslint": "^5.16.0",
"eslint-config-react-app": "^4.0.1",
"eslint-loader": "2.1.2",
"eslint-plugin-flowtype": "2.50.1",
"eslint-plugin-import": "2.16.0",
"eslint-plugin-jsx-a11y": "6.2.1",
"eslint-plugin-react": "7.12.4",
"eslint-plugin-react-hooks": "^1.5.0",
"file-loader": "3.0.1",
"fs-extra": "7.0.1",
"hashmap": "^2.3.0",
"html-webpack-plugin": "4.0.0-beta.5",
"identity-obj-proxy": "3.0.0",
"is-wsl": "^1.1.0",
"jest": "24.7.1",
"jest-environment-jsdom-fourteen": "0.1.0",
"jest-resolve": "24.7.1",
"jest-watch-typeahead": "0.3.0",
"js-md5": "^0.7.3",
"less": "2.7.3",
"less-loader": "^5.0.0",
"less-vars-to-js": "^1.3.0",
"mini-css-extract-plugin": "0.5.0",
"moment": "^2.23.0",
"optimize-css-assets-webpack-plugin": "5.0.1",
"pako": "^1.0.10",
"pnp-webpack-plugin": "1.2.1",
"postcss-flexbugs-fixes": "4.1.0",
"postcss-loader": "3.0.0",
"postcss-normalize": "7.0.1",
"postcss-preset-env": "6.6.0",
"postcss-safe-parser": "4.0.1",
"react": "^16.8.6",
"react-app-polyfill": "^1.0.1",
"react-beautiful-dnd": "^12.1.1",
"react-cookie": "^4.0.0",
"react-dev-utils": "^9.0.1",
"react-dnd": "^6.0.0",
"react-dnd-html5-backend": "^6.0.0",
"react-dom": "^16.8.6",
"react-highlight-words": "^0.16.0",
"react-hot-loader": "^4.11.1",
"react-rnd": "^9.2.0",
"react-router-dom": "^5.0.1",
"react-websocket": "^2.0.1",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"resolve": "1.10.0",
"sass-loader": "7.1.0",
"semver": "6.0.0",
"terser-webpack-plugin": "1.2.3",
"ts-pnp": "1.1.2",
"url-loader": "1.1.2",
"uuid": "^3.3.2",
"webpack": "4.29.6",
"webpack-dev-server": "3.2.1",
"webpack-manifest-plugin": "2.0.4",
"workbox-webpack-plugin": "4.2.0"
},
"scripts": {
"start": "node scripts/start.js",
"build": "node scripts/build.js",
"test": "node scripts/test.js"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx,ts,tsx}",
"!src/**/*.d.ts"
],
"setupFiles": [
"react-app-polyfill/jsdom"
],
"setupFilesAfterEnv": [],
"testMatch": [
"<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}",
"<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}"
],
"testEnvironment": "jest-environment-jsdom-fourteen",
"transform": {
"^.+\\.(js|jsx|ts|tsx)$": "<rootDir>/node_modules/babel-jest",
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
"^(?!.*\\.(js|jsx|ts|tsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx|ts|tsx)$",
"^.+\\.module\\.(css|sass|scss)$"
],
"modulePaths": [],
"moduleNameMapper": {
"^react-native$": "react-native-web",
"^.+\\.module\\.(css|sass|scss)$": "identity-obj-proxy"
},
"moduleFileExtensions": [
"web.js",
"js",
"web.ts",
"ts",
"web.tsx",
"tsx",
"json",
"web.jsx",
"jsx",
"node"
],
"watchPlugins": [
"jest-watch-typeahead/filename",
"jest-watch-typeahead/testname"
]
},
"babel": {
"presets": [
"react-app"
],
"plugins": [
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
[
"@babel/plugin-proposal-class-properties",
{
"loose": true
}
]
]
},
"homepage": "./resource/workbench",
"devDependencies": {
"@babel/plugin-proposal-decorators": "^7.4.4",
"@uiw/react-md-editor": "^1.14.3",
"babel-plugin-dva-hmr": "^0.4.1",
"css-loader": "^2.1.1",
"echarts-for-react": "^2.0.15-beta.1",
"immutability-helper": "^3.0.1",
"jquery": "^3.4.1",
"pako": "^1.0.10",
"react-draggable-tags": "^0.4.0-beta.2",
"react-resizable": "^1.8.0",
"redux-devtools-extension": "^2.13.8",
"style-loader": "^0.23.1",
"xlsx": "^0.15.5"
}
}
I'm running into a strange issue here where the following console error is thrown anytime I modify the value feeding the MDEditor component. The component continues to function normally, just lots of console noise.
handleKeyDown.js:25 Uncaught TypeError: Cannot read property 'toLowerCase' of undefined
at handleKeyDown.js:25
at onKeyDown (Textarea.js:41)
at HTMLUnknownElement.callCallback (react-dom.development.js:191)
at Object.invokeGuardedCallbackDev (react-dom.development.js:240)
at invokeGuardedCallback (react-dom.development.js:293)
at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:308)
at executeDispatch (react-dom.development.js:393)
at executeDispatchesInOrder (react-dom.development.js:418)
at executeDispatchesAndRelease (react-dom.development.js:3303)
at executeDispatchesAndReleaseTopLevel (react-dom.development.js:3312)
Code:
import MDEditor, { commands } from '@uiw/react-md-editor';
interface PropTypes extends RouterProps {}
const MyForm: FunctionComponent<PropTypes> = (props: PropTypes) => {
const [item, setItem] = useState({title: "", body: ""})
return (
<MDEditor
height={200}
value={insight.body}
onChange={(value) => {
setItem(prevState => {
return { ...prevState, body: value}
})
}}/>
)
};
Anyone else running into this? Im hitting this on the 3.0.0-beta.1 release. I have not tried going back to older releases.
After I change font family (in somewhere I don't remember), I got this UI's error:
It only happens on the title (and other lines has special characters in begin of line), on normal lines it's doesn't happen. the edit cursor does not move to the end of the line, no matter whether I press the end of a line or use the arrow keys, it is there.
I'm found a way to fix, add some css (scss in my case) to change font family of "span.token.title.important" and "span.token.title.important .token.punctuation" like this:
// scss
span.token.title.important {
font-family: inherit;
.token.punctuation {
font-family: inherit;
}
}
// css
span.token.title.important {
font-family: inherit;
}
span.token.title.important .token.punctuation {
font-family: inherit;
}
"span.token.title.important" and ".token.punctuation" took font-family css from its parent and problem has been fix:
I was having trouble trying to customize some of the components inside the package, namely Toolbar
and Teaxarea
(exported from src/components/Toolbar
and src/components/Textarea
respectively). When reading through the code, I happened to come across this block: (src/MDEditor.tsx, line 158-165):
<Toolbar
active={{
fullscreen: this.state.fullscreen,
preview: this.state.preview,
}}
prefixCls={prefixCls} commands={commands}
onCommand={this.handleCommand}
/>
I'm wondering if the Toolbar component can be styled through className.
When bundled with create-react-app default settings this library produces over 400 chunked bundles. They are invidually all small, but total almost 1mb. I don't know what they all are, and they don't all appear to be loaded, but it is quite strange.
It looks like they are mostly from prism. I'm guessing they are individual language highlighting packs. Perhaps there is a way to skip them?
This tool is beautiful by the way, thank you for making it. This is easily the nicest markdown editor I've come across
preview="preview"
is working fine, but suddenly when I use the toolbar there is not markdown syntax rendered to the text area.
If a user writes **bold text ** is shown bold in the preview but it shouldn't be according to MD specification.
Moreover, the MD renderer that this library is using https://remarkjs.github.io/react-markdown/ is working fine.
Hi everyone,
When using this awesome component in my NextJS app I ran into a problem where the text cursor is shifted from the "preview text" in the edit mode when using the title tag (the '#')
For example in the following image, the cursor is actually between the 'r' and 'k' of the word 'markdown'
If that is of any help, here is my next.config.js:
const withSass = require('@zeit/next-sass');
const withCSS = require('@zeit/next-css')
const withPlugins = require('next-compose-plugins');
const sassConfig = {
cssModules: true,
cssLoaderOptions: {
camelCase: true
}
};
const cssConfig = {
cssModules: false,
};
module.exports = withPlugins([
[withSass, sassConfig],
[withCSS, cssConfig],
])
Thanks in advance for your help
Hello 👋
First time using react-md-editor
. I'm trying to have MDEditor
occupy the entire height of my window but I think I'm facing a bug now since, for example, a window.innerHeight
of 900
gets me a MDEditor
with an height
of 871
.
Here's the code that I have right now.
I'm also using tailwind
but if I create a div
with the height
of window.innerHeight
it works perfectly fine
import { useState, useRef } from 'react';
import './App.css';
import MDEditor from '@uiw/react-md-editor';
const App = () => {
const [data, setData] = useState([{ text: 'Test note' }]);
const [note, setNote] = useState('');
const heightHere = window.innerHeight;
return (
<div className="relative bg-gray-100 h-screen">
<div>
<MDEditor
className="py-2 px-5 w-10/12"
id="noteinput"
type="text"
placeholder="Enter a new note"
value={note}
onChange={setNote}
preview="edit"
hideToolbar
height={heightHere}
visiableDragbar={false}
/>
</div>
</div>
);
};
export default App;
I made a video explaining the bug. Seeing the checklist on a second line in the preview. Also seeing the checklist with a bullet point in front of it at times.
See first half of this video: https://www.loom.com/share/2b9a883f95e043508353424e6a2ebdd9
I want to validate the user input easily using yup for minLength, maxLength, etc.
Is there a recommended way?
I also, want to abstract it more using react-hook-from, but it seems that you don't forwardRefs.
Can you provide an example to extend the component to support an additional markdown syntax?. For instance, something like this __hello__
for underlined text
I'm trying to get a notification when the textarea gets/loses focus. That doesn't appear to be possible unless I'm missing something?
Hi, I want to use this package but I have some basic problems, like the placeholder not working. This is my code:
import React, {useState} from "react";
import MDEditor from "@uiw/react-md-editor";
export function MarkdownArea(props) {
const t = props.t;
const identifier = props.identifier;
const labelText = props.labelText;
const placeholder = props.placeholder;
const ancestor = props.ancestor;
const register = props.register;
const errors = props.errors;
const isRequired = props.isRequired;
const minLen = props.minLen;
const maxLen = props.maxLen;
const [value, setValue] = useState("");
const textareaProps =
{ placeholder
, readOnly: true
}
return (
<div className={`coreInput__inputWrapper ${ancestor}__inputWrapper`}>
<span className={`coreInput__inputLabel ${ancestor}__inputLabel`}>
{t(labelText)}
</span>
<MDEditor
value={value}
onChange={setValue}
height={300}
textareaProps={textareaProps}
/>
{errors[identifier] && <p className="coreInput__error">{errors[identifier].message}</p>}
</div>
)
}
And I'm using this MarkdownArea component like this:
<MarkdownArea
t={t}
identifier={langCode + "-description"}
labelText="description"
placeholder="hola mundo"
ancestor="ProductCreate"
register={register}
errors={errors}
isRequired={true}
minLen={config.product.minLen_description}
maxLen={config.product.maxLen_description}
/>
But the placeholder is not working. Also any insights on how to integrate this textarea with react-hook-form will be appreciated
Is there any way to update the text area? because it is just updating the markdown preview.
See: https://github.com/uiwjs/react-md-editor/blob/master/src/MDEditor.tsx
Type of height
:
height?: React.CSSProperties['height']
But when specifying "100%"
, there's error:
index.js:1 Warning: `NaN` is an invalid value for the `height` css style property.
in div (created by MDEditor)
in div (created by MDEditor)
I think at this line:
style={{ height: this.state.fullscreen ? 'calc(100% - 29px)' : (this.state.height as number) - 29 }}
If we change to below, the error can be fixed:
style={{ height: this.state.fullscreen ? 'calc(100% - 29px)' : `calc(${this.state.height} - 29px` }}
I'm using this package in one of my projects. Everything is ok if I render the package and start typing markdown content in it but if I just click on a button after the render to get markdown data from the internet (or anywhere else) and then send it down to the component using the props, the preview works fine but the text area would be empty.
In demo page, the Katex paragraph Support Custom KaTeX Preview
.
When I try to edit the line, delete the last character x
```Katex
Error happened and page goto blank. Here is the error log
react_devtools_backend.js:562 Error: Minified React error #152; visit https://reactjs.org/docs/error-decoder.html?invariant=152&args[]=code for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
at react-dom.production.min.js:3539
at Po (react-dom.production.min.js:4247)
at Bo (react-dom.production.min.js:4296)
at gl (react-dom.production.min.js:6697)
at us (react-dom.production.min.js:6150)
at ls (react-dom.production.min.js:6139)
at Jl (react-dom.production.min.js:5880)
at react-dom.production.min.js:2851
at t.unstable_runWithPriority (scheduler.production.min.js:309)
at Ha (react-dom.production.min.js:2816)
react-dom.production.min.js:3539 Uncaught Error: Minified React error #152; visit https://reactjs.org/docs/error-decoder.html?invariant=152&args[]=code for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
at react-dom.production.min.js:3539
at Po (react-dom.production.min.js:4247)
at Bo (react-dom.production.min.js:4296)
at gl (react-dom.production.min.js:6697)
at us (react-dom.production.min.js:6150)
at ls (react-dom.production.min.js:6139)
at Jl (react-dom.production.min.js:5880)
at react-dom.production.min.js:2851
at t.unstable_runWithPriority (scheduler.production.min.js:309)
at Ha (react-dom.production.min.js:2816)
Thanks for sharing your awesome library.
I am adding some rendering options like katex.
const renderers = {
inlineCode: ({ children }) => {
if (/^\$\$(.*)\$\$/.test(children)) {
const html = katex.renderToString(children.replace(/^\$\$(.*)\$\$/, '$1'), {
throwOnError: false,
});
return <code dangerouslySetInnerHTML={{ __html: html }} />
}
return children;
},
code: ({ children, language, value }) => {
if (language.toLocaleLowerCase() === 'katex') {
const html = katex.renderToString(value, {
throwOnError: false
});
return (
<pre>
<code dangerouslySetInnerHTML={{ __html: html }} />
</pre>
);
}
return children;
}
}
However, I would like to use it with markdown's default rendering options like code block (python, C++, etc.).
int a = 10
Can I override my custom parameter options to the default renderer?
default options(codeblocks, ...) + my custom options(katex, ...)
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.
Uncaught TypeError: Cannot read property 'warp' of null
at MDEditor._this.handleScroll (MDEditor.tsx:121)
at HTMLUnknownElement.callCallback (react-dom.development.js:188)
at HTMLUnknownElement.sentryWrapped (helpers.ts:87)
at Object.invokeGuardedCallbackDev (react-dom.development.js:237)
at invokeGuardedCallback (react-dom.development.js:292)
at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:306)
at executeDispatch (react-dom.development.js:389)
at executeDispatchesInOrder (react-dom.development.js:414)
at executeDispatchesAndRelease (react-dom.development.js:3278)
at executeDispatchesAndReleaseTopLevel (react-dom.development.js:3287)
at forEachAccumulated (react-dom.development.js:3259)
at runEventsInBatch (react-dom.development.js:3304)
at runExtractedPluginEventsInBatch (react-dom.development.js:3514)
at handleTopLevel (react-dom.development.js:3558)
at batchedEventUpdates$1 (react-dom.development.js:21871)
at batchedEventUpdates (react-dom.development.js:795)
at dispatchEventForLegacyPluginEventSystem (react-dom.development.js:3568)
at attemptToDispatchEvent (react-dom.development.js:4267)
at dispatchEvent (react-dom.development.js:4189)
at unstable_runWithPriority (scheduler.development.js:653)
at dispatchUserBlockingUpdate (react-dom.development.js:4172)
at HTMLDocument.sentryWrapped (helpers.ts:87)
MDEditor._this.handleScroll
src/MDEditor.tsx:121
118 | }
119 | private handleScroll = (e: React.UIEvent<HTMLDivElement>) => {
120 | const preview = this.preview.current!.mdp.current! as HTMLDivElement;
> 121 | const textarea = this.textarea.current!.warp.current! as HTMLDivElement;
| ^ 122 | if (textarea && preview) {
123 | const scale = (textarea.scrollHeight - textarea.offsetHeight) / (preview.scrollHeight - preview.offsetHeight);
124 | if (e.target === textarea && this.leftScroll) {
View compiled
HTMLUnknownElement.callCallback
node_modules/react-dom/cjs/react-dom.development.js:188
HTMLUnknownElement.sentryWrapped
src/helpers.ts:87
84 | } else {
85 | // If config is not fetched yet, wait for all configs (we don't know which one we need) and
86 | // find the appId (if any) corresponding to this measurementId. If there is one, wait on
> 87 | // that appId's initialization promise. If there is none, promise resolves and gtag
| ^ 88 | // call goes through.
89 | const dynamicConfigResults = await Promise.all(dynamicConfigPromisesList);
90 | const foundConfig = dynamicConfigResults.find(
"@uiw/react-md-editor": "^1.14.4",
When I changed modes, preview, editor, both, This Type Error occured.
NextJS does not allow global CSS to be imported at the component level, only in _app.js.
error - ./node_modules/@uiw/react-md-editor/lib/esm/index.css
Global CSS cannot be imported from within node_modules.
Read more: https://err.sh/next.js/css-npm
See https://codesandbox.io/s/compassionate-cookies-msmsd?file=/pages/index.js
I have issues with formatting of the paragraphs when using the editor, when using
<div className="row">
{edit ? <MDEditor value={value} onChange={setValue} /> : <MDEditor.Markdown source={value} />}
</div>
<div className="row">
<ReactMarkdown plugins={[gfm]} children={value} />
</div>
the result looks like this which is not what you expect. I want to show the input to my editor as two paragraphs, but the editor doesn't seem to format the paragraphs so that it can be shown as paragraphs?
The following screenshots show that, if a toolbar button has focus, it's not very clear because the styling doesn't look any different from the default state.
In order to make it more accessible for people that rely on the keyboard to navigate pages, the buttons should look as they do on hover when they receive focus.
现在的Preview Markdown不支持使用KaTeX对数学公式进行渲染,有这个计划吗
Issue : The textarea doesn't do any validation or sanitize any input to it.
What is happening : This makes editor execute inline html code.
How to reproduce ? : Simply type <img src onerror="alert('hey!')"/>
in input box
Can you provide an example to extend the component to support custom shortcuts?
I'm looking for something like this:
Is this feature miss since v2 ? I can not access commandOrchestrator anywhere since v2. I worked under v1.
const r = useRef();
function exec() {
if (r.current) {
r.current.commandOrchestrator.executeCommand({ execute(state, api) { /* ... */ } });
}
}
return (
<>
<button onClick={exec}>execute command from here</button>
<MDEditor ref={r}/>;
</>
)
Hi there!
Sorry if it's a stupid question, I'm using this library in my project which involves editing as well.
How do I go about prepopulating the editor with some content?
This is a relatively simple fix yet crucial to improve this package's popularity.
There's already an issue on this but for some reason it's closed. All the "fixes" suggested there are unreliable (edit node_modules
directly) or unencouraged (using the deprecated package @zeit/next-css
)
so not able to use in custom toolbar like the others.
node_modules/@uiw/react-md-editor/lib/cjs/index.d.ts(4,1):
Declaration or statement expected. TS1128
2 | import * as commands from './commands';
3 | import * as MarkdownUtil from './utils/markdownUtils';
> 4 | export type { ICommand, CommandOrchestrator, TextRange, TextState, TextApi } from './commands';
| ^
5 | export type { TextSection } from './utils/markdownUtils';
6 | export * from './Editor';
7 | export { MarkdownUtil, commands, };
All I have done is yarn add @uiw/react-md-editor
and that is the error it kicks back. Not quite sure what would cause it to explode though.
Dear All,
I created a NextJS project and installed the react-markdown-editor via npm. When I try to run my NextJS project the following error message appears:
Error
Global CSS cannot be imported from within node_modules. Read more: https://nextjs.org/docs/messages/css-npm Location: node_modules\@uiw\react-markdown-preview\lib\esm\index.js
And the possible reason according to NextJS documentation:
https://nextjs.org/docs/messages/css-npm
It will be really great if "react-markdown-editor" can be ported for NextJS framework properly.
Note:
Seeing a strange issue where the layers are not in line and showing duplicate data.
See second half of this video: https://www.loom.com/share/2b9a883f95e043508353424e6a2ebdd9
Dear All,
I created a NextJS project and installed the react-markdown-editor via npm.
I have made the following configuration in my next.config.js file to enable Webpack 5:
module.exports = withCSS({ // Your configurations here future: { webpack5: true, strictPostcssConfiguration: true, }, });
When I try to run my NextJS & Webpack 5 package the following error message appears:
Error
`ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Using webpack 5. Reason: future.webpack5 option enabled https://nextjs.org/docs/messages/webpack5
Warning: Built-in CSS support is being disabled due to custom CSS configuration being detected.
See here for more info: https://nextjs.org/docs/messages/built-in-css-disabled
(node:8240) [DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK] DeprecationWarning: Compilation.hooks.normalModuleLoader was moved to NormalModule.getCompilationHooks(compilation).loader
(Use node --trace-deprecation ...
to show where the warning was created)
(node:8240) [DEP_WEBPACK_MAIN_TEMPLATE_RENDER_MANIFEST] DeprecationWarning: MainTemplate.hooks.renderManifest is deprecated (use Compilation.hooks.renderManifest instead)
(node:8240) [DEP_WEBPACK_CHUNK_TEMPLATE_RENDER_MANIFEST] DeprecationWarning: ChunkTemplate.hooks.renderManifest is deprecated (use Compilation.hooks.renderManifest instead)
(node:8240) [DEP_WEBPACK_MAIN_TEMPLATE_HASH_FOR_CHUNK] DeprecationWarning: MainTemplate.hooks.hashForChunk is deprecated (use JavascriptModulesPlugin.getCompilationHooks().chunkHash instead)
(node:8240) [DEP_WEBPACK_CHUNK_MODULES_ITERABLE] DeprecationWarning: Chunk.modulesIterable: Use new ChunkGraph API
[webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Node.js doesn't offer a (nice) way to introspect the ESM dependency graph yet.
Until a full solution is available webpack uses an experimental ESM tracking based on parsing.
As best effort webpack parses the ESM files to guess dependencies. But this can lead to expensive and incorrect tracking.
event - compiled successfully
[webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Node.js doesn't offer a (nice) way to introspect the ESM dependency graph yet.
Until a full solution is available webpack uses an experimental ESM tracking based on parsing.
As best effort webpack parses the ESM files to guess dependencies. But this can lead to expensive and incorrect tracking.
`
It will be really great if "react-markdown-editor" can be ported for NextJS framework & Webpack 5.
Regards,
MHS
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.