Explorar el Código

Code refactoring.

Aleksander Nowodzinski hace 6 años
padre
commit
57a7a8eb02

+ 7 - 4
packages/ckeditor5-core/src/editor/utils/securesourceelement.js

@@ -29,15 +29,18 @@ export default function secureSourceElement( editor ) {
 	if ( sourceElement.dataset.ckeditorSecuredElement ) {
 		/**
 		 * A DOM element used to create the editor (e.g.
-		 * {@link module:editor-classic/classiceditor~ClassicEditor.create `ClassicEditor.create()`})
+		 * {@link module:editor-inline/inlineeditor~InlineEditor.create `InlineEditor.create()`})
 		 * has already been used to create another editor instance. Make sure each editor is
 		 * created with an unique DOM element.
 		 *
-		 * @error editor-source-element-used-more-than-once
+		 * @error securesourceelement-element-used-more-than-once
+		 * @param {HTMLElement} element DOM element that caused the collision.
 		 */
 		throw new CKEditorError(
-			'editor-source-element-used-more-than-once: ' +
-			'The DOM source element cannot be used to create an editor more than once.'
+			'securesourceelement-element-used-more-than-once: ' +
+			'The DOM element cannot be used to create multiple editor instances.',
+			editor,
+			{ element: sourceElement }
 		);
 	}
 

+ 3 - 3
packages/ckeditor5-core/tests/editor/utils/securesourceelement.js

@@ -60,8 +60,8 @@ describe( 'secureSourceElement()', () => {
 	it( 'throws an error if the same element was used twice', () => {
 		sourceElement.dataset.ckeditorSecuredElement = true;
 
-		expectToThrowCKEditorError(
-			() => secureSourceElement( editor ),
-			/^editor-source-element-used-more-than-once/ );
+		expectToThrowCKEditorError( () => {
+			secureSourceElement( editor );
+		}, /^securesourceelement-element-used-more-than-once/, editor, { element: sourceElement } );
 	} );
 } );