Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Move assert check directly to child class.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Samsel committed May 22, 2019
1 parent 81ca239 commit 6624119
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/ballooneditor.js
Expand Up @@ -196,7 +196,12 @@ export default class BalloonEditor extends Editor {
*/
static create( sourceElementOrData, config = {} ) {
return new Promise( resolve => {
Editor._assertAllowedSourceElement( sourceElementOrData );
const isHTMLElement = isElement( sourceElementOrData );

if ( isHTMLElement && sourceElementOrData.tagName === 'TEXTAREA' ) {
// Documented in core/editor/editor.js
throw new CKEditorError( 'editor-wrong-element: This type of editor cannot be initialized inside <textarea> element.' );
}

const editor = new this( sourceElementOrData, config );

Expand All @@ -206,7 +211,7 @@ export default class BalloonEditor extends Editor {
editor.ui.init();
} )
.then( () => {
if ( !isElement( sourceElementOrData ) && config.initialData ) {
if ( !isHTMLElement && config.initialData ) {
// Documented in core/editor/editorconfig.jdoc.
throw new CKEditorError(
'editor-create-initial-data: ' +
Expand Down

0 comments on commit 6624119

Please sign in to comment.