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 e5cfec1 commit c3ab7f8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/inlineeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,12 @@ export default class InlineEditor 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 @@ -199,7 +204,7 @@ export default class InlineEditor 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 c3ab7f8

Please sign in to comment.