commit: Disable automatic numbering / bulleting when inside code block.

This commit is contained in:
N-Shar-ma 2023-11-10 02:12:44 +05:30 committed by Tim Abbott
parent 602d1d7323
commit db9ac4b674
2 changed files with 5 additions and 0 deletions

View File

@ -153,6 +153,10 @@ export function should_enter_send(e) {
} }
function handle_bulleting_or_numbering($textarea, 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 // handles automatic insertion or removal of bulleting or numbering
const before_text = split_at_cursor($textarea.val(), $textarea)[0]; const before_text = split_at_cursor($textarea.val(), $textarea)[0];
const previous_line = bulleted_numbered_list_util.get_last_line(before_text); const previous_line = bulleted_numbered_list_util.get_last_line(before_text);

View File

@ -17,6 +17,7 @@ const compose_ui = mock_esm("../src/compose_ui", {
autosize_textarea() { autosize_textarea() {
autosize_called = true; autosize_called = true;
}, },
cursor_inside_code_block: () => false,
}); });
const compose_validate = mock_esm("../src/compose_validate", { const compose_validate = mock_esm("../src/compose_validate", {
validate_message_length: () => true, validate_message_length: () => true,