diff --git a/web/src/composebox_typeahead.js b/web/src/composebox_typeahead.js index 785ffd7e36..b3b075b540 100644 --- a/web/src/composebox_typeahead.js +++ b/web/src/composebox_typeahead.js @@ -153,6 +153,10 @@ export function should_enter_send(e) { } function handle_bulleting_or_numbering($textarea, e) { + // We only want this functionality if the cursor is not in a code block + if (compose_ui.cursor_inside_code_block($textarea)) { + return; + } // handles automatic insertion or removal of bulleting or numbering const before_text = split_at_cursor($textarea.val(), $textarea)[0]; const previous_line = bulleted_numbered_list_util.get_last_line(before_text); diff --git a/web/tests/composebox_typeahead.test.js b/web/tests/composebox_typeahead.test.js index d00f8f471f..07ac427941 100644 --- a/web/tests/composebox_typeahead.test.js +++ b/web/tests/composebox_typeahead.test.js @@ -17,6 +17,7 @@ const compose_ui = mock_esm("../src/compose_ui", { autosize_textarea() { autosize_called = true; }, + cursor_inside_code_block: () => false, }); const compose_validate = mock_esm("../src/compose_validate", { validate_message_length: () => true,