@shakrmedia/editor-sdk ShakrEditor

ShakrEditor class#

Shakr Editor class which returns a instance that can communicates with Shakr's Editor iframe window.

Signature:
declare class ShakrEditor extends EventEmitter<ShakrEditorEventMap>
Extends:

EventEmitter<ShakrEditorEventMap>

Constructors#

ConstructorModifiersDescription
(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#

PropertyModifiersTypeDescription
is_openbooleanWhether Shakr Editor is opened or not.
render_session_idstring | nullRender Session object id which is used to open Shakr Editor. See ShakrEditorOptions.render_session_id for details.
show_idstring | nullShow object id which is used to open Shakr Editor. See ShakrEditorOptions.show_id for details.

Methods#

MethodModifiersDescription
close(force: boolean): voidClose 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(): thisLaunch 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): thisinit event emitted when Shakr Editor window is initialized properly.
on(type: 'load', listener: () => void): thisload event emitted when Shakr Editor is fully loaded and ready to be used.
on(type: 'confirm_close', listener: () => void): thisconfirm_close event emitted when a user tries to close Shakr Editor while it is saving data.
on(type: 'error', listener: (data: ShakrEditorErrorEvent) => void): thiserror 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): thisclosed event emitted when a user closed Shakr Editor.
on(type: 'finish', listener: (data?: ShakrEditorFinishEvent) => void): thisfinish 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): thisget_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): thisopen_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): voidUpdate logo image in Shakr Editor. This method cannot be called while Shakr Editor is opened.