I’m writing a Markdown editor based on MarkdownKit and a subclass of Xojo’s built-in
TextArea. Things work fine except if I paste text into the
TextArea. Is there a way when pasting into a
TextArea using the default macOS
cmd-V keystroke to paste in only plain text? I have a feeling that the styles are being pulled in with the paste and that’s messing things up.
For some context, my app is re-parsing the contents of the
TextArea every second (if the text has changed), converting it into a Markdown abstract syntax tree and then walking that tree, pulling the start and end positions of each element and styling them using
TextArea.StyledText.SomeProperty(start, length). Before each parse, I clear the styles in the TextArea in a method within the TextArea subclass like this:
// Cache the length of the text. Var length As Integer = StyledText.Text.Length Me.StyledText.Bold(0, length) = False Me.StyledText.Italic(0, length) = False Me.StyledText.Underline(0, length) = False Me.StyledText.Size(0, length) = StyleTextSize Me.StyledText.TextColor(0, length) = StyleTextColor
Any help greatly appreciated.