8
0
فهرست منبع

Improved an error message.

Piotrek Koszuliński 7 سال پیش
والد
کامیت
1b0d693fc9

+ 6 - 5
packages/ckeditor5-core/src/editor/utils/elementapimixin.js

@@ -23,13 +23,14 @@ const ElementApiMixin = {
 	updateSourceElement() {
 	updateSourceElement() {
 		if ( !this.sourceElement ) {
 		if ( !this.sourceElement ) {
 			/**
 			/**
-			 * In case of the editor is creating using an initial data instead of the DOM element,
-			 * the {@link ElementApi~updateSourceElement `updateSourceElement()`} method cannot be called because there is no
-			 * {@link ElementApi~sourceElement `sourceElement`} that could be updated.
+			 * Cannot update the source element of a detached editor.
 			 *
 			 *
-			 * @error elementapimixin-missing-sourceelement
+			 * The {@link ElementApi~updateSourceElement `updateSourceElement()`} method cannot be called if you did not
+			 * pass an element to `Editor.create()`.
+			 *
+			 * @error editor-missing-sourceelement
 			 */
 			 */
-			throw new CKEditorError( 'elementapi-missing-sourceelement: The "sourceElement" is required by the "ElementApi" interface.' );
+			throw new CKEditorError( 'editor-missing-sourceelement: Cannot update the source element of a detached editor.' );
 		}
 		}
 
 
 		setDataInElement( this.sourceElement, this.data.get() );
 		setDataInElement( this.sourceElement, this.data.get() );

+ 2 - 2
packages/ckeditor5-core/tests/editor/utils/elementapimixin.js

@@ -45,8 +45,8 @@ describe( 'ElementApiMixin', () => {
 			expect( editorElement.innerHTML ).to.equal( 'foo bar' );
 			expect( editorElement.innerHTML ).to.equal( 'foo bar' );
 		} );
 		} );
 
 
-		it( 'throws an error if "sourceElement" has not set', () => {
-			expect( () => editor.updateSourceElement() ).to.throw( CKEditorError, /elementapi-missing-sourceelement/ );
+		it( 'throws an error if "sourceElement" has not been set', () => {
+			expect( () => editor.updateSourceElement() ).to.throw( CKEditorError, /editor-missing-sourceelement/ );
 		} );
 		} );
 	} );
 	} );
 } );
 } );