by ggreiner · 13y ago · 0 comments
I decided not to allow commenting across line breaks because they way I highlight commented text looked weird across line breaks. However I thought my way of allowing commenting over HTML tags (links and such) was pretty cool. I found all HTML tags with a regex and then started removing them one at a time from the bottom of the page until I could find the selected text. This gives me the starting index in the raw HTML of the selection and then I just step through the selection (skipping html tags) to find the ending index. Probably not the most efficient method but it works well!
No comments yet.