administrate-field-simple_markdown 0.4.0.rc2 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +39 -14
- data/README.md +20 -2
- data/administrate-field-simple_markdown.gemspec +2 -2
- data/app/views/fields/simple_markdown/_form.html.erb +11 -6
- data/lib/administrate/field/simple_markdown.rb +6 -0
- data/spec/lib/administrate/field/simple_markdown_spec.rb +30 -1
- data/yarn.lock +3 -3
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ac5590e3fc0de4e9b1fcb2746b90319e488ee39f3b7921ccdff153766e7e271
|
4
|
+
data.tar.gz: 5c30b3b2a6b6530d1e0c16d37b93446392eb594e39b7cb6f2b2e6aebfea44eb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 92a52d9d15d2f3ef988b44b3eaa64df91b4b3bfdae4ee8dff8de091f44d23b870ccd33d11179fb12483459c59315c6952706687942bc9997c098ade7a0451f6e
|
7
|
+
data.tar.gz: 4703137b3aec0490b9a2ed1e3cf19b2b68d6dbc276c729376a2e97a25085d04611fbba2d7fb0281b85b29432c992883b890ff8881777ddbc35643af828b42507
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.7.
|
1
|
+
2.7.5
|
data/CHANGELOG.md
CHANGED
@@ -1,63 +1,88 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v0.7.0](https://github.com/zooppa/administrate-field-simple_markdown/tree/v0.7.0) (2020-01-06)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/zooppa/administrate-field-simple_markdown/compare/v0.6.0...v0.7.0)
|
6
|
+
|
7
|
+
- Add support for Rails 7 (thanks @neumayr)
|
8
|
+
|
9
|
+
## [v0.6.0](https://github.com/zooppa/administrate-field-simple_markdown/tree/v0.6.0) (2020-07-01)
|
10
|
+
|
11
|
+
[Full Changelog](https://github.com/zooppa/administrate-field-simple_markdown/compare/v0.5.0...v0.6.0)
|
12
|
+
|
13
|
+
- Support nonce for Content Security Policy (thanks @parterburn)
|
14
|
+
|
15
|
+
## [v0.5.0](https://github.com/zooppa/administrate-field-simple_markdown/tree/v0.5.0) (2020-05-28)
|
16
|
+
|
17
|
+
[Full Changelog](https://github.com/zooppa/administrate-field-simple_markdown/compare/v0.4.0...v0.5.0)
|
18
|
+
|
19
|
+
- Add support for full EasyMDE configuration (thanks @hernanvicente)
|
20
|
+
|
21
|
+
## [v0.4.0](https://github.com/zooppa/administrate-field-simple_markdown/tree/v0.4.0) (2020-05-28)
|
22
|
+
|
23
|
+
[Full Changelog](https://github.com/zooppa/administrate-field-simple_markdown/compare/v0.3.0...v0.4.0)
|
24
|
+
|
25
|
+
- Revert initialization logic to HTML ID. This won’t be compatible with other
|
26
|
+
Administrate plugin (e.g. Administrate::Field::NestedHasMany)
|
27
|
+
- Switch to EasyMDE (thanks @casaper)
|
28
|
+
|
3
29
|
## [v0.3.0](https://github.com/zooppa/administrate-field-simple_markdown/tree/v0.3.0) (2020-03-16)
|
4
30
|
|
5
31
|
[Full Changelog](https://github.com/zooppa/administrate-field-simple_markdown/compare/v0.2.1...v0.3.0)
|
6
32
|
|
7
|
-
|
8
|
-
|
9
|
-
|
33
|
+
- Support namespaced models and injected fields (thanks @sedubois)
|
34
|
+
- Add support for Redcarpet options (thanks @casaper)
|
10
35
|
|
11
36
|
## [v0.2.1](https://github.com/zooppa/administrate-field-simple_markdown/tree/v0.2.1) (2019-01-15)
|
12
37
|
|
13
38
|
[Full Changelog](https://github.com/zooppa/administrate-field-simple_markdown/compare/v0.2.0...v0.2.1)
|
14
39
|
|
15
|
-
|
40
|
+
- Require Rack greater than 2.0.8
|
16
41
|
|
17
42
|
## [v0.2.0](https://github.com/zooppa/administrate-field-simple_markdown/tree/v0.2.0) (2018-08-27)
|
18
43
|
|
19
44
|
[Full Changelog](https://github.com/zooppa/administrate-field-simple_markdown/compare/v0.1.2...v0.2.0)
|
20
45
|
|
21
|
-
|
46
|
+
- Update the requirements on Rails to permit the latest version
|
22
47
|
|
23
48
|
## [v0.1.2](https://github.com/zooppa/administrate-field-simple_markdown/tree/v0.1.2) (2018-05-24)
|
24
49
|
|
25
50
|
[Full Changelog](https://github.com/zooppa/administrate-field-simple_markdown/compare/v0.1.1...v0.1.2)
|
26
51
|
|
27
|
-
|
52
|
+
- Use snakecase when generating ID (thanks @golmansax)
|
28
53
|
|
29
54
|
## [v0.1.1](https://github.com/zooppa/administrate-field-simple_markdown/tree/v0.1.1) (2018-03-09)
|
30
55
|
|
31
56
|
[Full Changelog](https://github.com/zooppa/administrate-field-simple_markdown/compare/v0.1.0...v0.1.1)
|
32
57
|
|
33
|
-
|
58
|
+
- Restore list styles for Markdown elements (thanks @pedantic-git)
|
34
59
|
|
35
60
|
## [v0.1.0](https://github.com/zooppa/administrate-field-simple_markdown/tree/v0.1.0) (2018-01-23)
|
36
61
|
|
37
62
|
[Full Changelog](https://github.com/zooppa/administrate-field-simple_markdown/compare/v0.0.4...v0.1.0)
|
38
63
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
64
|
+
- Require Redcarpet
|
65
|
+
- Add RSpec and tests
|
66
|
+
- Handle null data
|
67
|
+
- Update documentation
|
43
68
|
|
44
69
|
## [v0.0.4](https://github.com/zooppa/administrate-field-simple_markdown/tree/v0.0.4) (2017-04-03)
|
45
70
|
|
46
71
|
[Full Changelog](https://github.com/zooppa/administrate-field-simple_markdown/compare/v0.0.3...v0.0.4)
|
47
72
|
|
48
|
-
|
73
|
+
- Bump up Administrate dependency
|
49
74
|
|
50
75
|
## [v0.0.3](https://github.com/zooppa/administrate-field-simple_markdown/tree/v0.0.3) (2017-03-20)
|
51
76
|
|
52
77
|
[Full Changelog](https://github.com/zooppa/administrate-field-simple_markdown/compare/v0.0.2...v0.0.3)
|
53
78
|
|
54
|
-
|
79
|
+
- Bump up Administrate dependency
|
55
80
|
|
56
81
|
## [v0.0.2](https://github.com/zooppa/administrate-field-simple_markdown/tree/v0.0.2) (2016-11-22)
|
57
82
|
|
58
83
|
[Full Changelog](https://github.com/zooppa/administrate-field-simple_markdown/compare/v0.0.1...v0.0.2)
|
59
84
|
|
60
|
-
|
85
|
+
- Bump up Administrate dependency
|
61
86
|
|
62
87
|
## [v0.0.1](https://github.com/zooppa/administrate-field-simple_markdown/tree/v0.0.1) (2016-11-16)
|
63
88
|
|
data/README.md
CHANGED
@@ -7,12 +7,22 @@ A plugin to edit Markdown text in [Administrate] using [EasyMDE].
|
|
7
7
|
|
8
8
|
![Demo](https://raw.githubusercontent.com/zooppa/administrate-field-simple_markdown/master/demo.gif)
|
9
9
|
|
10
|
+
---
|
11
|
+
|
12
|
+
### IMPORTANT NOTICE
|
13
|
+
|
14
|
+
**This gem is not actively maintained anymore**.
|
15
|
+
|
16
|
+
If you’re interested in taking over and steward the project moving forward, please get in touch.
|
17
|
+
|
18
|
+
---
|
19
|
+
|
10
20
|
## Usage
|
11
21
|
|
12
22
|
Add it to your `Gemfile`:
|
13
23
|
|
14
24
|
```ruby
|
15
|
-
gem 'administrate-field-simple_markdown', '~> 0.
|
25
|
+
gem 'administrate-field-simple_markdown', '~> 0.7.0'
|
16
26
|
```
|
17
27
|
|
18
28
|
Run:
|
@@ -36,11 +46,19 @@ ATTRIBUTE_TYPES = {
|
|
36
46
|
no_intra_emphasis: true,
|
37
47
|
strikethrough: true,
|
38
48
|
highlight: true,
|
39
|
-
space_after_headers: true
|
49
|
+
space_after_headers: true,
|
50
|
+
easymde_options: {
|
51
|
+
placeholder: 'Type here...',
|
52
|
+
spell_checker: false,
|
53
|
+
hide_icons: %w[guide heading]
|
54
|
+
}
|
40
55
|
})
|
41
56
|
}.freeze
|
42
57
|
```
|
43
58
|
|
59
|
+
You can pass EasyMDE a configuration object via the `easymde_options` option.
|
60
|
+
Check the [full list of available options](https://github.com/Ionaru/easy-markdown-editor#options-list).
|
61
|
+
|
44
62
|
## About
|
45
63
|
|
46
64
|
Administrate::Field::SimpleMarkdown is maintained by [Zooppa].
|
@@ -2,7 +2,7 @@ $:.push File.expand_path('../lib', __FILE__)
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = 'administrate-field-simple_markdown'
|
5
|
-
gem.version = '0.
|
5
|
+
gem.version = '0.7.0'
|
6
6
|
gem.authors = ['Zooppa']
|
7
7
|
gem.email = ['dev@zooppa.com']
|
8
8
|
gem.homepage = 'https://github.com/zooppa/administrate-field-simple_markdown'
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
16
|
|
17
17
|
gem.add_runtime_dependency 'administrate', '< 1.0.0'
|
18
|
-
gem.add_runtime_dependency 'rails', '>= 4.2', '<
|
18
|
+
gem.add_runtime_dependency 'rails', '>= 4.2', '< 8'
|
19
19
|
gem.add_runtime_dependency 'redcarpet', '~> 3.3'
|
20
20
|
gem.add_runtime_dependency 'rack', '~> 2.0', '>= 2.0.8'
|
21
21
|
|
@@ -15,14 +15,19 @@ This partial renders a WYSIWYG text area to help writing Markdown text
|
|
15
15
|
<%= f.label field.attribute %>
|
16
16
|
</div>
|
17
17
|
<div class="field-unit__field simple_markdown">
|
18
|
-
<%= f.text_area field.attribute
|
18
|
+
<%= f.text_area field.attribute,
|
19
|
+
data: {
|
20
|
+
easymde_options: field.easymde_options
|
21
|
+
}
|
22
|
+
%>
|
19
23
|
</div>
|
20
24
|
<%= content_for :javascript do %>
|
21
|
-
|
25
|
+
<%= javascript_tag nonce: true do %>
|
22
26
|
$(function() {
|
23
|
-
|
24
|
-
|
25
|
-
|
27
|
+
var el = document.getElementById('<%= field.html_id %>')
|
28
|
+
var options = JSON.parse(el.getAttribute('data-easymde-options'));
|
29
|
+
|
30
|
+
new EasyMDE(Object.assign({}, { element: el }, options));
|
26
31
|
});
|
27
|
-
|
32
|
+
<%- end %>
|
28
33
|
<% end %>
|
@@ -16,6 +16,12 @@ module Administrate
|
|
16
16
|
@data || ''
|
17
17
|
end
|
18
18
|
|
19
|
+
def easymde_options
|
20
|
+
options.fetch(:easymde_options, {})
|
21
|
+
.transform_keys { |key| key.to_s.camelize(:lower) }
|
22
|
+
.to_json
|
23
|
+
end
|
24
|
+
|
19
25
|
def to_html
|
20
26
|
markdown(html_renderer).render(data).html_safe
|
21
27
|
end
|
@@ -1,11 +1,14 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Administrate::Field::SimpleMarkdown do
|
4
|
-
subject {
|
4
|
+
subject { described_class.new(:simple_markdown, data, :show) }
|
5
5
|
|
6
6
|
let(:md) { '**foo** is the new _bar_' }
|
7
7
|
let(:text) { 'foo is the new bar' }
|
8
8
|
let(:html) { '<p><strong>foo</strong> is the new <em>bar</em></p>' }
|
9
|
+
let(:options) { {} }
|
10
|
+
|
11
|
+
before { allow(subject).to receive(:options).and_return(options) }
|
9
12
|
|
10
13
|
describe '#data' do
|
11
14
|
let(:output) { subject.data }
|
@@ -27,6 +30,32 @@ describe Administrate::Field::SimpleMarkdown do
|
|
27
30
|
end
|
28
31
|
end
|
29
32
|
|
33
|
+
describe '#easymde_options' do
|
34
|
+
let(:output) { subject.easymde_options }
|
35
|
+
let(:data) { text }
|
36
|
+
|
37
|
+
context 'with nil' do
|
38
|
+
it 'returns an empty hash' do
|
39
|
+
expect(output).to eq "{}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'with valid options' do
|
44
|
+
let(:options) do
|
45
|
+
{
|
46
|
+
easymde_options: {
|
47
|
+
placeholder: 'Type here...',
|
48
|
+
hide_icons: ['foo', 'bar']
|
49
|
+
}
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'returns the data' do
|
54
|
+
expect(output).to eq '{"placeholder":"Type here...","hideIcons":["foo","bar"]}'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
30
59
|
describe '#to_s' do
|
31
60
|
let(:output) { subject.to_s }
|
32
61
|
|
data/yarn.lock
CHANGED
@@ -10,9 +10,9 @@ codemirror-spell-checker@1.1.2:
|
|
10
10
|
typo-js "*"
|
11
11
|
|
12
12
|
codemirror@^5.52.2:
|
13
|
-
version "5.
|
14
|
-
resolved "https://registry.yarnpkg.com/codemirror/-/codemirror-5.
|
15
|
-
integrity sha512-
|
13
|
+
version "5.61.0"
|
14
|
+
resolved "https://registry.yarnpkg.com/codemirror/-/codemirror-5.61.0.tgz#318e5b034a707207948b92ffc2862195e8fdb08e"
|
15
|
+
integrity sha512-D3wYH90tYY1BsKlUe0oNj2JAhQ9TepkD51auk3N7q+4uz7A/cgJ5JsWHreT0PqieW1QhOuqxQ2reCXV1YXzecg==
|
16
16
|
|
17
17
|
easymde@^2.10.1:
|
18
18
|
version "2.10.1"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: administrate-field-simple_markdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zooppa
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: administrate
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: '4.2'
|
34
34
|
- - "<"
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: '
|
36
|
+
version: '8'
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '4.2'
|
44
44
|
- - "<"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '8'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: redcarpet
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -140,7 +140,7 @@ homepage: https://github.com/zooppa/administrate-field-simple_markdown
|
|
140
140
|
licenses:
|
141
141
|
- MIT
|
142
142
|
metadata: {}
|
143
|
-
post_install_message:
|
143
|
+
post_install_message:
|
144
144
|
rdoc_options: []
|
145
145
|
require_paths:
|
146
146
|
- lib
|
@@ -151,12 +151,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
151
151
|
version: '0'
|
152
152
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
153
|
requirements:
|
154
|
-
- - "
|
154
|
+
- - ">="
|
155
155
|
- !ruby/object:Gem::Version
|
156
|
-
version:
|
156
|
+
version: '0'
|
157
157
|
requirements: []
|
158
|
-
rubygems_version: 3.1.
|
159
|
-
signing_key:
|
158
|
+
rubygems_version: 3.1.6
|
159
|
+
signing_key:
|
160
160
|
specification_version: 4
|
161
161
|
summary: Markdown editor for Administrate
|
162
162
|
test_files:
|