activeadmin_medium_editor 0.2.8 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 198234928f35e1e71157a7207409a6bb36295c27984a55218408354b43f10cca
4
- data.tar.gz: d200fd0df2e77bee9dded43d03513ca6e22f1d5e4e68b16807ee6359119cf7e9
3
+ metadata.gz: d552424d2bffd4166c766a96cadebcf1dd6f718690fde2c8da62777dcc367dc3
4
+ data.tar.gz: 5c66ee3bee3e8acfea0d3d65d0957c7a26b2a1e6c1b7082c93246726a398d742
5
5
  SHA512:
6
- metadata.gz: 0312f017322d542d0700220bf67d08d0379f86d5584e32a99b73bf4866995f25edde1740fdd16132c4cfca50abefe5f0ef34d5e4126a6c364344c94a530f9633
7
- data.tar.gz: cb08235c025fb86754b585b4bb834fa61df8f864f7355e7df9b44698ea3399cacd23cd55a26e5785085a3a42d75ec4ffb77145a680d5fca55d0742e6c741c83d
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 article form conf:
37
+ # Active Admin post form conf:
40
38
  form do |f|
41
- f.inputs 'Article' do
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
- f.input :description, as: :medium_editor, input_html: { data: { options: '{"spellcheck":false,"toolbar":{"buttons":["bold","italic","underline","anchor","orderedlist","unorderedlist","strikethrough","subscript","superscript","pre","h1","h2","h3","h4","h5","h6","html"]}}' } }
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
- ## Notes
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
- - The gem is available as open-source under the terms of the [MIT](LICENSE.txt)
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: 0 1.5em 1.5em 0;
34
- padding-left: 1.5em;
72
+ margin: 1em 2em 1em 0;
73
+ padding-left: 2em;
35
74
  }
36
75
  }
37
76
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveAdmin
4
4
  module MediumEditor
5
- VERSION = '0.2.8'
5
+ VERSION = '0.2.9'
6
6
  end
7
7
  end
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.8
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-03 00:00:00.000000000 Z
11
+ date: 2020-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activeadmin