8
0
Просмотр исходного кода

Bound EditingController#isReadOnly to the Editor#isReadOnly.

Oskar Wróbel 8 лет назад
Родитель
Сommit
2bffa07d9a

+ 1 - 0
packages/ckeditor5-core/src/editor/standardeditor.js

@@ -39,6 +39,7 @@ export default class StandardEditor extends Editor {
 
 		// Documented in Editor.
 		this.editing = new EditingController( this.document );
+		this.editing.bind( 'isReadOnly' ).to( this );
 
 		/**
 		 * Instance of the {@link module:core/editingkeystrokehandler~EditingKeystrokeHandler}.

+ 12 - 0
packages/ckeditor5-core/tests/editor/standardeditor.js

@@ -31,6 +31,18 @@ describe( 'StandardEditor', () => {
 			expect( editor.keystrokes ).to.be.instanceof( EditingKeystrokeHandler );
 		} );
 
+		it( 'should bind editing#isReadOnly to the editor', () => {
+			const editor = new StandardEditor( editorElement, { foo: 1 } );
+
+			editor.isReadOnly = false;
+
+			expect( editor.editing.isReadOnly ).to.false;
+
+			editor.isReadOnly = true;
+
+			expect( editor.editing.isReadOnly ).to.true;
+		} );
+
 		it( 'activates #keystrokes', () => {
 			const spy = sinon.spy( EditingKeystrokeHandler.prototype, 'listenTo' );
 			const editor = new StandardEditor( editorElement, { foo: 1 } );