From 2201d693e22d3b29299a7d05b94811bb27691510 Mon Sep 17 00:00:00 2001 From: Daniyar Itegulov Date: Thu, 28 May 2020 18:38:13 +1000 Subject: [PATCH] Make book player plugin exit gracefully --- src/components/bookPlayer/plugin.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/components/bookPlayer/plugin.js b/src/components/bookPlayer/plugin.js index 44153d4438..3893d7ada6 100644 --- a/src/components/bookPlayer/plugin.js +++ b/src/components/bookPlayer/plugin.js @@ -25,14 +25,22 @@ export class BookPlayer { stop() { let elem = this._mediaElement; + let tocElement = this._tocElement; let rendition = this._rendition; - if (elem && rendition) { - rendition.destroy(); - - elem.remove(); + if (elem) { + dialogHelper.close(elem); this._mediaElement = null; } + + if (tocElement) { + dialogHelper.close(tocElement); + this._tocElement = null; + } + + if (rendition) { + rendition.destroy(); + } } onWindowKeyUp(e) {