Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Fixed nested editable manual test.
Browse files Browse the repository at this point in the history
  • Loading branch information
szymonkups committed Feb 15, 2018
1 parent b1580a0 commit 4b33b87
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions tests/manual/markers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ];
Expand All @@ -45,7 +45,7 @@ ClassicEditor
priority: 1
};
}
} );
} ) );

window.document.getElementById( 'add-yellow' ).addEventListener( 'mousedown', e => {
e.preventDefault();
Expand Down
12 changes: 5 additions & 7 deletions tests/manual/nestededitable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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', {
Expand Down Expand Up @@ -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 ) );
}
} );

Expand Down

0 comments on commit 4b33b87

Please sign in to comment.