File tree Expand file tree Collapse file tree
plugins/ckeditor5-woltlab-image/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ export class WoltlabImage extends Plugin {
7777 dispatcher . on < DowncastInsertEvent > (
7878 `insert:${ imageType } ` ,
7979 ( _evt , { item } , conversionApi ) => {
80- const { mapper, writer } = conversionApi ;
80+ const { mapper } = conversionApi ;
8181 const { domConverter } = this . editor . editing . view ;
8282
8383 const container = mapper . toViewElement ( item as Element ) ;
@@ -102,7 +102,13 @@ export class WoltlabImage extends Plugin {
102102 }
103103
104104 const setMaxWidth = ( ) => {
105- writer . setStyle ( "max-width" , `${ img . naturalWidth } px` , container ) ;
105+ this . editor . editing . view . change ( ( writer ) => {
106+ writer . setStyle (
107+ "max-width" ,
108+ `${ img . naturalWidth } px` ,
109+ container ,
110+ ) ;
111+ } ) ;
106112 } ;
107113
108114 if ( img . complete && img . naturalHeight !== 0 ) {
You can’t perform that action at this time.
0 commit comments