Revert "Detect document focus properly and allow null selection in model"

Caused lots of bugs with null selections being dereferenced
and insertion of nodes by dialogs failing because the selection
is null when closing the dialog.

This reverts commit c3a2a8544c3621c5e1a1fca1214988fc2b79e1b6.

Change-Id: If91d059f2c7f1ee91759b3c7f4cef75433911601
Merge "Revert "Detect document focus properly and allow null selection in model""