|
@@ -6,26 +6,20 @@
|
|
|
/* globals document */
|
|
/* globals document */
|
|
|
|
|
|
|
|
import View from '../../../src/view/view';
|
|
import View from '../../../src/view/view';
|
|
|
-import Position from '../../../src/view/position';
|
|
|
|
|
-import { parse } from '../../../src/dev-utils/view';
|
|
|
|
|
|
|
+import { setData } from '../../../src/dev-utils/view';
|
|
|
import createViewRoot from '../_utils/createroot';
|
|
import createViewRoot from '../_utils/createroot';
|
|
|
|
|
|
|
|
const view = new View();
|
|
const view = new View();
|
|
|
const viewDocument = view.document;
|
|
const viewDocument = view.document;
|
|
|
-const viewRoot = createViewRoot( viewDocument, 'div' );
|
|
|
|
|
|
|
+createViewRoot( viewDocument, 'div' );
|
|
|
view.attachDomRoot( document.getElementById( 'editor' ) );
|
|
view.attachDomRoot( document.getElementById( 'editor' ) );
|
|
|
|
|
|
|
|
-view.change( writer => {
|
|
|
|
|
- const { selection, view: data } = parse(
|
|
|
|
|
- '<container:p><attribute:strong>foo</attribute:strong>[]<attribute:strong>bar</attribute:strong></container:p>' +
|
|
|
|
|
- '<container:p></container:p>' +
|
|
|
|
|
- '<container:p><attribute:strong></attribute:strong></container:p>' +
|
|
|
|
|
- '<container:p>bom</container:p>'
|
|
|
|
|
- );
|
|
|
|
|
-
|
|
|
|
|
- writer.insert( Position.createAt( viewRoot ), data );
|
|
|
|
|
- writer.setSelection( selection );
|
|
|
|
|
-} );
|
|
|
|
|
|
|
+setData( view,
|
|
|
|
|
+ '<container:p><attribute:strong>foo</attribute:strong>[]<attribute:strong>bar</attribute:strong></container:p>' +
|
|
|
|
|
+ '<container:p></container:p>' +
|
|
|
|
|
+ '<container:p><attribute:strong></attribute:strong></container:p>' +
|
|
|
|
|
+ '<container:p>bom</container:p>'
|
|
|
|
|
+);
|
|
|
|
|
|
|
|
viewDocument.on( 'selectionChange', () => {
|
|
viewDocument.on( 'selectionChange', () => {
|
|
|
// Re-render view selection each time selection is changed.
|
|
// Re-render view selection each time selection is changed.
|