Explorar el Código

Minor improvements for the manual test.

Kamil Piechaczek hace 7 años
padre
commit
32bf3e2c1a

+ 1 - 1
packages/ckeditor5-editor-classic/tests/manual/classiceditor-data.html

@@ -1,5 +1,5 @@
 <p>
-	<button id="destroyEditor">Destroy editor</button>
+	<button id="destroyEditors">Destroy editors</button>
 	<button id="initEditor">Init editor</button>
 </p>
 

+ 7 - 5
packages/ckeditor5-editor-classic/tests/manual/classiceditor-data.js

@@ -14,19 +14,19 @@ import Undo from '@ckeditor/ckeditor5-undo/src/undo';
 import Bold from '@ckeditor/ckeditor5-basic-styles/src/bold';
 import Italic from '@ckeditor/ckeditor5-basic-styles/src/italic';
 
-const data = '<h2>Hello world!</h2><p>This is an editor instance.</p>';
-
 window.editors = [];
+let counter = 1;
 
 const container = document.querySelector( '.container' );
 
 function initEditor() {
 	ClassicEditor
-		.create( data, {
+		.create( `<h2>Hello world! #${ counter }</h2><p>This is an editor instance.</p>`, {
 			plugins: [ Enter, Typing, Paragraph, Undo, Heading, Bold, Italic ],
 			toolbar: [ 'heading', '|', 'bold', 'italic', 'undo', 'redo' ]
 		} )
 		.then( editor => {
+			counter += 1;
 			window.editors.push( editor );
 			container.appendChild( editor.element );
 		} )
@@ -35,14 +35,16 @@ function initEditor() {
 		} );
 }
 
-function destroyEditor() {
+function destroyEditors() {
 	window.editors.forEach( editor => {
 		editor.destroy()
 			.then( () => {
 				editor.element.remove();
 			} );
 	} );
+	window.editors = [];
+	counter = 1;
 }
 
 document.getElementById( 'initEditor' ).addEventListener( 'click', initEditor );
-document.getElementById( 'destroyEditor' ).addEventListener( 'click', destroyEditor );
+document.getElementById( 'destroyEditors' ).addEventListener( 'click', destroyEditors );

+ 1 - 1
packages/ckeditor5-editor-classic/tests/manual/classiceditor-data.md

@@ -1,3 +1,3 @@
 1. Click "Init editor".
-2. New editor instance should be appended to the document with initial data in it.
+2. New editor instance should be appended to the document with initial data in it. You can create more than one editor.
 3. After clicking "Destroy editor" all editors should be removed from the document.