Przeglądaj źródła

Fixed nested editable manual test.

Szymon Kupś 8 lat temu
rodzic
commit
5d079b70ed

+ 2 - 2
packages/ckeditor5-engine/tests/manual/markers.js

@@ -35,7 +35,7 @@ ClassicEditor
 		window.editor = editor;
 		model = editor.model;
 
-		downcastMarkerToHighlight( {
+		editor.conversion.for( 'editingDowncast' ).add( downcastMarkerToHighlight( {
 			model: 'highlight',
 			view: data => {
 				const color = data.markerName.split( ':' )[ 1 ];
@@ -45,7 +45,7 @@ ClassicEditor
 					priority: 1
 				};
 			}
-		} );
+		} ) );
 
 		window.document.getElementById( 'add-yellow' ).addEventListener( 'mousedown', e => {
 			e.preventDefault();

+ 5 - 7
packages/ckeditor5-engine/tests/manual/nestededitable.js

@@ -13,7 +13,6 @@ import {
 	downcastElementToElement
 } from '../../src/conversion/downcast-converters';
 
-import ViewEditableElement from '../../src/view/editableelement';
 import { getData } from '../../src/dev-utils/model';
 import global from '@ckeditor/ckeditor5-utils/src/dom/global';
 
@@ -30,7 +29,6 @@ class NestedEditable extends Plugin {
 	init() {
 		const editor = this.editor;
 		const editing = editor.editing;
-		const viewDocument = editing.view;
 		const schema = editor.model.schema;
 
 		schema.register( 'figure', {
@@ -60,15 +58,15 @@ class NestedEditable extends Plugin {
 
 		editor.conversion.for( 'downcast' ).add( downcastElementToElement( {
 			model: 'figcaption',
-			view: () => {
-				const element = new ViewEditableElement( 'figcaption', { contenteditable: 'true' } );
-				element.document = viewDocument;
+			view: ( modelItem, consumable, conversionApi ) => {
+				const viewWriter = conversionApi.writer;
+				const element = viewWriter.createEditableElement( 'figcaption', { contenteditable: 'true' } );
 
 				element.on( 'change:isFocused', ( evt, property, is ) => {
 					if ( is ) {
-						element.addClass( 'focused' );
+						editing.view.change( writer => writer.addClass( 'focused', element ) );
 					} else {
-						element.removeClass( 'focused' );
+						editing.view.change( writer => writer.removeClass( 'focused', element ) );
 					}
 				} );