@univerjs/docs-find-replace integrates the shared find-and-replace UI with Univer Docs.
| Package | UMD global | CSS | Locales | Facade entry | Worker entry |
|---|---|---|---|---|---|
@univerjs/docs-find-replace |
UniverDocsFindReplace |
No | No | No | No |
pnpm add @univerjs/docs-find-replace @univerjs/find-replace
# or
npm install @univerjs/docs-find-replace @univerjs/find-replaceStart with the integration setup for your document type, including its required plugins, styles, and locale resources. The snippet below assumes that setup is complete.
import { LocaleType, mergeLocales, Univer } from '@univerjs/core';
import { UniverDocsFindReplacePlugin } from '@univerjs/docs-find-replace';
import { UniverFindReplacePlugin } from '@univerjs/find-replace';
import FindReplaceEnUS from '@univerjs/find-replace/locale/en-US';
import '@univerjs/find-replace/lib/index.css';
const univer = new Univer({
locale: LocaleType.EN_US,
locales: {
[LocaleType.EN_US]: mergeLocales(FindReplaceEnUS),
},
});
univer.registerPlugin(UniverFindReplacePlugin);
univer.registerPlugin(UniverDocsFindReplacePlugin);Register the shared find-and-replace plugin before the Docs adapter so it can provide the common UI, locale strings, and services. Configure the rest of the Docs plugin stack before adding these two plugins.
Phase one searches and replaces literal text in the current document body, including tables. It excludes headers, footers, comments, drawings, regular expressions, formatting search, special characters, result sidebars, presets, and Facade APIs.