How to use the @ckeditor/ckeditor5-engine/src/dev-utils/model.parse function in @ckeditor/ckeditor5-engine

To help you get started, we’ve selected a few @ckeditor/ckeditor5-engine examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ckeditor / ckeditor5-table / tests / converters / table-post-fixer.js View on Github external
it( 'should add missing columns to tableRows that are shorter then the longest table row (complex 1)', () => {
			const parsed = parse( modelTable( [
				[ '00', { rowspan: 2, contents: '10' } ],
				[ '10', { colspan: 2, contents: '12' } ],
				[ '20', '21' ]
			] ), model.schema );

			model.change( writer => {
				writer.remove( Range.createIn( root ) );
				writer.insert( parsed, root );
			} );

			expect( formatTable( getModelData( model, { withoutSelection: true } ) ) ).to.equal( formattedModelTable( [
				[ '00', { rowspan: 2, contents: '10' }, '', '' ],
				[ '10', { colspan: 2, contents: '12' } ],
				[ '20', '21', '', '' ]
			] ) );
		} );
github ckeditor / ckeditor5-table / tests / converters / table-post-fixer.js View on Github external
it( 'should fix multiple tables', () => {
			const tableA = modelTable( [
				[ '11' ],
				[ '21', '22' ]
			] );
			const tableB = modelTable( [
				[ 'aa', 'ab' ],
				[ 'ba', 'bb' ]
			] );
			const tableC = modelTable( [
				[ 'xx' ],
				[ 'yy', 'yy' ]
			] );

			const parsed = parse( tableA + tableB + tableC, model.schema );

			model.change( writer => {
				writer.remove( Range.createIn( root ) );
				writer.insert( parsed, root );
			} );

			const expectedTableA = formattedModelTable( [
				[ '11', '' ],
				[ '21', '22' ]
			] );
			const expectedTableB = formattedModelTable( [
				[ 'aa', 'ab' ],
				[ 'ba', 'bb' ]
			] );
			const expectedTableC = formattedModelTable( [
				[ 'xx', '' ],
github ckeditor / ckeditor5-table / tests / converters / table-post-fixer.js View on Github external
function _insertRow( writer, rowIndex, rowData ) {
			const table = root.getChild( 0 );

			const parsedTable = parse(
				modelTable( [ rowData ] ),
				model.schema
			);

			writer.insert( parsedTable.getChild( 0 ), table, rowIndex );
		}