[feature/editor-code-tabs] Make inTag function reusable

Change inTag function to reusable JS function that can check
for any BBCode

PHPBB3-11557