Various context menu display issues

* Check the popup fits within the node horizontally as well
  as vertically before embedding.
* Calculate the position of the node relative to the document.
  Previously we assumed the parent was the document and so used
  jQuery#position but this is not the case if a custom $focusable
  is passed to FocusableNode.
* Forcefully re-show the context menu on resizable node mouse up.
  This is apparently done automatically by a redraw event, but if
  the user just clicked on a resize node without dragging the context
  menu would be lost.

Change-Id: Id477a30827c9393a446e9c44466c83dabc7e0ab4