We have a multi site solution where we would like to establish different RTE profiles for different sites. In these profiles we'd like to be able to set a site specific Images folder in the media library. We'd also like to set a site specific root folder for the Insert Link button.
Is this possible "out of the box"? If so, how?
ADDING A BUTTON TO THE RICH TEXT EDITOR SITECORE First create a button under/sitecore/system/Settings/Html Editor Profiles/Rich Text IDE/ Toolbar/Instagram or YouTube. Now go back to your Sitecore Button item and in the click field replace with YouTube. This will add a button in the Rich Text Editor.
In the Content Type Builder page, add the Rich Text Editor (RTE) field to it. In the Edit Properties section of the RTE field, under Editor Version, select Latest. Under the Editor Type, select Custom, and choose the formatting options you want to include in the RTE field.
This is not possible out of the box using a single template. If each site has their own set of templates then you can obviously set the source to the different RTE profiles for each site, but this still not solve the issue of restricting the to specific folders for media library or internal links.
You can override the default controls in /sitecore/shell/Controls/Rich Text Editor/InsertLink/InsertLink.xml
and /sitecore/shell/Controls/Rich Text Editor/InsertImage/InsertImage.xml
.
Within these you can manipulate the GUID
passed to the DataContext.
<CodeBeside Type="Sitecore.Shell.Controls.RichTextEditor.InsertLink.InsertLinkForm,Sitecore.Client"/>
<DataContext ID="InternalLinkDataContext" Root="{GUID}"/>
<DataContext ID="MediaDataContext" Root="{GUID}"/>
The current item is passed as a querystring parameter fo
which you can access from the code behind and use your own logic to set the correct root by overriding the InsertLinkForm
class. Unfortunately the current item is not passed to the InsertImage.xml control so need to pass through the context item id.
If you take a look at the JS for the InsertImage command located in /sitecore/shell/controls/Rich Text Editor/RichText Command.js
then this is the location that the link is generated. You can modify RadEditorCommandList["InsertSitecoreMedia"]
function to pass through the id in a similar way to InsertSitecoreLink
. The caveat here is I am using a slightly older version of Sitecore 7.2 in which there may have been an issue with Links/Media not remembering the user selection and opening in the same location. You may want to verify the id passed, if so you can use your own parameter.
Place the modified files in /sitecore/shell/Override
and Sitecore will use these instead.
This still doesn't help with custom RTE profiles per site and passing through the values but hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With