@uiw/react-md-editor 3.12.2 → 3.14.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 +9 -7
- package/dist/mdeditor.css +16 -11
- package/dist/mdeditor.js +1320 -1718
- package/dist/mdeditor.min.css +1 -1
- package/dist/mdeditor.min.js +1 -1
- package/dist/mdeditor.min.js.LICENSE.txt +1 -15
- package/esm/Editor.d.ts +5 -3
- package/esm/Editor.js +12 -5
- package/esm/Editor.js.map +4 -3
- package/esm/components/TextArea/index.css +8 -1
- package/esm/components/TextArea/index.less +8 -1
- package/esm/components/Toolbar/index.css +5 -0
- package/esm/components/Toolbar/index.d.ts +1 -0
- package/esm/components/Toolbar/index.js +3 -1
- package/esm/components/Toolbar/index.js.map +5 -3
- package/esm/components/Toolbar/index.less +5 -0
- package/esm/index.css +3 -0
- package/esm/index.less +3 -0
- package/lib/Context.js.map +1 -1
- package/lib/Editor.d.ts +5 -3
- package/lib/Editor.js +14 -6
- package/lib/Editor.js.map +11 -3
- package/lib/commands/bold.js.map +2 -1
- package/lib/commands/code.js.map +4 -1
- package/lib/commands/comment.js.map +2 -1
- package/lib/commands/image.js.map +2 -1
- package/lib/commands/index.js.map +2 -1
- package/lib/commands/italic.js.map +2 -1
- package/lib/commands/link.js.map +2 -1
- package/lib/commands/list.js.map +4 -1
- package/lib/commands/quote.js.map +4 -1
- package/lib/commands/strikeThrough.js.map +2 -1
- package/lib/commands/title1.js.map +2 -1
- package/lib/commands/title2.js.map +2 -1
- package/lib/commands/title3.js.map +2 -1
- package/lib/commands/title4.js.map +2 -1
- package/lib/commands/title5.js.map +2 -1
- package/lib/commands/title6.js.map +2 -1
- package/lib/components/DragBar/index.js.map +5 -2
- package/lib/components/TextArea/Markdown.js.map +5 -1
- package/lib/components/TextArea/Textarea.js.map +5 -1
- package/lib/components/TextArea/handleKeyDown.js.map +3 -1
- package/lib/components/TextArea/index.js.map +3 -2
- package/lib/components/TextArea/index.less +8 -1
- package/lib/components/Toolbar/Child.js.map +3 -1
- package/lib/components/Toolbar/index.d.ts +1 -0
- package/lib/components/Toolbar/index.js +3 -1
- package/lib/components/Toolbar/index.js.map +8 -3
- package/lib/components/Toolbar/index.less +5 -0
- package/lib/index.less +3 -0
- package/markdown-editor.css +16 -1
- package/package.json +12 -12
- package/src/Editor.tsx +14 -6
- package/src/__test__/editor.test.tsx +1 -1
- package/src/components/TextArea/index.less +8 -1
- package/src/components/Toolbar/index.less +5 -0
- package/src/components/Toolbar/index.tsx +4 -2
- package/src/index.less +3 -0
package/README.md
CHANGED
|
@@ -207,7 +207,7 @@ The following example is preview in [CodeSandbox](https://codesandbox.io/s/markd
|
|
|
207
207
|
|
|
208
208
|
[](https://codesandbox.io/embed/headless-frog-em8yg?fontsize=14&hidenavigation=1&theme=dark)
|
|
209
209
|
|
|
210
|
-
> ⚠️ Upgrade v2 to v3 [d025430](https://github.com/uiwjs/react-md-editor/blob/
|
|
210
|
+
> ⚠️ Upgrade v2 to v3 [d025430](https://github.com/uiwjs/react-md-editor/blob/7b9f11ab689a7ea288df3e82c26f4f0e9a53d271/website/ExmapleKaTeX.tsx#L1-L63)
|
|
211
211
|
|
|
212
212
|
```bash
|
|
213
213
|
npm install katex
|
|
@@ -217,6 +217,7 @@ npm install katex
|
|
|
217
217
|
import React from "react";
|
|
218
218
|
import ReactDOM from "react-dom";
|
|
219
219
|
import MDEditor from '@uiw/react-md-editor';
|
|
220
|
+
import { getCodeString } from 'rehype-rewrite';
|
|
220
221
|
import katex from 'katex';
|
|
221
222
|
import 'katex/dist/katex.css';
|
|
222
223
|
|
|
@@ -246,15 +247,16 @@ export default function App() {
|
|
|
246
247
|
}
|
|
247
248
|
return <code>{txt}</code>;
|
|
248
249
|
}
|
|
250
|
+
const code = props.node && props.node.children ? getCodeString(props.node.children) : txt;
|
|
249
251
|
if (
|
|
250
|
-
typeof
|
|
252
|
+
typeof code === 'string' &&
|
|
251
253
|
typeof className === 'string' &&
|
|
252
254
|
/^language-katex/.test(className.toLocaleLowerCase())
|
|
253
255
|
) {
|
|
254
|
-
const html = katex.renderToString(
|
|
256
|
+
const html = katex.renderToString(code, {
|
|
255
257
|
throwOnError: false,
|
|
256
258
|
});
|
|
257
|
-
return <code dangerouslySetInnerHTML={{ __html: html }} />;
|
|
259
|
+
return <code style={{ fontSize: '150%' }} dangerouslySetInnerHTML={{ __html: html }} />;
|
|
258
260
|
}
|
|
259
261
|
return <code className={String(className)}>{txt}</code>;
|
|
260
262
|
},
|
|
@@ -488,13 +490,13 @@ Inherit custom color variables by adding [`.wmde-markdown-var`](https://github.c
|
|
|
488
490
|
- `textareaProps?: TextareaHTMLAttributes`: Set the `textarea` related props.
|
|
489
491
|
- `renderTextarea?: (props, opts) => JSX.Element;`: Use div to replace TextArea or re-render TextArea. [#193](https://github.com/uiwjs/react-md-editor/issues/193)
|
|
490
492
|
- `height?: number=200`: The height of the editor.
|
|
491
|
-
- `
|
|
493
|
+
- `visibleDragbar?: boolean=true`: Show drag and drop tool. Set the height of the editor.
|
|
492
494
|
- `highlightEnable?: boolean=true`: Disable editing area code highlighting. The value is `false`, which increases the editing speed.
|
|
493
495
|
- `fullscreen?: boolean=false`: Show markdown preview.
|
|
494
496
|
- `overflow?: boolean=true`: Disable `fullscreen` setting body styles
|
|
495
497
|
- `preview?: 'live' | 'edit' | 'preview'`: Default value `live`, Show markdown preview.
|
|
496
|
-
- `maxHeight?: number=1200`: Maximum drag height. The `
|
|
497
|
-
- `minHeights?: number=100`: Minimum drag height. The `
|
|
498
|
+
- `maxHeight?: number=1200`: Maximum drag height. The `visibleDragbar=true` value is valid.
|
|
499
|
+
- `minHeights?: number=100`: Minimum drag height. The `visibleDragbar=true` value is valid.
|
|
498
500
|
- `tabSize?: number=2`: The number of characters to insert when pressing tab key. Default `2` spaces.
|
|
499
501
|
- `defaultTabEnable?: boolean=false`: If `false`, the `tab` key inserts a tab character into the textarea. If `true`, the `tab` key executes default behavior e.g. focus shifts to next element.
|
|
500
502
|
- `hideToolbar?: boolean=false`: Option to hide the tool bar.
|
package/dist/mdeditor.css
CHANGED
|
@@ -351,7 +351,6 @@ body[data-color-mode*='light'] {
|
|
|
351
351
|
width: -webkit-max-content;
|
|
352
352
|
width: max-content;
|
|
353
353
|
max-width: 100%;
|
|
354
|
-
overflow: auto;
|
|
355
354
|
}
|
|
356
355
|
.wmde-markdown td,
|
|
357
356
|
.wmde-markdown th {
|
|
@@ -387,15 +386,6 @@ body[data-color-mode*='light'] {
|
|
|
387
386
|
font-weight: 600;
|
|
388
387
|
line-height: 1.25;
|
|
389
388
|
}
|
|
390
|
-
.wmde-markdown table {
|
|
391
|
-
border-spacing: 0;
|
|
392
|
-
border-collapse: collapse;
|
|
393
|
-
display: block;
|
|
394
|
-
width: -webkit-max-content;
|
|
395
|
-
width: max-content;
|
|
396
|
-
max-width: 100%;
|
|
397
|
-
overflow: auto;
|
|
398
|
-
}
|
|
399
389
|
.wmde-markdown td,
|
|
400
390
|
.wmde-markdown th {
|
|
401
391
|
padding: 0;
|
|
@@ -1067,8 +1057,15 @@ body[data-color-mode*='light'] {
|
|
|
1067
1057
|
}
|
|
1068
1058
|
.w-md-editor-text-pre {
|
|
1069
1059
|
position: relative;
|
|
1070
|
-
margin: 0px;
|
|
1060
|
+
margin: 0px !important;
|
|
1071
1061
|
pointer-events: none;
|
|
1062
|
+
background-color: transparent !important;
|
|
1063
|
+
}
|
|
1064
|
+
.w-md-editor-text-pre > code {
|
|
1065
|
+
padding: 0 !important;
|
|
1066
|
+
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
|
|
1067
|
+
font-size: 14px !important;
|
|
1068
|
+
line-height: 18px !important;
|
|
1072
1069
|
}
|
|
1073
1070
|
.w-md-editor-text-input {
|
|
1074
1071
|
position: absolute;
|
|
@@ -1179,6 +1176,11 @@ body[data-color-mode*='light'] {
|
|
|
1179
1176
|
-ms-user-select: none;
|
|
1180
1177
|
user-select: none;
|
|
1181
1178
|
}
|
|
1179
|
+
.w-md-editor-toolbar.bottom {
|
|
1180
|
+
border-bottom: 0px;
|
|
1181
|
+
border-top: 1px solid var(--color-border-default);
|
|
1182
|
+
border-radius: 0 0 3px 3px;
|
|
1183
|
+
}
|
|
1182
1184
|
.w-md-editor-toolbar ul,
|
|
1183
1185
|
.w-md-editor-toolbar li {
|
|
1184
1186
|
margin: 0;
|
|
@@ -1286,6 +1288,9 @@ body[data-color-mode*='light'] {
|
|
|
1286
1288
|
top: 0;
|
|
1287
1289
|
right: 0;
|
|
1288
1290
|
bottom: 0;
|
|
1291
|
+
border-radius: 0 0 5px 0;
|
|
1292
|
+
display: flex;
|
|
1293
|
+
flex-direction: column;
|
|
1289
1294
|
}
|
|
1290
1295
|
.w-md-editor-preview .anchor {
|
|
1291
1296
|
display: none;
|