Skip to main content

Bridge.Slides

Allows the content developer to directly influence the state of slides in the presentation.

.getArticle()

Returns the current active slide DOM element as a Jquery Object. Good for accessing and mutating the current slide.

Bridge.Slides.getArticle();

.getArticleID()

Returns the ID of the current active slide DOM element. Useful when generating keys or compiling selectors.

Bridge.Slides.getArticleID();
note

.getArticle() and getArticleID() are particularly useful when the current slide's ID is generated by the app and not determined by the content developer (eg. templates).

.updateSelections(slides)

Used to update the visibility of slides in the presentation while presenting. Takes an array of objects containing the details of slides and updates the visibility of the corresponding slides in the presentation.

ParameterTypeDescription
slidesArrayArray of objects containing slide paths in the format deck/section/slide and a boolean visible value
Bridge.Slides.updateSelections([
{
path: "{{deck}}/{{section}}/slide_key",
visible: true,
},
]);
info

The deck and section you are currently in can be referred to as {{deck}} and {{section}} respectively.

.updateAdjunctSubslides(path, subslideArray)

Used to update the properties of the adjunct subslides of a given slide while presenting. Takes the path of the slide to affect, and an array of subslide objects.

Within the subslide objects, the parameters most likely to be modified are visibility and sequence - the former to hide or show subslides, the latter to change the order in which they appear.

let path = Bridge.Navigation.getSlidePath();
let currentSlideModel = Bridge.Slides.getSlide(path);
let subslides = currentSlideModel.subslides;
// code that manipulates
// the contents of objects in the subslides array
Bridge.Slides.updateAdjunctSubslides(path, subslides);
note

Changes made by this API call are persisted. This means that it will not function correctly when presenting in Offline mode.

caution

There is currently an issue where the change to the subslide states for the current slide is not communicated to remote preso clients. updateAdjunctSubslides() must be called on the Client as well as the Master to keep them in sync.

.getSlideList()

Returns a flattened list of all the slides with their keys, visibility and urls.

Bridge.Slides.getSlideList();
[
{
deck: "deck-key",
section: null,
slide: null,
subslide: null,
url: "https://client.salespreso.com/api/deckversions/285/",
visible: true,
},
{
deck: "deck-key",
section: "section-key",
slide: null,
subslide: null,
url: "https://client.salespreso.com/api/slides/100020/",
visible: true,
},
{
deck: "deck-key",
section: "section-key",
slide: "slide-key",
subslide: null,
url: "https://client.salespreso.com/api/slides/100021/",
visible: true,
},
{
deck: "deck-key",
section: "section-key",
slide: "slide-key",
subslide: "subslide-1",
url: "https://client.salespreso.com/api/subslides/12345/",
visible: true,
},
];

.getSections()

Returns an array of section objects.

Each object, in addition to a range of parameters such as title and key, also contains a slides parameter, which is an array of slide objects. The section and slide objects share a similar structure.

Bridge.Slides.getSections();

Returns:

[
{
adjunctSlideLimit: 0
autoAdjunctID: null
createdByAutoAdjunct: false
createdByTemplate: false
css: "path/to/a/file"
custom: false
deckversion: 1
html: "path/to/a/file"
id: 1768
index: 0
isWelcome: false
key: "mydeckkey"
path: "mydeckkey/about_us"
path_data: {deck_id: 1767, deck_key: "mydeckkey", section_id: 1768, section_key: "about_us", slide_id: null}
sequence: 0
slides: [
{
autoAdjunctID: null
createdByAutoAdjunct: false
createdByTemplate: false
css: "path/to/a/file"
custom: false
editable: false
html: "path/to/a/file"
id: 1770
index: 0
key: "where-we-began"
path: "mydeckkey/about_us/where-we-began"
path_data: {deck_id: 1767, deck_key: "mydeckkey", section_id: 1768, section_key: "where-we-began", slide_id: 1770}
section: 1769
sequence: 1
subslides: []
tags: ["subslide_container"]
templateID: null
thumbnail: null
title: "Where we began"
type: "slide"
url: "/slides/1770/"
visible: true
}
],
tags: null
templateID: null
thumbnail: null
title: "About Us"
type: "section"
url: "/sections/1768/"
visible: true
}
]

.updateSections(sections)

Updates the structure of the preso's sections and slides. The parameters most likely to be changed are the sequence and visible properties to change the ordering and visibility of sections and/or their slides.

ParameterTypeDescription
sectionsArrayArray of section objects, see Bridge.Slides.getSections() for required structure
Bridge.Slides.updateSections(sections);

passing back the array, to apply the changes.

note

In a RemotePreso context, .updateSections() should be called only on the master; the app will propagate changes to any connected client.

warning

Changes made by this API call are persisted. This means that it will not function correctly when presenting in offline mode. We recommend prohibiting changes to sections while offline and notifying your users appropriately, review the offline mode detection guide for direction on how to achieve this.