activeadmin_medium_editor 0.2.4 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/README.md +28 -26
  4. data/app/assets/stylesheets/activeadmin/_medium_editor_input.scss +51 -0
  5. data/app/assets/stylesheets/activeadmin/medium_editor/_settings.scss +6 -0
  6. data/app/assets/stylesheets/activeadmin/medium_editor/animations/_image-loading.scss +8 -0
  7. data/app/assets/stylesheets/activeadmin/medium_editor/animations/_pop-upwards.scss +20 -0
  8. data/app/assets/stylesheets/activeadmin/medium_editor/components/_anchor-preview.scss +24 -0
  9. data/app/assets/stylesheets/activeadmin/medium_editor/components/_file-dragging.scss +12 -0
  10. data/app/assets/stylesheets/activeadmin/medium_editor/components/_placeholder.scss +27 -0
  11. data/app/assets/stylesheets/activeadmin/medium_editor/components/_toolbar-form.scss +44 -0
  12. data/app/assets/stylesheets/activeadmin/medium_editor/components/_toolbar.scss +98 -0
  13. data/app/assets/stylesheets/activeadmin/medium_editor/medium_editor.scss +31 -0
  14. data/app/assets/stylesheets/activeadmin/medium_editor/themes/beagle.scss +120 -0
  15. data/app/assets/stylesheets/activeadmin/medium_editor/themes/bootstrap.scss +101 -0
  16. data/app/assets/stylesheets/activeadmin/medium_editor/themes/default.scss +87 -0
  17. data/app/assets/stylesheets/activeadmin/medium_editor/themes/flat.scss +90 -0
  18. data/app/assets/stylesheets/activeadmin/medium_editor/themes/mani.scss +87 -0
  19. data/app/assets/stylesheets/activeadmin/medium_editor/themes/roman.scss +87 -0
  20. data/app/assets/stylesheets/activeadmin/medium_editor/themes/tim.scss +101 -0
  21. data/app/assets/stylesheets/activeadmin/medium_editor/util/_clearfix.scss +7 -0
  22. data/lib/activeadmin/medium_editor/version.rb +1 -1
  23. metadata +154 -32
  24. data/.gitignore +0 -3
  25. data/.rubocop.yml +0 -73
  26. data/Gemfile +0 -3
  27. data/activeadmin_medium_editor.gemspec +0 -21
  28. data/app/assets/stylesheets/activeadmin/_medium_editor_input.sass +0 -36
  29. data/app/assets/stylesheets/activeadmin/medium_editor/medium_editor.css +0 -230
  30. data/app/assets/stylesheets/activeadmin/medium_editor/medium_editor.min.css +0 -1
  31. data/app/assets/stylesheets/activeadmin/medium_editor/themes/beagle.css +0 -81
  32. data/app/assets/stylesheets/activeadmin/medium_editor/themes/beagle.min.css +0 -1
  33. data/app/assets/stylesheets/activeadmin/medium_editor/themes/bootstrap.css +0 -67
  34. data/app/assets/stylesheets/activeadmin/medium_editor/themes/bootstrap.min.css +0 -1
  35. data/app/assets/stylesheets/activeadmin/medium_editor/themes/default.css +0 -63
  36. data/app/assets/stylesheets/activeadmin/medium_editor/themes/default.min.css +0 -1
  37. data/app/assets/stylesheets/activeadmin/medium_editor/themes/flat.css +0 -58
  38. data/app/assets/stylesheets/activeadmin/medium_editor/themes/flat.min.css +0 -1
  39. data/app/assets/stylesheets/activeadmin/medium_editor/themes/mani.css +0 -57
  40. data/app/assets/stylesheets/activeadmin/medium_editor/themes/mani.min.css +0 -1
  41. data/app/assets/stylesheets/activeadmin/medium_editor/themes/roman.css +0 -58
  42. data/app/assets/stylesheets/activeadmin/medium_editor/themes/roman.min.css +0 -1
  43. data/app/assets/stylesheets/activeadmin/medium_editor/themes/tim.css +0 -67
  44. data/app/assets/stylesheets/activeadmin/medium_editor/themes/tim.min.css +0 -1
  45. data/screenshot.jpg +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1584ab7bff1f752c1d93bf42300abfd3a64d04d3da03810408f332aca1187f44
