activeadmin_medium_editor 0.2.8 → 0.2.9
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d552424d2bffd4166c766a96cadebcf1dd6f718690fde2c8da62777dcc367dc3
|
4
|
+
data.tar.gz: 5c66ee3bee3e8acfea0d3d65d0957c7a26b2a1e6c1b7082c93246726a398d742
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a184a28f68f2165e017d1628ec287c902d77ab67d61162a6572d7560280012ceb18c09191b08bf056bf742f4ee37baa813e909da9238943d610aaa312d512c0e
|
7
|
+
data.tar.gz: 2ae2e169cec0e803a8ffcee88af9e5bf8478218e65a0f1f58d9b3eb33dbaeee2bdbf145d99b8910a8b67447b371fb3c936ea4f624f251da591a70fb4d713c493
|
data/README.md
CHANGED
@@ -23,22 +23,20 @@ An Active Admin plugin to use [medium-editor](https://github.com/yabwe/medium-ed
|
|
23
23
|
//= require activeadmin/medium_editor_input
|
24
24
|
```
|
25
25
|
- Use the input with `as: :medium_editor` in Active Admin model conf
|
26
|
+
- **data-options**: permits to set *medium-editor* options directly - see [options list](https://github.com/yabwe/medium-editor#mediumeditor-options) (examples below)
|
26
27
|
|
27
|
-
Why 2 separated scripts/styles? In this way you can include a different version of *medium-editor* if you like
|
28
|
+
> Why 2 separated scripts/styles? In this way you can include a different version of *medium-editor* if you like
|
28
29
|
|
29
30
|
> **UPDATE FROM VERSION < 2.8**: please change your _app/assets/stylesheets/active_admin.scss_ using the new import lines above
|
30
31
|
|
31
|
-
## Options
|
32
|
-
**data-options**: permits to set *medium-editor* options directly - see [options list](https://github.com/yabwe/medium-editor#mediumeditor-options)
|
33
|
-
|
34
32
|
## Examples
|
35
33
|
|
36
34
|
### Basic usage
|
37
35
|
|
38
36
|
```ruby
|
39
|
-
# Active Admin
|
37
|
+
# Active Admin post form conf:
|
40
38
|
form do |f|
|
41
|
-
f.inputs '
|
39
|
+
f.inputs 'Post' do
|
42
40
|
f.input :title
|
43
41
|
f.input :description, as: :medium_editor, input_html: { data: { options: '{"spellcheck":false,"toolbar":{"buttons":["bold","italic","underline","anchor"]}}' } }
|
44
42
|
f.input :published
|
@@ -50,12 +48,11 @@ Why 2 separated scripts/styles? In this way you can include a different version
|
|
50
48
|
### Buttons configuration
|
51
49
|
|
52
50
|
```ruby
|
53
|
-
|
51
|
+
toolbar = { buttons: %w[bold italic underline strikethrough subscript superscript anchor image quote pre orderedlist unorderedlist indent outdent justifyLeft justifyCenter justifyRight justifyFull h1 h2 h3 h4 h5 h6 removeFormat html] }
|
52
|
+
f.input :description, as: :medium_editor, input_html: { data: { options: { toolbar: toolbar } } }
|
54
53
|
```
|
55
54
|
|
56
|
-
|
57
|
-
- With the current version of Medium Editor some default buttons seem to not work properly, from my test they are: "indent", "outdent", "quote", "justifyLeft", "justifyCenter", "justifyRight", "justifyFull"
|
58
|
-
- If some of this feature are needed I could suggest to override the button behavior or to use custom style classes. See the Medium Editor documentation for details.
|
55
|
+
For details about the buttons' effect please refer to medium-editor documentation.
|
59
56
|
|
60
57
|
## Do you like it? Star it!
|
61
58
|
If you use this component just star it. A developer is more motivated to improve a project when there is some interest.
|
@@ -67,4 +64,4 @@ Take a look at [other Active Admin components](https://github.com/blocknotes?utf
|
|
67
64
|
- The good guys that opened issues and pull requests from time to time
|
68
65
|
|
69
66
|
## License
|
70
|
-
|
67
|
+
The gem is available as open-source under the terms of the [MIT](LICENSE.txt).
|
@@ -1,6 +1,6 @@
|
|
1
1
|
function initMediumEditors() {
|
2
|
-
$('.medium-editor').each(function() {
|
3
|
-
if(!$(this).hasClass('medium-editor--active')) {
|
2
|
+
$('.medium-editor').each(function () {
|
3
|
+
if (!$(this).hasClass('medium-editor--active')) {
|
4
4
|
var options = {};
|
5
5
|
options = $.extend({}, options, $(this).data('options'));
|
6
6
|
new MediumEditor($(this), options);
|
@@ -9,10 +9,10 @@ function initMediumEditors() {
|
|
9
9
|
});
|
10
10
|
}
|
11
11
|
|
12
|
-
$(document).on('has_many_add:after', function() {
|
12
|
+
$(document).on('has_many_add:after', function () {
|
13
13
|
initMediumEditors();
|
14
14
|
});
|
15
15
|
|
16
|
-
$(document).ready(function() {
|
16
|
+
$(document).ready(function () {
|
17
17
|
initMediumEditors();
|
18
18
|
});
|
@@ -21,17 +21,56 @@ body.active_admin form {
|
|
21
21
|
text-align: initial;
|
22
22
|
}
|
23
23
|
|
24
|
+
h1 {
|
25
|
+
margin-top: 0.67em;
|
26
|
+
margin-bottom: 0.67em;
|
27
|
+
}
|
28
|
+
|
29
|
+
h2 {
|
30
|
+
margin-top: 0.83em;
|
31
|
+
margin-bottom: 0.83em;
|
32
|
+
}
|
33
|
+
|
34
|
+
h3 {
|
35
|
+
margin-top: 1em;
|
36
|
+
margin-bottom: 1em;
|
37
|
+
}
|
38
|
+
|
39
|
+
h4 {
|
40
|
+
margin-top: 1.33em;
|
41
|
+
margin-bottom: 1.33em;
|
42
|
+
}
|
43
|
+
|
44
|
+
h5 {
|
45
|
+
margin-top: 1.67em;
|
46
|
+
margin-bottom: 1.67em;
|
47
|
+
}
|
48
|
+
|
49
|
+
h6 {
|
50
|
+
margin-top: 2.33em;
|
51
|
+
margin-bottom: 2.33em;
|
52
|
+
}
|
53
|
+
|
54
|
+
blockquote {
|
55
|
+
margin: 1.5em;
|
56
|
+
}
|
57
|
+
|
24
58
|
ol {
|
25
59
|
list-style-type: decimal;
|
26
60
|
}
|
27
61
|
|
62
|
+
p {
|
63
|
+
margin-top: 1em;
|
64
|
+
margin-bottom: 1em;
|
65
|
+
}
|
66
|
+
|
28
67
|
ul {
|
29
68
|
list-style-type: disc;
|
30
69
|
}
|
31
70
|
|
32
71
|
ul, ol {
|
33
|
-
margin:
|
34
|
-
padding-left:
|
72
|
+
margin: 1em 2em 1em 0;
|
73
|
+
padding-left: 2em;
|
35
74
|
}
|
36
75
|
}
|
37
76
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeadmin_medium_editor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mattia Roccoberton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activeadmin
|