Skip to content

Commit

Permalink
TextareaView should not be manually resizable by default.
Browse files Browse the repository at this point in the history
  • Loading branch information
oleq committed Sep 25, 2023
1 parent cb9505e commit 70c8e55
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
4 changes: 2 additions & 2 deletions packages/ckeditor5-ui/src/textarea/textareaview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default class TextareaView extends InputBase<HTMLTextAreaElement> {
* Specifies the value of HTML attribute that indicates whether the user can resize the element.
*
* @observable
* @default 'both'
* @default 'none'
*/
declare public resize: 'both' | 'horizontal' | 'vertical' | 'none';

Expand All @@ -72,7 +72,7 @@ export default class TextareaView extends InputBase<HTMLTextAreaElement> {
this.set( 'minRows', 2 );
this.set( 'maxRows', 5 );
this.set( '_height', null );
this.set( 'resize', 'both' );
this.set( 'resize', 'none' );

this.on( 'change:minRows', this._validateMinMaxRows.bind( this ) );
this.on( 'change:maxRows', this._validateMinMaxRows.bind( this ) );
Expand Down
17 changes: 4 additions & 13 deletions packages/ckeditor5-ui/tests/manual/textarea/textareaview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,13 @@ function createPlainTextareaWithVerticalResizeOnly() {
addToPlayground( 'Default rows, manual v-resize only', textareaView );
}

function createPlainTextareaWithNoResize() {
const textareaView = new TextareaView();

textareaView.resize = 'none';

addToPlayground( 'Default rows, no manual resize', textareaView );
}

function createPlainTextareaWithFixedSizeAndNoResize() {
function createPlainTextareaWithFixedSizeAndResizeBoth() {
const textareaView = new TextareaView();

textareaView.minRows = textareaView.maxRows = 3;
textareaView.resize = 'none';
textareaView.resize = 'both';

addToPlayground( '3 fixed rows, no manual resize', textareaView );
addToPlayground( '3 fixed rows, resize: both', textareaView );
}

function addToPlayground( name, view ) {
Expand Down Expand Up @@ -110,5 +102,4 @@ createPlainTextareaWithMoreRows();
createPlainTextareaWithFixedRows();
createPlainTextareaWithSingleRow();
createPlainTextareaWithVerticalResizeOnly();
createPlainTextareaWithNoResize();
createPlainTextareaWithFixedSizeAndNoResize();
createPlainTextareaWithFixedSizeAndResizeBoth();
4 changes: 2 additions & 2 deletions packages/ckeditor5-ui/tests/textarea/textareaview.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe( 'TextareaView', () => {
} );

it( 'should have default resize attribute value', () => {
expect( view.element.style.resize ).to.equal( 'both' );
expect( view.element.style.resize ).to.equal( 'none' );
} );

it( 'should warn if #minHeight is greater than #maxHeight', () => {
Expand Down Expand Up @@ -201,7 +201,7 @@ describe( 'TextareaView', () => {

describe( 'resize attribute', () => {
it( 'should react on view#reisze', () => {
expect( view.element.style.resize ).to.equal( 'both' );
expect( view.element.style.resize ).to.equal( 'none' );

view.resize = 'vertical';

Expand Down

0 comments on commit 70c8e55

Please sign in to comment.