我在将插件代码片段添加到我的 ckeditor 时遇到问题。
- 我将 gem 'ckeditor' 添加到 gemfile
- 接下来将此添加到 application.js//= require ckeditor/init
- <%= f.input :body, :as => :ckeditor, :input_html => { :ckeditor => {:toolbar => 'Full'} } %> 到我的 View 表单
然后我就可以使用ckeditor了。例如,我可以创建 div 容器填充它并返回到 ckeditor。
当我想将 codesippet 添加到 ckeditor 时,我的问题出现了。
为了使用这个插件,我首先创建了 app/assets/javascripts/ckeditor/config.js 文件并填充了这个:
CKEDITOR.editorConfig = function( config ) { config.language = 'fr'; config.uiColor = '#AADC6E';};
我从 ckeditor 站点下载具有所有依赖项的插件,并将此文件添加到 ckeditor/plugins 中,当然添加 config.extraPlugins = 'codesnippet' + 其他插件。
有了这个,我看到了代码片段的图标,我可以使用它,但是当我想关闭这个窗口并继续时,我看到了我的 ckeditor,但我无法点击任何东西,我的所有网站上都有一点白色透明涂层 - 一些东西像这样。
在 ckeditor 中出现的每个窗口都会发生这种情况。下面我写了我尝试做的事情来解决这个问题: 1. 我尝试添加我的基本路径,就像在 https://github.com/galetahub/ckeditor 上的文档中一样
- 我尝试了这个解决方案:
in assets/javascripts/application.js //= require ckeditor_fix #- add this line //= require ckeditor/init //= require_tree . in assets/javascripts create new file ckeditor_fix.js var CKEDITOR_BASEPATH = '/assets/ckeditor/';
至少我尝试了 turbolinks 的转弯,但这仍然不起作用。 当我从我的 app/assets/javascripts 中删除 ckeditor 文件夹时,我的 ckedtior 工作得很好。
最佳答案
试试这个
<%= f.cktext_area :body, :ckeditor => {:toolbar => 'Full'} %>
关于javascript - 带有 CKEditor 的 Rails 4 - 插件(codesnipet)不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25906536/