activeadmin_quill_editor 1.2.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 +59 -7
- data/app/assets/javascripts/activeadmin/quill_editor_input.js +25 -0
- data/lib/activeadmin/quill_editor/version.rb +1 -1
- metadata +3 -6
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
|
|
@@ -101,9 +105,62 @@ Consider that this is just a basic example: images are uploaded as soon as they
|
|
101
105
|
the *upload_admin_post_path*) and it doesn't provide a way to remove images (just deleting them from
|
102
106
|
the editor will not destroy them, you'll need to implement a purge logic for that).
|
103
107
|
|
104
|
-
##
|
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
|
117
|
+
|
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
|
+
```
|
105
140
|
|
106
|
-
|
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
|
+
```
|
107
164
|
|
108
165
|
## Do you like it? Star it!
|
109
166
|
|
@@ -111,11 +168,6 @@ If you use this component just star it. A developer is more motivated to improve
|
|
111
168
|
|
112
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).
|
113
170
|
|
114
|
-
## Contributors
|
115
|
-
|
116
|
-
- [Mattia Roccoberton](http://blocknot.es): author
|
117
|
-
- The good guys that opened issues and pull requests from time to time
|
118
|
-
|
119
171
|
## License
|
120
172
|
|
121
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
|
@@ -76,7 +75,6 @@ metadata:
|
|
76
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
|
@@ -91,8 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
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: []
|