We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 596af9a + b85e3bb commit 5e91858Copy full SHA for 5e91858
src/ReactMde.tsx
@@ -37,7 +37,11 @@ export class ReactMde extends React.Component<ReactMdeProps> {
37
handleCommand = (command: Command) => {
38
const {value: {text}, onChange} = this.props;
39
const newValue = command.execute(text, getSelection(this.textArea));
40
- onChange(newValue);
+ if (newValue instanceof Promise) {
41
+ newValue.then((v) => onChange(v));
42
+ } else {
43
+ onChange(newValue);
44
+ }
45
}
46
47
/**
src/types/Command.ts
@@ -5,5 +5,5 @@ export interface Command {
5
type?: string;
6
icon?: string;
7
tooltip?: string;
8
- execute: (text: string, selection: TextSelection) => Value;
+ execute: (text: string, selection: TextSelection) => Value | Promise<Value>;
9
0 commit comments