API References
Setting Options
| Option | Definition | Default Value | Available values |
|---|---|---|---|
| lang | Editor language | en | en, es |
| category | Templates panel main category | undefined | category’s slug |
| width | Template width | 85 | Check on limitations |
| height | Template height | 54 | Check on limitations |
| unit | Measurement unit | mm | px, mm |
| format | Download format | jpeg, png, pdf, mp4 | |
| templateId | Template id to load by default | new-artboard | new-artboard, user template id |
initialize(API_KEY: string, options?: EditorOptions)
Setup Wepik’s editor.
wepik.initialize('API_KEY', {
lang: 'en',
height: 1000,
width: 1000,
unit: 'px',
format: 'jpeg',
});
open()
Open Wepik’s editor.
wepik.open();
close()
Close Wepik’s editor.
wepik.close();
onClose(callback: () => void)
This option allows you to execute a function when the user clicks on the Close Editor button.
wepik.onClose(() => {
wepik.close();
});
onPublish(callback: (data: PublishEvent) => void)
PublishEvent
| Property | Description | Type |
|---|---|---|
| eventName | Name of the event | string |
| url | Template download URL | string |
| templateId | User template id | string |
This option allows you to execute a function when the user clicks on the Continue button.
The link to download the template is available for 24 hours.
wepik.onPublish((event) => alert(event.url));
onAutoSave(callback: (data: AutoSaveEvent) => void)
AutoSaveEvent
| Property | Description | Type |
|---|---|---|
| eventName | Name of the event | string |
| templateId | User template id | string |
This option allows you to execute a function when we automatically saved the user template.
wepik.onAutoSave((event) => console.log(`Template saved with id: ${event.templateId}`));