Make the final step Continue button say Finish instead.
This commit is contained in:
parent
76a86eacff
commit
93be9bfca8
|
@ -57,9 +57,7 @@ function startTour(
|
|||
eventHandlers: TourStepEventHandler[],
|
||||
runMainAgainAfterComplete: boolean,
|
||||
): void {
|
||||
const tour = new Shepherd.Tour({
|
||||
defaultStepOptions: {
|
||||
buttons: [
|
||||
const defaultButtons: Shepherd.Step.StepOptionsButton[] = [
|
||||
{
|
||||
classes: "btn",
|
||||
text: "Continue",
|
||||
|
@ -81,7 +79,11 @@ function startTour(
|
|||
this.cancel();
|
||||
},
|
||||
},
|
||||
],
|
||||
];
|
||||
|
||||
const tour = new Shepherd.Tour({
|
||||
defaultStepOptions: {
|
||||
buttons: [...defaultButtons],
|
||||
},
|
||||
useModalOverlay: true,
|
||||
});
|
||||
|
@ -106,7 +108,14 @@ function startTour(
|
|||
|
||||
// For every step we have, add it to the tour and subsequently add all the
|
||||
// event handlers to that step.
|
||||
for (const stepOptions of steps) {
|
||||
for (const [stepNumber, stepOptions] of steps.entries()) {
|
||||
// If the final step doesn't have buttons defined, set the "Continue" button
|
||||
// text to "Finish".
|
||||
if (stepOptions.buttons === undefined && stepNumber + 1 === steps.length) {
|
||||
stepOptions.buttons = [...defaultButtons];
|
||||
stepOptions.buttons[0].text = "Finish";
|
||||
}
|
||||
|
||||
const step = tour.addStep(stepOptions);
|
||||
|
||||
for (const [targetStepId, [eventName, eventHandler]] of eventHandlers) {
|
||||
|
|
Loading…
Reference in New Issue