Skip to content

Commit

Permalink
Aligned the sample.
Browse files Browse the repository at this point in the history
  • Loading branch information
pomek committed Apr 5, 2022
1 parent 7cc2413 commit 930edf7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions sample/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ <h1>CKEditor 5 – React Component – development sample</h1>
const readOnlyButton = document.getElementById( 'readOnly' );
const simulateErrorButton = document.getElementById( 'simulateError' );

const SAMPLE_READ_ONLY_LOCK_ID = 'Integration Sample';

class App extends React.Component {
constructor( props ) {
super( props );
Expand All @@ -47,6 +49,7 @@ <h1>CKEditor 5 – React Component – development sample</h1>
return React.createElement( CKEditor.CKEditor, {
editor: ClassicEditor,
data: this.state.documents[ this.state.documentID ],
// disabled: true,
id: this.state.documentID,
onReady: editor => {
window.editor = editor;
Expand Down Expand Up @@ -82,12 +85,12 @@ <h1>CKEditor 5 – React Component – development sample</h1>
} );

editor.ui.view.listenTo( readOnlyButton, 'click', () => {
editor.isReadOnly = !editor.isReadOnly;
editor.enableReadOnlyMode( SAMPLE_READ_ONLY_LOCK_ID, !editor.isReadOnly );

if ( editor.isReadOnly ) {
this.innerText = 'Switch to editable mode';
readOnlyButton.innerText = 'Switch to editable mode';
} else {
this.innerText = 'Switch to read-only mode';
readOnlyButton.innerText = 'Switch to read-only mode';
}
} );
},
Expand Down

0 comments on commit 930edf7

Please sign in to comment.