dante-editor 0.0.1

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.
Files changed (58) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +22 -0
  3. data/.travis.yml +4 -0
  4. data/Gemfile +23 -0
  5. data/Gemfile.lock +146 -0
  6. data/Procfile +1 -0
  7. data/README.md +129 -0
  8. data/TODO.md +45 -0
  9. data/bower.json +10 -0
  10. data/config.rb +82 -0
  11. data/config.ru +31 -0
  12. data/dante-editor.gemspec +19 -0
  13. data/lib/dante-editor.rb +3 -0
  14. data/lib/dante-editor/version.rb +5 -0
  15. data/license.md +22 -0
  16. data/rakefile +2 -0
  17. data/source/assets/fonts/fontello.eot +0 -0
  18. data/source/assets/fonts/fontello.svg +36 -0
  19. data/source/assets/fonts/fontello.ttf +0 -0
  20. data/source/assets/fonts/fontello.woff +0 -0
  21. data/source/assets/images/background.png +0 -0
  22. data/source/assets/images/icon-logo.png +0 -0
  23. data/source/assets/images/icon.png +0 -0
  24. data/source/assets/images/media-loading-placeholder.png +0 -0
  25. data/source/assets/images/middleman.png +0 -0
  26. data/source/assets/javascripts/all.js +3 -0
  27. data/source/assets/javascripts/dante.js +7 -0
  28. data/source/assets/javascripts/dante/dante.js.coffee.erb +7 -0
  29. data/source/assets/javascripts/dante/editor.js.coffee +917 -0
  30. data/source/assets/javascripts/dante/menu.js.coffee +202 -0
  31. data/source/assets/javascripts/dante/tooltip.js.coffee +302 -0
  32. data/source/assets/javascripts/dante/utils.js.coffee +235 -0
  33. data/source/assets/javascripts/dante/view.js.coffee +56 -0
  34. data/source/assets/javascripts/deps.js +4 -0
  35. data/source/assets/javascripts/spec.js +2 -0
  36. data/source/assets/javascripts/specs/cleaner.js.coffee +8 -0
  37. data/source/assets/javascripts/specs/dante_view.js.coffee +74 -0
  38. data/source/assets/javascripts/specs/editor.js.coffee +57 -0
  39. data/source/assets/stylesheets/all.css.scss +4 -0
  40. data/source/assets/stylesheets/dante.css.scss +3 -0
  41. data/source/assets/stylesheets/dante/base.css.scss +57 -0
  42. data/source/assets/stylesheets/dante/editor.css.scss +662 -0
  43. data/source/assets/stylesheets/dante/fonts.css.scss +106 -0
  44. data/source/assets/stylesheets/normalize.css +375 -0
  45. data/source/embeds.html.erb +29 -0
  46. data/source/index.html.erb +28 -0
  47. data/source/layouts/layout.erb +21 -0
  48. data/source/layouts/spec.html.erb +24 -0
  49. data/source/partials/_example_1.erb +30 -0
  50. data/source/partials/_example_2.erb +33 -0
  51. data/source/partials/_example_3.erb +17 -0
  52. data/source/partials/_readme.markdown +78 -0
  53. data/source/partials/test/_example_1.erb +18 -0
  54. data/source/readme.html.erb +28 -0
  55. data/source/tests/dante_view.html.erb +11 -0
  56. data/source/tests/index.html.erb +32 -0
  57. data/tmp/.gitkeep +0 -0
  58. metadata +99 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6de1fa4fbcebb4bfdea9ffec73648fe6a129e692
