@shakrmedia/editor-sdk ShakrEditor
ShakrEditor class
Shakr Editor class which returns a instance that can communicates with Shakr's Editor iframe window.
Signature:export declare class ShakrEditor extends EventEmitter<ShakrEditorEventMap>
EventEmitter<ShakrEditorEventMap>
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)(option) | Constructor for ShakrEditor class. Either ShakrEditor.show_id or ShakrEditor.render_session_id should be provided to option parameter. See ShakrEditorOptions for details. |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
is_open | boolean | Whether Shakr Editor is opened or not. | |
render_session_id | string | null | Render Session object id which is used to open Shakr Editor. See ShakrEditorOptions.render_session_id for details. | |
show_id | string | null | Show object id which is used to open Shakr Editor. See ShakrEditorOptions.show_id for details. |
Methods
Method | Modifiers | Description |
---|---|---|
close(force: boolean): void | Close Shakr Editor iframe window. This will trigger 'confirm_close' event if there are any data not saved yet. Or if all data were saved properly, it will close the Shakr Editor window immediately. | |
launch(): this | Launch Shakr Editor and open its iframe window. | |
off<K extends keyof ShakrEditorEventMap>(type: K, listener: (this: this, event: ShakrEditorEventMap[K]) => void): this | ||
on(type: 'init', listener: () => void): this | init event emitted when Shakr Editor window is initialized properly. | |
on(type: 'load', listener: () => void): this | load event emitted when Shakr Editor is fully loaded and ready to be used. | |
on(type: 'confirm_close', listener: () => void): this | confirm_close event emitted when a user tries to close Shakr Editor while it is saving data. | |
on(type: 'error', listener: (data: ShakrEditorErrorEvent) => void): this | error event emitted when there is an error while loading Shakr Editor. Shakr Editor iframe window will be closed when this event is emitted. | |
on(type: 'closed', listener: () => void): this | closed event emitted when a user closed Shakr Editor. | |
on(type: 'finish', listener: (data?: ShakrEditorFinishEvent) => void): this | finish event emitted when Shakr Editor finishes a editing session. Shakr Editor iframe window will be closed when this event is emitted. data parameter with a rendered video url will be provided to event listener when ShakrEditorOptions.wait_rendering is true. | |
on(type: 'get_media', listener: (data: ShakrEditorGetMediaEvent) => void): this | get_media event emitted when Shakr Editor loads external media library or try to search in it. This event will be only emitted when ShakrEditorOptions.media_libraries is provided and ShakrEditorMediaLibrary.custom_ui flag is false or not provided. | |
on(type: 'open_media_library', listener: (data: ShakrEditorOpenMediaLibraryEvent) => void): this | open_media_library event emitted when Shakr Editor opens external media library. This event will be only emitted when ShakrEditorOptions.media_libraries is provided and ShakrEditorMediaLibrary.custom_ui flag is true. | |
setImage(url: string): void | Update logo image in Shakr Editor. This method cannot be called while Shakr Editor is opened. |