Contribute to this guide

guideFind and replace

The find and replace feature lets you find and replace any text in your document. This speeds up your work and helps with the consistency of your content.

# Demo

Use the find and replace toolbar button Find and replace to open the search dialog. Use it to find and replace words or phrases. You can also use the Ctrl/Cmd+F keyboard shortcut. Try replacing “AI” with “artificial intelligence” to make the content appeal to less tech-savvy users. Be careful to match the case!

AI Alchemy: Crafting Captivating Content in 2024

CKEditor 5 AI Assistant feature helps generate content.
Using AI Assistant in CKEditor 5.

In 2024, AI has turbocharged content creation, making it faster and more engaging. Automation takes care of the nitty-gritty tasks like research and initial drafts, giving human creators more time for the fun stuff.

Thanks to Natural Language Processing, AI now gets context, tone, and audience preferences. This means content can be personalized, SEO-optimized, and perfectly tuned to connect with different audiences.

But the real magic happens in collaboration. AI is like a creative sidekick, suggesting ideas, offering feedback, and seamlessly working alongside human creators. The result? Content that's not just efficient but also a cool blend of machine smarts and human creativity.

In a nutshell, AI in 2024 is revolutionizing content creation, offering creators powerful tools to make content that's not only efficient but also captivating and globally resonant.

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

# Configuration

# Configuring the UI type

By default, the find and replace form displays inside a dialog. That allows for keeping it open while editing the document at the same time. Alternatively, you can display the feature in a dropdown. To do this, use the config.findAndReplace.uiType configuration option:

ClassicEditor
    .create( document.querySelector( '#editor' ), {
        findAndReplace: {
            uiType: 'dropdown'
        }
    } )
    .then( /* ... */ )
    .catch( /* ... */ );

AI Alchemy: Crafting Captivating Content in 2024

CKEditor 5 AI Assistant feature helps generate content.
Using AI Assistant in CKEditor 5.

In 2024, AI has turbocharged content creation, making it faster and more engaging. Automation takes care of the nitty-gritty tasks like research and initial drafts, giving human creators more time for the fun stuff.

Thanks to Natural Language Processing, AI now gets context, tone, and audience preferences. This means content can be personalized, SEO-optimized, and perfectly tuned to connect with different audiences.

But the real magic happens in collaboration. AI is like a creative sidekick, suggesting ideas, offering feedback, and seamlessly working alongside human creators. The result? Content that's not just efficient but also a cool blend of machine smarts and human creativity.

In a nutshell, AI in 2024 is revolutionizing content creation, offering creators powerful tools to make content that's not only efficient but also captivating and globally resonant.

# Installation

The find and replace feature is enabled by default in the superbuild only.

To add this feature to your editor, install the @ckeditor/ckeditor5-find-and-replace package:

npm install --save @ckeditor/ckeditor5-find-and-replace

Then add the FindAndReplace plugin to your plugin list:

import { FindAndReplace } from '@ckeditor/ckeditor5-find-and-replace';

ClassicEditor
    .create( document.querySelector( '#editor' ), {
        plugins: [ FindAndReplace, /* ... */ ],
        toolbar: [ 'findAndReplace', /* ... */ ],
    } )
    .then( /* ... */ )
    .catch( /* ... */ );

Read more about installing plugins.

# Common API

The FindAndReplace plugin registers the 'findAndReplace' UI button component and the 'find', 'findNext', 'findPrevious', 'replace' and 'replaceAll' commands.

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

// Find all occurrences of a given text.
editor.execute( 'find', 'steam' );

You can also move the highlight through all matched results with the 'findNext' and 'findPrevious' commands:

// Move the search highlight to the next match.
editor.execute( 'findNext' );

You can also replace all occurrences of a given text in the editor instance using the 'replaceAll' command:

editor.execute( 'replaceAll', 'diesel', 'steam' );

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-find-and-replace.