Skip to main content
Version: Next

Security And Autosave

Security and autosave architecture for safe content handling and reliable persistence workflows.

Security model

  • Sanitize inbound and outbound HTML paths.
  • Restrict unsafe tags/attributes at the editor boundary.
  • Apply consistent rules in both React and web component integrations.

Autosave model

  • Trigger save logic from content-change events.
  • Debounce saves to avoid write amplification.
  • Persist per document id to prevent cross-document overwrite.
  1. Define an allowlist-based sanitization policy.
  2. Normalize pasted/imported HTML before render.
  3. Enable debounced autosave and persist revision timestamps.
  4. Restore draft content only for the same document scope.

Failure handling

  • Show save status (saving, saved, error) in UI.
  • Retry failed saves with bounded backoff.
  • Keep unsaved draft state local until remote persistence succeeds.

API Surface

SurfaceTypeNotes
security runtime configConfig APIControls sanitize-on-paste/input policy and HTML safety behavior
autosave runtime configConfig APIControls enablement, interval/debounce, storage provider/keying
Content change events/callbacksIntegration APITrigger persistence pipelines and save-state UX
setConfig({...}) / React runtime propsUpdate APIApplies security/autosave settings per editor instance

Config Matrix

AreaKey OptionPurpose
Securitysanitizer/allowlist rulesprevent unsafe HTML
Securitypaste/import normalizationblock malformed DOM
Autosavedebounce intervalreduce save churn
Autosavestorage adapterlocal/remote persistence
Autosavedocument keyingisolate drafts

Validation Checklist

  • Sanitization rules remove disallowed constructs predictably.
  • Autosave does not fire excessive writes under rapid typing.
  • Restored drafts match the correct document id.
  • Save failure state remains non-blocking for editing.