Sitecore 7.0中的自定义RTE下拉列表

Vai*_*hav 2 sitecore rad-controls telerik

我的客户希望在RTE(sitecore版本7.0)中有一个类似于符号下拉列表的下拉列表.客户想要不同符号类型的不同下拉列表,例如,具有希腊符号大写字母的下拉列表,具有希腊符号小写字母的下拉列表,具有数学符号的下拉列表以及具有其他/其他类型符号的下拉列表.

我试图了解RadControls如何工作以及如何在Telerik RadControl上添加它,但我无法将该概念映射到sitecore的富文本编辑器.此外,我试图了解RTE中存在的符号下拉如何工作,但由于其代码嵌入在Sitecore.Client dll中,我无法理解它.

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

谢谢,Vaibhav.

jam*_*kam 5

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

切换到core数据库并在您正在使用的RTE配置文件的工具栏中添加一个新按钮(例如/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.在"Click"字段中输入名称,例如InsertCustomSymbols

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

Sitecore RTE配置文件

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

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

创建补丁配置以添加JS文件:

<clientscripts>
   <htmleditor>
     <script src="/location/to/custom.js" language="javascript" key="customJs" />
   </htmleditor>
</clientscripts>
Run Code Online (Sandbox Code Playgroud)

如果您使用下拉按钮然后还添加了css样式来设置图标,它也应该与"Click"字段的名称相同.

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

RTE自定义列表

我没有风格,但你明白了.根据需要添加,确保设置正确的RTE配置文件.

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