0

我在我的rails 3.1应用程序中有ckeditor,但我无法将字体大小和字体下拉列表添加到我的工具栏中。Rails 3.1 ckeditor:在工具栏中添加字体大小?

我的编辑视图代码:

<%= javascript_include_tag "ckeditor/ckeditor.js" %> 
... 
<%= form_for @page, :html => { :class => 'edit_page', :id => "page_form" } do |page| %> 
... 
<%= page.cktext_area :content, {:height => "350px", :width => "920px"}%> 
... 
<% end %> 

我能调整高度和宽度,但不添加任何其他参数?

回答

2

可能会迟到,但rails 3.1应用程序,你可以去/vendor/bundle/ruby/1.8/gems/ckeditor-3.7.0/vendor/assets/javascripts/ckeditor/config.js这就是对工具栏的配置发生。

这里是我的配置

.. 
    ... 
    /* Toolbars */ 
     config.toolbar = 'Easy'; 

     config.toolbar_Easy = 
     [ 
      ['Source','-','Preview'], 
      ['Cut','Copy','Paste','PasteText','PasteFromWord',], 
      ['Undo','Redo','-','SelectAll','RemoveFormat'], 
      ['Styles','Format','FontSize'],['Maximize','-','About'], 
      ['Subscript', 'Superscript', 'TextColor'], 
      ['Bold','Italic','Underline','Strike'], ['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'], 
      ['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'], 
      ['Link','Unlink','Anchor'], 
      /* ['Image', 'Attachment', 'Flash', 'Embed'], */ 
      ['Table','HorizontalRule','Smiley','SpecialChar','PageBreak'] 
     ]; 
    ... 
    .. 

的个例并没有这个配置看起来如何在形式

ckeditor modified toolbar

1

我从来没有使用过这个宝石或ckeditor,但看着他们的文档,它看起来很直截了当。

看上去好像你刚修改公共/ Java脚本/ CKEditor的/ config.js

config.fontSize_sizes = '16/16px;24/24px;48/48px;'; 

参考。

https://github.com/galetahub/ckeditor

http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.fontSize_sizes

+1

遐我试过了,但我认为正在使用的文件不是一个我改变。它正在缩小资产/ ckeditor/ckeditor.js,我无法在我的代码库指令中找到它。对此有何帮助?它可能在哪里?我在我的代码目录中搜索了assests文件夹.. – n00b 2012-02-24 04:37:37

0

rmagnum2002的图像,是否可以更改宽度和工具栏按钮的高度。例如:改变大小下拉框的宽度。

我已经添加了一些插件,但不知道如何更改插件的宽度?

1

您可以安装这个插件http://ckeditor.com/addon/font

提取和“字体”文件夹复制到ckeditor/plugins目录,然后你的代码调用插件里面。

CKEDITOR.replace(this.id, { 
    extraPlugins: 'font', 
}); 

现在你的工具栏将显示与字体系列和大小选项如下

font-family and fontsize in ckeditor