4
- data.tar.gz: 5f6d6f6f43db3f8849902a0b0106b17e7ba703ee371f4118c1f3c85ca6dc8dd4
3
+ metadata.gz: 198234928f35e1e71157a7207409a6bb36295c27984a55218408354b43f10cca
4
+ data.tar.gz: d200fd0df2e77bee9dded43d03513ca6e22f1d5e4e68b16807ee6359119cf7e9
5
5
  SHA512:
6
- metadata.gz: af3a6057f90d75f30a1cf1233fc8aa7178ffab8b7bae24e14f6b96084fa2d02b363d81cad7a76ff9b12fc5762cbeb03dfc260987a4de3ea1ce303d9738d3967f
7
- data.tar.gz: e12a525672fac9ba6250d560b268595dbf2c1151291cf3ef17b535567ef0464054be2dd0022f6e74095ce04d736ef897baf3b8f94c25672d22471a5fa58889af
6
+ metadata.gz: 0312f017322d542d0700220bf67d08d0379f86d5584e32a99b73bf4866995f25edde1740fdd16132c4cfca50abefe5f0ef34d5e4126a6c364344c94a530f9633
7
+ data.tar.gz: cb08235c025fb86754b585b4bb834fa61df8f864f7355e7df9b44698ea3399cacd23cd55a26e5785085a3a42d75ec4ffb77145a680d5fca55d0742e6c741c83d
@@ -1,4 +1,4 @@
1
- Copyright (c) 2017 Mattia Roccoberton
1
+ Copyright (c) 2017-2020 Mattia Roccoberton
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,38 +1,42 @@
1
- # ActiveAdmin Medium Editor [![Gem Version](https://badge.fury.io/rb/activeadmin_medium_editor.svg)](https://badge.fury.io/rb/activeadmin_medium_editor)
1
+ # Active Admin Medium Editor [![Gem Version](https://badge.fury.io/rb/activeadmin_medium_editor.svg)](https://badge.fury.io/rb/activeadmin_medium_editor) [![CircleCI](https://circleci.com/gh/blocknotes/activeadmin_medium_editor.svg?style=svg)](https://circleci.com/gh/blocknotes/activeadmin_medium_editor)
2
2
 
