return !(e.is('input:not(#q),select,textarea'));
}
this.keyShortcut('escape', function () {
- if ($this.fluidbook.help.isVisible()) {
- $this.fluidbook.help.hide();
- }
- if ($this.fluidbook.menu.viewMode()) {
- $this.fluidbook.menu.closeView(function () {
-
- }, true, true);
- }
- $this.fluidbook.search.closeSearch();
- $this.fluidbook.search.closeResultsNav();
- $this.fluidbook.nav.burger.close();
-
- if ($this.fluidbook.support.isFullscreen()) {
- document.exitFullscreen();
- }
+ $this.escape();
});
this.keyShortcut('tab,shift+tab', function (e, handler) {
let dir = handler.shortcut === 'tab' ? 1 : -1;
this.keyShortcut('f10', function () {
$this.fluidbook.nav.burger.toggle();
- })
+ });
+
+ setInterval(function () {
+ $this.listenToIframeEscapeEvents();
+ }, 500);
+ },
+
+ listenToIframeEscapeEvents: function () {
+ var $this = this;
+ $('iframe:not(.listenescape)').each(function () {
+ $(this).addClass('listenescape');
+ let iframe = $(this);
+ $(this).on('load', function () {
+ let win = $(iframe).get(0).contentWindow;
+ let doc = win.document;
+ doc.addEventListener('keydown', function (e) {
+ if (e.code === 'Escape') {
+ $this.escape();
+ }
+ });
+ });
+
+ });
+ },
+
+ escape: function () {
+ if (this.fluidbook.help.isVisible()) {
+ this.fluidbook.help.hide();
+ }
+ if (this.fluidbook.menu.viewMode()) {
+ this.fluidbook.menu.closeView(function () {
+
+ }, true, true);
+ }
+ this.fluidbook.search.closeSearch();
+ this.fluidbook.search.closeResultsNav();
+ this.fluidbook.nav.burger.close();
+
+ if (this.fluidbook.support.isFullscreen()) {
+ document.exitFullscreen();
+ }
},
_navigate: function (list, dir, actions) {