Hello Amanda, I have been scouring the forums looking for a solution to importing content into a “Rich Text” or “Rich Content” field in my collections.
I have content created by our site users that I need to programically convert to an object for insert/update to our custom collections using the backend wixData.update() / wixData.insert() API calls.
I am able to convert to any Google supported doc exports like HTML/RTF, but wixData() treats the data as a string and so in Content Manager, it looks like this instead of the expected WYSIWYG editor UI.
{\rtf1\ansi\deff0{\fonttbl {\f0\fnil\fcharset0 Calibri;}{\f1\fnil\fcharset2 Symbol;}}{\colortbl ;\red0\green0\blue0;}{\pard\cf1undefined{ THIS }{ IS A RTF EXPORT }{\cf1undefined TEST }\sb70\par}}
But when I create the same content from Content Manager and view it in Node, the object looks like the following.
nodes: [
{
type: 'PARAGRAPH',
id: 'foo',
nodes: [
{
type: 'TEXT',
id: '',
nodes: [],
textData: { text: 'THIS ', decorations: [] }
},
{
type: 'TEXT',
id: '',
nodes: [],
textData: {
text: 'IS A',
decorations: [
{ type: 'BOLD', fontWeightValue: 700 },
{ type: 'UNDERLINE', underlineData: true }
]
}
},
{
type: 'TEXT',
id: '',
nodes: [],
textData: { text: ' TEST', decorations: [] }
}
],
paragraphData: { textStyle: { textAlignment: 'AUTO' }, indentation: 0 }
}
]
So I’m obviously using the wrong tools / methods to generate a “Rich Text” / “Rich Content” object that WIX recognizes.
Can you help with some guidance, or are there WIX NPM modules that allow me to generate / convert to the correct object model from another file / data format?
Much appreciated any help / direction you can offer.