#252, #158

1. fix for editing links failure in IE,FF,safari.
2. fix for toolbar's button active state after selecting text.

Fixes: #252, #158