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