Font embed code feature bug fix + refactoring

Font embed code instructions were only updated when a new font was
selected, not when an already loaded font was selected again, which
prompted me to factor that code out of the on click handler to avoid
having to repeat it and using a function
Refactoring + syntax error fix