activeadmin_quill_editor 1.1.0 → 1.3.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/README.md +63 -7
- data/app/assets/javascripts/activeadmin/quill_editor_input.js +25 -0
- data/lib/activeadmin/quill_editor/version.rb +1 -1
- metadata +7 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 166486f6d1608e906d42b3b17c5123b6366c5de0b6bbdd8e1f3dc8a66acbf4a0
|
4
|
+
data.tar.gz: f2cdcf461d5a116496768d63e015ef0fdbe07dcafc5ee0ff8a5a740dfae3737d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ccb3e2bf4f7fd563d5dc78b6b1e05faaacd3791e67bccc14e3f8169375b2fae05824a8f45bf689178156fe9cd196a78922612ca02e73954c72ecdd6b6457fce4
|
7
|
+
data.tar.gz: 767180a9419b8883ecf931ac88f2fb1a2b8501dd280458204ec3ab65aeac1e2b122102c4624a058136b29d66843a4d0661d3071342228fe9bfa52f7ca72f1150
|
data/README.md
CHANGED
@@ -2,8 +2,12 @@
|
|
2
2
|
[](https://badge.fury.io/rb/activeadmin_quill_editor)
|
3
3
|
[](https://rubygems.org/gems/activeadmin_quill_editor)
|
4
4
|
[](https://github.com/blocknotes/activeadmin_quill_editor/actions/workflows/linters.yml)
|
5
|
+
|
5
6
|
[](https://github.com/blocknotes/activeadmin_quill_editor/actions/workflows/specs_rails61.yml)
|
6
7
|
[](https://github.com/blocknotes/activeadmin_quill_editor/actions/workflows/specs_rails70.yml)
|
8
|
+
[](https://github.com/blocknotes/activeadmin_quill_editor/actions/workflows/specs_rails71.yml)
|
9
|
+
[](https://github.com/blocknotes/activeadmin_quill_editor/actions/workflows/specs_rails72.yml)
|
10
|
+
[](https://github.com/blocknotes/activeadmin_quill_editor/actions/workflows/specs_rails80.yml)
|
7
11
|
|
8
12
|
An Active Admin plugin to use [Quill Rich Text Editor](https://github.com/quilljs/quill) in form fields.
|
9
13
|
|
@@ -13,6 +17,8 @@ Please :star: if you like it.
|
|
13
17
|
|
14
18
|
## Install
|
15
19
|
|
20
|
+
_NOTE_: Ruby 2.7 is supported until version 1.1.0
|
21
|
+
|
16
22
|
After installing Active Admin, add to your Gemfile: `gem 'activeadmin_quill_editor'` (and execute *bundle*)
|
17
23
|
|
18
24
|
If you installed Active Admin without Webpacker support (default for now):
|
@@ -48,6 +54,8 @@ In your Active Admin models, form configuration, set the text inputs with `as: :
|
|
48
54
|
|
49
55
|
**data-options**: permits to set *quill editor* options directly - see [options list](https://quilljs.com/docs/configuration/)
|
50
56
|
|
57
|
+
If you are using Action Text (`has_rich_text`) on the same field of the Quill editor please take a look at [this workaround](https://github.com/blocknotes/activeadmin_quill_editor/issues/33#issuecomment-1965996947) to avoid issues.
|
58
|
+
|
51
59
|
## Examples
|
52
60
|
|
53
61
|
### Basic usage
|
@@ -97,9 +105,62 @@ Consider that this is just a basic example: images are uploaded as soon as they
|
|
97
105
|
the *upload_admin_post_path*) and it doesn't provide a way to remove images (just deleting them from
|
98
106
|
the editor will not destroy them, you'll need to implement a purge logic for that).
|
99
107
|
|
100
|
-
##
|
108
|
+
## Javascript API
|
109
|
+
|
110
|
+
Some methods are provided for advanced use cases:
|
111
|
+
|
112
|
+
- `window.getQuillEditors()`: returns all the available Quill editors instances;
|
113
|
+
- `window.getQuillEditorByIndex(n)`: returns the N-th Quill editor instance;
|
114
|
+
- `window.getQuillEditorByElementId(id)`: returns the Quill editor instance related to the specified element id (e.g. _article_description_).
|
115
|
+
|
116
|
+
## Development
|
101
117
|
|
102
|
-
|
118
|
+
Project created by [Mattia Roccoberton](http://blocknot.es), thanks also to the good guys that opened issues and pull requests from time to time.
|
119
|
+
|
120
|
+
There 3 ways to interact with this project:
|
121
|
+
|
122
|
+
1) Using Docker:
|
123
|
+
|
124
|
+
```sh
|
125
|
+
# Run rails server on the dummy app (=> http://localhost:3000 to access to ActiveAdmin):
|
126
|
+
make up
|
127
|
+
# Enter in a Rails console (with the dummy app started):
|
128
|
+
make console
|
129
|
+
# Enter in a shell (with the dummy app started):
|
130
|
+
make shell
|
131
|
+
# Run the linter on the project (with the dummy app started):
|
132
|
+
make lint
|
133
|
+
# Run the test suite (with the dummy app started):
|
134
|
+
make specs
|
135
|
+
# Remove container and image:
|
136
|
+
make cleanup
|
137
|
+
# To try different versions of Ruby/Rails/ActiveAdmin edit docker-compose.yml
|
138
|
+
# For more commands please check the Makefile
|
139
|
+
```
|
140
|
+
|
141
|
+
2) Using Appraisal:
|
142
|
+
|
143
|
+
```sh
|
144
|
+
export RAILS_ENV=development
|
145
|
+
# Install dependencies
|
146
|
+
bin/appraisal
|
147
|
+
# Run server (or any command)
|
148
|
+
bin/appraisal rails s
|
149
|
+
# Or with specific versions
|
150
|
+
bin/appraisal rails71-activeadmin rails s
|
151
|
+
```
|
152
|
+
|
153
|
+
3) With a local setup:
|
154
|
+
|
155
|
+
```sh
|
156
|
+
# Dev setup (set the required envs)
|
157
|
+
source extra/dev_setup.sh
|
158
|
+
# Install dependencies
|
159
|
+
bundle
|
160
|
+
# Run server (or any command)
|
161
|
+
bin/rails s
|
162
|
+
# To try different versions of Rails/ActiveAdmin edit extra/dev_setup.sh
|
163
|
+
```
|
103
164
|
|
104
165
|
## Do you like it? Star it!
|
105
166
|
|
@@ -107,11 +168,6 @@ If you use this component just star it. A developer is more motivated to improve
|
|
107
168
|
|
108
169
|
Or consider offering me a coffee, it's a small thing but it is greatly appreciated: [about me](https://www.blocknot.es/about-me).
|
109
170
|
|
110
|
-
## Contributors
|
111
|
-
|
112
|
-
- [Mattia Roccoberton](http://blocknot.es): author
|
113
|
-
- The good guys that opened issues and pull requests from time to time
|
114
|
-
|
115
171
|
## License
|
116
172
|
|
117
173
|
The gem is available as open-source under the terms of the [MIT](LICENSE.txt).
|
@@ -1,3 +1,4 @@
|
|
1
|
+
/* eslint-disable no-undef */
|
1
2
|
(function () {
|
2
3
|
'use strict'
|
3
4
|
|
@@ -73,6 +74,9 @@
|
|
73
74
|
method: 'POST'
|
74
75
|
}).then(response => response.json())
|
75
76
|
.then(result => {
|
77
|
+
if (!result.url) {
|
78
|
+
reject('Upload failed')
|
79
|
+
}
|
76
80
|
resolve(result.url);
|
77
81
|
})
|
78
82
|
.catch(error => {
|
@@ -84,6 +88,27 @@
|
|
84
88
|
}
|
85
89
|
}
|
86
90
|
|
91
|
+
// --- public functions --------------------------------------------------------
|
92
|
+
window.getQuillEditors = function() {
|
93
|
+
const editors = document.querySelectorAll('[data-aa-quill-editor]')
|
94
|
+
let list = []
|
95
|
+
|
96
|
+
editors.forEach(function(editor) { list.push(editor['_quill-editor']) })
|
97
|
+
return list
|
98
|
+
}
|
99
|
+
|
100
|
+
window.getQuillEditorByIndex = function(index) {
|
101
|
+
const editors = document.querySelectorAll('[data-aa-quill-editor]')
|
102
|
+
|
103
|
+
return (index >= 0 && index < editors.length) ? editors[index]['_quill-editor'] : null
|
104
|
+
}
|
105
|
+
|
106
|
+
window.getQuillEditorByElementId = function(id) {
|
107
|
+
const editor = document.querySelector(`[data-aa-quill-editor]#${id}`)
|
108
|
+
|
109
|
+
return editor ? editor['_quill-editor'] : null
|
110
|
+
}
|
111
|
+
|
87
112
|
// --- events ------------------------------------------------------------------
|
88
113
|
$(document).ready(initQuillEditors)
|
89
114
|
$(document).on('has_many_add:after', '.has_many_container', initQuillEditors)
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeadmin_quill_editor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mattia Roccoberton
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-03-18 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: activeadmin
|
@@ -16,7 +15,7 @@ dependencies:
|
|
16
15
|
requirements:
|
17
16
|
- - ">="
|
18
17
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
18
|
+
version: '2.9'
|
20
19
|
- - "<"
|
21
20
|
- !ruby/object:Gem::Version
|
22
21
|
version: '4'
|
@@ -26,7 +25,7 @@ dependencies:
|
|
26
25
|
requirements:
|
27
26
|
- - ">="
|
28
27
|
- !ruby/object:Gem::Version
|
29
|
-
version: '2.
|
28
|
+
version: '2.9'
|
30
29
|
- - "<"
|
31
30
|
- !ruby/object:Gem::Version
|
32
31
|
version: '4'
|
@@ -73,10 +72,9 @@ licenses:
|
|
73
72
|
- MIT
|
74
73
|
metadata:
|
75
74
|
homepage_uri: https://github.com/blocknotes/activeadmin_quill_editor
|
76
|
-
changelog_uri: https://github.com/blocknotes/activeadmin_quill_editor/blob/
|
75
|
+
changelog_uri: https://github.com/blocknotes/activeadmin_quill_editor/blob/main/CHANGELOG.md
|
77
76
|
source_code_uri: https://github.com/blocknotes/activeadmin_quill_editor
|
78
77
|
rubygems_mfa_required: 'true'
|
79
|
-
post_install_message:
|
80
78
|
rdoc_options: []
|
81
79
|
require_paths:
|
82
80
|
- lib
|
@@ -84,15 +82,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
84
82
|
requirements:
|
85
83
|
- - ">="
|
86
84
|
- !ruby/object:Gem::Version
|
87
|
-
version:
|
85
|
+
version: '3.0'
|
88
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
87
|
requirements:
|
90
88
|
- - ">="
|
91
89
|
- !ruby/object:Gem::Version
|
92
90
|
version: '0'
|
93
91
|
requirements: []
|
94
|
-
rubygems_version: 3.
|
95
|
-
signing_key:
|
92
|
+
rubygems_version: 3.6.2
|
96
93
|
specification_version: 4
|
97
94
|
summary: Quill Editor for ActiveAdmin
|
98
95
|
test_files: []
|