4 Коммитов

Автор SHA1 Сообщение Дата
Mattia Roccoberton
dc97316303 v0.2.9 2020-09-04 08:49:20 +02:00
Mattia Roccoberton
e9b8abc88e Merge pull request #14 from blocknotes/fix/text-alignment
Reduce the importance of the reset rules
2020-09-03 13:02:47 +02:00
Mattia Roccoberton
582667dc59 Reduce the importance of the reset rules
This allows to let Quill features to override the reset styles.

Closes #8
2020-09-03 13:00:42 +02:00
m.pestov
76c06f5346 Don't send paragraph tag if editor blank 2020-09-03 12:45:42 +02:00
4 изменённых файлов: 18 добавлений и 14 удалений

Просмотреть файл

@@ -1,6 +1,6 @@
# ActiveAdmin Quill Editor [![Gem Version](https://badge.fury.io/rb/activeadmin_quill_editor.svg)](https://badge.fury.io/rb/activeadmin_quill_editor) [![CircleCI](https://circleci.com/gh/blocknotes/activeadmin_quill_editor.svg?style=svg)](https://circleci.com/gh/blocknotes/activeadmin_quill_editor)
An Active Admin plugin to use [Quill Rich Text Editor](https://github.com/quilljs/quill)
An Active Admin plugin to use [Quill Rich Text Editor](https://github.com/quilljs/quill) in form fields.
![screenshot](screenshot.png)
@@ -18,7 +18,7 @@ An Active Admin plugin to use [Quill Rich Text Editor](https://github.com/quillj
```
- Use the input with `as: :quill_editor` in Active Admin model conf
Why 2 separated scripts? In this way you can include a different version of *quill editor* if you like.
Why 2 separated scripts/styles? In this way you can include a different version of *quill editor* if you like.
> **UPDATE FROM VERSION <= 2.0**: please add to your _app/assets/stylesheets/active_admin.scss_ the line `@import 'activeadmin/quill_editor/quill.snow';`
@@ -44,11 +44,11 @@ Why 2 separated scripts? In this way you can include a different version of *qui
### Toolbar buttons configuration
```ruby
f.input :description, as: :quill_editor, input_html: {data: {options: {modules: {toolbar: [['bold', 'italic', 'underline'], ['link']]}, placeholder: 'Type something...', theme: 'snow'}}}
f.input :description, as: :quill_editor, input_html: { data: { options: { modules: { toolbar: [['bold', 'italic', 'underline'], ['link']] }, placeholder: 'Type something...', theme: 'snow' } } }
```
## Notes
- Upload functions (Images, Documents, Files, etc.) are not implemented yet
- Upload features (images/documents/files): not tested yet.
## Do you like it? Star it!
If you use this component just star it. A developer is more motivated to improve a project when there is some interest.
@@ -60,4 +60,4 @@ Take a look at [other Active Admin components](https://github.com/blocknotes?utf
- The good guys that opened issues and pull requests from time to time
## License
- The gem is available as open-source under the terms of the [MIT](LICENSE.txt)
The gem is available as open-source under the terms of the [MIT](LICENSE.txt).

Просмотреть файл

@@ -30,7 +30,11 @@ function initQuillEditors() {
formtastic.onsubmit = function() {
for(var i = 0; i < editors.length; i++) {
var input = editors[i].querySelector('input[type="hidden"]');
input.value = editors[i]['_quill-editor'].root.innerHTML;
if (editors[i]['_quill-editor'].editor.isBlank()) {
input.value = '';
} else {
input.value = editors[i]['_quill-editor'].root.innerHTML;
}
}
};
}

Просмотреть файл

@@ -1,3 +1,10 @@
// reset internal elements
.ql-editor * {
margin: initial;
padding: initial;
text-align: initial;
}
body.active_admin .quill-editor {
display: inline-block;
width: calc(80% - 2px);
@@ -23,13 +30,6 @@ body.active_admin .quill-editor {
min-height: 150px;
padding: 10px;
// reset internal elements
* {
margin: initial;
padding: initial;
text-align: initial;
}
ol {
list-style-type: decimal;
}

Просмотреть файл

@@ -2,6 +2,6 @@
module ActiveAdmin
module QuillEditor
VERSION = '0.2.8'
VERSION = '0.2.9'
end
end