Skip to content

Commit 358f295

Browse files
committed
writemaths: Fix the check for being inside a maths environment
This fixes the behaviour of inserting a <br> when you press Enter inside a maths environment.
1 parent d51afeb commit 358f295

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

editor/static/js/editor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1431,7 +1431,7 @@ $(document).ready(function() {
14311431
setup: function(ed) {
14321432
ed.on('keydown', function(oe) {
14331433
// when inside a math environment, pressing the enter key adds a <br> instead of a paragraph break.
1434-
if(oe.key != 'Enter' || oe.shiftKey || oe.ctrlKey || oe.altKey || oe.metaKey || !ed.getBody().classList.contains('in-maths')) {
1434+
if(oe.key != 'Enter' || oe.shiftKey || oe.ctrlKey || oe.altKey || oe.metaKey || !element.classList.contains('in-maths')) {
14351435
return;
14361436
}
14371437
oe.preventDefault();

0 commit comments

Comments
 (0)