Default Template Design
Implement code provided below to use default template design whilst displaying article to end user.
Install
Customize & InstallInstall Multiple Instances
To create multiple instances that can have different features, change value ofname
attribute and key ofadiptal.studio.settings
object, as shown in example below.
Functions
These are predefined functions inadiptal.studio
object.
1. init()
This function takes iframe node as parameter and initializes that instance of editor.
Example:
Customize & Install2. toggleTheme()
This function takes iframe node as parameter and toggles theme of that instance of editor.
Example:
3. disable()
This function takes iframe node as parameter and disables editing of that instance of editor.
Example:
4. enable()
This function takes iframe node as parameter and enables that instance of editor if it is disabled.
Example:
5. reset()
This function takes iframe node as parameter. It can be used to re-customize editor features or re-initializes an instance of editor. If this function gets called, unsaved changes will be deleted.
reset()
andenable()
do same action, butenable()
only works when instance of editor is disabled.
Example:
6. addFileOptions()
This function takes iframe node and json config as parameters and it add or update customizable file options of that instance of editor.
Json config:
Config | Feature | Value |
---|---|---|
allow_comments | Toggle for user to allow comment on file. | 0/1 |
is_draft | Toggle for user to flag file as draft. | 0/1 |
is_featured | Toggle for user to flag file as featured/special. | 0/1 |
approveFile | Button for administrative users to approve file. | Boolean |
deleteFile | Button to delete file. | Boolean |
scheduled_at | Lets user to schedule when file will get published. | JSON Object |
Schedule config:
*Bothmin_date
andmax_date
configs are required to enable date selection range feature.
Config | Feature | Value |
---|---|---|
readonly | Disable updating schedule. Once file is published user must not update schedule. | Boolean |
min_date | Set date selection range. | Date Object |
max_date | Set date selection range. | Date Object |
value | Set schedule date saved on server. | Date Object |
Examples:
7. showMetadata()
This function takes iframe node as parameter and shows metadata modal of that instance of editor.
Example:
8. manageImages()
This function takes iframe node and array config as parameters and manage images of that instance of editor. It can also be used to manage updated list of images. If you have enabledrelative_url
feature ininit()
, you can use relative url of those images accordingly.
Example:
9. saveFile()
This function takes iframe node as parameter and programatically triggers save function of that instance of editor.
Example:
10. loadFile()
This function takes iframe node and json config as parameters and loads file on that instance of editor.
Json config:
Config | Feature | Value |
---|---|---|
title | Sets title. *if metadata feature enabled in init() . | String |
description | Sets description. *if metadata feature enabled in init() . | String |
cover_image_url | Sets cover image. *if metadata and coverimage feature enabled in init() . | String |
category_index | Selects category. *if metadata and categories feature enabled in init() . | Int/String |
tags | Sets tags. *if metadata and tags feature enabled in init() . | Array of String |
content | Sets file content. *Exact content you got fromadiptal_studio_saveFile event. | String |
11. showToast()
This function takes iframe node and json config as parameters and shows toast on that instance of editor.
Json config:
Config | Feature | Value |
---|---|---|
heading | Sets heading. | String |
body | Sets body. | String |
name | Sets toast name to update toast information. *If multiple toast has same name, it will hide all previous toast and only show latest. | String |
type | Type of toast. 1. default ( not required to set type ) 2. danger 3. warning 4. success 5. info 6. progress ( timeout infinite by default ) | String |
infinite | Timeout infinite or 5000 ms. | Boolean |
12. hideToast()
This function takes iframe node and toast name as parameters and hide toast of that name if any on that instance of editor.
Example:
13. progressToast()
This function takes iframe node, toast name, and percent progress as parameters and update toast's progress of that name if any on that instance of editor. If progress value is 100 it will automatically hide toast in 5000 ms.
Example:
Events
These are predefined events inadiptal.studio
object.
1. adiptal_studio_live
This event is triggered when editor instance is loaded.
2. adiptal_studio_lastActive
This event is triggered when editor instance is active.
3. adiptal_studio_uploadImages
This event is triggered when images are uploaded through editor instance.
4. adiptal_studio_deleteImages
This event is triggered when images are deleted through editor instance.
5. adiptal_studio_approveFile
This event is trigger when user wants to approve file through editor instance.
6. adiptal_studio_deleteFile
This event is trigger when user wants to delete file through editor instance.
7. adiptal_studio_saveFile
This event is triggered when user wants to save file through editor instance or when programatically callssaveFile()
.