Instance methods
The ClassicEditor returned by createClassicEditor() is the main CMS application handle.
| Method | Result and behavior |
|---|---|
| getData() | Canonical HTML string |
| setData(source) | Replace canonical content |
| focus() | Focus the editing surface |
| setReadonly(value) | Change readonly state |
| setWorkspaceView(view) | void or Promise; consistently await it |
| save() / retrySave() | Promise; requires a save adapter |
| destroy() | Promise; release owned resources |
Do not use a destroyed handle. Access commands and services through the public classic.editor interface rather than private fields.
Checked code
ts
export async function withHost(host: HTMLElement) {
const editor = await createClassicEditor(host, { data: '<p>Hello</p>' });
editor.setData('<p>Updated</p>');
const html = editor.getData();
editor.setReadonly(true);
await editor.destroy(); // Before removing the host element.
return html;
}Checked against the published types; see imports and types for imports.