首页 > 解决方案 > Ruby on Rails - 如何将 ckeditor 插件与 rails 6 集成

问题描述

所以,我正在使用带有 rails 6 的 ckeditor gem;

javascript/packs/application.js:

require("packs/ckeditor/config")

javascript/packs/ckeditor/config.js:

CKEDITOR.editorConfig = function( config )
{
  config.extraPlugins = 'eqneditor,imageresizerowandcolumn,balloontoolbar,balloonpanel';
  // Define changes to default configuration here. For example:
  // config.language = 'fr';
  // config.uiColor = '#AADC6E';
  config.resize_enabled = true;
  /* Filebrowser routes */
  // The location of an external file browser, that should be launched when "Browse Server" button is pressed.
  config.filebrowserBrowseUrl = "/ckeditor/attachment_files";

  // The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Flash dialog.
  config.filebrowserFlashBrowseUrl = "/ckeditor/attachment_files";

  // The location of a script that handles file uploads in the Flash dialog.
  config.filebrowserFlashUploadUrl = "/ckeditor/attachment_files";

  // The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Link tab of Image dialog.
  config.filebrowserImageBrowseLinkUrl = "/ckeditor/pictures";

  // The location of an external file browser, that should be launched when "Browse Server" button is pressed in the Image dialog.
  config.filebrowserImageBrowseUrl = "/ckeditor/pictures";

  // The location of a script that handles file uploads in the Image dialog.
  config.filebrowserImageUploadUrl = "/ckeditor/pictures?";

  // The location of a script that handles file uploads.
  config.filebrowserUploadUrl = "/ckeditor/attachment_files";

  config.allowedContent = true;
  config.filebrowserUploadMethod = 'form';

};

意见:

<%= javascript_include_tag Ckeditor.cdn_url%>
<%= cktext_area :notes, ckeditor: {toolbar: 'Full'}%>

编辑器正确加载,但我没有看到我在 ckeditor 的 config.js 中配置的任何插件

标签: javascriptruby-on-railsrubyckeditorruby-on-rails-6

解决方案


推荐阅读