Skip to content

Template class

Provides information on editor saved templates and Cling gallery templates.

Important

  • This is not a mandatory step of the widget implementation. Cling already provides out-of-the-box support for managing templates through Document class (editor).
  • Widget authorization is required to use the template class.

What is a "saved template"?

A saved template is owned by the editor which can utilize the template instance methods

A gallery template comes from Cling's official template gallery and are available for all Cling users. These are not template instances and does not have access to the template instance methods.

They can however be applied to new documents:

jsx
const galleryTemplates = await window.Cling.template.fetchGallery()
const galleryId = galleryTemplates[0].id
const documentInstance = await window.Cling.document.new({ galleryId })