3
3
  An Active Admin plugin to use [medium-editor](https://github.com/yabwe/medium-editor), a compact and clean WYSIWYG editor.
4
4
 
5
- ![screenshot](screenshot.jpg)
5
+ ![screenshot](screenshot.png)
6
6
 
7
- *Usage*: select some text in the input, a pop-up menu is shown with the available buttons
7
+ ## Usage
8
+ - After the installation, select some text in the editor
9
+ - A pop-up menu is shown with the available buttons
10
+ - Click on a button and the effect will be applied to the selected text
8
11
 
9
12
  ## Install
10
-
11
- - Add to your Gemfile:
12
- `gem 'activeadmin_medium_editor'`
13
- - Execute bundle
14
- - Add at the end of your ActiveAdmin styles (_app/assets/stylesheets/active_admin.scss_):
15
- ```css
13
+ - After installing Active Admin, add to your Gemfile: `gem 'activeadmin_medium_editor'` (and execute *bundle*)
14
+ - Add at the end of your Active Admin styles (_app/assets/stylesheets/active_admin.scss_):
15
+ ```scss
16
+ @import 'activeadmin/medium_editor/medium_editor';
16
17
  @import 'activeadmin/medium_editor_input';
17
- @import 'activeadmin/medium_editor/themes/default.css'; // or another theme
18
+ @import 'activeadmin/medium_editor/themes/default'; // or another theme
18
19
  ```
19
- - Add at the end of your ActiveAdmin javascripts (_app/assets/javascripts/active_admin.js_):
20
+ - Add at the end of your Active Admin javascripts (_app/assets/javascripts/active_admin.js_):
20
21
  ```js
21
22
  //= require activeadmin/medium_editor/medium_editor
22
23
  //= require activeadmin/medium_editor_input
23
24
  ```
24
25
  - Use the input with `as: :medium_editor` in Active Admin model conf
25
26
 
26
- Why 2 separated scripts? In this way you can include a different version of *medium-editor* if you like.
27
+ Why 2 separated scripts/styles? In this way you can include a different version of *medium-editor* if you like.
27
28
 
28
- ## Options
29
+ > **UPDATE FROM VERSION < 2.8**: please change your _app/assets/stylesheets/active_admin.scss_ using the new import lines above
29
30
 
31
+ ## Options
30
32
  **data-options**: permits to set *medium-editor* options directly - see [options list](https://github.com/yabwe/medium-editor#mediumeditor-options)
31
33
 
32
34
  ## Examples
33
35
 
36
+ ### Basic usage
37
+
34
38
  ```ruby
35
- # ActiveAdmin article form conf:
39
+ # Active Admin article form conf:
36
40
  form do |f|
37
41
  f.inputs 'Article' do
38
42
  f.input :title
@@ -43,26 +47,24 @@ Why 2 separated scripts? In this way you can include a different version of *med
43
47
  end
44
48
  ```
45
49
 
46
- Some more buttons:
50
+ ### Buttons configuration
47
51
 
48
- `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"]}}' } }`
52
+ ```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"]}}' } }
54
+ ```
49
55
 
50
56
  ## Notes
51
-
52
- 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"
53
-
54
- 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.
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
59
 
56
60
  ## Do you like it? Star it!
57
-
58
61
  If you use this component just star it. A developer is more motivated to improve a project when there is some interest.
59
62
 
60
- Take a look at [other ActiveAdmin components](https://github.com/blocknotes?utf8=✓&tab=repositories&q=activeadmin&type=source) that I made if you are curious.
63
+ Take a look at [other Active Admin components](https://github.com/blocknotes?utf8=✓&tab=repositories&q=activeadmin&type=source) that I made if you are curious.
61
64
 
62
65
  ## Contributors
63
-
64
- - [Mattia Roccoberton](http://blocknot.es) - creator, maintainer
66
+ - [Mattia Roccoberton](http://blocknot.es): author
67
+ - The good guys that opened issues and pull requests from time to time
65
68
 
66
69
  ## License
67
-
68
- [MIT](LICENSE.txt)
70
+ - The gem is available as open-source under the terms of the [MIT](LICENSE.txt)
@@ -0,0 +1,51 @@
1
+ body.active_admin form {
2
+ textarea.medium-editor-hidden{
3
+ display: none;
4
+ }
5
+
6
+ .medium-editor-element {
7
+ background-color: #fff;
8
+ border-radius: 3px;
9
+ border: 1px solid #c9d0d6;
10
+ display: inline-block;
11
+ max-height: 200px;
12
+ min-height: 100px;
13
+ overflow-y: scroll;
14
+ padding: 8px 10px 7px;
15
+ width: calc(80% - 22px);
16
+
17
+ // reset internal elements
18
+ * {
19
+ margin: initial;
20
+ padding: initial;
21
+ text-align: initial;
22
+ }
23
+
24
+ ol {
25
+ list-style-type: decimal;
26
+ }
27
+
28
+ ul {
29
+ list-style-type: disc;
30
+ }
31
+
32
+ ul, ol {
33
+ margin: 0 1.5em 1.5em 0;
34
+ padding-left: 1.5em;
35
+ }
36
+ }
37
+
38
+ .medium-editor-element:focus {
39
+ border-color: transparent;
40
+ }
41
+
42
+ .medium_editor > label {
43
+ display: inline-block;
44
+ float: none;
45
+ vertical-align: top;
46
+ }
47
+ }
48
+
49
+ button.medium-editor-action {
50
+ border-radius: 0;
51
+ }
@@ -0,0 +1,6 @@
1
+ // typography
2
+ $font-fixed: Consolas, "Liberation Mono", Menlo, Courier, monospace !default;
3
+ $font-sans-serif: "Helvetica Neue", Helvetica, Arial, sans-serif !default;
4
+
5
+ // ui / positioning
6
+ $z-toolbar: 2000 !default;
@@ -0,0 +1,8 @@
1
+ @keyframes medium-editor-image-loading {
2
+ 0% {
3
+ transform: scale(0)
4
+ }
5
+ 100% {
6
+ transform: scale(1);
7
+ }
8
+ }
@@ -0,0 +1,20 @@
1
+ @keyframes medium-editor-pop-upwards {
2
+ 0% {
3
+ opacity: 0;
4
+ transform: matrix(.97, 0, 0, 1, 0, 12);
5
+ }
6
+
7
+ 20% {
8
+ opacity: .7;
9
+ transform: matrix(.99, 0, 0, 1, 0, 2);
10
+ }
11
+
12
+ 40% {
13
+ opacity: 1;
14
+ transform: matrix(1, 0, 0, 1, 0, -1);
15
+ }
16
+
17
+ 100% {
18
+ transform: matrix(1, 0, 0, 1, 0, 0);
19
+ }
20
+ }
@@ -0,0 +1,24 @@
1
+ .medium-editor-anchor-preview {
2
+ font-family: $font-sans-serif;
3
+ font-size: 16px;
4
+ left: 0;
5
+ line-height: 1.4;
6
+ max-width: 280px;
7
+ position: absolute;
8
+ text-align: center;
9
+ top: 0;
10
+ word-break: break-all;
11
+ word-wrap: break-word;
12
+ visibility: hidden;
13
+ z-index: $z-toolbar;
14
+
15
+ a {
16
+ color: #fff;
17
+ display: inline-block;
18
+ margin: 5px 5px 10px;
19
+ }
20
+ }
21
+
22
+ .medium-editor-anchor-preview-active {
23
+ visibility: visible;
24
+ }
@@ -0,0 +1,12 @@
1
+ .medium-editor-dragover {
2
+ background: #ddd;
3
+ }
4
+
5
+ .medium-editor-image-loading {
6
+ animation: medium-editor-image-loading 1s infinite ease-in-out;
7
+ background-color: #333;
8
+ border-radius: 100%;
9
+ display: inline-block;
10
+ height: 40px;
11
+ width: 40px;
12
+ }
@@ -0,0 +1,27 @@
1
+ .medium-editor-placeholder {
2
+ position: relative;
3
+
4
+ &:after {
5
+ content: attr(data-placeholder) !important;
6
+ font-style: italic;
7
+ position: absolute;
8
+ left: 0;
9
+ top: 0;
10
+ white-space: pre;
11
+ padding: inherit;
12
+ margin: inherit;
13
+ }
14
+ }
15
+
16
+ .medium-editor-placeholder-relative {
17
+ position: relative;
18
+
19
+ &:after {
20
+ content: attr(data-placeholder) !important;
21
+ font-style: italic;
22
+ position: relative;
23
+ white-space: pre;
24
+ padding: inherit;
25
+ margin: inherit;
26
+ }
27
+ }
@@ -0,0 +1,44 @@
1
+ .medium-editor-toolbar-form {
2
+ display: none;
3
+
4
+ input,
5
+ a {
6
+ font-family: $font-sans-serif;
7
+ }
8
+
9
+ .medium-editor-toolbar-form-row {
10
+ line-height: 14px;
11
+ margin-left: 5px;
12
+ padding-bottom: 5px;
13
+ }
14
+
15
+ .medium-editor-toolbar-input,
16
+ label {
17
+ border: none;
18
+ box-sizing: border-box;
19
+ font-size: 14px;
20
+ margin: 0;
21
+ padding: 6px;
22
+ width: 316px;
23
+ display: inline-block;
24
+
25
+ &:focus {
26
+ appearance: none;
27
+ border: none;
28
+ box-shadow: none;
29
+ outline: 0;
30
+ }
31
+ }
32
+
33
+ a {
34
+ display: inline-block;
35
+ font-size: 24px;
36
+ font-weight: bolder;
37
+ margin: 0 10px;
38
+ text-decoration: none;
39
+ }
40
+ }
41
+
42
+ .medium-editor-toolbar-form-active {
43
+ display: block;
44
+ }
@@ -0,0 +1,98 @@
1
+ %medium-toolbar-arrow {
2
+ border-style: solid;
3
+ content: '';
4
+ display: block;
5
+ height: 0;
6
+ left: 50%;
7
+ margin-left: -8px;
8
+ position: absolute;
9
+ width: 0;
10
+ }
11
+
12
+ .medium-toolbar-arrow-under:after {
13
+ @extend %medium-toolbar-arrow;
14
+ border-width: 8px 8px 0 8px;
15
+ }
16
+
17
+ .medium-toolbar-arrow-over:before {
18
+ @extend %medium-toolbar-arrow;
19
+ border-width: 0 8px 8px 8px;
20
+ top: -8px;
21
+ }
22
+
23
+ .medium-editor-toolbar {
24
+ font-family: $font-sans-serif;
25
+ font-size: 16px;
26
+ left: 0;
27
+ position: absolute;
28
+ top: 0;
29
+ visibility: hidden;
30
+ z-index: $z-toolbar;
31
+
32
+ ul {
33
+ margin: 0;
34
+ padding: 0;
35
+ }
36
+
37
+ li {
38
+ float: left;
39
+ list-style: none;
40
+ margin: 0;
41
+ padding: 0;
42
+
43
+ button {
44
+ box-sizing: border-box;
45
+ cursor: pointer;
46
+ display: block;
47
+ font-size: 14px;
48
+ line-height: 1.33;
49
+ margin: 0;
50
+ padding: 15px;
51
+ text-decoration: none;
52
+
53
+ &:focus {
54
+ outline: none;
55
+ }
56
+ }
57
+
58
+ .medium-editor-action-underline {
59
+ text-decoration: underline;
60
+ }
61
+
62
+ .medium-editor-action-pre {
63
+ font-family: $font-fixed;
64
+ font-size: 12px;
65
+ font-weight: 100;
66
+ padding: 15px 0;
67
+ }
68
+ }
69
+ }
70
+
71
+ .medium-editor-toolbar-active {
72
+ visibility: visible;
73
+ }
74
+
75
+ .medium-editor-sticky-toolbar {
76
+ position: fixed;
77
+ top: 1px;
78
+ }
79
+
80
+ .medium-editor-relative-toolbar {
81
+ position: relative;
82
+ }
83
+
84
+ .medium-editor-toolbar-active.medium-editor-stalker-toolbar {
85
+ animation: medium-editor-pop-upwards 160ms forwards linear;
86
+ }
87
+
88
+ .medium-editor-toolbar-actions {
89
+ @extend %clearfix;
90
+ }
91
+
92
+ .medium-editor-action-bold {
93
+ font-weight: bolder;
94
+ }
95
+
96
+ .medium-editor-action-italic {
97
+ font-style: italic;
98
+ }
@@ -0,0 +1,31 @@
1
+ @import "settings";
2
+ @import "animations/image-loading";
3
+ @import "animations/pop-upwards";
4
+ @import "components/anchor-preview";
5
+ @import "components/file-dragging";
6
+ @import "components/placeholder";
7
+ @import "components/toolbar";
8
+ @import "components/toolbar-form";
9
+ @import "util/clearfix";
10
+
11
+ // contenteditable rules
12
+ .medium-editor-element {
13
+ word-wrap: break-word;
14
+ min-height: 30px;
15
+
16
+ img {
17
+ max-width: 100%;
18
+ }
19
+
20
+ sub {
21
+ vertical-align: sub;
22
+ }
23
+
24
+ sup {
25
+ vertical-align: super;
26
+ }
27
+ }
28
+
29
+ .medium-editor-hidden {
30
+ display: none;
31
+ }