bbcode implementation with text selection