Automatic application
HTML is available in Base/Pro and CSS in Pro. HTML/Markdown use the same editing window as visual content; there is no manual Save or preview mode. Valid source applies after a 250 ms pause. HTML opens with indentation and logical line numbers; a soft-wrapped line keeps the same number.
Validation
Basic checks catch unclosed or mismatched tags, unsafe/unsupported import and invalid CSS. A rejected draft does not replace the canonical document. The status explains the error and prevents mode switching. Fix the source or use Reset source. getHTML/getJSON/getCSS continue to return the last applied revision.
Styles and history
HTML and CSS apply atomically as one history operation. CSS is stored separately from JSON. Supported text styles use a restricted tag-selector/property policy; classes, IDs, at-rules, url(), variables, positioning and !important are rejected. Shadow DOM isolates document styles from application UI.
Programmatic changes
Await CSS operations; capture revision for delayed edits. A newer API revision blocks a stale source draft until reset. Confirmation of formatting loss never bypasses cleanup. Errors, security.
editor.setMode('html');
await editor.whenSourceReady();
console.log(editor.getMode());
await editor.setContent('<p>Документ</p>', {
css: 'p { color: #246a50; line-height: 1.6; }'
});
const html = editor.getHTML();
const css = editor.getCSS();