Installation
Factory: createSearchReplacePlugin(), id search-replace. Requires preset pro and enabled features.plugins. Use a constructor plugins array or usePlugin on an existing editor; do not install the same id twice. In the script build the factory belongs to the ViText namespace; workspace ESM imports are shown below.
Behavior and limitations
Provides next match, case-sensitive and whole-word search, single replacement and replace-all. Matching uses structured text-block positions, including empty blocks/tables. Changes validate revisions and run in one history transaction; replacement remains plain text and inherits marks from the first matching character.
Removal and ownership
usePlugin returns a disposer; removePlugin('search-replace') removes the same plugin. Destroy automatically revokes its managed commands, subscriptions and UI. The document stays intact. Application-owned requests still need application cleanup. Plugin contract, methods.
import { ViText, createSearchReplacePlugin } from '@vitext-ru/editor';
const editor = new ViText('#editor', {
preset: 'pro', language: 'en',
plugins: [createSearchReplacePlugin()]
});
editor.usePlugin(createSearchReplacePlugin());
editor.executePluginCommand('search-replace', 'open');