TinyMCE editor and Blocks

Vote:
 

Hi,

A general question really - the tinyMCE editor allows the drag and dropping of any block within the EpiServer UI, but sometimes I run into issues with certain blocks being rendered.  My question is "Is the EpiServer TinyMCE built for this purpose as it initially has no "insert block" button/function or should all blocks sit outside by default and custom buttons created for the insertion of blocks?

Thanks

Steve

#117313
Feb 17, 2015 17:38
Vote:
 

Hi Steve,

Yes, the TinyMCE editor supports rendering of blocks. It will call the partial renderer of the block to render it. What type of issues are you running in to?

/T

#117314
Feb 17, 2015 18:06
Vote:
 

Hi Toni,

Thanks for the swift response :)

That's great to hear. I was initially having issues with the internal links not resolving correctly (as described here: http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=116262&epslanguage=en), so I put in a workaround to fix that, but subsequently seems to have broken the block rendering.

Thanks

Steve

#117317
Feb 17, 2015 18:16
Vote:
 

What was the workaround? I looked at the other link and you are using something I haven't seen before to render the property:

<Web:BoundProperty ID="MainContentBoundProperty" runat="server" /> 


Why not use the default EPiServer:Property user control to render your properties?

/T

#117318
Feb 17, 2015 18:21
Vote:
 

Hi,

Happens with either property control, the workaround i used was

/// <summary>
/// To the HTML string fixed.
/// </summary>
/// <param name="instance">The instance.</param>
/// <returns></returns>
public static string ToHtmlStringFixed(this XhtmlString instance)
{
if (null == instance)
return null;
if (instance.IsEmpty)
return String.Empty;

StringBuilder stringBuilder = new StringBuilder();
foreach (IStringFragment stringFragment in instance.Fragments)
{
UrlFragment urlFragment = stringFragment as UrlFragment;

if (null != urlFragment)
{
Uri externalUrl;
if (TryGetExternalUrl(urlFragment.InternalFormat, out externalUrl))
{
stringBuilder.Append(externalUrl);
continue;
}
}
stringBuilder.Append(stringFragment.GetViewFormat());
}

return stringBuilder.ToString();
}

/// <summary>
/// Tries the get external URL.
/// </summary>
/// <param name="internalFormat">The internal format.</param>
/// <param name="externalUrl">The external URL.</param>
/// <returns></returns>
private static bool TryGetExternalUrl(string internalFormat, out Uri externalUrl)
{
try
{
//The call to GetExternal URL here is a wrapper around a call to EPiServer.Global.UrlRewriteProvider.ConvertToExternal.
var builder = new UrlBuilder(internalFormat);
Global.UrlRewriteProvider.ConvertToExternal(builder, null, Encoding.ASCII);
externalUrl = builder.Uri;
}
catch (Exception)
{
externalUrl = null;
}
return null != externalUrl;
}

#117319
Feb 17, 2015 18:34
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.