Word content pasted into Plate cannot be saved: fontSize and textIndent issues

Issue

Recently, I encountered an issue while using the Plate rich-text editor.

When copying content from Microsoft Word into Plate, the text, colors, and tables all appear normal—but clicking “Save” triggers an error:

"fontSize is not a safe font size"

"Contains unauthorized attributes: ['textIndent']"

After several rounds of troubleshooting, I realized these are actually manifestations of the same underlying problem: Formatting copied from Word may render correctly in the browser and Plate, but does not necessarily conform to the backend’s strict schema for Plate documents.

One rich-text bug per day :sweat_smile:

Why fontSize Cannot Be Saved

Word typically uses the unit pt (points) for font sizes.

For example, copying text sized at 10.5 pt from Word into Plate may result in the following JSON node:

{
  "text": "Ephedra",
  "fontSize": "10.5pt"
}

However, the backend’s Plate validation only permits the units: px, em, rem, and %. Thus, although the editor renders 10.5pt without issue, the backend rejects it as an “unsafe” font size upon saving.

The fix is to convert pt to px before saving. The conversion ratio is: 1 pt = 4/3 px.

Do not simply remove the fontSize property—doing so would allow saving but discard the original font size information copied from Word.

What Is the Unauthorized Attribute textIndent?

After resolving the fontSize issue, another error appears:

"Contains unauthorized attributes: ['textIndent']"

textIndent usually represents first-line indentation or paragraph indentation in Word—and is unsupported by Plate. If your application does not require preserving Word’s first-line indentation, you can safely remove all textIndent properties before saving.

Why Does the textIndent Error Report Different Array Indices Each Time?

The first error says: "value[13] contains textIndent". After fixing that, it changes to "value[15] contains textIndent", and repeated manual fixes prove futile.

This happens because when a Word table is pasted into Plate, its internal structure becomes deeply nested:

table
  → tr
    → td
      → p
        → text

Adding even a single blank line or heading earlier in the document shifts all subsequent array indices—so hardcoding fixes like value[13] is unreliable. Instead, you must recursively traverse the entire Plate document and strip all textIndent properties.

Summary

The core issue isn’t that Plate fails to paste Word content—it’s that each layer supports a slightly different set of formatting features:

Word Format
→ Browser Clipboard
→ Plate JSON
→ Backend-Approved Plate JSON

Browsers are relatively permissive: both 10.5pt and textIndent render fine. In contrast, the backend enforces strict safety and data stability by accepting only whitelisted attributes and units.

Further Reading

Plate repository: GitHub - udecode/plate: Rich-text editor with AI and shadcn/ui · GitHub
Plate official website: https://platejs.org/