Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@ckeditor/ckeditor5-inspector

ckeditor131.9kSEE LICENSE IN LICENSE.md5.0.0

The official CKEditor 5 instance inspector.

readme

CKEditor 5 inspector

npm version CircleCI Coverage Status

The official CKEditor 5 rich text editor instance inspector for developers.

The inspector panel attached to the editor instance.

Documentation 📖

Learn how to use the inspector and see it live in the Development tools guide.

Quick start

Include the script to load the inspector:

<script src="path/to/inspector.js"></script>

Call CKEditorInspector.attach( editor ) when the editor instance is ready:

ClassicEditor
    .create( ... )
    .then( editor => {
        CKEditorInspector.attach( editor );
    } )
    .catch( error => {
        console.error( error );
    } );

Note: You can attach to multiple editors under unique names at a time. Then you can select the editor instance in the drop–down inside the inspector panel to switch context.

CKEditorInspector.attach( {
    'header-editor': editor1,
    'footer-editor': editor2,
    // ...
} );

Call CKEditorInspector.detach( name ) to detach the inspector from an editor instance.

Tip: CKEditorInspector.attach() returns the generated name of the editor if it was not provided.

// Attach the inspector to two editor instances:
const generatedName = CKEditorInspector.attach( editor1 );
CKEditorInspector.attach( { arbitraryName: editor2 } );

// ...

// Detach from the instances:
CKEditorInspector.detach( generatedName );
CKEditorInspector.detach( 'arbitraryName' );

Attaching to all editor instances

When multiple CKEditor 5 instances are running in DOM, you can call CKEditorInspector.attachToAll( [ options ] ) to attach the inspector to all of them at the same time. A shorthand for CKEditorInspector.attach( editor, [ options ] ) called individually for each instance.

// Discover all editor instances in DOM and inspect them all.
CKEditorInspector.attachToAll();

You can also pass the optional configuration object to this method.

Note: This method works with CKEditor v12.3.0 or later. Earlier editor versions will not be discovered.

Toggling the inspector visibility

Click the button in the upper-right corner of the inspector to quickly show or hide it. You can also use the <kbd>Alt</kbd>+<kbd>F12</kbd> (<kbd>⌥</kbd>+<kbd>F12</kbd> on Mac) keyboard shortcut.

The button that toggles the inspector visibility.

Configuration

You can pass configuration options to CKEditorInspector.attach() and CKEditorInspector.attachToAll() methods as the last argument:

CKEditorInspector.attach( editor, {
    // configuration options
} );

CKEditorInspector.attach( { 'editor-name': editor }, {
    // configuration options
} );

CKEditorInspector.attachToAll( {
    // configuration options
} );

isCollapsed

To attach the inspector with a collapsed UI, use the options.isCollapsed option.

Note: This option works when CKEditorInspector.attach() is called for the first time only.

CKEditorInspector.attach( { 'editor-name': editor }, {
    // Attach the inspector to the "editor" but the UI will be collapsed.
    isCollapsed: true
} );

Development

To configure the environment:

git clone git@github.com:ckeditor/ckeditor5-inspector.git
cd ckeditor5-inspector
yarn install

Working with the code

Start the webpack file watcher:

yarn dev

and open http://path/to/ckeditor5-inspector/sample/inspector.html in your web browser.

Building

To build the production version of the inspector, run:

yarn build

Testing

To run tests, execute:

yarn test

Releasing the package

CircleCI automates the release process and can release both channels: stable (X.Y.Z) and pre-releases (X.Y.Z-alpha.X, etc.).

Before you start, you need to prepare the changelog entries.

  1. Make sure the #master branch is up-to-date: git fetch && git checkout master && git pull.
  2. Prepare a release branch: git checkout -b release-[YYYYMMDD] where YYYYMMDD is the current day.
  3. Generate the changelog entries: yarn run release:prepare-changelog.
    • You can specify the release date by passing the --date option, e.g., --date=2025-06-11.
    • By passing the --dry-run option, you can check what the script will do without actually modifying the files.
    • Read all the entries, correct poor wording and other issues, wrap code names in backticks to format them, etc.
    • Add the missing the/a articles, () to method names, "it's" -> "its", etc.
    • A newly introduced feature should have just one changelog entry – something like "The initial implementation of the FOO feature." with a description of what it does.
  4. Commit all changes and prepare a new pull request targeting the #master branch.
  5. Ping the @ckeditor/ckeditor-5-platform team to review the pull request and trigger the release process.

License

Licensed under a dual-license model, this software is available under:

For more information, see: https://ckeditor.com/legal/ckeditor-licensing-options.

changelog

Changelog

5.0.0 (July 9, 2025)

BREAKING CHANGES

  • Due to changes in type definitions and package structure in CKEditor 5 v46.0.0, the inspector now requires this version or newer. Earlier versions are no longer compatible. See ckeditor/ckeditor5#18583.

4.1.0 (2022-05-26)

Features

  • Introduced the schema tab. Closes #41. (commit)

4.0.0 (2022-04-12)

BREAKING CHANGES

  • Due to introducing the lock mechanism for the Editor#isReadOnly property, the inspector uses the new way of enabling the read-only mode in the editor. It requires an instance of CKEditor 5 in version 34 or higher. See ckeditor/ckeditor5#10496.

Other changes

  • Aligned the CKEditor 5 Inspector API to use the new lock mechanism when enabling/disabling the read-only mode. (commit)

3.1.1 (2022-03-29)

