web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Model driven : problem...
Power Apps
Suggested Answer

Model driven : problem with Enriched text field

(1) ShareShare
ReportReport
Posted on by 38
Hi,
In a Model-Driven application, I have a rich text field.

When I save the text, it is stored in the following HTML format:
<div class="ck-content" data-wrapper="true" dir="ltr" style="--ck-image-style-spacing: 1.5em; --ck-inline-image-style-spacing: calc(var(--ck-image-style-spacing) / 2); font-family: Arial; font-size: 12pt;">
  <div class="ck-content stickystyles-wrapper-insert" style="font-family:Arial;font-size:12pt;" dir="ltr" data-wrapper="true">
    Lorem spicuis.
  </div>
</div>
However, when I refresh the page, the code changes to:
 
<div class="ck-content" data-wrapper="true" dir="ltr" style="--ck-image-style-spacing: 1.5em; --ck-inline-image-style-spacing: calc(var(--ck-image-style-spacing) / 2); font-family: Arial; font-size: 12pt;">
  <p style="margin: 0;">Lorem spicuis.</p>
</div>
I would like the code to always remain the same as in the initial save, with the two <div> elements.

Is there anything that can be done to achieve this?
Categories:
I have the same question (0)
  • Suggested answer
    SpongYe Profile Picture
    5,909 Super User 2026 Season 1 on at
     
    Documentation about Rich text editor limitations also documents that rich text fields store HTML tags together with user-entered data, but the editor has limitations. For the modern rich text editor, Microsoft specifically mentions that nested HTML structures, including deeply nested <div> or <table> elements, can cause rendering problems and recommends simplifying the HTML structure by removing unnecessary nested <div> or <table> tags to ensure consistent rendering.
     
    Because of this, I do not think there is a supported configuration that will force the Model-Driven App Rich Text Editor to always keep the exact same two-div structure after refresh.
     
    If exact HTML preservation is a hard requirement, use a custom PCF control or HTML web resource. Microsoft supports using HTML web resources in Model-Driven Apps for custom UI/client extensions.

     

    If you have any questions or feedback, please let me know. Have a great day! 😊

    -----------------------
    SpongYe Power Platform Enthusiast [LinkedIn] | [Youtube| [My blog]

     

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my blog [@SpongYe] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

  • Suggested answer
    Valantis Profile Picture
    6,526 on at
     
    This is confirmed behavior from Microsoft docs.

    The rich text editor in Model-Driven Apps uses CKEditor, which normalizes HTML on render. The nested div structure you see on initial save gets simplified to paragraph tags on reload because CKEditor applies its own HTML cleanup rules regardless of what was originally stored.
    This isn't a bug it's how the editor processes content.

    There's no supported configuration to prevent this normalization. If preserving the exact HTML structure matters for your use case (e.g. for downstream processing or display),
     
    path: use a custom PCF control which gives you full control over how the content is stored and rendered without CKEditor's normalization.
     

     

    Best regards,

    Valantis

     

    ✅ If this helped solve your issue, please Accept as Solution so others can find it quickly.

    ❤️ If it didn’t fully solve it but was still useful, please click “Yes” on “Was this reply helpful?” or leave a Like :).

    🏷️ For follow-ups  @Valantis.

    📝 https://valantisond365.com/

    💼 LinkedIn

    ▶️ YouTube

     
  • Suggested answer
    SyedBilal Profile Picture
    37 on at
    This is CKEditor's expected behavior—it normalizes HTML on save and refresh. CKEditor's schema sanitizes your markup, converting nested divs to semantically correct <p> tags.
    Why this happens:
    -CKEditor cleans up HTML to prevent formatting issues
    -Nested <div> with class stickystyles-wrapper-insert doesn't match CKEditor's allowed schema
    -The <p> version is actually more standard HTML
     
    1-Accept the normalization —Your content is preserved; only the wrapper tags change. Functionally, it's identical.
    2-Customize CKEditor schema—If you need exact HTML preservation, you can extend CKEditor's configuration to allow your div structure, but this requires custom plugin development and may cause editor display issues.
    3-Store separately—Keep formatting metadata in a separate field if you need exact HTML structure preservation.
    For most cases, option 1 is best—the normalized output is cleaner and more compatible. The text content remains unchanged.
  • Suggested answer
    11manish Profile Picture
    3,038 on at
    For Model-Driven Apps, treat the Rich Text Editor as a content editor, not as a mechanism for preserving exact HTML markup.
     
    Rich Text Field -> Editor Normalization -> Semantic HTML Output
    Microsoft does not guarantee that specific tags such as <div>, <p>, or editor wrapper elements will remain unchanged after save and reload.
     
    If your solution requires exact HTML preservation, use a custom PCF control or store the HTML in a plain text column instead of relying on the standard Rich Text
     
    control.
  • Valantis Profile Picture
    6,526 on at

    Hi @khedidja90,

    Just wanted to check in and see if everything is working now. If you still need any help, feel free to let me know.

    Also, if the issue is resolved, it would be great if you could mark the answer as solved so others with the same question can find it easily.

     

    Thanks and have a great day!

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 481

#2
WarrenBelz Profile Picture

WarrenBelz 379 Most Valuable Professional

#3
11manish Profile Picture

11manish 291

Last 30 days Overall leaderboard