How to use the @ckeditor/ckeditor5-engine/src/view/element 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-image / tests / imagecaption / utils.js View on Github external
it( 'should return null if figcaption\'s parent is not a figure', () => {
			const element = new ViewElement( 'figcaption' );
			new ViewElement( 'div', null, element ); // eslint-disable-line no-new

			expect( matchImageCaption( element ) ).to.be.null;
		} );
github ckeditor / ckeditor5-image / tests / imagecaption / utils.js View on Github external
it( 'should return null if figcaption\'s parent is not a figure', () => {
			const element = new ViewElement( 'figcaption' );
			new ViewElement( 'div', null, element ); // eslint-disable-line no-new

			expect( matchImageCaption( element ) ).to.be.null;
		} );
github ckeditor / ckeditor5-image / tests / imagecaption / utils.js View on Github external
it( 'should return null if parent has no image class', () => {
			const element = new ViewElement( 'figcaption' );
			new ViewElement( 'figure', null, element ); // eslint-disable-line no-new

			expect( matchImageCaption( element ) ).to.be.null;
		} );
github ckeditor / ckeditor5-markdown-gfm / src / renderer / handlers / image.js View on Github external
export default function parseImage( node, event, walker ) {
	const image = new ViewElement( 'img', { src: node.destination } );
	const figure = new ViewElement( 'figure', { class: 'image' }, image );

	const child = node.firstChild;

	// Parse text inside image and put it into alt.
	if ( child && child.type == 'text' ) {
		image.setAttribute( 'alt', child.literal );

		walker.resumeAt( child, false );
	}

	return figure;
}
github ckeditor / ckeditor5-markdown-gfm / src / renderer / handlers / image.js View on Github external
export default function parseImage( node, event, walker ) {
	const image = new ViewElement( 'img', { src: node.destination } );
	const figure = new ViewElement( 'figure', { class: 'image' }, image );

	const child = node.firstChild;

	// Parse text inside image and put it into alt.
	if ( child && child.type == 'text' ) {
		image.setAttribute( 'alt', child.literal );

		walker.resumeAt( child, false );
	}

	return figure;
}
github ckeditor / ckeditor5-image / tests / widget / utils.js View on Github external
it( 'should add element\'s label if one is provided as function', () => {
			element = new ViewElement( 'div' );
			widgetize( element, { label: () => 'foo bar baz label' } );

			expect( getLabel( element ) ).to.equal( 'foo bar baz label' );
		} );
	} );
github ckeditor / ckeditor5-image / tests / imagecaption / utils.js View on Github external
it( 'should return null if figcaption has no parent', () => {
			const element = new ViewElement( 'figcaption' );

			expect( matchImageCaption( element ) ).to.be.null;
		} );
github ckeditor / ckeditor5-image / tests / widget / utils.js View on Github external
it( 'should return false for non-widgetized elements', () => {
			expect( isWidget( new ViewElement( 'p' ) ) ).to.be.false;
		} );
	} );
github ckeditor / ckeditor5-image / tests / widget / utils.js View on Github external
it( 'should allow to set label for element', () => {
			const element = new ViewElement( 'p' );
			setLabel( element, 'foo bar baz' );

			expect( getLabel( element ) ).to.equal( 'foo bar baz' );
		} );
github ckeditor / ckeditor5-image / tests / widget / utils.js View on Github external
it( 'should return empty string for elements without label', () => {
			const element = new ViewElement( 'div' );

			expect( getLabel( element ) ).to.equal( '' );
		} );