Index: /CKEditor/branches/features/readonly/_source/core/editor.js
===================================================================
--- /CKEditor/branches/features/readonly/_source/core/editor.js	(revision 6752)
+++ /CKEditor/branches/features/readonly/_source/core/editor.js	(revision 6753)
@@ -410,4 +410,7 @@
 			mode = this.mode;
 
+		if ( !mode )
+			return;
+
 		for ( var name in commands )
 		{
@@ -503,4 +506,5 @@
 
 			this.on( 'mode', updateCommands, null, null, 1 );
+			this.on( 'readOnly', updateCommands, null, null, 1 );
 
 			initConfig( this, instanceConfig );
Index: /CKEditor/branches/features/readonly/_source/plugins/button/plugin.js
===================================================================
--- /CKEditor/branches/features/readonly/_source/plugins/button/plugin.js	(revision 6752)
+++ /CKEditor/branches/features/readonly/_source/plugins/button/plugin.js	(revision 6753)
@@ -94,4 +94,17 @@
 	var keydownFn = CKEDITOR.tools.addFunction( CKEDITOR.ui.button._.keydown, CKEDITOR.ui.button._ ),
 		focusFn = CKEDITOR.tools.addFunction( CKEDITOR.ui.button._.focus, CKEDITOR.ui.button._ );
+
+function updateState( editor )
+{
+	// "this" is a CKEDITOR.ui.button instance.
+
+	var mode = editor.mode;
+
+	// Restore saved button state.
+	var state = this.modes[ mode ] ? modeStates[ mode ] != undefined ? modeStates[ mode ] :
+			CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED;
+
+	this.setState( editor.readOnly && !this.readOnly ? CKEDITOR.TRISTATE_DISABLED : state );
+}
 
 CKEDITOR.ui.button.prototype =
@@ -147,14 +160,8 @@
 				}, this );
 
-			editor.on( 'mode', function()
-				{
-					var mode = editor.mode;
-
-					// Restore saved button state.
-					var state = this.modes[ mode ] ? modeStates[ mode ] != undefined ? modeStates[ mode ] :
-							CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED;
-
-					this.setState( editor.readOnly && !this.readOnly ? CKEDITOR.TRISTATE_DISABLED : state );
-				}, this);
+			editor.on( 'mode', updateState, this);
+
+			// If this button is sensitive to readOnly state, update it accordingly.
+			!this.readOnly && editor.on( 'readOnly', updateState, this);
 		}
 		else if ( command )
Index: /CKEditor/branches/features/readonly/_source/plugins/editingblock/plugin.js
===================================================================
--- /CKEditor/branches/features/readonly/_source/plugins/editingblock/plugin.js	(revision 6752)
+++ /CKEditor/branches/features/readonly/_source/plugins/editingblock/plugin.js	(revision 6753)
@@ -60,6 +60,9 @@
 							editor.on( 'mode', function()
 								{
-									setData();
-									editor.removeListener( 'mode', arguments.callee );
+									if ( editor.mode )
+									{
+										setData();
+										editor.removeListener( 'mode', arguments.callee );
+									}
 								});
 						}
@@ -180,4 +183,5 @@
 		{
 			this.setData( data );
+			this.fire( 'mode' );
 			return;
 		}
Index: /CKEditor/branches/features/readonly/_source/plugins/showblocks/plugin.js
===================================================================
--- /CKEditor/branches/features/readonly/_source/plugins/showblocks/plugin.js	(revision 6752)
+++ /CKEditor/branches/features/readonly/_source/plugins/showblocks/plugin.js	(revision 6753)
@@ -102,6 +102,9 @@
 		refresh : function( editor )
 		{
-			var funcName = ( this.state == CKEDITOR.TRISTATE_ON ) ? 'addClass' : 'removeClass';
-			editor.document.getBody()[ funcName ]( 'cke_show_blocks' );
+			if ( editor.document )
+			{
+				var funcName = ( this.state == CKEDITOR.TRISTATE_ON ) ? 'addClass' : 'removeClass';
+				editor.document.getBody()[ funcName ]( 'cke_show_blocks' );
+			}
 		}
 	};
Index: /CKEditor/branches/features/readonly/_source/plugins/showborders/plugin.js
===================================================================
--- /CKEditor/branches/features/readonly/_source/plugins/showborders/plugin.js	(revision 6752)
+++ /CKEditor/branches/features/readonly/_source/plugins/showborders/plugin.js	(revision 6753)
@@ -51,6 +51,9 @@
 		refresh : function( editor )
 		{
-			var funcName = ( this.state == CKEDITOR.TRISTATE_ON ) ? 'addClass' : 'removeClass';
-			editor.document.getBody()[ funcName ]( 'cke_show_borders' );
+			if ( editor.document )
+			{
+				var funcName = ( this.state == CKEDITOR.TRISTATE_ON ) ? 'addClass' : 'removeClass';
+				editor.document.getBody()[ funcName ]( 'cke_show_borders' );
+			}
 		}
 	};
