@concordnow/ckeditor5-image-rendering
Version:
Image rendering feature for CK Editor 5
29 lines (25 loc) • 534 B
JavaScript
import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
export default class ImageDisplay extends Plugin {
static get pluginName() {
return 'ImageDisplay';
}
init() {
const editor = this.editor;
const conversion = editor.conversion;
conversion.for( 'upcast' )
.attributeToAttribute( {
view: {
name: 'img',
styles: {
'display': /[\s\S]+/
}
},
model: {
key: 'customImageDisplay',
value: viewImage => {
return viewImage.getStyle( 'display' );
}
}
} );
}
}