Bug fixes

  • Improved rendering of GHS attributes in the inspector. Closes #129. (commit)

3.1.0 (2022-02-17)

Features

  • Made it possible to set editor data using the UI. Closes #138. (commit)

3.0.0 (2022-02-03)

BREAKING CHANGES

  • Upgraded the minimal versions of Node.js to 14.0.0 due to the end of LTS.

Features

  • Implemented the mini inspector (MiniCKEditorInspector) in a separate build. Closes #143. (commit)
  • The "Log editor data" button should copy to the clipboard if clicked with the Shift key. Closes #136. (commit)

Other changes

2.3.0 (2021-11-30)

Features

  • Introduced editor quick actions toolbar (see #38) to log editor data, toggle editor read-only, and destroy editor. Closes #121, #104. (commit)

Other changes

  • Added the margin-bottom style to the <body> element when the inspector is collapsed to avoid covering the footer. Closes #126. (commit)

2.2.2 (2021-01-20)

Other changes

  • Added the data-cke-inspector=true attribute to all <style> tags injected by the application. Closes #106. (commit)

    Also:

    • Reduced the number of <style> tags injected by the application.
    • Used the .ck-inspector namespace for CSS custom properties used by the inspector to clean up the developer tools and improve DX.

2.2.1 (2020-11-04)

Bug fixes

  • Node attributes should be sorted in trees and node inspectors (both for the model and the view). Closes #97. (commit)
  • The inspector should not throw when attributes are objects with circular references. Closes #98. (commit)

2.2.0 (2020-08-05)

Features

  • Brought support for the editor view RawElement. Closes #89. (commit)
  • Made it possible to toggle the inspector using the <kbd>Alt</kbd>+<kbd>F12</kbd> keyboard shortcut. Closes #87. (commit)

Bug fixes

  • Addressed the "react-fast-compare circular refs" warning by switching to Lodash isEqual(). Closes #86. (commit)

Other changes

  • The inspector should not update on editor events when the UI is collapsed. Closes #80. (commit)

2.1.0 (2020-06-01)

Features

  • Added the "Scroll to selection" buttons in the Model and View tabs. Closes #77. (699eab6)

Bug fixes

  • Checkboxes in the inspector UI should be centered vertically. Closes #84. (65b8aca)
  • Improved performance of the inspector by avoiding unnecessary React rendering. Closes #79. (44e7850)
  • User-agent styles of HTML select elements should not be overridden by the inspector. Closes #65. (396af59)

2.0.0 (2020-03-26)

Features

  • Implemented markers preview in the "Model" tree. Implemented the "Markers" tab. Implemented support for multiple model/view ranges both in the trees and "Selection" tabs. Improved selection rendering in trees for smooth UX. Closes #12. Closes #7. Closes #68. Closes #73. (0d58db6)

1.5.0 (2019-12-05)

Features

  • Allowed inspecting model attribute properties. Closes #40. (448ae71)

Bug fixes

  • The inspector should render the RTL content in the trees properly. Closes #64. (40c3102)

1.4.0 (2019-09-23)

Features

  • Allowed attaching the inspector collapsed using a configuration passed to CKEditorInspector#attach(). Implemented the CKEditorInspector#destroy() method. Unified CKEditorInspector#attach() arguments syntax and allowed attaching to multiple editor instances at a time. Closes #44. Closes #42. Closes #48. (69ad014)
  • Implemented the CKEditorInspector#attachToAll() method. Closes #56. (8a3c7ea)
  • Introduced the .ck-inspector-body-collapsed class on <body> (next to .ck-inspector-body-expanded) to clearly distinguish expanded and collapsed inspector states. (664b9cd)

    Thanks to @skurfuerst!

Bug fixes

  • EditableElement should be recognized in the View node inspector. Closes #49. (729a922)

BREAKING CHANGES

  • The CKEditorInspector.attach( 'editor-name', editor ); syntax was deprecated and replaced by an object literal CKEditorInspector.attach( { 'editor-name': editor, ... } );.

    Note: The old syntax works (backward compatibility) but it produces a warning in the console and will be removed in the future. We highly recommend using the new attach() method syntax (learn more).

1.3.0 (2019-03-20)

Features

  • Added a comment to each UIElement in the view tree to make it more distinguishable. Closes #13. (aef8995)
  • Added Custom Properties lists to the editor view node inspector. Closes #16. (b44708f)

Bug fixes

  • Long values should be truncated in the Tree and PropertyList to avoid performance issues. Closes #31. (16fa0e4)
  • The inspector should not scale beyond the height of the visible viewport. Closes #34. (86c287b)

1.2.0 (2019-03-11)

Features

  • Implemented vertical inspector resizing. Closes #4. (97d56aa)

1.1.0 (2019-03-06)

Features

  • Allowed using the editor instance as the only argument of CKEditorInspector.attach(). Closes #11. (63ff58e)

Bug fixes

  • Command value should be displayed properly in the list when defined as an object. Related to #9. (3d36cfa)
  • The command inspector should not crash when command's value is undefined. (10821a3)
  • The inspector should not crash when an attribute value is an object. Closes #10. (681f2e2)
  • The view tree inspector should display all attributes of all elements. Closes #9. (705f3c4)
  • View EmptyElement should not render with a closing tag. Added support for missing Empty and UI elements in the inspector and the tree. Closes #5. (e648ab4)

Other changes

  • Code refactoring. Minor improvements in rendering attributes and properties. (ad65184)

1.0.0 (2019-02-28)

Initial release.