Contribute to this guide

Fullscreen mode

The fullscreen mode lets you temporarily expand the editor to the whole browser viewport, giving you more space to comfortably edit content and use editor’s UI features.

# Demo

Use the fullscreen mode toolbar button Enter fullscreen mode in the editor below to see the feature in action. Once you enter the fullscreen mode, you will notice the following changes:

  • Editor UI is stretched to the whole browser viewport.
  • Menu bar is visible by default, regardless of its presence outside fullscreen.
  • The editor editable area dimensions are changed.
  • Some dialogs are re-positioned to better utilize the increased space.
  • Website scroll is disabled.
  • Annotations display mode is switched to wide sidebar (this affects only annotations UIs without filter function configured).

Fullscreen mode can also be toggled using the Ctrl+Shift+F (or Cmd+Shift+F) keystroke.

This demo presents a limited set of features. Visit the feature-rich editor example to see more in action.

# Installation

⚠️ New import paths

Starting with version 42.0.0, we changed the format of import paths. This guide uses the new, shorter format. Refer to the Packages in the legacy setup guide if you use an older version of CKEditor 5.

After installing the editor, add the feature to your plugin list and toolbar configuration:

import { ClassicEditor, Fullscreen } from 'ckeditor5';

ClassicEditor
	.create( document.querySelector( '#editor' ), {
		licenseKey: '<YOUR_LICENSE_KEY>', // Or 'GPL'.
		plugins: [ Fullscreen, /* ... */ ],
		toolbar: [ 'fullscreen', /* ... */ ]
		fullscreen: {
			// Configuration.
		}
	} )
	.then( /* ... */ )
	.catch( /* ... */ );

# Supported editor types

Fullscreen mode is ready-to-use for classic and decoupled editors. If you want to use it with other editor type, you can use custom callbacks to adjust the layout according to your needs. See the details in the Further customization section.

# Configuration

Fullscreen mode is designed to provide a great editing experience without requiring any additional effort from the integrator. It provides integration with most of the official CKEditor 5 features out-of-the-box, detecting which of them are available. At the same time, it is possible to fully customize how the fullscreen mode is displayed, either through configuration flags, custom CSS definitions or by providing a custom callback that will execute more complex changes.

By default, menu bar is visible in fullscreen mode for any supported editor type, regardless of their original configuration. To disable it, use the config.fullscreen.menuBar.isVisible option:

ClassicEditor
    .create( document.querySelector( '#editor' ), {
        // ... Other configuration options ...
        fullscreen: {
            menuBar: {
                isVisible: false
            }
        }
    } )
    .then( /* ... */ )
    .catch( /* ... */ );

Note that this setting does not change the original behavior defined in config.menuBar.isVisible configuration option.

# Toolbar grouping

Toolbar grouping in fullscreen mode will behave the same as outside it. To define the behavior explicitly, use config.fullscreen.toolbar.shouldNotGroupWhenFull option:

ClassicEditor
    .create( document.querySelector( '#editor' ), {
        // ... Other configuration options ...
        fullscreen: {
            toolbar: {
                shouldNotGroupWhenFull: true
            }
        }
    } )
    .then( /* ... */ )
    .catch( /* ... */ );

Note that this setting does not change the original behavior defined in config.toolbar.shouldNotGroupWhenFull configuration option.

# Using a custom container

If you want to use the fullscreen mode to enhance the editing experience but there are still some elements in your website layout that should stay visible, you can pass a custom container for the editor in fullscreen mode using config.fullscreen.container property. The editor will be resized to match the size of the provided container.

ClassicEditor
    .create( document.querySelector( '#editor' ), {
        // ... Other configuration options ...
        fullscreen: {
            container: document.querySelector( '.fullscreen-editor-container' )
        }
    } )
    .then( /* ... */ )
    .catch( /* ... */ );

When using a custom container, the website scroll will not be locked to allow for accessing the rest of the website content.

For more technical details, please check the plugin configuration API.

# Further customization

Besides basic configuration, it is possible to do virtually any changes to the fullscreen mode layout using CSS and custom configurable callbacks.

# Basic template

To change the component styling (like editable area width or background color), you can use the CSS classes (precede each with .ck.ck-fullscreen__main-wrapper selector to ensure enough CSS specificity):

  • ck-fullscreen__top-wrapper - top wrapper holding the menu bar and toolbar.
  • ck-fullscreen__menu-bar - container with menu bar.
  • ck-fullscreen__toolbar - container with toolbar.
  • ck-fullscreen__editable-wrapper - container with sidebars and editable area.
  • ck-fullscreen__sidebar - this class is assigned to both left and right sidebar.
  • ck-fullscreen__left-sidebar - class that only left sidebar has.
  • ck-fullscreen__right-sidebar - class that only right sidebar has.
  • ck-fullscreen__editable - container with the editable area.
  • ck-fullscreen__bottom-wrapper - empty container that can be used for footer-like features.

# Callbacks

If you want to display some additional elements in the fullscreen mode, set the config.fullscreen.onEnterCallback and config.fullscreen.onLeaveCallback properties.

