Skip to content

Latest commit

 

History

History
115 lines (81 loc) · 3.25 KB

README.md

File metadata and controls

115 lines (81 loc) · 3.25 KB

Solidus Editor

CircleCI

This extension provides an inline rich-text editor for Solidus. It is based off spree_editor. It implements different types of editors:

Please not that this extension is just a simple integration of some pretty complex gems: ckeditor and tinymce-rails.

If you have issues, please check their issues trackers first.


Installation

  1. Add the Solidus Editor gem to your Gemfile:
gem 'solidus_editor', github: 'solidusio-contrib/solidus_editor', branch: 'master'
  1. Run:
$ bundle install
$ rails g solidus_editor:install
  1. If using CKEditor, and would like to enable file uploads run the ckeditor generator:
$ rails g ckeditor:install --orm=active_record --backend=paperclip && rake db:migrate
  1. In order to secure your file uploads to only be accessed by admins you will also need to configure config/initializers/ckeditor.rb:
config.authorize_with :cancan, Spree::Ability
  1. In order to precompile CKEditor's generated assets, you will need to add a line in config/initializers/assets.rb:
Rails.application.config.assets.precompile += %w( ckeditor/*)

Configuration

solidus_editor should be configured inside an initializer

# Required if using solidus_frontend
Spree::Config[:show_raw_product_description] = true

SpreeEditor::Config.tap do |config|
  config.ids = 'product_description page_body event_body'

  # change the editor to CKEditor
  config.current_editor = 'CKEditor'
end

Solidus itself should be configured to show

The default values are:

config.enabled = true,
config.current_editor = 'TinyMCE',
config.ids = 'product_description page_body'

Language-Support

To obtain support for multiple languages with TinyMCE add tinymce-rails-langs to your Gemfile:

gem 'tinymce-rails-langs'

TinyMCE will not be loaded unless it finds a language package matching your Spree::Config.default_locale.


Testing

First bundle your dependencies, then run rake. rake will default to building the dummy app if it does not exist, then it will run specs, and Rubocop static code analysis.

bundle
bundle exec rake

When testing your application's integration with this extension you may use its factories. Simply add this require statement to your spec_helper:

require 'solidus_editor/factories'

Copyright (c) 2016 James Whelton and other contributors, released under the New BSD License