]> _ Git - fluidbook-html5.git/commitdiff
fix #3642 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 14 May 2020 09:35:46 +0000 (11:35 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 14 May 2020 09:35:46 +0000 (11:35 +0200)
js/libs/fluidbook/fluidbook.tabs.js

index ff346aea8c70a34e4ab88534b20b99e56efab2e1..6323a6012002bcae9e0fcded2ee2760bf16a3664 100644 (file)
@@ -112,9 +112,18 @@ FluidbookTabs.prototype = {
         if (this.hasSections()) {
             $.each(this.sections, function (id, limit) {
                 var sectionPages = [];
+                var foundOnePage = false;
                 $.each(pages, function (k, p) {
-                    if ($this.getSectionByPageNumber(p) - 1 === id) {
+                    if (p === '-' && foundOnePage) {
                         sectionPages.push(p);
+                    } else {
+                        if ($this.getSectionByPageNumber(p) - 1 === id) {
+                            foundOnePage = true;
+                            sectionPages.push(p);
+                        } else if (foundOnePage) {
+                            // Assume that if this page is not in the current section, next ones won't be either
+                            return false;
+                        }
                     }
                 });
                 sections.push(sectionPages);