Transfer RichText to Lightbox

Dear All,

I have a page with

  • a dataset ‘DatasetItems’
  • a repeater connected to the ‘DatasetItems’
  • a Lightbox ‘Customer’

I typed the following code to transfer to the lightbox the items from the collection. For the FirstName and LastName is OK because the collection fields are Text Format but I have an issue with the Comment text who is a RichText format.

//PAGE CODE
import wixWindow from ‘wix-window’;

export function Container_click(event) {
let currentItemFirstName = $w(‘#DatasetItems’).getCurrentItem();
let currentItemLastName = $w(‘#DatasetItems’).getCurrentItem();
let currentItemComment = $w(‘#DatasetItems’).getCurrentItem();
wixWindow.openLightbox(“Customer”, {
“pageSend1”: (currentItemFirstName.firstName),
“pageSend2”: (currentItemLastName.lastName),
“pageSend3”: (currentItemComment.comment) THIS IS A RICH TEXT
})
}

// LIGHTBOX CODE
import wixWindow from ‘wix-window’;

$w.onReady( function () {
let received = wixWindow.lightbox.getContext();
$w(‘#FirstName’).text = received.pageSend1;
$w(‘#LastName’).text = received.pageSend2;
$w(‘#Comment’).text = received.pageSend3; THIS IS A RICH TEXT
} );

What to do to avoid to have in my lightbox text item →

Comment

Thank you for your help
Best regards,
Domivax

Thank you Heath H-M
It works. Only change .text to .html

If you have setup your dataset to have a rich text field and formatted the text as you need it to be shown in your dataset rich text field, then it should be html as Heath says.
https://support.wix.com/en/article/corvid-about-formatting-text-elements
https://www.wix.com/corvid/reference/$w.Text.html

Have a read here.
https://support.wix.com/en/article/connecting-text-elements#rich-text-fields-1
https://support.wix.com/en/article/formatting-rich-text-elements-in-the-dashboards-data-manager