Skip to content

Commit

Permalink
fix(main): added a click monitor to the resize.background to shift th…
Browse files Browse the repository at this point in the history
…e focus back to editor when closed.
  • Loading branch information
JoelParke committed Oct 3, 2016
1 parent c39cb8a commit a3133ca
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ textAngular.directive("textAngular", [
scope.reflowPopover = function(_el){
var scrollTop = scope.getScrollTop(scope.displayElements.scrollWindow[0], false);
var spaceAboveImage = _el[0].offsetTop-scrollTop.top;
//var spaceBelowImage = scope.displayElements.text[0].offsetHeight - _el[0].offsetHeight - spaceAboveImage;
//console.log(spaceAboveImage, spaceBelowImage);

/* istanbul ignore if: catches only if near bottom of editor */
if(spaceAboveImage < 51) {
Expand Down Expand Up @@ -256,6 +258,12 @@ textAngular.directive("textAngular", [
scope.displayElements.resize.overlay.append(scope.displayElements.resize.info);
scope.displayElements.scrollWindow.append(scope.displayElements.resize.overlay);

// A click event on the resize.background will now shift the focus to the editor
/* istanbul ignore next: click on the resize.background to focus back to editor */
scope.displayElements.resize.background.on('click', function(e) {
scope.displayElements.text[0].focus();
});

// define the show and hide events
scope.reflowResizeOverlay = function(_el){
_el = angular.element(_el)[0];
Expand Down

0 comments on commit a3133ca

Please sign in to comment.