Can I set the root folder for the insert image button in the advanced text editor profile?

We have a solution for several sites where we would like to install different RTE profiles for different sites. In these profiles, we would like to be able to set the Images folder in the library. We would also like to set the root folder for a specific site for the "Insert Link" button.

Is this possible out of the box? If so, how?

+5
source share
1 answer

This is not possible out of the box using one template. If each site has its own set of templates, then you can obviously set the source for different RTE profiles for each site, but this still does not solve the problem of restricting certain folders for the 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 .

Inside them, 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 element is passed as the querystring fo parameter, 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 element is not passed to the InsertImage.xml control, so you need to go through the context element identifier.

If you look at JS for the InsertImage command located in /sitecore/shell/controls/Rich Text Editor/RichText Command.js , then this is the location where the link is created. You can change the RadEditorCommandList["InsertSitecoreMedia"] function to go through the identifier in the same way as InsertSitecoreLink . The caveat here is that I'm using a slightly older version of Sitecore 7.2, which might have had a problem with Links / Media that doesn't remember the user's choice and opening in the same place. You can check the passed id if you can use your own parameter.

Put the modified files in /sitecore/shell/Override and Sitecore will use them instead.

This still does not help to configure RTE profiles on the site and skip values, but hope this helps.

+4
source

Source: https://habr.com/ru/post/1200739/


All Articles