Merge branch 'correct-slide-number-fix' into 'master'

Correction of previous fix for setting slide numbers in footers

Closes #942

See merge request openlp/openlp!366
This commit is contained in:
Raoul Snyman 2021-11-26 22:08:03 +00:00
commit b35080fd98

View File

@ -296,7 +296,7 @@ var Display = {
let doItemTransitions = options.doItemTransitions || false; let doItemTransitions = options.doItemTransitions || false;
let hideMouse = options.hideMouse || false; let hideMouse = options.hideMouse || false;
if (options.slideNumbersInFooter) { if (options.slideNumbersInFooter) {
Display._revealConfig.slideNumber = "c/t"; Display._revealConfig.slideNumber = Display.setFooterSlideNumbers;
} }
// Now continue to initialisation // Now continue to initialisation
@ -1177,6 +1177,22 @@ var Display = {
"left: -999999px" "left: -999999px"
].join(" !important;"); ].join(" !important;");
document.body.appendChild(Display._fontContainer); document.body.appendChild(Display._fontContainer);
},
/**
* Prepare the slide number (slide x/y) for insertion into the Reveal footer
* This is a callback function which Reveal calls to get the values
* Fixes https://gitlab.com/openlp/openlp/-/issues/942
*/
setFooterSlideNumbers: function (slide) {
let value = ['', '', ''];
// Reveal does call this function passing undefined
if (typeof slide === 'undefined') {
return value;
}
value[0] = Reveal.getSlidePastCount(slide) + 1;
value[1] = '/';
value[2] = Object.keys(Display._slides).length;
return value;
} }
}; };
new QWebChannel(qt.webChannelTransport, function (channel) { new QWebChannel(qt.webChannelTransport, function (channel) {