rails_simplemde_editor 0.0.1 → 0.0.3
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: 8747dce63e232869bc240e8551465956bad10de59bec58fb484ea51dfd842518
|
4
|
+
data.tar.gz: 5e5dc884025ca045d52e58e80f382b6732b3cecf12f73554c6342e47c02aff52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 175b3caf1722134bea2ed2271e0db921a8b0b5cfbde6c2ee33eccfd5331b7323037ef67a0f5045a430d87b50a4585e0bfe53f3d8231847a85a29dfd38e15030c
|
7
|
+
data.tar.gz: 06722eb46d0af785adc834f47b16f7e3200a3e63298006ebad1266b2bfd518a042d6ea47c4370c91388279442f24b06b765ad3998e80aca53e04f130db5c10da
|
data/README.md
CHANGED
@@ -1,14 +1,18 @@
|
|
1
|
-
# RailsSimplemdeEditor
|
1
|
+
# RailsSimplemdeEditor [](https://badge.fury.io/rb/rails_simplemde_editor)
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
SimpleMDE is a simple, embeddable, and beautiful JS markdown editor, visit https://simplemde.com/ for details.
|
4
|
+
rails_simplemde_editor will helps your rails app integrate with simplemde, includes images uploading.
|
6
5
|
|
7
6
|
## Installation
|
8
7
|
|
8
|
+
### 1. Installation
|
9
|
+
|
9
10
|
Add this line to your application's Gemfile:
|
10
11
|
|
11
12
|
```ruby
|
13
|
+
gem 'jquery-rails'
|
14
|
+
gem 'carrierwave'
|
15
|
+
gem 'mini_magick'
|
12
16
|
gem 'rails_simplemde_editor'
|
13
17
|
```
|
14
18
|
|
@@ -20,9 +24,43 @@ Or install it yourself as:
|
|
20
24
|
|
21
25
|
$ gem install rails_simplemde_editor
|
22
26
|
|
27
|
+
### 2. Run generator:
|
28
|
+
|
29
|
+
```bash
|
30
|
+
rails g rails_simplemde_editor:install
|
31
|
+
```
|
32
|
+
Notice: rails_simplemde_editor needs applications.js/application.css in your project.
|
33
|
+
|
34
|
+
```bash
|
35
|
+
rails g rails_simplemde_editor:migration
|
36
|
+
```
|
37
|
+
|
23
38
|
## Usage
|
24
39
|
|
25
|
-
|
40
|
+
```erb
|
41
|
+
<%= f.text_area :body, data: {owner_type: f.object.class.to_s, owner_id: f.object.id }, class: 'rails_simplemde' %>
|
42
|
+
```
|
43
|
+
|
44
|
+
## Customize
|
45
|
+
|
46
|
+
Create file `config/initializers/rails_simplemde.rb`
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
# customize controller
|
50
|
+
Simplemde::AssetsController.class_eval do
|
51
|
+
# code
|
52
|
+
end
|
53
|
+
|
54
|
+
# customize asset uploader
|
55
|
+
Simplemde::AssetUploader.class_eval do
|
56
|
+
# code
|
57
|
+
end
|
58
|
+
|
59
|
+
# customize image uploader
|
60
|
+
Simplemde::ImageUploader.class_eval do
|
61
|
+
# code
|
62
|
+
end
|
63
|
+
```
|
26
64
|
|
27
65
|
## Development
|
28
66
|
|
@@ -32,7 +70,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
70
|
|
33
71
|
## Contributing
|
34
72
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
73
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/zhaoguobin/rails_simplemde_editor. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
74
|
|
37
75
|
## License
|
38
76
|
|
@@ -1,3 +1,11 @@
|
|
1
|
+
simplemdes = []
|
2
|
+
|
3
|
+
$(document).on 'turbolinks:before-cache', ->
|
4
|
+
simplemdes.forEach (simplemde) ->
|
5
|
+
simplemde.toTextArea()
|
6
|
+
simplemde = null
|
7
|
+
simplemdes = []
|
8
|
+
|
1
9
|
$(document).on 'turbolinks:load', ->
|
2
10
|
inlineAttachmentConfig =
|
3
11
|
uploadUrl: '/simplemde/upload.json',
|
@@ -7,9 +15,10 @@ $(document).on 'turbolinks:load', ->
|
|
7
15
|
$('.rails_simplemde').each ->
|
8
16
|
simplemde = new SimpleMDE({ element: this, forceSync: true })
|
9
17
|
configs =
|
10
|
-
|
11
|
-
|
12
|
-
|
18
|
+
extraParams:
|
19
|
+
owner_type: $(this).data('ownerType') || '',
|
20
|
+
owner_id: $(this).data('ownerId') || ''
|
13
21
|
|
14
22
|
configs = Object.assign(configs, inlineAttachmentConfig)
|
15
23
|
inlineAttachment.editors.codemirror4.attach(simplemde.codemirror, configs)
|
24
|
+
simplemdes.push(simplemde)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_simplemde_editor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zhao
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|