Skip to content

feat(rich-text): store Quill Delta alongside HTML#2295

Closed
Raymond0212 wants to merge 1 commit into
mendix:mainfrom
Raymond0212:rich-text-delta
Closed

feat(rich-text): store Quill Delta alongside HTML#2295
Raymond0212 wants to merge 1 commit into
mendix:mainfrom
Raymond0212:rich-text-delta

Conversation

@Raymond0212

Copy link
Copy Markdown

Pull request type

New feature (non-breaking change which adds functionality)

Test related change (New E2E test, test automation, etc.)


Description

This PR adds optional Quill Delta JSON persistence to the Rich Text web widget.

We have seen serious discrepancies when persisted HTML is rendered back into editable Rich Text content, especially for content that contains tabs or formatting that does not round-trip cleanly through semantic HTML. Customers also have strong requirements for reliable diff views and side-by-side content comparison.

To support those use cases, this change keeps the existing HTML persistence unchanged and adds an optional secondary storage path for the native Quill document model:

  • Existing value attribute continues to store semantic HTML.
  • New Enable delta setting enables Delta persistence (please refer to the attached screenshot).
  • New Delta attribute stores JSON.stringify(quill.getContents()) in a separate string attribute. (please refer to the attached screenshot).
  • Delta attribute is hidden unless Delta persistence is enabled. (please refer to the attached screenshot).
  • Studio Pro validation reports a configuration error when Delta persistence is enabled without selecting a Delta attribute.
  • onChange still runs once per logical editor update.
  • onLeave change detection uses Delta snapshots when Delta persistence is enabled, so formatting-only changes can be detected.
  • Existing editor loading remains HTML-based for backward compatibility.

The stored Delta JSON is intended to support future rendering paths using Quill Delta directly, and allow users to write custom JavaScript-based diff and side-by-side comparison features.

What should be covered while testing?

  • Verify existing HTML persistence still works when Enable delta is disabled.
  • Verify Delta attribute is hidden by default.
  • Enable Enable delta and verify Delta attribute becomes visible.
  • Verify Studio Pro shows a configuration error when Delta persistence is enabled but no Delta attribute is selected.
  • Select a string attribute for Delta persistence and edit content in the widget.
  • Confirm the existing value attribute stores semantic HTML.
  • Confirm the Delta attribute stores valid JSON with an ops array.
  • Verify onChangeType = onDataChange still triggers once per debounced editor update.
  • Verify onChangeType = onLeave detects formatting-only changes when Delta persistence is enabled.

Validation performed:

  • pnpm lint in packages/pluggableWidgets/rich-text-web
  • pnpm test in packages/pluggableWidgets/rich-text-web
  • pnpm build in packages/pluggableWidgets/rich-text-web

E2E test perform on local app with correct parsable Quill delta json persisted in DB.

image

@Raymond0212 Raymond0212 requested a review from a team as a code owner June 29, 2026 10:23
@gjulivan

Copy link
Copy Markdown
Collaborator

We are not going this way because this will cause problems when engine changes.

Please check on
#2270

@gjulivan gjulivan closed this Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants