Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent inline hardcoding width property using autogrow plugin #4919

Merged
merged 6 commits into from
Oct 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/creators/themedui.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ CKEDITOR.replaceClass = 'ckeditor';
* ```
*
* @param {Number/String} width The new width. It can be an integer denoting a value
* in pixels or a CSS size value with unit.
* in pixels or a CSS size value with unit. When null is passed, the value will not be set.
* @param {Number/String} height The new height. It can be an integer denoting a value
* in pixels or a CSS size value with unit.
* @param {Boolean} [isContentHeight] Indicates that the provided height is to
Expand Down
7 changes: 2 additions & 5 deletions plugins/autogrow/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,8 @@
if ( newHeight != currentHeight && lastHeight != newHeight ) {
newHeight = editor.fire( 'autoGrow', { currentHeight: currentHeight, newHeight: newHeight } ).newHeight;

var boxSizingType = editor.container.getComputedStyle( 'box-sizing' ),
isBorderBox = boxSizingType === 'border-box',
width = editor.container.getSize( 'width', isBorderBox );

editor.resize( width, newHeight, true );
// Set width parameter as null, to update only the height of the editor. (#4891)
editor.resize( null, newHeight, true );
lastHeight = newHeight;
}

Expand Down
19 changes: 19 additions & 0 deletions tests/plugins/autogrow/autogrow.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,25 @@

editor.execCommand( 'autogrow' );

wait();
} );
},

// (#4891)
'test autogrow shouldn\'t add inline width property to editor container': function() {
var editor = this.editor,
bot = this.editorBot;

bot.setData( autogrowTools.getTestContent( 10 ), function() {
editor.once( 'afterCommandExec', function() {
resume( function() {
var editorContainerInlineWidth = editor.container.getStyle( 'width' );

assert.areSame( editorContainerInlineWidth, '', 'Editor shouldn\'t have any inline width property' );
} );
} );

editor.execCommand( 'autogrow' );
wait();
} );
}
Expand Down