MCPcopy Create free account
hub / github.com/ckeditor/ckeditor5-react / create

Method create

src/EditorWatchdogAdapter.tsx:54–79  ·  view source on GitHub ↗
( sourceElementOrDataOrConfig: HTMLElement | string | EditorConfig, config?: EditorConfig )

Source from the content-addressed store, hash-verified

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.

Callers 7

_initializeEditorMethod · 0.45
_createEditorMethod · 0.45
useMultiRootEditorFunction · 0.45
_initializeEditorFunction · 0.45
_updateEditorDataFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected