Sitecore 7.0中的自定义RTE下拉列表 [英] Custom RTE Dropdown in Sitecore 7.0

查看:102
本文介绍了Sitecore 7.0中的自定义RTE下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的客户希望具有一个类似于RTE(sitecore版本7.0)中的Symbols Dropdown的下拉列表.客户希望针对不同的符号类型使用不同的下拉菜单,例如,具有大写希腊符号的下拉菜单,具有小写希腊符号的下拉菜单,具有数学符号的下拉菜单以及具有其他/杂类符号的下拉菜单.

My client desires to have a dropdown similar to Symbols Dropdown in the RTE (sitecore version 7.0). The client wants different dropdowns for different symbol types, for example, a dropdown having Greek Symbols Upper case, a dropdown having Greek Symbols Lower case, a dropdown having Mathematical Symbols and a dropdown having Other/Misc types of symbols.

我试图了解RadControls的工作原理以及如何在Telerik RadControl上添加它,但是我无法将其映射到sitecore的RTF编辑器中.此外,我试图了解RTE中现有的Symbols Dropdown的工作原理,但是由于其代码嵌入在Sitecore.Client dll中,因此我对此不太了解.

I have tried to understand how RadControls work and how to add this on Telerik RadControl but I am unable to map the concept to sitecore's rich text editor. Additionally, I have tried to understand how existent Symbols Dropdown in RTE works but since its code is embedded in Sitecore.Client dll I cant understand much from it.

有人可以详细说明实现这一目标的步骤吗?

Can some one please detail the steps to achieve this?

谢谢, Vaibhav.

Thanks, Vaibhav.

推荐答案

您可以将自己的自定义放置列表或放置按钮添加到RTE.

You can add your own custom drop list or drop button to the RTE.

切换到core数据库并在您正在使用的RTE配置文件的工具栏中添加一个新按钮(例如/sitecore/system/Settings/Html Editor Profiles/Rich Text Full/Toolbar 1)

Switch to the core database and add a new button in the toolbar of the RTE profile you are using (e.g. /sitecore/system/Settings/Html Editor Profiles/Rich Text Full/Toolbar 1)

确保按钮模板的类型为Html Editor Custom Drop DownHtml Editor Custom Drop Down Button,这些模板可以在/sitecore/templates/System/Html Editor Profiles中找到.在[点击]栏位中输入名称,例如InsertCustomSymbols

Make sure the template of the button is of type Html Editor Custom Drop Down or Html Editor Custom Drop Down Button, these can be found in /sitecore/templates/System/Html Editor Profiles. Give a name in the 'Click' field, e.g. InsertCustomSymbols

在按钮上添加子项,以使用Html Editor List Item模板创建所需的符号"或文本. 标题"值是将显示在下拉列表中的值,值"是将被插入的值(例如,希腊符号).

Add child items to your button to create the "symbols" or text you need using Html Editor List Item template. The 'Header' value is what will be displayed in the dropdown list and 'Value' is what will get inserted (e.g. your greek symbols).

您现在需要处理按钮的click事件,并使用以下JS创建文件:

You now need to handle the click event of the button, create a file with the following JS:

RadEditorCommandList["InsertCustomSymbols"] = function(commandName, editor, args) {
  var val = args.get_value();
  editor.pasteHtml(val);
  args.set_cancel(true);
}

如果您使用了下拉"按钮,然后还添加了CSS样式来设置图标,则该图标也应与点击"字段相同.

If you used the Drop Down Button then also add a css style to set the icon, it should also be the same name as the 'Click' field.

<style type="text/css">                        
  span.InsertCustomSymbols
  {
    background-image:url('/path/to/icon.gif');                                                                
  }
</style>

我没有设置样式,但您明白了.根据需要添加任意数量,请确保设置正确的RTE配置文件.

I didn't style it but you get the idea. Add as many as you need, make sure you set the correct RTE profile.

您可以在此 Telerik Custom中找到更多信息.下拉演示

这篇关于Sitecore 7.0中的自定义RTE下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