rails_simplemde_editor 0.0.1 → 0.0.3

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: edd2efb0f3475aac63637053b2d36da84e2c84a4d77596d8fc9501a7384b9411
4
- data.tar.gz: 6d3f5fa196e9565cd6bf89359099038a614e8f2980e1c8d978a94694b3d97b39
3
+ metadata.gz: 8747dce63e232869bc240e8551465956bad10de59bec58fb484ea51dfd842518
4
+ data.tar.gz: 5e5dc884025ca045d52e58e80f382b6732b3cecf12f73554c6342e47c02aff52
5
5
  SHA512:
6
- metadata.gz: cf4c09ee645ac3012c2c538d3443399e62a6b45fa26a003dbf0285ab888d141567c557878e6af012591dd35d9945371d8ae6302ce9ad3f732b4a275d9a34cf64
7
- data.tar.gz: 9c4985d5eb118ef5801d93dafc85dd7c2fc2307489519c6911950238315e89a6744f4fe78d3972a1d4486b5c66d7a422ab6b7fad11f4acd377e79a2ff63c9554
6
+ metadata.gz: 175b3caf1722134bea2ed2271e0db921a8b0b5cfbde6c2ee33eccfd5331b7323037ef67a0f5045a430d87b50a4585e0bfe53f3d8231847a85a29dfd38e15030c
7
+ data.tar.gz: 06722eb46d0af785adc834f47b16f7e3200a3e63298006ebad1266b2bfd518a042d6ea47c4370c91388279442f24b06b765ad3998e80aca53e04f130db5c10da
data/README.md CHANGED
@@ -1,14 +1,18 @@
1
- # RailsSimplemdeEditor
1
+ # RailsSimplemdeEditor [![Gem Version](https://badge.fury.io/rb/rails_simplemde_editor.svg)](https://badge.fury.io/rb/rails_simplemde_editor)
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rails_simplemde_editor`. To experiment with that code, run `bin/console` for an interactive prompt.
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
- TODO: Write usage instructions here
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/[USERNAME]/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.
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
- extraParams:
11
- owner_type: $(this).data('ownerType') || '',
12
- owner_id: $(this).data('ownerId') || ''
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)
@@ -1,3 +1,3 @@
1
1
  module RailsSimplemdeEditor
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.3"
3
3
  end
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.1
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-20 00:00:00.000000000 Z
11
+ date: 2018-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler