Installation
Install a fixed version, import the CMS entry and stylesheet, and mount after the host DOM exists.
sh
pnpm add @soeditor/editor@1.2.1html
<label for="content">Article content</label>
<textarea id="content" name="content"><p>Start writing</p></textarea>ts
import { createClassicEditor } from '@soeditor/editor/cms';
import '@soeditor/editor/cms/styles.css';The checked function below mounts the editor. Call await attach() to get the instance. The default entry provides WYSIWYG; use the optional entry for Source or a save adapter.
Checked code
ts
export async function attach() {
const host = document.querySelector<HTMLTextAreaElement>('#content');
if (!host) throw new Error('Missing #content textarea');
return createClassicEditor(host, { locale: 'zh-CN', minHeight: 280 });
}Checked against the published types; see imports and types for imports.