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 @@ -76,7 +76,7 @@ export class WoltlabImage extends Plugin {
7676 dispatcher . on < DowncastInsertEvent > (
7777 `insert:${ imageType } ` ,
7878 ( _evt , { item } , conversionApi ) => {
79- const { mapper, writer } = conversionApi ;
79+ const { mapper } = conversionApi ;
8080 const { domConverter } = this . editor . editing . view ;
8181
8282 const container = mapper . toViewElement ( item as Element ) ;
@@ -99,7 +99,13 @@ export class WoltlabImage extends Plugin {
9999 }
100100
101101 const setMaxWidth = ( ) => {
102- writer . setStyle ( "max-width" , `${ img . naturalWidth } px` , container ) ;
102+ this . editor . editing . view . change ( ( writer ) => {
103+ writer . setStyle (
104+ "max-width" ,
105+ `${ img . naturalWidth } px` ,
106+ container ,
107+ ) ;
108+ } ) ;
103109 } ;
104110
105111 if ( img . complete && img . naturalHeight !== 0 ) {
You can’t perform that action at this time.
0 commit comments