|
|
@@ -62,7 +62,6 @@ export default class CodeMirrorEditor extends AbstractEditor {
|
|
|
isEnabledEmojiAutoComplete: false,
|
|
|
isLoadingKeymap: false,
|
|
|
isSimpleCheatsheetShown: this.props.isGfmMode && this.props.value.length === 0,
|
|
|
- isCheatsheetModalButtonShown: this.props.isGfmMode && this.props.value.length > 0,
|
|
|
isCheatsheetModalShown: false,
|
|
|
additionalClassSet: new Set(),
|
|
|
};
|
|
|
@@ -507,10 +506,9 @@ export default class CodeMirrorEditor extends AbstractEditor {
|
|
|
const isGfmMode = isGfmModeTmp || this.state.isGfmMode;
|
|
|
const value = valueTmp || this.getCodeMirror().getDoc().getValue();
|
|
|
|
|
|
- // update isSimpleCheatsheetShown, isCheatsheetModalButtonShown
|
|
|
+ // update isSimpleCheatsheetShown
|
|
|
const isSimpleCheatsheetShown = isGfmMode && value.length === 0;
|
|
|
- const isCheatsheetModalButtonShown = isGfmMode && value.length > 0;
|
|
|
- this.setState({ isSimpleCheatsheetShown, isCheatsheetModalButtonShown });
|
|
|
+ this.setState({ isSimpleCheatsheetShown });
|
|
|
}
|
|
|
|
|
|
renderLoadingKeymapOverlay() {
|
|
|
@@ -533,14 +531,6 @@ export default class CodeMirrorEditor extends AbstractEditor {
|
|
|
: '';
|
|
|
}
|
|
|
|
|
|
- renderSimpleCheatsheet() {
|
|
|
- return <SimpleCheatsheet />;
|
|
|
- }
|
|
|
-
|
|
|
- renderCheatsheetModalBody() {
|
|
|
- return <Cheatsheet />;
|
|
|
- }
|
|
|
-
|
|
|
renderCheatsheetModalButton() {
|
|
|
const showCheatsheetModal = () => {
|
|
|
this.setState({ isCheatsheetModalShown: true });
|
|
|
@@ -557,17 +547,41 @@ export default class CodeMirrorEditor extends AbstractEditor {
|
|
|
<Modal.Title><i className="icon-fw icon-question" />Markdown Help</Modal.Title>
|
|
|
</Modal.Header>
|
|
|
<Modal.Body className="pt-1">
|
|
|
- { this.renderCheatsheetModalBody() }
|
|
|
+ <Cheatsheet />
|
|
|
</Modal.Body>
|
|
|
</Modal>
|
|
|
|
|
|
- <button type="button" className="btn-link gfm-cheatsheet-modal-link text-muted small mr-3" onClick={() => { showCheatsheetModal() }}>
|
|
|
+ <button type="button" className="btn-link gfm-cheatsheet-modal-link text-muted small p-0" onClick={() => { showCheatsheetModal() }}>
|
|
|
<i className="icon-question" /> Markdown
|
|
|
</button>
|
|
|
</React.Fragment>
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+ renderCheatsheetOverlay() {
|
|
|
+ const cheatsheetModalButton = this.renderCheatsheetModalButton();
|
|
|
+
|
|
|
+ return (
|
|
|
+ <div className="overlay overlay-gfm-cheatsheet mt-1 p-3">
|
|
|
+ { this.state.isSimpleCheatsheetShown
|
|
|
+ ? (
|
|
|
+ <div className="text-right">
|
|
|
+ {cheatsheetModalButton}
|
|
|
+ <div className="mt-2">
|
|
|
+ <SimpleCheatsheet />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ : (
|
|
|
+ <div className="mr-4">
|
|
|
+ {cheatsheetModalButton}
|
|
|
+ </div>
|
|
|
+ )
|
|
|
+ }
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* return a function to replace a selected range with prefix + selection + suffix
|
|
|
*
|
|
|
@@ -808,10 +822,7 @@ export default class CodeMirrorEditor extends AbstractEditor {
|
|
|
|
|
|
{ this.renderLoadingKeymapOverlay() }
|
|
|
|
|
|
- <div className="overlay overlay-gfm-cheatsheet mt-1 p-3 pt-3">
|
|
|
- { this.state.isSimpleCheatsheetShown && this.renderSimpleCheatsheet() }
|
|
|
- { this.state.isCheatsheetModalButtonShown && this.renderCheatsheetModalButton() }
|
|
|
- </div>
|
|
|
+ { this.renderCheatsheetOverlay() }
|
|
|
|
|
|
<HandsontableModal
|
|
|
ref={(c) => { this.handsontableModal = c }}
|