trix 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop_todo.yml +38 -3
- data/.travis.yml +8 -4
- data/Appraisals +9 -8
- data/README.md +1 -2
- data/Rakefile +1 -1
- data/gemfiles/{rails_4.0.gemfile → rails_5.0.gemfile} +1 -1
- data/gemfiles/{rails_4.1.gemfile → rails_5.1.gemfile} +1 -1
- data/gemfiles/rails_master.gemfile +1 -0
- data/lib/formtastic/inputs/trix_editor_input.rb +3 -1
- data/lib/trix/engine.rb +8 -0
- data/lib/trix/form.rb +6 -6
- data/lib/trix/simple_form/trix_editor_input.rb +12 -0
- data/lib/trix/version.rb +1 -1
- data/trix.gemspec +4 -2
- data/vendor/assets/javascripts/trix.js +10 -9
- data/vendor/assets/stylesheets/trix.css +196 -196
- metadata +34 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2ece98d65e59234a3f9d0ec7d73935f8d4d0b4f2
|
|
4
|
+
data.tar.gz: bc96359cfe7b562cc7c128b79b92f47206f7985a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a321171c18443d9a262495a5fdedc3eb16292cbd1a56ff9a939c3f7a6ed21f8bf861e911ea968362878913b010644f83a62ee75251538b1409e828b03f2e0452
|
|
7
|
+
data.tar.gz: eab4fbb25c47d9dacc9ba464df93a34a31f2383c3dd4a073dafe178d5cc0efe2d0d94292946c3961923d49fff8a0d73fcb715a943fd0bfa885f9e5b4e09836b0
|
data/.gitignore
CHANGED
data/.rubocop_todo.yml
CHANGED
|
@@ -1,6 +1,41 @@
|
|
|
1
|
+
# This configuration was generated by
|
|
2
|
+
# `rubocop --auto-gen-config`
|
|
3
|
+
# on 2017-07-16 12:30:37 -0300 using RuboCop version 0.35.1.
|
|
4
|
+
# The point is for the user to remove these configuration records
|
|
5
|
+
# one by one as the offenses are removed from the code base.
|
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
|
8
|
+
|
|
9
|
+
# Offense count: 1
|
|
1
10
|
Metrics/AbcSize:
|
|
2
|
-
|
|
11
|
+
Max: 22
|
|
12
|
+
|
|
13
|
+
# Offense count: 10
|
|
14
|
+
# Configuration parameters: AllowURI, URISchemes.
|
|
3
15
|
Metrics/LineLength:
|
|
4
|
-
Max:
|
|
16
|
+
Max: 104
|
|
17
|
+
|
|
18
|
+
# Offense count: 1
|
|
19
|
+
# Configuration parameters: CountComments.
|
|
20
|
+
Metrics/MethodLength:
|
|
21
|
+
Max: 11
|
|
22
|
+
|
|
23
|
+
# Offense count: 10
|
|
24
|
+
# Configuration parameters: Exclude.
|
|
5
25
|
Style/Documentation:
|
|
6
|
-
|
|
26
|
+
Exclude:
|
|
27
|
+
- 'spec/**/*'
|
|
28
|
+
- 'test/**/*'
|
|
29
|
+
- 'lib/formtastic/inputs/trix_editor_input.rb'
|
|
30
|
+
- 'lib/trix.rb'
|
|
31
|
+
- 'lib/trix/engine.rb'
|
|
32
|
+
- 'lib/trix/form.rb'
|
|
33
|
+
- 'lib/trix/simple_form/trix_editor_input.rb'
|
|
34
|
+
- 'lib/trix/version.rb'
|
|
35
|
+
|
|
36
|
+
# Offense count: 1
|
|
37
|
+
# Cop supports --auto-correct.
|
|
38
|
+
# Configuration parameters: PreferredDelimiters.
|
|
39
|
+
Style/PercentLiteralDelimiters:
|
|
40
|
+
Exclude:
|
|
41
|
+
- 'spec/trix_editor_helper_spec.rb'
|
data/.travis.yml
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
language: ruby
|
|
2
2
|
rvm:
|
|
3
|
-
- 2.2.
|
|
4
|
-
- 2.3.
|
|
3
|
+
- 2.2.7
|
|
4
|
+
- 2.3.4
|
|
5
|
+
- 2.4.1
|
|
5
6
|
gemfile:
|
|
6
|
-
- gemfiles/rails_4.0.gemfile
|
|
7
|
-
- gemfiles/rails_4.1.gemfile
|
|
8
7
|
- gemfiles/rails_4.2.gemfile
|
|
8
|
+
- gemfiles/rails_5.0.gemfile
|
|
9
|
+
- gemfiles/rails_5.1.gemfile
|
|
9
10
|
- gemfiles/rails_master.gemfile
|
|
11
|
+
matrix:
|
|
12
|
+
allow_failures:
|
|
13
|
+
- gemfile: 'gemfiles/rails_master.gemfile'
|
|
10
14
|
before_install: gem install bundler -v 1.11.2
|
data/Appraisals
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
appraise "rails-4.
|
|
2
|
-
gem "rails", "~> 4.
|
|
1
|
+
appraise "rails-4.2" do
|
|
2
|
+
gem "rails", "~> 4.2.0"
|
|
3
3
|
end
|
|
4
4
|
|
|
5
|
-
appraise "rails-
|
|
6
|
-
gem "rails", "~>
|
|
5
|
+
appraise "rails-5.0" do
|
|
6
|
+
gem "rails", "~> 5.0.0"
|
|
7
7
|
end
|
|
8
8
|
|
|
9
|
-
appraise "rails-
|
|
10
|
-
gem "rails", "~>
|
|
9
|
+
appraise "rails-5.1" do
|
|
10
|
+
gem "rails", "~> 5.1.0"
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
appraise "rails-master" do
|
|
14
14
|
gem "rails", git: "https://github.com/rails/rails.git", branch: "master"
|
|
15
|
+
gem "arel", git: "https://github.com/rails/arel.git", branch: "master"
|
|
15
16
|
%w[rspec-core rspec-expectations rspec-mocks rspec-rails rspec-support].each do |lib|
|
|
16
|
-
gem lib, git:
|
|
17
|
+
gem lib, git: "https://github.com/rspec/#{lib}.git", branch: 'master'
|
|
17
18
|
end
|
|
18
|
-
end
|
|
19
|
+
end
|
data/README.md
CHANGED
|
@@ -41,13 +41,12 @@ forms, just use the `trix_editor` helper:
|
|
|
41
41
|
f.trix_editor :body
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
If you are using the [Formtastic](https://github.com/justinfrench/formtastic) gem or the [Simple Form](https://github.com/plataformatec/simple_form) gem, you can do this:
|
|
45
45
|
|
|
46
46
|
```ruby
|
|
47
47
|
f.input :body, as: :trix_editor
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
|
|
51
50
|
## Trix
|
|
52
51
|
|
|
53
52
|
For the official Trix Github repository, go
|
data/Rakefile
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
source "https://rubygems.org"
|
|
4
4
|
|
|
5
5
|
gem "rails", :git => "https://github.com/rails/rails.git", :branch => "master"
|
|
6
|
+
gem "arel", :git => "https://github.com/rails/arel.git", :branch => "master"
|
|
6
7
|
gem "rspec-core", :git => "https://github.com/rspec/rspec-core.git", :branch => "master"
|
|
7
8
|
gem "rspec-expectations", :git => "https://github.com/rspec/rspec-expectations.git", :branch => "master"
|
|
8
9
|
gem "rspec-mocks", :git => "https://github.com/rspec/rspec-mocks.git", :branch => "master"
|
|
@@ -2,8 +2,10 @@ class TrixEditorInput < Formtastic::Inputs::StringInput
|
|
|
2
2
|
def to_html
|
|
3
3
|
input_wrapping do
|
|
4
4
|
editor_tag_params = {
|
|
5
|
-
input: input_html_options[:id]
|
|
5
|
+
input: input_html_options[:id],
|
|
6
|
+
class: 'trix-content'
|
|
6
7
|
}
|
|
8
|
+
|
|
7
9
|
editor_tag = template.content_tag('trix-editor', '', editor_tag_params)
|
|
8
10
|
hidden_field = builder.hidden_field(method, input_html_options)
|
|
9
11
|
|
data/lib/trix/engine.rb
CHANGED
|
@@ -4,6 +4,14 @@ module Trix
|
|
|
4
4
|
ActiveSupport.on_load(:action_view) do
|
|
5
5
|
require 'trix/form'
|
|
6
6
|
end
|
|
7
|
+
|
|
8
|
+
if defined? ::SimpleForm
|
|
9
|
+
require 'trix/simple_form/trix_editor_input'
|
|
10
|
+
|
|
11
|
+
::SimpleForm.setup do |config|
|
|
12
|
+
config.custom_inputs_namespaces << 'Trix::SimpleForm'
|
|
13
|
+
end
|
|
14
|
+
end
|
|
7
15
|
end
|
|
8
16
|
end
|
|
9
17
|
end
|
data/lib/trix/form.rb
CHANGED
|
@@ -8,18 +8,18 @@ module TrixEditorHelper
|
|
|
8
8
|
def trix_editor_tag(name, value = nil, options = {})
|
|
9
9
|
options.symbolize_keys!
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
css_class = Array.wrap(options[:class]).join(' ')
|
|
12
|
+
attributes = { class: "formatted_content trix-content #{css_class}".squish }
|
|
13
13
|
attributes[:autofocus] = true if options[:autofocus]
|
|
14
|
-
attributes[:placeholder] = options[:placeholder] if options[:placeholder]
|
|
15
|
-
attributes[:spellcheck] = options[:spellcheck] if options[:spellcheck]
|
|
16
14
|
attributes[:input] = options[:input] || "trix_input_#{TrixEditorHelper.id += 1}"
|
|
17
|
-
|
|
15
|
+
|
|
16
|
+
valid_html_options = [:placeholder, :spellcheck, :toolbar, :tabindex]
|
|
17
|
+
attributes.merge!(options.slice(*valid_html_options))
|
|
18
18
|
|
|
19
19
|
editor_tag = content_tag('trix-editor', '', attributes)
|
|
20
20
|
input_tag = hidden_field_tag(name, value, id: attributes[:input])
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
input_tag + editor_tag
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module Trix
|
|
2
|
+
module SimpleForm
|
|
3
|
+
class TrixEditorInput < ::SimpleForm::Inputs::Base
|
|
4
|
+
def input(_wrapper_options)
|
|
5
|
+
editor_tag = template.content_tag('trix-editor', '', input: input_class, class: 'trix-content')
|
|
6
|
+
hidden_field = @builder.hidden_field(attribute_name, input_html_options)
|
|
7
|
+
|
|
8
|
+
template.content_tag('div', editor_tag + hidden_field, class: 'trix-editor-wrapper')
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
data/lib/trix/version.rb
CHANGED
data/trix.gemspec
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# coding: utf-8
|
|
2
|
+
|
|
2
3
|
lib = File.expand_path('../lib', __FILE__)
|
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
5
|
require 'trix/version'
|
|
@@ -19,13 +20,14 @@ Gem::Specification.new do |spec|
|
|
|
19
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
20
21
|
spec.require_paths = ['lib']
|
|
21
22
|
|
|
22
|
-
spec.add_runtime_dependency 'rails'
|
|
23
|
+
spec.add_runtime_dependency 'rails', ['> 4.1', '< 5.2']
|
|
23
24
|
|
|
24
25
|
spec.add_development_dependency 'appraisal'
|
|
25
26
|
spec.add_development_dependency 'bundler', '~> 1.10'
|
|
26
27
|
spec.add_development_dependency 'formtastic', '~> 3.0'
|
|
28
|
+
spec.add_development_dependency 'simple_form', '~> 3.5'
|
|
27
29
|
spec.add_development_dependency 'rake', '~> 10.0'
|
|
28
30
|
spec.add_development_dependency 'rspec-rails'
|
|
29
31
|
spec.add_development_dependency 'rspec-activemodel-mocks'
|
|
30
|
-
spec.add_development_dependency 'rubocop'
|
|
32
|
+
spec.add_development_dependency 'rubocop', '0.35.1'
|
|
31
33
|
end
|