From a82c76bd80687eaadd4a60ab24185ac9a71820cd Mon Sep 17 00:00:00 2001 From: RAR Date: Mon, 16 Oct 2023 15:43:55 +0200 Subject: [PATCH] fix: added issue, table, help to commands, task list more like in github (#582) * fix: Task list - always add unfinished task in the new line This is how Github handles it. It makes sense, as you add new task, you probably want to finish them in the future (not add them as finished). * fix: Added issue, table, help to commands --- core/src/commands/index.ts | 4 ++++ core/src/components/TextArea/handleKeyDown.tsx | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core/src/commands/index.ts b/core/src/commands/index.ts index 3f700db57..1d6e82708 100644 --- a/core/src/commands/index.ts +++ b/core/src/commands/index.ts @@ -23,6 +23,7 @@ import { title4 } from './title4'; import { title5 } from './title5'; import { title6 } from './title6'; import { table } from './table'; +import { issue } from './issue'; import { help } from './help'; export interface CommandOrchestrator { @@ -202,6 +203,9 @@ export { unorderedListCommand, orderedListCommand, checkedListCommand, + table, + issue, + help, codeEdit, codeLive, codePreview, diff --git a/core/src/components/TextArea/handleKeyDown.tsx b/core/src/components/TextArea/handleKeyDown.tsx index 6f3d0016f..93c16c070 100644 --- a/core/src/components/TextArea/handleKeyDown.tsx +++ b/core/src/components/TextArea/handleKeyDown.tsx @@ -115,10 +115,12 @@ export default function handleKeyDown( startStr = '\n* '; } - if (currentLineStr.startsWith('- [ ]')) { + if ( + currentLineStr.startsWith('- [ ]') || + currentLineStr.startsWith('- [X]') || + currentLineStr.startsWith('- [x]') + ) { startStr = '\n- [ ] '; - } else if (currentLineStr.startsWith('- [X]') || currentLineStr.startsWith('- [x]')) { - startStr = '\n- [X] '; } if (/^\d+.\s/.test(currentLineStr)) {