4
+ data.tar.gz: e15d6a670d5871b86148d52d6a4dfed42855baa1
5
+ SHA512:
6
+ metadata.gz: 50e79a22fdee6e1c8641815d65810851bc535ada073b3d6c629c0c4f739c9b5a94cf9890258b7ccc2524161ad694d71e3a47aa1a460e4435f4628ab9567c8e7c
7
+ data.tar.gz: 6971b66fec35c57e7909c2074c5b14063449714a47bfcdbdc94b3e190ceec1111727fd1bb15bacf7484b8d7d0d73cbecc098fbdb358e9ce3d7b55ccaa5bc7c3d
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ # See http://help.github.com/ignore-files/ for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile ~/.gitignore_global
6
+
7
+ # Ignore bundler config
8
+ /.bundle
9
+
10
+ # Ignore the build directory
11
+ /build
12
+
13
+ # Ignore Sass' cache
14
+ /.sass-cache
15
+
16
+ # Ignore .DS_store file
17
+ .DS_Store
18
+
19
+ /bower_components
20
+ /node_modules
21
+
22
+ /tmp/images/**/*
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ before_script:
2
+ - sudo npm install -g grunt
3
+
4
+ script: grunt test --verbose --force
data/Gemfile ADDED
@@ -0,0 +1,23 @@
1
+ # If you have OpenSSL installed, we recommend updating
2
+ # the following line to use "https"
3
+ source 'http://rubygems.org'
4
+
5
+ gem "therubyracer"
6
+ gem "middleman", "~>3.1.4"
7
+
8
+ # Live-reloading plugin
9
+ gem "middleman-livereload", "~> 3.1.0"
10
+ gem 'middleman-gh-pages'
11
+ # For faster file watcher updates on Windows:
12
+ gem "wdm", "~> 0.1.0", :platforms => [:mswin, :mingw]
13
+ gem "github-markup"
14
+ gem "redcarpet"
15
+ gem "sinatra"
16
+ gem "pry"
17
+
18
+ gemspec
19
+
20
+ # Cross-templating language block fix for Ruby 1.8
21
+ platforms :mri_18 do
22
+ gem "ruby18_source_location"
23
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,146 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ dante-editor (0.0.1)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+ activesupport (3.2.19)
10
+ i18n (~> 0.6, >= 0.6.4)
11
+ multi_json (~> 1.0)
12
+ chunky_png (1.3.1)
13
+ coderay (1.1.0)
14
+ coffee-script (2.2.0)
15
+ coffee-script-source
16
+ execjs
17
+ coffee-script-source (1.8.0)
18
+ compass (1.0.1)
19
+ chunky_png (~> 1.2)
20
+ compass-core (~> 1.0.1)
21
+ compass-import-once (~> 1.0.5)
22
+ rb-fsevent (>= 0.9.3)
23
+ rb-inotify (>= 0.9)
24
+ sass (>= 3.3.13, < 3.5)
25
+ compass-core (1.0.1)
26
+ multi_json (~> 1.0)
27
+ sass (>= 3.3.0, < 3.5)
28
+ compass-import-once (1.0.5)
29
+ sass (>= 3.2, < 3.5)
30
+ em-websocket (0.5.1)
31
+ eventmachine (>= 0.12.9)
32
+ http_parser.rb (~> 0.6.0)
33
+ eventmachine (1.0.3)
34
+ execjs (1.4.1)
35
+ multi_json (~> 1.0)
36
+ ffi (1.9.6)
37
+ github-markup (1.3.0)
38
+ posix-spawn (~> 0.3.8)
39
+ haml (4.0.5)
40
+ tilt
41
+ hike (1.2.3)
42
+ http_parser.rb (0.6.0)
43
+ i18n (0.6.11)
44
+ kramdown (1.4.2)
45
+ libv8 (3.16.14.7)
46
+ listen (1.3.1)
47
+ rb-fsevent (>= 0.9.3)
48
+ rb-inotify (>= 0.9)
49
+ rb-kqueue (>= 0.2)
50
+ method_source (0.8.2)
51
+ middleman (3.1.6)
52
+ coffee-script (~> 2.2.0)
53
+ compass (>= 0.12.2)
54
+ execjs (~> 1.4.0)
55
+ haml (>= 3.1.6)
56
+ kramdown (~> 1.2)
57
+ middleman-core (= 3.1.6)
58
+ middleman-more (= 3.1.6)
59
+ middleman-sprockets (>= 3.1.2)
60
+ sass (>= 3.1.20)
61
+ uglifier (~> 2.1.0)
62
+ middleman-core (3.1.6)
63
+ activesupport (~> 3.2.6)
64
+ bundler (~> 1.1)
65
+ i18n (~> 0.6.1)
66
+ listen (~> 1.1)
67
+ rack (>= 1.4.5)
68
+ rack-test (~> 0.6.1)
69
+ thor (>= 0.15.2, < 2.0)
70
+ tilt (~> 1.3.6)
71
+ middleman-gh-pages (0.0.3)
72
+ rake (> 0.9.3)
73
+ middleman-livereload (3.1.1)
74
+ em-websocket (>= 0.2.0)
75
+ middleman-core (>= 3.0.2)
76
+ multi_json (~> 1.0)
77
+ rack-livereload
78
+ middleman-more (3.1.6)
79
+ middleman-sprockets (3.1.4)
80
+ middleman-core (>= 3.0.14)
81
+ middleman-more (>= 3.0.14)
82
+ sprockets (~> 2.1)
83
+ sprockets-helpers (~> 1.0.0)
84
+ sprockets-sass (~> 1.0.0)
85
+ multi_json (1.10.1)
86
+ posix-spawn (0.3.9)
87
+ pry (0.10.0)
88
+ coderay (~> 1.1.0)
89
+ method_source (~> 0.8.1)
90
+ slop (~> 3.4)
91
+ rack (1.5.2)
92
+ rack-livereload (0.3.15)
93
+ rack
94
+ rack-protection (1.5.3)
95
+ rack
96
+ rack-test (0.6.2)
97
+ rack (>= 1.0)
98
+ rake (10.3.2)
99
+ rb-fsevent (0.9.4)
100
+ rb-inotify (0.9.5)
101
+ ffi (>= 0.5.0)
102
+ rb-kqueue (0.2.3)
103
+ ffi (>= 0.5.0)
104
+ redcarpet (3.2.0)
105
+ ref (1.0.5)
106
+ ruby18_source_location (0.2)
107
+ sass (3.4.6)
108
+ sinatra (1.4.5)
109
+ rack (~> 1.4)
110
+ rack-protection (~> 1.4)
111
+ tilt (~> 1.3, >= 1.3.4)
112
+ slop (3.5.0)
113
+ sprockets (2.12.2)
114
+ hike (~> 1.2)
115
+ multi_json (~> 1.0)
116
+ rack (~> 1.0)
117
+ tilt (~> 1.1, != 1.3.0)
118
+ sprockets-helpers (1.0.1)
119
+ sprockets (~> 2.0)
120
+ sprockets-sass (1.0.3)
121
+ sprockets (~> 2.0)
122
+ tilt (~> 1.1)
123
+ therubyracer (0.12.1)
124
+ libv8 (~> 3.16.14.0)
125
+ ref
126
+ thor (0.19.1)
127
+ tilt (1.3.7)
128
+ uglifier (2.1.2)
129
+ execjs (>= 0.3.0)
130
+ multi_json (~> 1.0, >= 1.0.2)
131
+
132
+ PLATFORMS
133
+ ruby
134
+
135
+ DEPENDENCIES
136
+ dante-editor!
137
+ github-markup
138
+ middleman (~> 3.1.4)
139
+ middleman-gh-pages
140
+ middleman-livereload (~> 3.1.0)
141
+ pry
142
+ redcarpet
143
+ ruby18_source_location
144
+ sinatra
145
+ therubyracer
146
+ wdm (~> 0.1.0)
data/Procfile ADDED
@@ -0,0 +1 @@
1
+ app: bundle exec rackup config.ru
data/README.md ADDED
@@ -0,0 +1,129 @@
1
+ #Dante Editor
2
+
3
+ ####Just another Medium editor clone.
4
+
5
+ ##Motivation:
6
+
7
+ I´ve tried all the medium clones out there, they are really great and all have it´s pros & cons, but none of them have all the features that medium wysywig provides, so I wonder, how difficult could be build my own Medium clone?
8
+
9
+ Until now I´ve been able to implement the following features:
10
+
11
+ ## Features:
12
+
13
+ + HTML sanitizer when paste text or initial load.
14
+ + Image formatting/upload for paste events.
15
+ + Add an unique name to elements on page.
16
+ + Implementation of the famous tooltip on each paragraph when selected
17
+ + Tab navigation.
18
+ + Embeds:
19
+ + Image Uploader with *preview* and caption option.
20
+ + Embed data for pasted link through OEmbed services.
21
+ + Embed media information for pasted links through OEmbed services.
22
+ + CSS tries to use the same fonts used in Medium, if you have setup those fonts, or fallbacks to open fonts (by Google fonts) or system fonts.
23
+ + serif: freight-text-pro fallbacks to Merriweather or Georgia,
24
+ + sans: jaf-bernino-sans fallbacks to Open Sans or Lucida Grande
25
+
26
+ ## Demo:
27
+
28
+ [http://michelson.github.io/Dante/](http://michelson.github.io/Dante/)
29
+
30
+ ## Usage:
31
+
32
+ ### HTML:
33
+
34
+ ```html
35
+ <div id="editor">
36
+ your content here
37
+ </div>
38
+ ```
39
+
40
+ ### Javascript:
41
+
42
+ ```html
43
+ <script type="text/javascript">
44
+ editor = new Dante.Editor(
45
+ {
46
+ el: "#editor",
47
+ upload_url: "/images.json", //it expect an url string in response like /your/server/image.jpg or http://app.com/images/image.jpg
48
+ store_url: "/save" //post to save
49
+
50
+ }
51
+ );
52
+ editor.start()
53
+ </script>
54
+ ```
55
+
56
+ ### Configuration options:
57
+
58
+ el: default: #editor
59
+ debugMode: default: false
60
+ upload_url: default: /uploads.json
61
+ oembed_url: default: http://api.embed.ly/1/oembed?url="
62
+ extract_url: default: http://api.embed.ly/1/extract?url="
63
+
64
+ ### Rails / AssetPippeline
65
+
66
+ in Gemfile
67
+
68
+ ```gem "dante-editor"```
69
+
70
+ ### stylesheets:
71
+
72
+ ```@import "dante";```
73
+
74
+ ### javascripts:
75
+
76
+ ```//= require 'dante'```
77
+
78
+ ## Disclaimer:
79
+
80
+ This Library will work on early versions of Chrome/Safari/FF/IE.
81
+ I don't have any intentions to target all browsers versions, really... if you like this library and need backwards support for an specific version you can submit a patch to help with the development or just upgrade your shitty browser :D
82
+
83
+ ## Dependencies:
84
+
85
+ Some dependencies are required in order to Dante editor to work propperly:
86
+
87
+ + Jquery
88
+ + [Underscore](https://github.com/documentcloud/underscore)
89
+ + [Sanitize.js](https://github.com/gbirke/sanitize.js)
90
+
91
+
92
+ drop underscore and jquery dependencies is on the roadmap.
93
+
94
+
95
+ ## Development:
96
+
97
+ There is a development web app middleman/sinatra to work with the source files and make the proper tests.
98
+ To use application:
99
+
100
+ ### Installation:
101
+
102
+ + install ruby
103
+ + execute `bundle install`
104
+
105
+ ### Start app:
106
+
107
+ `bundle exec rackup config.ru` and visit http://localhost:9292
108
+
109
+ or
110
+
111
+ `bundle exec middleman ` (this is without upload server)
112
+ and visit localhost:4567
113
+
114
+ or
115
+
116
+ `foreman start` and visit http://localhost:9292
117
+
118
+ ### Tests:
119
+
120
+ tests are located in source/tests and /source/assets/spec folder and accessible by visit host/tests
121
+
122
+ ## TODO
123
+
124
+ [read todo](./TODO.md)
125
+
126
+
127
+ ### LICENSE
128
+
129
+ Miguel Michelson Martinez [Licensed under MIT.](./license.md) 2014
data/TODO.md ADDED
@@ -0,0 +1,45 @@
1
+
2
+ #TODO:
3
+
4
+ + GENERALS
5
+ + FF in case markup breaks (like linebreak with br or unwraped text when typing) just rewrap from current range.
6
+
7
+ + SANITIZE PROCESS:
8
+ + childs links inside first level elements clean & add classes ie
9
+
10
+ a target="_blank" href="#" data-href="#" class="markup--anchor markup--p-anchor" data-tooltip="#" data-tooltip-position="bottom" data-tooltip-type="link">example link</a>
11
+
12
+ + MENU
13
+ + Filter inner tags (except a, b, i ... ) when convert to blockquote
14
+
15
+ + DELETE
16
+
17
+ + handle remove from PRE tag, it set rare span, just remove it
18
+ + clean node when remove one
19
+
20
+ + IMAGES:
21
+
22
+ + upload, show progress, complete
23
+ + handle enter (linebreak) when selected in caption (build new P)
24
+ + Fix problem in FF when linebreak or arrow down to new P , is typing backwards!! (could be a range 1 char problem ?)
25
+
26
+ + EMBEDS:
27
+ + fix navigation arrows when up or down through them
28
+ + problem FF when linebreak or arrow down to new P , is typing backwards!! (could be a range 1 char problem ?)
29
+
30
+ + SUBMIT:
31
+ get clean version of content
32
+
33
+
34
+ ## ROADMAP
35
+
36
+ + 0.0.5
37
+ + TODO LIST COMPLETE!
38
+ + 0.1.0
39
+ + implement layout changes on embeds & uploads.
40
+ + 0.2.0
41
+ + implement creation of new sections
42
+ + 1.0.0
43
+ + use Rangy for better selection & range support.
44
+
45
+
data/bower.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "name" : "dante",
3
+ "version" : "0.0.1",
4
+ "main" : "dante.js",
5
+ "dependencies" : {
6
+ "jquery": "*",
7
+ "underscore" : "*",
8
+ "sanitize.js" : "*",
9
+ }
10
+ }
data/config.rb ADDED
@@ -0,0 +1,82 @@
1
+ ###
2
+ # Compass
3
+ ###
4
+
5
+ # Change Compass configuration
6
+ # compass_config do |config|
7
+ # config.output_style = :compact
8
+ # end
9
+
10
+ ###
11
+ # Page options, layouts, aliases and proxies
12
+ ###
13
+
14
+ # Per-page layout changes:
15
+ #
16
+ # With no layout
17
+ # page "/path/to/file.html", :layout => false
18
+ #
19
+ # With alternative layout
20
+ # page "/path/to/file.html", :layout => :otherlayout
21
+ #
22
+ # A path which all have the same layout
23
+ # with_layout :admin do
24
+ # page "/admin/*"
25
+ # end
26
+
27
+ # Proxy pages (http://middlemanapp.com/dynamic-pages/)
28
+ # proxy "/this-page-has-no-template.html", "/template-file.html", :locals => {
29
+ # :which_fake_page => "Rendering a fake page with a local variable" }
30
+
31
+ ###
32
+ # Helpers
33
+ ###
34
+
35
+ # Automatic image dimensions on image_tag helper
36
+ # activate :automatic_image_sizes
37
+
38
+ # Reload the browser automatically whenever files change
39
+ # activate :livereload
40
+
41
+ # Methods defined in the helpers block are available in templates
42
+ # helpers do
43
+ # def some_helper
44
+ # "Helping"
45
+ # end
46
+ # end
47
+
48
+ set :css_dir, 'assets/stylesheets'
49
+
50
+ set :js_dir, 'assets/javascripts'
51
+
52
+ set :images_dir, 'assets/images'
53
+
54
+ set :fonts_dir, 'assets/fonts'
55
+
56
+ #set :markdown_engine, :redcarpet
57
+ set :markdown_engine, :kramdown
58
+
59
+ page "/tests/*", :layout => "spec"
60
+
61
+ sprockets.append_path File.join "#{root}", "bower_components"
62
+
63
+ # Build-specific configuration
64
+ configure :build do
65
+ # For example, change the Compass output style for deployment
66
+ # activate :minify_css
67
+
68
+ # Minify Javascript on build
69
+ # activate :minify_javascript
70
+
71
+ # Enable cache buster
72
+ # activate :asset_hash
73
+
74
+ activate :relative_assets
75
+ set :relative_links, true
76
+
77
+ # Use relative URLs
78
+ # activate :relative_assets
79
+
80
+ # Or use a different image path
81
+ # set :http_path, "/Content/images/"
82
+ end