Skip to content

DOCX Editor Architecture Map

This page is a reviewer map for packages/docx_editor. It explains the package boundary, the runtime flow, and which authority stays with the host application.

What This Package Owns

docx_editor is the regulated editor shell around Syncfusion DocumentEditor. It does not parse WordprocessingML itself and it does not decide whether a user is allowed to edit a business document. Its job is to connect the editor UI to host-owned policy, audit, storage, lifecycle, locking, signing, conversion, and controlled print contracts.

text
host document record
  -> DocxPickedDocument
  -> DocxController
  -> SyncfusionDocxEditor
  -> Syncfusion iframe / desktop editor
  -> DocxFileGateway
  -> storage, review, signing, conversion, print contracts

Boundary With Vyuh DOCX

ConcernOwnerReason
DOCX and SFDT parsingvyuh_docxPure document format work
PDF layout and paintingvyuh_docxRendering engine work
Syncfusion editor hostingdocx_editorFlutter/editor integration
Actor attributiondocx_editor and hostSession and audit concern
Capabilities and lifecycle gatesdocx_editor and hostBusiness authorization concern
Storage writes and versioningHost through DocxStorageAdapterBackend owns persistence
Electronic signature ceremonydocx_editor and hostRequires actor, reauth, audit, vocabulary
Controlled copy issuancedocx_editor and hostRequires policy, copy allocation, register, audit

The important review point is that docx_editor depends on vyuh_docx for conversion and rendering, but keeps regulated workflow decisions out of vyuh_docx.

Runtime Flow

  1. The host resolves a document into DocxPickedDocument.
  2. The host builds DocxCapabilities from server-side access decisions.
  3. The host creates DocxController with storage, trusted time, actor, audit, lifecycle, and optional signing policy.
  4. SyncfusionDocxEditor applies the picked document's capabilities and edit lock to the controller.
  5. The editor platform implementation opens DOCX or SFDT content in Syncfusion.
  6. The platform implementation attaches a DocxFileGateway so the controller can request SFDT, DOCX, or PDF bytes from the live editor.
  7. Saves, downloads, comments, revisions, signing, and print issuance go back through DocxController so capability, lifecycle, lock, and audit rules are enforced in one place.

Main Components

ComponentResponsibility
SyncfusionDocxEditorPublic Flutter widget. Selects web/desktop implementation and attaches the session to the controller.
DocxControllerCentral enforcement point for capabilities, lifecycle, locks, dirty state, save/export, comments, revisions, signing, and audit.
DocxCapabilitiesDeclarative action gates for the current actor/document. Presets cover view, comment, review, edit, and locked edit modes.
DocxPickedDocumentHost-resolved document input containing source, capabilities, lifecycle, lock, integrity expectations, and metadata.
DocxFileGatewayInternal live-editor bridge used by the controller to get current SFDT, DOCX, and PDF content.
DocxConversionServiceAbstract conversion contract. VyuhDocxConversionService is the pure-Dart implementation backed by vyuh_docx.
ControlledPrintServiceIssues controlled or uncontrolled PDF copies with policy, allocation, trusted time, register, and audit hooks.

Host-Owned Authority

Production hosts must provide these values from trusted backend state:

Host inputWhy it is not local-only
DocxActorRequired for attribution and electronic signatures.
DocxCapabilitiesMust be derived from server-side policy, workflow task, lifecycle, and permissions.
DocxLifecycleStateReleased documents must not become editable because of a client mistake.
DocxEditLockSingle-editor enforcement needs backend lock ownership.
DocxStorageAdapterSaves and versions belong to the host document repository.
DocxTrustedClockAudit and signatures need authoritative UTC time.
DocxCredentialVerifierE-sign reauthentication must use the host identity system.
onAuditEventAudit durability belongs to the host.
Controlled print policy/register/allocationCopy issuance must be atomic and traceable.

Security-Relevant Bridge Boundary

On web, the editor runs inside an iframe and uses postMessage for readiness, content-change events, and bridge request responses. The web implementation accepts only messages that come from the editor iframe's contentWindow. When DocxSyncfusionConfig.trustedOrigin is set, the generated editor HTML also pins outgoing messages to that origin.

Reviewer focus:

  • forged page messages must not complete pending export/save requests;
  • the host should set trustedOrigin outside local development;
  • bridge responses are still treated as untrusted until the controller applies capability, lifecycle, lock, and integrity checks.

Review Checklist

  • vyuh_docx remains the only place doing document parsing and PDF rendering.
  • docx_editor remains the only place doing actor, lifecycle, signing, and controlled-print workflow.
  • Host contracts are explicit constructor parameters or interfaces.
  • Capability mapping fails closed when the host grants no access.
  • Save/export requests use the controller and cannot bypass policy.
  • Web bridge messages are pinned to the editor iframe source.