fckeditor 插件使用和 rails2.3 不兼容的解决办法 : fckeditor 插件使用和 rails2.3 不兼容的解决办法 下载包解压放到当前项目主目录下 vendor\plugins\fckeditor 目录中 rake fckeditor:intall 在项目目录中出现 public\javascripts\fckeditor 里面是产生的 JS 文件。 在更新了 Rails2.3 后发现和 fckeditor 出现了兼容性问题。 undefined method `relative_url_root' for # 搜了一下找到解决办法如下。主要是路径 PATH 问题 先到 目录 vendor\plugins\fckeditor 找到文件 app/controllers/fckeditor_controller.rb look for uploaded = request.relative_url_root.to_s+"#{UPLOADED}/#{params[:Type]}" replace it with this = ActionController::Base.relative_url_root.to_s+"#{UPLOADED}/#{params[:Type]}" 同样在文件 lib/fckeditor.rb replace js_path = "#{request.relative_url_root}/javascripts" with js_path = "#{ActionController::Base.relative_url_root}/javascripts"
uploaded
ror(rails)中使用 tinymce 过程详解及问题解答 中使用 关键字: 关键字 tinymce ror rails 前几天在 ror 中
学习使用 tinymce,从安装到使用,过程中还有一些问题,查了网上的一些 资料,自己也琢磨了一些,现在整理一下,做个总结。 1、下载 plugin。 github/kete/tiny_mce/tree/master 2、安装 1. 将下载的东东解压后,拷贝到 rails 工程的 vendor/plugins 文件夹下,注意,tinymce 插件的文件夹名应起为:tiny_mce 2. 执行 rake tiny_mce:install? 安装 tinymce 的静态文件到相应的文件夹下。如果使用 的 netbeans,可以右键点击工程名,找到 Run/Debug Rake Task 菜单,其中会找到 doc:plugins:tiny_mce 的任务项,选中执行就可以了。 经过以上两步,tiny_mce 就安装完毕了。 3、使用 1. 在布局模板的头部增加<%#= include_tiny_mce_if_needed %>, 这样, 可以使 tiny_mce 插件自己决定是否引入相应的 js 脚本。 2. 在视图模板的表单中, 直接在 text area 标签中加上 class 为 mceEditor, 即可实现 html 编辑器效果。如:<%= f.text_area :body, :class => "mceEditor" %>
4、配置 tinymce 是一个强大的 html 编辑器, 提供了非常丰富的选项配置参数。 当使用 tinymce 的 ror 插件时,可以通过在 controller 中设置这些参数。如: Ruby 代码 1. uses_tiny_mce( :options => { 2. :theme => 'advanced', # 皮肤 3. :language => 'zh', # 中文界面 4. :convert_urls => false, # 不转换路径, 否则在插入图片或头像时, 会转成相对路径, 容易导致路径错乱。 5. :theme_advanced_toolbar_location => "top", # 工具条在上面 6. :theme_advanced_toolbar_align => "left", 7. :theme_advanced_resizing => true, # 似乎不好使 8. :theme_advanced_resize_horizontal => false, 9. :paste_auto_cleanup_on_paste => true, 10. # 工具条上的按钮布局 11. :theme_advanced_buttons1 => %w{formatselect fontselect fontsizeselect forecolor ba ckcolor bold italic underline strikethrou
gh sub sup removeformat}, 12. :theme_advanced_buttons2 => %w{undo redo cut copy paste separator justifyleft justi fycenter justifyright separator indent outdent separator bullist numlist separator link unli nk image media emotions separator table separator fullscreen}, 13. :theme_advanced_buttons3 => [], 14. # 字体列表中显示的字体 15. :theme_advanced_fonts => %w{宋体=宋体;黑体=黑体;仿宋=仿宋;楷体=楷体;隶书= 隶 书 ; 幼 圆 = 幼 圆;Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial blac k,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-s erif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Imp ac