Change editor controls to properly edit block markdown - #2139
Closed
MoshiKoi wants to merge 5 commits into
Closed
Conversation
Block markdown should place the markdown symbols at the start of each line, rather than the middle. Blockquotes, lists, and headers fall under this category. Fixes codidact#2051
ArtOfCode-
requested changes
Aug 19, 2026
| $field[0].setSelectionRange(startPos, endPos); | ||
| const lines = $field.val().substring(startPos, endPos).split('\n'); | ||
| let jdx = 0; | ||
| for (let idx = 0; idx < lines.length; ++idx) { |
Member
There was a problem hiding this comment.
Does a for-let block work here?
Member
Author
There was a problem hiding this comment.
No, (assuming you meant for (let line of lines). The way it works is that it has to actually reassign the lines. A range for does not do reassignment like that; I can't write line = this.callback(line) to change the actual array item.
Oaphi
requested changes
Aug 19, 2026
Co-authored-by: ArtOfCode <ArtOfCode-@users.noreply.github.com>
We don't expect action to be null or invalid since it comes directly from the buttons. If somehow that occurs, it shouldn't be silently ignored.
Member
Author
|
Closing in favor of #2140 for CI purposes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2051
Block markdown should place the markdown symbols at the start of each line, rather than in the middle, even if that's where the selection is.
Blockquoted
Numbered list