自定义CKEditor

发布于 2024-11-07 12:33:21 字数 1167 浏览 0 评论 0原文

我已经将 ckeditor 安装到我的 asp.mvc 项目中,现在我需要实现一些已实现的选项。我如何定义配置文件或者其中有什么问题?

<link href="../../ckeditor/contents.css" rel="stylesheet" type="text/css"></link>
<script src="../../ckeditor/ckeditor.js" type="text/javascript"></script>
<script src="../../../../ckeditor/config.js" type="text/javascript"></script>

<textarea class="ckeditor" cols="20" id="Article_Text" name="Article.Text" rows="2">

</textarea>

然而,这仍然以默认设置呈现。

和我的 ckeditor config.js

CKEditor1.editorConfig = function( config )
{
    // Define changes to default configuration here. For example:
    config.language = 'cz';
    config.uiColor = '#FFF';
};
CKEditor1.config.toolbar = new object[]
{
    new object[] { "Source" },
    new object[] { "Bold", "Italic", "Underline", "Strike", "-", "Subscript", "Superscript" },
    new object[] { "NumberedList", "BulletedList", "-", "Outdent", "Indent" },
    "/",
    new object[] { "Styles", "Format", "Font", "FontSize", "TextColor", "BGColor", "-", "About" },
};

CKEditor_preview

i have installed ckeditor into my asp.mvc project, now i need to implement just some of the options that are implemented. How do i define the config file or what i have wrong in it?

<link href="../../ckeditor/contents.css" rel="stylesheet" type="text/css"></link>
<script src="../../ckeditor/ckeditor.js" type="text/javascript"></script>
<script src="../../../../ckeditor/config.js" type="text/javascript"></script>

<textarea class="ckeditor" cols="20" id="Article_Text" name="Article.Text" rows="2">

</textarea>

how ever this still render with default settings.

and my ckeditor config.js

CKEditor1.editorConfig = function( config )
{
    // Define changes to default configuration here. For example:
    config.language = 'cz';
    config.uiColor = '#FFF';
};
CKEditor1.config.toolbar = new object[]
{
    new object[] { "Source" },
    new object[] { "Bold", "Italic", "Underline", "Strike", "-", "Subscript", "Superscript" },
    new object[] { "NumberedList", "BulletedList", "-", "Outdent", "Indent" },
    "/",
    new object[] { "Styles", "Format", "Font", "FontSize", "TextColor", "BGColor", "-", "About" },
};

CKEditor_preview

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

遇到 2024-11-14 12:33:21

我已经找到了基本的解决方案

 <script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>  
  <script src="../../ckeditor/ckeditor.js" type="text/javascript"></script>
  <script src="../../ckeditor/adapters/jquery.js" type="text/javascript"></script>
  <script src="../../ckeditor/config.js" type="text/javascript"></script>

  <script type="text/javascript">
      $(function() {
      var config =
            {
              height: 180,
              width: 515,
              linkShowAdvancedTab: false,
              scayt_autoStartup: true,
              enterMode: Number(2),
              toolbar_Full: [['Styles', 'Bold', 'Italic', 'Underline', 'SpellChecker', 'Scayt', '-', 'NumberedList', 'BulletedList'],
                                ['Link', 'Unlink'], ['Undo', 'Redo', '-', 'SelectAll']]

            };
            $('#editor').ckeditor(config);
      });
    </script>
    <textarea name="myTextArea" id="editor">
        To learn more about ASP.NET MVC visit <a href="http://asp.net/mvc" title="ASP.NET MVC Website">http://asp.net/mvc</a>.
    </textarea>

i have found the basic solution

 <script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>  
  <script src="../../ckeditor/ckeditor.js" type="text/javascript"></script>
  <script src="../../ckeditor/adapters/jquery.js" type="text/javascript"></script>
  <script src="../../ckeditor/config.js" type="text/javascript"></script>

  <script type="text/javascript">
      $(function() {
      var config =
            {
              height: 180,
              width: 515,
              linkShowAdvancedTab: false,
              scayt_autoStartup: true,
              enterMode: Number(2),
              toolbar_Full: [['Styles', 'Bold', 'Italic', 'Underline', 'SpellChecker', 'Scayt', '-', 'NumberedList', 'BulletedList'],
                                ['Link', 'Unlink'], ['Undo', 'Redo', '-', 'SelectAll']]

            };
            $('#editor').ckeditor(config);
      });
    </script>
    <textarea name="myTextArea" id="editor">
        To learn more about ASP.NET MVC visit <a href="http://asp.net/mvc" title="ASP.NET MVC Website">http://asp.net/mvc</a>.
    </textarea>
作死小能手 2024-11-14 12:33:21

你好,应该是

CKEDITOR.editorConfig

而不是 CKEditor1.editorConfig。我认为那时它会起作用。

这是 ckeditor 配置的完整文档。

HI, it should be

CKEDITOR.editorConfig

instead of CKEditor1.editorConfig. I think it will work then.

here is the full documentation for ckeditor cofiguration.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文