I have a specific requirement to extend existing RteMacroRenderingValueConverter (or create a new convertor for RTE Datatype). I have created a tinymce-plugin similar to Umbraco Link plugin which allows user to add a Product link. (i.e, user can insert a product-link for product code=123 as <a href="{\ProductLink:ProductCode=123}">Product Page</a> )
Now I want to get it converted to actual link (i.e, http://my.domain.com/{current-culture}/Product/Details/123) while rendering the page.
The challenge I have is Umbraco does not allow more than one convertor per property.
So wondering if there is any way to achieve this functionality.
This approach generally works, but I encountered issues when there were macros in the rich text editors. To get around that, I replaced RteMacroRenderingValueConverter instead of TinyMceValueConverter. There are a couple caveats to be aware of.
RteMacroRenderingValueConverter is in the Umbraco.Web namespace and not Umbraco.Core like the others.
The modified version of the RteMacroRenderingValueConverter will need to return an IHtmlString instead of a string. I'm pretty sure the DefaultPropertyValueConverter attribute causes the TinyMceValueConverter to run against the data after the RteMacroRenderingValueConverter does its thing. Unfortunately, it's an internal attribute and so can't be incorporated into custom code.
Extending RTE property value converter
Hi,
I have a specific requirement to extend existing RteMacroRenderingValueConverter (or create a new convertor for RTE Datatype). I have created a tinymce-plugin similar to Umbraco Link plugin which allows user to add a Product link. (i.e, user can insert a product-link for product code=123 as
<a href="{\ProductLink:ProductCode=123}">Product Page</a>
) Now I want to get it converted to actual link (i.e, http://my.domain.com/{current-culture}/Product/Details/123) while rendering the page.The challenge I have is Umbraco does not allow more than one convertor per property.
So wondering if there is any way to achieve this functionality.
Many thanks in advance.
Regards,
Nirmit
Hi Nirmit,
I think you need to create your own value convertor for this.
To remove the default value convertor for the Rte you can use this code :
Now you can create your own implementation of the TinyMceValueConvertor.
A good starting point is the source of the default one :
https://github.com/umbraco/Umbraco-CMS/blob/dev-v7/src/Umbraco.Core/PropertyEditors/ValueConverters/TinyMceValueConverter.cs
Dave
Thanks dave for the suggestion. It solved my problem. :)
Comment author was deleted
+1, Had to use this today :)
This approach generally works, but I encountered issues when there were macros in the rich text editors. To get around that, I replaced RteMacroRenderingValueConverter instead of TinyMceValueConverter. There are a couple caveats to be aware of.
is working on a reply...