简体   繁体   English

如何在Telerik的RadEditor上设置默认字体?

[英]How do I set the default font on Telerik's RadEditor?

There must be an easy way to set the default selected font of the Font Name dropdown list. 必须有一种简单的方法来设置字体名称下拉列表的默认选定字体。 I've been looking around on the Telerik site and forums but I can't find a simple way. 我一直在环视Telerik网站和论坛,但我找不到一个简单的方法。 Maybe there is no simple way, but maybe I just can't find it. 也许没有简单的方法,但也许我找不到它。

Here is my RadEditor: 这是我的RadEditor:

      <telerik:RadEditor ID="RadEditor1" runat="server" ContentFilters="MakeUrlsAbsolute,ConvertToXhtml,RemoveScripts"
                    EditModes="All" EnableResize="false" Font-Bold="false" Font-Names="Arial" Font-Size="8pt"
                    Height="230px" MaxHtmlLength="3000" MaxTextLength="3000" NewLineMode="Br" Skin="Web20">
                    <Tools>
                        <telerik:EditorToolGroup>
                            <telerik:EditorTool Name="ImageManager" />
                            <telerik:EditorSeparator />
                            <telerik:EditorTool Enabled="true" Name="FontName" />
                            <telerik:EditorTool Enabled="true" Name="FontSize" />
                            <telerik:EditorSeparator />
                            <telerik:EditorTool Enabled="true" Name="BackColor" />
                            <telerik:EditorTool Enabled="true" Name="ForeColor" />
                            <telerik:EditorTool Enabled="true" Name="Bold" />
                            <telerik:EditorTool Enabled="true" Name="Italic" />
                            <telerik:EditorTool Enabled="true" Name="Underline" />
                            <telerik:EditorSeparator />
                            <telerik:EditorTool Enabled="true" Name="Copy" />
                            <telerik:EditorTool Enabled="true" Name="Cut" />
                            <telerik:EditorTool Enabled="true" Name="Paste" />
                            <telerik:EditorTool Enabled="true" Name="AjaxSpellCheck" Text="Spell Check" />
                        </telerik:EditorToolGroup>
                    </Tools>
                    <ImageManager MaxUploadFileSize="1048576" SearchPatterns="*.jpg,*.jpeg,*.png,*.gif,*.bmp, *.ico"
                        UploadPaths="~/images/" ViewPaths="~/images/" />
                </telerik:RadEditor>

I hope one of you out there can tell me! 我希望你们中的一个人能告诉我! Thanks! 谢谢!

This article might be helpful http://www.telerik.com/help/aspnet-ajax/editor-default-font-for-editable-content.html 本文可能会有所帮助http://www.telerik.com/help/aspnet-ajax/editor-default-font-for-editable-content.html

You can also set the default FontName header dropdown value in the OnClientLoad event using this code: 您还可以使用以下代码在OnClientLoad事件中设置默认的FontName标头下拉值:

var tool = editor.getToolByName("FontName");
tool.set_value("Tahoma");

This worked: 这有效:

The editor: 编辑:

 <telerik:RadEditor ID="myEditor" OnClientLoad="RadEditorLoad" runat="server" ... >

Handler: 处理器:

        function RadEditorLoad(editor, eventArgs) {

            // Set the Editor Default Font to Arial

             editor.get_contentArea().style.fontFamily = 'Arial'
        }

Found this at: http://www.telerik.com/community/forums/aspnet-ajax/editor/radeditor-setting-font.aspx 发现于: http//www.telerik.com/community/forums/aspnet-ajax/editor/radeditor-setting-font.aspx

Create a css file 'RadEditorContentArea.css' with the following content: 使用以下内容创建一个css文件'RadEditorContentArea.css':

body 
{  
   font-family: Arial!important;
}

Add this css file as the editor css file as follows 将此css文件添加为编辑器css文件,如下所示

<telerik:RadEditor runat="server" ID="RadEditor1">
    <CssFiles>
        <telerik:EditorCssFile Value="~/RadEditorContentArea.css" />
    </CssFiles>
</telerik:RadEditor>

Check out this link for more: http://docs.telerik.com/devtools/aspnet-ajax/controls/editor/managing-content/content-area-appearance/default-font-for-editable-content 查看此链接了解更多信息: http//docs.telerik.com/devtools/aspnet-ajax/controls/editor/managing-content/content-area-appearance/default-font-for-editable-content

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何找出默认情况下Telerik的RADeditor使用哪种皮肤? - how do I find out which skin Telerik's RADeditor is using by default? 如何使用JavaScript设置Telerik RadEditor的StripFormattingOnPaste属性? - How do I set the StripFormattingOnPaste property of a Telerik RadEditor with JavaScript? 如何使用Telerik RadEditor控件? - How do I use the Telerik RadEditor control? 在Telerik RadEditor中添加字体 - Adding a font in Telerik RadEditor 如何在Telerik RAD控件RADEditor / WYSIWYG控件中更改文档管理器的最大上载文件大小? - How do I change the maximum Upload File Size for the Document Manager in a Telerik RAD Controls RADEditor/WYSIWYG control? 如何在Chrome的Telerik RadEditor中一次选择多个项目? - How can I select multiple items at once in Telerik RadEditor on Chrome? 如何更改Telerik RadEditor宽度 - How to change Telerik RadEditor width 使用Telerik的RadEditor遇到多个问题 - Multiple problems working with Telerik's RadEditor 当键入错误的单词时,如何使Telerik的RadEditor的拼写检查器自动启动? - How to get Telerik's RadEditor's Spell checker to start automatically when incorrect word is typed? 如何将Telerik RadGrid默认设置为编辑模式? (ASP.NET) - How do I set Telerik RadGrid to Edit mode by default? (ASP.NET)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM