8
0
Просмотр исходного кода

Revert "Prevent of creation decoupled editor in textarea."

This reverts commit 7a4e4a1c37a56440736b61a4c16328e7bbf6b771.
Mateusz Samsel 6 лет назад
Родитель
Сommit
75316c1ec4
1 измененных файлов с 23 добавлено и 22 удалено
  1. 23 22
      packages/ckeditor5-editor-decoupled/src/decouplededitor.js

+ 23 - 22
packages/ckeditor5-editor-decoupled/src/decouplededitor.js

@@ -213,30 +213,31 @@ export default class DecoupledEditor extends Editor {
 	 * @returns {Promise} A promise resolved once the editor is ready. The promise resolves with the created editor instance.
 	 */
 	static create( sourceElementOrData, config = {} ) {
-		let editor;
-		return Editor.allowedElement( sourceElementOrData )
-			.then( () => {
-				editor = new this( sourceElementOrData, config );
-			} )
-			.then( () => editor.initPlugins() )
-			.then( () => {
-				editor.ui.init();
-			} )
-			.then( () => {
-				if ( !isElement( sourceElementOrData ) && config.initialData ) {
-					// Documented in core/editor/editorconfig.jdoc.
-					throw new CKEditorError(
-						'editor-create-initial-data: ' +
-						'The config.initialData option cannot be used together with initial data passed in Editor.create().'
-					);
-				}
+		return new Promise( resolve => {
+			const editor = new this( sourceElementOrData, config );
+
+			resolve(
+				editor.initPlugins()
+					.then( () => {
+						editor.ui.init();
+					} )
+					.then( () => {
+						if ( !isElement( sourceElementOrData ) && config.initialData ) {
+							// Documented in core/editor/editorconfig.jdoc.
+							throw new CKEditorError(
+								'editor-create-initial-data: ' +
+								'The config.initialData option cannot be used together with initial data passed in Editor.create().'
+							);
+						}
 
-				const initialData = config.initialData || getInitialData( sourceElementOrData );
+						const initialData = config.initialData || getInitialData( sourceElementOrData );
 
-				return editor.data.init( initialData );
-			} )
-			.then( () => editor.fire( 'ready' ) )
-			.then( () => editor );
+						return editor.data.init( initialData );
+					} )
+					.then( () => editor.fire( 'ready' ) )
+					.then( () => editor )
+			);
+		} );
 	}
 }