onEnterCallback( container ) is fired when you enter fullscreen mode. Passed parameter is the final DOM element container generated by the default fullscreen behavior. It contains the whole fullscreen mode DOM structure, already set up (the editor UI is already injected into the container). You are free to perform any changes, for example, relocate sidebars or append additional UI elements.

onLeaveCallback( container ) is fired when you leave fullscreen mode. Passed parameter is the container with the fullscreen mode DOM structure. The callback should be used to take care of any of your custom components, for example, if some elements were moved to the fullscreen DOM structure, restore their original locations in the DOM.

# Demo - customized layout: pageless editor

Below you will find a customized demo:

  • Instead of occupying the whole viewport, the editor is stretched only over the main website area, not covering top and side navigation bars.
  • The “piece of paper” view is replaced by the “pageless” view, replicating the classic editor experience.
  • Menu bar is not displayed.

SERVICES AGREEMENT

This Contract for Services Agreement (the “Agreement”) is made and entered into as of [date] (the “Effective Date”), by and between [Client Name], a [state] corporation with its principal place of business at [address] (the “Client”), and [Service Provider Name], a [state] corporation with its principal place of business at [address] (the “Service Provider”).

Scope of Services

The Service Provider shall provide the following services to the CLIENT (the “Services”):

[Insert description of services]

Term

This Agreement shall commence on the Effective Date and shall continue until [Insert date], unless earlier terminated as provided herein (the “Term”).

Compensation

In consideration of the Services to be provided by the Service Provider, the Client shall pay the Service Provider the fees set forth in Exhibit A attached hereto and incorporated herein by reference (the “Fees”).

The Client shall pay the Fees within [Insert number] days of receipt of an invoice from the Service Provider.

If any Fees are not paid when due, the Service Provider may, in its sole discretion, suspend or terminate the Services.

Late Fees

If any payment is not received by the Service Provider within [Insert number] days of its due date, the Client shall pay a late fee equal to [Insert percentage] of the unpaid amount. The following table sets forth the specific late fee percentages that will apply based on the number of days the payment is past due:

Days Past Due
Late Fee Percentage
1-30 days
[Insert percentage]
31-60 days
[Insert percentage]
61-90 days
[Insert percentage]
Over 90 days
[Insert percentage]

The Client agrees that the late fees set forth in this table are reasonable and necessary to compensate the Service Provider for the costs and expenses it will incur as a result of any late payments. The Service Provider reserves the right to waive or reduce any late fees in its sole discretion.

Termination

This Agreement may be terminated: 

  1. By either party upon [Insert number] days’ written notice to the other party;
  2. By the Client upon the occurrence of a material breach by the Service Provider of this Agreement that is not cured within [Insert number] days after written notice thereof is given to the Service Provider; or
  3. By the Service Provider upon the occurrence of a material breach by the Client of this Agreement that is not cured within [Insert number] days after written notice thereof is given to the Client.

Effect of Termination

Upon termination of this Agreement for any reason, the Service Provider shall immediately cease providing the Services, and the Client shall pay the Service Provider for all Services performed prior to the effective date of termination.

Confidentiality

The Service Provider agrees to keep confidential all information and materials disclosed by the Client to the Service Provider in connection with the Services (the “Confidential Information”).

The Service Provider shall not use the Confidential Information for any purpose other than to perform the Services.

The Service Provider shall take reasonable measures to protect the confidentiality of the Confidential Information.

Exceptions

The obligations of confidentiality set forth in this Agreement shall not apply to any Confidential Information that:

  1. is already known to the Service Provider prior to its disclosure by the Client;
  2. is or becomes publicly known through no fault of the Service Provider; or
  3. is obtained by the Service Provider from a third party without a breach of any obligation of confidentiality.

Representations and Warranties

The Service Provider represents and warrants that it has the necessary expertise, qualifications, and experience to perform the Services.

The Client represents and warrants that it has the legal right to engage the Service Provider to perform the Services.

Disclaimer of Other Warranties

Except for the express warranties set forth in this Agreement, the Service Provider makes no other warranties, express or implied, with respect to the Services, including, without limitation, any implied warranties of merchantability or fitness for a particular purpose.

Here are some CKEditor 5 features that are a perfect match for fullscreen mode:

  • Document outline – Display the list of all document headings next to the editing area.
  • Track changes – Mark user changes in the content and show them as suggestions in the sidebar for acceptance or rejection.
  • Real-time collaboration – Work on the same document with other users simultaneously.

# Common API

The fullscreen plugin registers:

  • the fullscreen UI button components for toolbar and menu bar,
  • the toggleFullscreen command.

You can execute the command using the editor.execute() method:

// Toggle the fullscreen mode.
editor.execute( 'toggleFullscreen' );

We recommend using the official CKEditor 5 inspector for development and debugging. It will give you tons of useful information about the state of the editor such as internal data structures, selection, commands, and many more.

# Contribute

The source code of the feature is available on GitHub at https://github.com/ckeditor/ckeditor5/tree/master/packages/ckeditor5-fullscreen.