Apply styles across multiple paragraphs
When selecting a block of text within a textfield and then clicking on B for bold or I for italics (and probably other styles as well), it doesn't work if multiple paragraphs are selected. The markup characters (e.g. * and _) only show up at the very beginning and end of selection, not around each paragraph within the selection.
If possible, the code should be able to detect carriage returns and place a markup character before and after each one (or none if there is no text between carriage returns) to account for multiple paragraphs.
For example, the result of clicking on the bold style button with all of the text selected should be