activeadmin_quill_editor 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +73 -0
- data/Gemfile +0 -1
- data/README.md +1 -1
- data/Rakefile +2 -2
- data/activeadmin_quill_editor.gemspec +4 -2
- data/app/assets/javascripts/activeadmin/quill_editor_input.js +11 -15
- data/lib/activeadmin/quill_editor.rb +2 -0
- data/lib/activeadmin/quill_editor/engine.rb +2 -0
- data/lib/activeadmin/quill_editor/version.rb +3 -1
- data/lib/activeadmin_quill_editor.rb +2 -0
- data/lib/formtastic/inputs/quill_editor_input.rb +7 -5
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8644198fa29615148c05e303e6e14e5618f45a35db6325e44a618acaff8dac09
|
4
|
+
data.tar.gz: c7d489ebc49866a7ca1b77daa2901795f99c7f55c8469488bffbac0671f2743f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c039f2c9009a15853294ecdd0ea87bbcf51c737c98b59fb379ecaf3bf06cc1189f6b142fa84f0c512e91d5473bad1c25edce8225b8590b145c6764f3bc42283
|
7
|
+
data.tar.gz: fbf2b324fff5e01f7b52b09f42f8427e39a17f1e3088233cf1bb54d6adc5407f034504049c40f329e186a1b39c143fac3b1c181dcc09a9f95b66be6a1de5b8fb
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-rspec
|
3
|
+
|
4
|
+
Rails:
|
5
|
+
Enabled: true
|
6
|
+
|
7
|
+
AllCops:
|
8
|
+
TargetRubyVersion: 2.3.8
|
9
|
+
TargetRailsVersion: 5.2
|
10
|
+
Exclude:
|
11
|
+
- db/schema.rb
|
12
|
+
- bin/*
|
13
|
+
- node_modules/**/*
|
14
|
+
# Temporary files
|
15
|
+
- tmp/**/*
|
16
|
+
|
17
|
+
Rails/InverseOf:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
Style/Documentation:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
Metrics/ClassLength:
|
24
|
+
# Default value is 100
|
25
|
+
Max: 150
|
26
|
+
|
27
|
+
Metrics/LineLength:
|
28
|
+
# Default is 80
|
29
|
+
Max: 120
|
30
|
+
|
31
|
+
Metrics/ModuleLength:
|
32
|
+
# Default is 100
|
33
|
+
Max: 150
|
34
|
+
|
35
|
+
Metrics/ParameterLists:
|
36
|
+
# Default is 5
|
37
|
+
Max: 6
|
38
|
+
|
39
|
+
RSpec/ExampleLength:
|
40
|
+
# Default is 10
|
41
|
+
Max: 20
|
42
|
+
|
43
|
+
Style/FrozenStringLiteralComment:
|
44
|
+
# Deface DOES edit strings in place
|
45
|
+
Exclude:
|
46
|
+
- 'app/overrides/**/*'
|
47
|
+
|
48
|
+
RSpec/MultipleExpectations:
|
49
|
+
# Default is 3
|
50
|
+
Max: 5
|
51
|
+
|
52
|
+
RSpec/NestedGroups:
|
53
|
+
# Default is 3
|
54
|
+
Max: 6
|
55
|
+
|
56
|
+
Metrics/AbcSize:
|
57
|
+
Max: 25
|
58
|
+
|
59
|
+
Metrics/BlockLength:
|
60
|
+
# This value double the rubocop default
|
61
|
+
Max: 50
|
62
|
+
|
63
|
+
Metrics/CyclomaticComplexity:
|
64
|
+
# This value double the rubocop default
|
65
|
+
Max: 12
|
66
|
+
|
67
|
+
Metrics/MethodLength:
|
68
|
+
# This value double the rubocop default
|
69
|
+
Max: 20
|
70
|
+
|
71
|
+
Metrics/PerceivedComplexity:
|
72
|
+
# Default is 7
|
73
|
+
Max: 10
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -22,7 +22,7 @@ Why 2 separated scripts? In this way you can include a different version of *qui
|
|
22
22
|
|
23
23
|
## Options
|
24
24
|
|
25
|
-
**data-options**: permits to set *quill editor* options directly - see [options list](https://quilljs.com/docs/
|
25
|
+
**data-options**: permits to set *quill editor* options directly - see [options list](https://quilljs.com/docs/configuration/)
|
26
26
|
|
27
27
|
## Examples
|
28
28
|
|
data/Rakefile
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
3
|
+
require 'bundler/gem_tasks'
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
2
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
5
|
require 'activeadmin/quill_editor/version'
|
4
6
|
|
@@ -15,5 +17,5 @@ Gem::Specification.new do |spec|
|
|
15
17
|
spec.files = `git ls-files -z`.split("\x0")
|
16
18
|
spec.require_paths = ['lib']
|
17
19
|
|
18
|
-
spec.add_runtime_dependency 'activeadmin', '
|
20
|
+
spec.add_runtime_dependency 'activeadmin', '>= 1.0'
|
19
21
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
window.onload = function
|
1
|
+
window.onload = function() {
|
2
2
|
initQuillEditors();
|
3
3
|
}
|
4
4
|
|
@@ -7,7 +7,7 @@ $(document).on('has_many_add:after', function() {
|
|
7
7
|
});
|
8
8
|
|
9
9
|
var initQuillEditors = function() {
|
10
|
-
var editors = document.querySelectorAll(
|
10
|
+
var editors = document.querySelectorAll('.quill-editor');
|
11
11
|
var default_options = {
|
12
12
|
modules: {
|
13
13
|
toolbar: [
|
@@ -17,32 +17,28 @@ var initQuillEditors = function() {
|
|
17
17
|
[{ 'align': [] }, { list: 'ordered' }, { list: 'bullet' }],
|
18
18
|
[{ 'color': [] }, { 'background': [] }],
|
19
19
|
['clean'],
|
20
|
-
// [{ 'size': ['small', false, 'large', 'huge'] }],
|
21
|
-
// [{ 'header': [1, 2, 3, 4, 5, 6, false] }],
|
22
20
|
]
|
23
21
|
},
|
24
22
|
placeholder: '',
|
25
23
|
theme: 'snow'
|
26
24
|
};
|
27
25
|
|
28
|
-
for(
|
29
|
-
var content = editors[i].querySelector(
|
26
|
+
for(var i = 0; i < editors.length; i++) {
|
27
|
+
var content = editors[i].querySelector('.quill-editor-content');
|
30
28
|
var isActive = editors[i].classList.contains('quill-editor--active');
|
31
|
-
if(
|
32
|
-
var options = editors[i].getAttribute(
|
33
|
-
editors[i]['_quill-editor'] = new Quill(
|
29
|
+
if(content && !isActive) {
|
30
|
+
var options = editors[i].getAttribute('data-options') ? JSON.parse(editors[i].getAttribute('data-options')) : default_options;
|
31
|
+
editors[i]['_quill-editor'] = new Quill(content, options);
|
34
32
|
editors[i].classList += ' quill-editor--active';
|
35
33
|
}
|
36
34
|
}
|
37
35
|
|
38
|
-
var formtastic = document.querySelector(
|
39
|
-
if(
|
36
|
+
var formtastic = document.querySelector('form.formtastic');
|
37
|
+
if(formtastic) {
|
40
38
|
formtastic.onsubmit = function() {
|
41
|
-
for(
|
42
|
-
var input = editors[i].querySelector(
|
39
|
+
for(var i = 0; i < editors.length; i++) {
|
40
|
+
var input = editors[i].querySelector('input[type="hidden"]');
|
43
41
|
input.value = editors[i]['_quill-editor'].root.innerHTML;
|
44
|
-
// input.value = editors[i]['_quill-editor'].getContents();
|
45
|
-
// input.value = editors[i].querySelector( '.quill-editor-content' ).innerHTML;
|
46
42
|
}
|
47
43
|
};
|
48
44
|
}
|
@@ -1,15 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Formtastic
|
2
4
|
module Inputs
|
3
5
|
class QuillEditorInput < Formtastic::Inputs::TextInput
|
4
6
|
def to_html
|
5
7
|
input_wrapping do
|
6
8
|
label_html <<
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
template.content_tag(:div, input_html_options.merge(class: 'quill-editor')) do
|
10
|
+
builder.hidden_field(input_name) <<
|
11
|
+
template.content_tag(:div, class: 'quill-editor-content') do
|
12
|
+
object.send(method).try :html_safe
|
13
|
+
end
|
11
14
|
end
|
12
|
-
end
|
13
15
|
end
|
14
16
|
end
|
15
17
|
end
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeadmin_quill_editor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mattia Roccoberton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeadmin
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.0'
|
27
27
|
description: An Active Admin plugin to use Quill Rich Text Editor
|
@@ -31,6 +31,7 @@ extensions: []
|
|
31
31
|
extra_rdoc_files: []
|
32
32
|
files:
|
33
33
|
- ".gitignore"
|
34
|
+
- ".rubocop.yml"
|
34
35
|
- Gemfile
|
35
36
|
- LICENSE.txt
|
36
37
|
- README.md
|
@@ -69,8 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
70
|
- !ruby/object:Gem::Version
|
70
71
|
version: '0'
|
71
72
|
requirements: []
|
72
|
-
|
73
|
-
rubygems_version: 2.6.14
|
73
|
+
rubygems_version: 3.0.2
|
74
74
|
signing_key:
|
75
75
|
specification_version: 4
|
76
76
|
summary: Quill Editor for ActiveAdmin
|