Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Merge pull request #453 from ckeditor/t/ckeditor5/1261
Browse files Browse the repository at this point in the history
Feature: Added the `.ck-read-only` CSS class to the `EditableUIView` when `#isReadOnly` is `true`.
  • Loading branch information
oleq authored Nov 6, 2018
2 parents 07c4fdb + 37bbb23 commit 4119822
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/editableui/editableuiview.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ export default class EditableUIView extends View {
'ck-content',
'ck-editor__editable',
'ck-rounded-corners',
bind.to( 'isFocused', value => value ? 'ck-focused' : 'ck-blurred' )
bind.to( 'isFocused', value => value ? 'ck-focused' : 'ck-blurred' ),
bind.if( 'isReadOnly', 'ck-read-only' )

],
contenteditable: bind.to( 'isReadOnly', value => !value ),
}
Expand Down
2 changes: 2 additions & 0 deletions tests/editableui/editableuiview.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ describe( 'EditableUIView', () => {
it( 'reacts on view#isReadOnly', () => {
view.isReadOnly = true;
expect( view.element.hasAttribute( 'contenteditable' ) ).to.be.false;
expect( view.element.classList.contains( 'ck-read-only' ) ).to.be.true;

view.isReadOnly = false;
expect( view.element.hasAttribute( 'contenteditable' ) ).to.be.true;
expect( view.element.classList.contains( 'ck-read-only' ) ).to.be.false;
} );
} );
} );
Expand Down

0 comments on commit 4119822

Please sign in to comment.