@uiw/react-md-editor 4.0.7 → 4.0.9
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 +104 -2
- package/commands.d.ts +14 -7
- package/dist/mdeditor.css +1 -1
- package/dist/mdeditor.js +231 -233
- package/dist/mdeditor.min.js +1 -1
- package/esm/Editor.d.ts +1 -1
- package/esm/Editor.nohighlight.d.ts +1 -1
- package/esm/commands/index.cn.js +4 -4
- package/esm/commands/index.d.ts +8 -8
- package/esm/commands/index.js +8 -8
- package/esm/commands/title.d.ts +7 -1
- package/esm/commands/title.js +11 -4
- package/esm/commands/title1.d.ts +6 -0
- package/esm/commands/title1.js +16 -9
- package/esm/commands/title2.d.ts +6 -0
- package/esm/commands/title2.js +16 -9
- package/esm/commands/title3.d.ts +6 -0
- package/esm/commands/title3.js +16 -9
- package/esm/commands/title4.d.ts +6 -0
- package/esm/commands/title4.js +16 -9
- package/esm/commands/title5.d.ts +6 -0
- package/esm/commands/title5.js +16 -9
- package/esm/commands/title6.d.ts +6 -0
- package/esm/commands/title6.js +16 -9
- package/esm/components/DragBar/index.d.ts +1 -1
- package/esm/components/TextArea/Markdown.d.ts +1 -1
- package/esm/components/TextArea/Textarea.d.ts +1 -1
- package/esm/components/TextArea/index.d.ts +4 -4
- package/esm/components/TextArea/index.nohighlight.d.ts +3 -3
- package/esm/components/Toolbar/Child.d.ts +1 -1
- package/esm/components/Toolbar/index.d.ts +1 -1
- package/esm/index.d.ts +3 -0
- package/esm/index.js +3 -0
- package/lib/Editor.d.ts +1 -1
- package/lib/Editor.nohighlight.d.ts +1 -1
- package/lib/commands/index.cn.js +4 -4
- package/lib/commands/index.d.ts +8 -8
- package/lib/commands/index.js +42 -0
- package/lib/commands/title.d.ts +7 -1
- package/lib/commands/title.js +12 -4
- package/lib/commands/title1.d.ts +6 -0
- package/lib/commands/title1.js +16 -9
- package/lib/commands/title2.d.ts +6 -0
- package/lib/commands/title2.js +16 -9
- package/lib/commands/title3.d.ts +6 -0
- package/lib/commands/title3.js +16 -9
- package/lib/commands/title4.d.ts +6 -0
- package/lib/commands/title4.js +16 -9
- package/lib/commands/title5.d.ts +6 -0
- package/lib/commands/title5.js +16 -9
- package/lib/commands/title6.d.ts +6 -0
- package/lib/commands/title6.js +16 -9
- package/lib/components/DragBar/index.d.ts +1 -1
- package/lib/components/TextArea/Markdown.d.ts +1 -1
- package/lib/components/TextArea/Textarea.d.ts +1 -1
- package/lib/components/TextArea/index.d.ts +4 -4
- package/lib/components/TextArea/index.nohighlight.d.ts +3 -3
- package/lib/components/Toolbar/Child.d.ts +1 -1
- package/lib/components/Toolbar/index.d.ts +1 -1
- package/lib/index.d.ts +3 -0
- package/lib/index.js +26 -1
- package/nohighlight.d.ts +2 -0
- package/package.json +1 -1
- package/src/Editor.nohighlight.tsx +2 -2
- package/src/Editor.tsx +3 -3
- package/src/commands/index.cn.ts +3 -3
- package/src/commands/index.ts +14 -7
- package/src/commands/title.tsx +11 -4
- package/src/commands/title1.tsx +14 -7
- package/src/commands/title2.tsx +14 -7
- package/src/commands/title3.tsx +14 -7
- package/src/commands/title4.tsx +14 -7
- package/src/commands/title5.tsx +14 -7
- package/src/commands/title6.tsx +14 -7
- package/src/components/DragBar/index.tsx +1 -1
- package/src/components/TextArea/Markdown.tsx +1 -1
- package/src/components/TextArea/Textarea.tsx +2 -2
- package/src/components/TextArea/index.nohighlight.tsx +5 -4
- package/src/components/TextArea/index.tsx +6 -5
- package/src/components/Toolbar/Child.tsx +1 -1
- package/src/components/Toolbar/index.tsx +2 -2
- package/src/index.tsx +3 -0
|
@@ -3,8 +3,8 @@ import MarkdownPreview from '@uiw/react-markdown-preview/nohighlight';
|
|
|
3
3
|
import TextArea from './components/TextArea/index.nohighlight';
|
|
4
4
|
import { ToolbarVisibility } from './components/Toolbar/';
|
|
5
5
|
import DragBar from './components/DragBar/';
|
|
6
|
-
import { getCommands, getExtraCommands, ICommand, TextState, TextAreaCommandOrchestrator } from './commands/';
|
|
7
|
-
import { reducer, EditorContext, ContextStore } from './Context';
|
|
6
|
+
import { getCommands, getExtraCommands, type ICommand, type TextState, TextAreaCommandOrchestrator } from './commands/';
|
|
7
|
+
import { reducer, EditorContext, type ContextStore } from './Context';
|
|
8
8
|
import type { MDEditorProps } from './Types';
|
|
9
9
|
|
|
10
10
|
function setGroupPopFalse(data: Record<string, boolean> = {}) {
|
package/src/Editor.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, { useEffect, useReducer, useMemo, useRef, useImperativeHandle
|
|
1
|
+
import React, { useEffect, useReducer, useMemo, useRef, useImperativeHandle } from 'react';
|
|
2
2
|
import MarkdownPreview from '@uiw/react-markdown-preview';
|
|
3
3
|
import { ToolbarVisibility } from './components/Toolbar/';
|
|
4
4
|
import TextArea from './components/TextArea/';
|
|
5
5
|
import DragBar from './components/DragBar/';
|
|
6
|
-
import { getCommands, getExtraCommands, ICommand, TextState, TextAreaCommandOrchestrator } from './commands/';
|
|
7
|
-
import { reducer, EditorContext, ContextStore } from './Context';
|
|
6
|
+
import { getCommands, getExtraCommands, type ICommand, type TextState, TextAreaCommandOrchestrator } from './commands/';
|
|
7
|
+
import { reducer, EditorContext, type ContextStore } from './Context';
|
|
8
8
|
import type { MDEditorProps } from './Types';
|
|
9
9
|
|
|
10
10
|
function setGroupPopFalse(data: Record<string, boolean> = {}) {
|
package/src/commands/index.cn.ts
CHANGED
|
@@ -46,7 +46,7 @@ let fullscreen: ICommand = {
|
|
|
46
46
|
...fullscreenInit,
|
|
47
47
|
buttonProps: { 'aria-label': '切换全屏(ctrl + 0)', title: '切换全屏(ctrl + 0)' },
|
|
48
48
|
};
|
|
49
|
-
let hr: ICommand = { ...hrInit, buttonProps: { 'aria-label': '
|
|
49
|
+
let hr: ICommand = { ...hrInit, buttonProps: { 'aria-label': '插入分割线 (ctrl + h)', title: '插入分割线 (ctrl + h)' } };
|
|
50
50
|
let image: ICommand = {
|
|
51
51
|
...imageInit,
|
|
52
52
|
buttonProps: { 'aria-label': '添加图像(ctrl + k)', title: '添加图像(ctrl + k)' },
|
|
@@ -91,8 +91,8 @@ let quote: ICommand = {
|
|
|
91
91
|
let strikethrough: ICommand = {
|
|
92
92
|
...strikethroughInit,
|
|
93
93
|
buttonProps: {
|
|
94
|
-
'aria-label': '
|
|
95
|
-
title: '
|
|
94
|
+
'aria-label': '添加删除线文本 (ctrl + shift + x)',
|
|
95
|
+
title: '添加删除线文本 (ctrl + shift + x)',
|
|
96
96
|
},
|
|
97
97
|
};
|
|
98
98
|
let issue: ICommand = { ...issueInit, buttonProps: { 'aria-label': '添加 issue', title: '添加 issue' } };
|
package/src/commands/index.ts
CHANGED
|
@@ -15,13 +15,13 @@ import { checkedListCommand, orderedListCommand, unorderedListCommand } from './
|
|
|
15
15
|
import { codeEdit, codeLive, codePreview } from './preview';
|
|
16
16
|
import { quote } from './quote';
|
|
17
17
|
import { strikethrough } from './strikeThrough';
|
|
18
|
-
import { title } from './title';
|
|
19
|
-
import { title1 } from './title1';
|
|
20
|
-
import { title2 } from './title2';
|
|
21
|
-
import { title3 } from './title3';
|
|
22
|
-
import { title4 } from './title4';
|
|
23
|
-
import { title5 } from './title5';
|
|
24
|
-
import { title6 } from './title6';
|
|
18
|
+
import { title, heading } from './title';
|
|
19
|
+
import { title1, heading1 } from './title1';
|
|
20
|
+
import { title2, heading2 } from './title2';
|
|
21
|
+
import { title3, heading3 } from './title3';
|
|
22
|
+
import { title4, heading4 } from './title4';
|
|
23
|
+
import { title5, heading5 } from './title5';
|
|
24
|
+
import { title6, heading6 } from './title6';
|
|
25
25
|
import { table } from './table';
|
|
26
26
|
import { issue } from './issue';
|
|
27
27
|
import { help } from './help';
|
|
@@ -188,6 +188,13 @@ export {
|
|
|
188
188
|
title4,
|
|
189
189
|
title5,
|
|
190
190
|
title6,
|
|
191
|
+
heading,
|
|
192
|
+
heading1,
|
|
193
|
+
heading2,
|
|
194
|
+
heading3,
|
|
195
|
+
heading4,
|
|
196
|
+
heading5,
|
|
197
|
+
heading6,
|
|
191
198
|
bold,
|
|
192
199
|
codeBlock,
|
|
193
200
|
comment,
|
package/src/commands/title.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ICommand, ExecuteState, TextAreaTextApi } from './';
|
|
3
|
-
import {
|
|
3
|
+
import { heading1 } from './title1';
|
|
4
4
|
import { selectLine, executeCommand } from '../utils/markdownUtils';
|
|
5
5
|
|
|
6
|
-
export function
|
|
6
|
+
export function headingExecute({
|
|
7
7
|
state,
|
|
8
8
|
api,
|
|
9
9
|
prefix,
|
|
@@ -19,8 +19,8 @@ export function titleExecute({
|
|
|
19
19
|
executeCommand({ api, selectedText: state1.selectedText, selection: state.selection, prefix, suffix });
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export const
|
|
23
|
-
...
|
|
22
|
+
export const heading: ICommand = {
|
|
23
|
+
...heading1,
|
|
24
24
|
icon: (
|
|
25
25
|
<svg width="12" height="12" viewBox="0 0 520 520">
|
|
26
26
|
<path
|
|
@@ -30,3 +30,10 @@ export const title: ICommand = {
|
|
|
30
30
|
</svg>
|
|
31
31
|
),
|
|
32
32
|
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated Use `heading` instead.
|
|
36
|
+
* This command is now deprecated and will be removed in future versions.
|
|
37
|
+
* Use `title` for inserting headings.
|
|
38
|
+
*/
|
|
39
|
+
export const title: ICommand = heading;
|
package/src/commands/title1.tsx
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { headingExecute } from '../commands/title';
|
|
3
3
|
import { ICommand, ExecuteState, TextAreaTextApi } from './';
|
|
4
4
|
|
|
5
|
-
export const
|
|
6
|
-
name: '
|
|
7
|
-
keyCommand: '
|
|
5
|
+
export const heading1: ICommand = {
|
|
6
|
+
name: 'heading1',
|
|
7
|
+
keyCommand: 'heading1',
|
|
8
8
|
shortcuts: 'ctrlcmd+1',
|
|
9
9
|
prefix: '# ',
|
|
10
10
|
suffix: '',
|
|
11
|
-
buttonProps: { 'aria-label': 'Insert
|
|
12
|
-
icon: <div style={{ fontSize: 18, textAlign: 'left' }}>
|
|
11
|
+
buttonProps: { 'aria-label': 'Insert Heading 1 (ctrl + 1)', title: 'Insert Heading 1 (ctrl + 1)' },
|
|
12
|
+
icon: <div style={{ fontSize: 18, textAlign: 'left' }}>Heading 1</div>,
|
|
13
13
|
execute: (state: ExecuteState, api: TextAreaTextApi) => {
|
|
14
|
-
|
|
14
|
+
headingExecute({ state, api, prefix: state.command.prefix!, suffix: state.command.suffix });
|
|
15
15
|
},
|
|
16
16
|
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated Use `heading1` instead.
|
|
20
|
+
* This command is now deprecated and will be removed in future versions.
|
|
21
|
+
* Use `title1` for inserting Heading 1.
|
|
22
|
+
*/
|
|
23
|
+
export const title1: ICommand = heading1;
|
package/src/commands/title2.tsx
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { headingExecute } from '../commands/title';
|
|
3
3
|
import { ICommand, ExecuteState, TextAreaTextApi } from './';
|
|
4
4
|
|
|
5
|
-
export const
|
|
6
|
-
name: '
|
|
7
|
-
keyCommand: '
|
|
5
|
+
export const heading2: ICommand = {
|
|
6
|
+
name: 'heading2',
|
|
7
|
+
keyCommand: 'heading2',
|
|
8
8
|
shortcuts: 'ctrlcmd+2',
|
|
9
9
|
prefix: '## ',
|
|
10
10
|
suffix: '',
|
|
11
|
-
buttonProps: { 'aria-label': 'Insert
|
|
12
|
-
icon: <div style={{ fontSize: 16, textAlign: 'left' }}>
|
|
11
|
+
buttonProps: { 'aria-label': 'Insert Heading 2 (ctrl + 2)', title: 'Insert Heading 2 (ctrl + 2)' },
|
|
12
|
+
icon: <div style={{ fontSize: 16, textAlign: 'left' }}>Heading 2</div>,
|
|
13
13
|
execute: (state: ExecuteState, api: TextAreaTextApi) => {
|
|
14
|
-
|
|
14
|
+
headingExecute({ state, api, prefix: state.command.prefix!, suffix: state.command.suffix });
|
|
15
15
|
},
|
|
16
16
|
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated Use `heading2` instead.
|
|
20
|
+
* This command is now deprecated and will be removed in future versions.
|
|
21
|
+
* Use `title2` for inserting Heading 2.
|
|
22
|
+
*/
|
|
23
|
+
export const title2: ICommand = heading2;
|
package/src/commands/title3.tsx
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { headingExecute } from '../commands/title';
|
|
3
3
|
import { ICommand, ExecuteState, TextAreaTextApi } from './';
|
|
4
4
|
|
|
5
|
-
export const
|
|
6
|
-
name: '
|
|
7
|
-
keyCommand: '
|
|
5
|
+
export const heading3: ICommand = {
|
|
6
|
+
name: 'heading3',
|
|
7
|
+
keyCommand: 'heading3',
|
|
8
8
|
shortcuts: 'ctrlcmd+3',
|
|
9
9
|
prefix: '### ',
|
|
10
10
|
suffix: '',
|
|
11
|
-
buttonProps: { 'aria-label': 'Insert
|
|
12
|
-
icon: <div style={{ fontSize: 15, textAlign: 'left' }}>
|
|
11
|
+
buttonProps: { 'aria-label': 'Insert Heading 3 (ctrl + 3)', title: 'Insert Heading 3 (ctrl + 3)' },
|
|
12
|
+
icon: <div style={{ fontSize: 15, textAlign: 'left' }}>Heading 3</div>,
|
|
13
13
|
execute: (state: ExecuteState, api: TextAreaTextApi) => {
|
|
14
|
-
|
|
14
|
+
headingExecute({ state, api, prefix: state.command.prefix!, suffix: state.command.suffix });
|
|
15
15
|
},
|
|
16
16
|
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated Use `heading3` instead.
|
|
20
|
+
* This command is now deprecated and will be removed in future versions.
|
|
21
|
+
* Use `title3` for inserting Heading 3.
|
|
22
|
+
*/
|
|
23
|
+
export const title3: ICommand = heading3;
|
package/src/commands/title4.tsx
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { headingExecute } from '../commands/title';
|
|
3
3
|
import { ICommand, ExecuteState, TextAreaTextApi } from './';
|
|
4
4
|
|
|
5
|
-
export const
|
|
6
|
-
name: '
|
|
7
|
-
keyCommand: '
|
|
5
|
+
export const heading4: ICommand = {
|
|
6
|
+
name: 'heading4',
|
|
7
|
+
keyCommand: 'heading4',
|
|
8
8
|
shortcuts: 'ctrlcmd+4',
|
|
9
9
|
prefix: '#### ',
|
|
10
10
|
suffix: '',
|
|
11
|
-
buttonProps: { 'aria-label': 'Insert
|
|
12
|
-
icon: <div style={{ fontSize: 14, textAlign: 'left' }}>
|
|
11
|
+
buttonProps: { 'aria-label': 'Insert Heading 4 (ctrl + 4)', title: 'Insert Heading 4 (ctrl + 4)' },
|
|
12
|
+
icon: <div style={{ fontSize: 14, textAlign: 'left' }}>Heading 4</div>,
|
|
13
13
|
execute: (state: ExecuteState, api: TextAreaTextApi) => {
|
|
14
|
-
|
|
14
|
+
headingExecute({ state, api, prefix: state.command.prefix!, suffix: state.command.suffix });
|
|
15
15
|
},
|
|
16
16
|
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated Use `heading4` instead.
|
|
20
|
+
* This command is now deprecated and will be removed in future versions.
|
|
21
|
+
* Use `title4` for inserting Heading 4.
|
|
22
|
+
*/
|
|
23
|
+
export const title4: ICommand = heading4;
|
package/src/commands/title5.tsx
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { headingExecute } from '../commands/title';
|
|
3
3
|
import { ICommand, ExecuteState, TextAreaTextApi } from './';
|
|
4
4
|
|
|
5
|
-
export const
|
|
6
|
-
name: '
|
|
7
|
-
keyCommand: '
|
|
5
|
+
export const heading5: ICommand = {
|
|
6
|
+
name: 'heading5',
|
|
7
|
+
keyCommand: 'heading5',
|
|
8
8
|
shortcuts: 'ctrlcmd+5',
|
|
9
9
|
prefix: '##### ',
|
|
10
10
|
suffix: '',
|
|
11
|
-
buttonProps: { 'aria-label': 'Insert
|
|
12
|
-
icon: <div style={{ fontSize: 12, textAlign: 'left' }}>
|
|
11
|
+
buttonProps: { 'aria-label': 'Insert Heading 5 (ctrl + 5)', title: 'Insert Heading 5 (ctrl + 5)' },
|
|
12
|
+
icon: <div style={{ fontSize: 12, textAlign: 'left' }}>Heading 5</div>,
|
|
13
13
|
execute: (state: ExecuteState, api: TextAreaTextApi) => {
|
|
14
|
-
|
|
14
|
+
headingExecute({ state, api, prefix: state.command.prefix!, suffix: state.command.suffix });
|
|
15
15
|
},
|
|
16
16
|
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated Use `heading5` instead.
|
|
20
|
+
* This command is now deprecated and will be removed in future versions.
|
|
21
|
+
* Use `title5` for inserting Heading 5.
|
|
22
|
+
*/
|
|
23
|
+
export const title5: ICommand = heading5;
|
package/src/commands/title6.tsx
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { headingExecute } from '../commands/title';
|
|
3
3
|
import { ICommand, ExecuteState, TextAreaTextApi } from './';
|
|
4
4
|
|
|
5
|
-
export const
|
|
6
|
-
name: '
|
|
7
|
-
keyCommand: '
|
|
5
|
+
export const heading6: ICommand = {
|
|
6
|
+
name: 'heading6',
|
|
7
|
+
keyCommand: 'heading6',
|
|
8
8
|
shortcuts: 'ctrlcmd+6',
|
|
9
9
|
prefix: '###### ',
|
|
10
10
|
suffix: '',
|
|
11
|
-
buttonProps: { 'aria-label': 'Insert
|
|
12
|
-
icon: <div style={{ fontSize: 12, textAlign: 'left' }}>
|
|
11
|
+
buttonProps: { 'aria-label': 'Insert Heading 6 (ctrl + 6)', title: 'Insert Heading 6 (ctrl + 6)' },
|
|
12
|
+
icon: <div style={{ fontSize: 12, textAlign: 'left' }}>Heading 6</div>,
|
|
13
13
|
execute: (state: ExecuteState, api: TextAreaTextApi) => {
|
|
14
|
-
|
|
14
|
+
headingExecute({ state, api, prefix: state.command.prefix!, suffix: state.command.suffix });
|
|
15
15
|
},
|
|
16
16
|
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated Use `heading6` instead.
|
|
20
|
+
* This command is now deprecated and will be removed in future versions.
|
|
21
|
+
* Use `title6` for inserting Heading 6.
|
|
22
|
+
*/
|
|
23
|
+
export const title6: ICommand = heading6;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useContext, useEffect } from 'react';
|
|
2
2
|
import { rehype } from 'rehype';
|
|
3
3
|
import rehypePrism from 'rehype-prism-plus';
|
|
4
|
-
import { IProps } from '../../Types';
|
|
4
|
+
import { type IProps } from '../../Types';
|
|
5
5
|
import { EditorContext } from '../../Context';
|
|
6
6
|
|
|
7
7
|
function html2Escape(sHtml: string) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useContext, useEffect } from 'react';
|
|
2
|
-
import { IProps } from '../../Types';
|
|
3
|
-
import { EditorContext, ExecuteCommandState } from '../../Context';
|
|
2
|
+
import { type IProps } from '../../Types';
|
|
3
|
+
import { EditorContext, type ExecuteCommandState } from '../../Context';
|
|
4
4
|
import { TextAreaCommandOrchestrator } from '../../commands/';
|
|
5
5
|
import handleKeyDown from './handleKeyDown';
|
|
6
6
|
import shortcuts from './shortcuts';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React, { useEffect, Fragment, useContext, JSX } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import type * as CSS from 'csstype';
|
|
3
|
+
import { EditorContext, type ContextStore, ExecuteCommandState } from '../../Context';
|
|
3
4
|
import shortcuts from './shortcuts';
|
|
4
5
|
import Textarea, { TextAreaProps } from './Textarea';
|
|
5
|
-
import { IProps } from '../../Types';
|
|
6
|
-
import { TextAreaCommandOrchestrator, ICommand } from '../../commands/';
|
|
6
|
+
import { type IProps } from '../../Types';
|
|
7
|
+
import { TextAreaCommandOrchestrator, type ICommand } from '../../commands/';
|
|
7
8
|
import './index.less';
|
|
8
9
|
|
|
9
10
|
type RenderTextareaHandle = {
|
|
@@ -66,7 +67,7 @@ export default function TextArea(props: ITextAreaProps) {
|
|
|
66
67
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
67
68
|
}, []);
|
|
68
69
|
|
|
69
|
-
const textStyle:
|
|
70
|
+
const textStyle: CSS.Properties = { WebkitTextFillColor: 'initial', overflow: 'auto' };
|
|
70
71
|
|
|
71
72
|
return (
|
|
72
73
|
<div ref={warp} className={`${prefixCls}-area ${className || ''}`} onScroll={onScroll}>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, { useEffect, Fragment, useContext, JSX } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import type * as CSS from 'csstype';
|
|
3
|
+
import { EditorContext, type ContextStore, type ExecuteCommandState } from '../../Context';
|
|
3
4
|
import shortcuts from './shortcuts';
|
|
4
5
|
import Markdown from './Markdown';
|
|
5
|
-
import Textarea, { TextAreaProps } from './Textarea';
|
|
6
|
-
import { IProps } from '../../Types';
|
|
7
|
-
import { TextAreaCommandOrchestrator, ICommand } from '../../commands/';
|
|
6
|
+
import Textarea, { type TextAreaProps } from './Textarea';
|
|
7
|
+
import { type IProps } from '../../Types';
|
|
8
|
+
import { TextAreaCommandOrchestrator, type ICommand } from '../../commands/';
|
|
8
9
|
import './index.less';
|
|
9
10
|
|
|
10
11
|
type RenderTextareaHandle = {
|
|
@@ -68,7 +69,7 @@ export default function TextArea(props: ITextAreaProps) {
|
|
|
68
69
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
69
70
|
}, []);
|
|
70
71
|
|
|
71
|
-
const textStyle:
|
|
72
|
+
const textStyle: CSS.Properties = highlightEnable ? {} : { WebkitTextFillColor: 'initial', overflow: 'auto' };
|
|
72
73
|
|
|
73
74
|
return (
|
|
74
75
|
<div ref={warp} className={`${prefixCls}-area ${className || ''}`} onScroll={onScroll}>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Fragment, useContext, useEffect, useRef } from 'react';
|
|
2
|
-
import { IProps } from '../../Types';
|
|
3
|
-
import { EditorContext, PreviewType, ContextStore } from '../../Context';
|
|
2
|
+
import { type IProps } from '../../Types';
|
|
3
|
+
import { EditorContext, type PreviewType, type ContextStore } from '../../Context';
|
|
4
4
|
import { ICommand } from '../../commands/';
|
|
5
5
|
import Child from './Child';
|
|
6
6
|
import './index.less';
|
package/src/index.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import * as commands from './commands/';
|
|
|
3
3
|
import * as MarkdownUtil from './utils/markdownUtils';
|
|
4
4
|
import './index.less';
|
|
5
5
|
|
|
6
|
+
export { headingExecute } from './commands/title';
|
|
6
7
|
export * from './commands/';
|
|
7
8
|
export * from './commands/group';
|
|
8
9
|
export * from './utils/markdownUtils';
|
|
@@ -10,6 +11,8 @@ export * from './utils/InsertTextAtPosition';
|
|
|
10
11
|
export * from './Editor';
|
|
11
12
|
export * from './Context';
|
|
12
13
|
export * from './Types';
|
|
14
|
+
export { default as handleKeyDown } from './components/TextArea/handleKeyDown';
|
|
15
|
+
export { default as shortcuts } from './components/TextArea/shortcuts';
|
|
13
16
|
|
|
14
17
|
export { MarkdownUtil, commands };
|
|
15
18
|
|