[SOLVED] Create rich text block (tiptap) programma...
# help-with-umbraco
g
Has anyone succeed in creating a block that is allowed on the tiptap text editor, programmatically?
l
How far did you come? What are the issues you are facing?
g
not far at all, right now im trying the approach for creating RichTextBlockValue, and then try to serialized it and use node.setValue("richText", "serializedValue"). Not sure if this is the right way.
specially hard if the block is between text.
l
Maybe you can tell us a little what the reasoning is. What do you want to achieve and why, that makes it easier to come up with a solution.
g
well im trying to migrated some data from Contentful to Umbraco v15. In Contentful the richTextEditor contains blocks where I will like to recreate the same data in Umbraco. So all markup is copied but not sure how I can create block in the richText TipTap. I just tried to create a new RichTextEditorValue and use the node.SetValue, but it didn't work.
I created a RichTextEditorValue that has two properties, Markup and Block, in Block a create a new BlockPropertyValue for each block propery than save that list (List) into RichTextEditorValue.Block. Than I serialized the content but the problem I had was that it was serialized in PascalCase instead of CamelCase. Then i save the serialized content to the IContent tiptap editor alias -> content.SetValue("tiptapeditor", serializedContent"). Let me know if you any question about my approach.
j
It would be really nice if Umbraco exposed all of the methods for reading and writing block values. In my opinion there should just be a method for this.
g
one more thing, make sure that in markup is not surrounded by paragraphs tag
41 Views