Added code to close modal dialogs in the new editor (#1327)

Added a directive to handle modal dialogs.  It handles a couple
things:

- Handles adding the shown CSS class when the dialog is shown
- Handles closing dialogs on escape and a click outside of the dialog
  (if the with-close attribute is present)

It doesn't add the class=modal attribute because that needs to be
present from the start, or else the browser will show the modal dialog
at the start.  It also doesn't add role=dialog because I'm not sure
how adding that attribute dynamically will affect screen readers.

Added method to allow closing for generic dialogs depending on the
paramater passed to openDialog().

Stop propagating the mouse click event when we open the clear
timing/clear text/revert dialogs.
Added code to close modal dialogs outside the editor (#1327)

This implements basically the same thing, except for outside of the
editor.  I didn't make closing the dialogs optional because it's not
needed for our current ones.  Also, I don't know why we would want to
disable closing the dialog, so I just left that code out.