Skip to content

Commit

Permalink
Desktop: Fixes #10007: Fixed Toggle Comment & Delete Line Options in …
Browse files Browse the repository at this point in the history
…Beta Editor
  • Loading branch information
criticic committed Feb 27, 2024
1 parent 40ae03c commit d86421f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/editor/CodeMirror/editorCommands/editorCommands.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EditorView } from '@codemirror/view';
import { EditorCommandType, ListType } from '../../types';
import { undo, redo, selectAll, indentSelection, cursorDocStart, cursorDocEnd, cursorLineStart, cursorLineEnd, deleteToLineStart, deleteToLineEnd, undoSelection, redoSelection, cursorPageDown, cursorPageUp, cursorCharRight, cursorCharLeft, insertNewlineAndIndent, cursorLineDown, cursorLineUp } from '@codemirror/commands';
import { undo, redo, selectAll, indentSelection, cursorDocStart, cursorDocEnd, cursorLineStart, cursorLineEnd, deleteToLineStart, deleteToLineEnd, undoSelection, redoSelection, cursorPageDown, cursorPageUp, cursorCharRight, cursorCharLeft, insertNewlineAndIndent, cursorLineDown, cursorLineUp, toggleComment, deleteLine } from '@codemirror/commands';
import {
decreaseIndent, increaseIndent,
toggleBolded, toggleCode,
Expand All @@ -22,6 +22,7 @@ const editorCommands: Record<EditorCommandType, EditorCommandFunction> = {
[EditorCommandType.ToggleItalicized]: toggleItalicized,
[EditorCommandType.ToggleCode]: toggleCode,
[EditorCommandType.ToggleMath]: toggleMath,
[EditorCommandType.ToggleComment]: toggleComment,
[EditorCommandType.ToggleNumberedList]: toggleList(ListType.OrderedList),
[EditorCommandType.ToggleBulletedList]: toggleList(ListType.UnorderedList),
[EditorCommandType.ToggleCheckList]: toggleList(ListType.CheckList),
Expand All @@ -39,6 +40,7 @@ const editorCommands: Record<EditorCommandType, EditorCommandFunction> = {
},
[EditorCommandType.DeleteToLineEnd]: deleteToLineEnd,
[EditorCommandType.DeleteToLineStart]: deleteToLineStart,
[EditorCommandType.DeleteLine]: deleteLine,
[EditorCommandType.IndentMore]: increaseIndent,
[EditorCommandType.IndentLess]: decreaseIndent,
[EditorCommandType.IndentAuto]: indentSelection,
Expand Down
2 changes: 2 additions & 0 deletions packages/editor/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export enum EditorCommandType {
ToggleItalicized = 'textItalic',
ToggleCode = 'textCode',
ToggleMath = 'textMath',
ToggleComment = 'toggleComment',

ToggleNumberedList = 'textNumberedList',
ToggleBulletedList = 'textBulletedList',
Expand All @@ -37,6 +38,7 @@ export enum EditorCommandType {

// Editing and navigation commands
ScrollSelectionIntoView = 'scrollSelectionIntoView',
DeleteLine = 'deleteLine',
DeleteToLineEnd = 'killLine',
DeleteToLineStart = 'delLineLeft',
IndentMore = 'indentMore',
Expand Down

1 comment on commit d86421f

@personalizedrefrigerator
Copy link
Collaborator

@personalizedrefrigerator personalizedrefrigerator commented on d86421f Feb 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me!

Edit: If you want to add tests, one place to do so could be in packages/editor/CodeMirror/CodeMirrorControl.test.ts.

Please sign in to comment.