( sourceElementOrDataOrConfig: HTMLElement | string | EditorConfig, config?: EditorConfig )
| 52 | public create( config: EditorConfig ): Promise<unknown>; |
| 53 | |
| 54 | public create( sourceElementOrDataOrConfig: HTMLElement | string | EditorConfig, config?: EditorConfig ): Promise<unknown> { |
| 55 | let watchdogItemConfiguration: Record<string, any> = { |
| 56 | creator: this._creator!, |
| 57 | id: this._id, |
| 58 | type: 'editor' |
| 59 | }; |
| 60 | |
| 61 | // Newer versions of the editor deprecated passing both source element and config at the same time. |
| 62 | // So, if the second argument (config) is present, the older version of the editor is being initialized. |
| 63 | if ( config ) { |
| 64 | // <= 47 legacy config approach to watchdog configuration. |
| 65 | watchdogItemConfiguration = { |
| 66 | ...watchdogItemConfiguration, |
| 67 | sourceElementOrData: sourceElementOrDataOrConfig, |
| 68 | config |
| 69 | }; |
| 70 | } else { |
| 71 | // >= 48 single config approach to watchdog item configuration. |
| 72 | watchdogItemConfiguration = { |
| 73 | ...watchdogItemConfiguration, |
| 74 | config: sourceElementOrDataOrConfig |
| 75 | }; |
| 76 | } |
| 77 | |
| 78 | return this._contextWatchdog.add( watchdogItemConfiguration as ContextWatchdogItemConfiguration ); |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * Creates a listener that is attached to context watchdog's item and run when the context watchdog fires. |
no outgoing calls
no test coverage detected