Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
beforeEach( () => {
document = new Document();
schema = document.schema;
root = document.createRoot();
schema.registerItem( 'p', '$block' );
schema.registerItem( 'h1', '$block' );
schema.registerItem( 'img', '$inline' );
schema.allow( { name: '$text', attributes: 'bold', inside: 'p' } );
schema.allow( { name: 'p', attributes: 'bold', inside: '$root' } );
setData( document, '<p>foo<img>bar</p>' );
ranges = [ Range.createOn( root.getChild( 0 ) ) ];
} );
_setSelectionOverElement( element ) {
this.editor.document.selection.setRanges( [ ModelRange.createOn( element ) ] );
}