wysihtml5n-rails 0.0.3 → 0.0.4

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NWNmMjU4Mzc5NGJmOTgyODRiODQ3MjIzZmM3NzBjYWZjMWIzZDEwNg==
4
+ NWY5OGQxZmJlZmY0MDZiZWRlOTEzN2E0ZTQ2MjZjNjU1YTMwNTUwNA==
5
5
  data.tar.gz: !binary |-
6
- YzFiNzg5M2VjMGI0MjViYTY4NTA1NmQyMTg4MmNlNGEwYjM3MDA4MQ==
6
+ NDcyYjg2NTA3NTgyMWJjNGI0MjkwZThiN2ViMTNjOWEyMjkzZTkyNA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YjE3OWQxNGMyNzkwYTA2ODllOTQ1ZTRiYjg0OTU3ZTM4YWNmOWI2ZjQ3MWVj
10
- OTZiNWYwNGU4MzQ5M2ViZTc3YTk0NjU1NWM0OGExYWU1MzQ3MjQ0MTgxMTIz
11
- M2Y5NDFiODcxMzBmODJiMTljODA4NDJkNDcxZGZjYWU3MjgyMTc=
9
+ MGJhNWE1OTNiOWRiYWYwNTgyYjAyZjU3ZTMzZmY0ZjUwM2UzOTNiMWM0MmFi
10
+ YjQxN2M0OGRjZjc1MmE4YzljMjAzOWVjMDNkMWRmMjg1NTg4ZTcwMjJjN2U0
11
+ NDJkNzMxZmZhMDFmOTAzNDFhMTljODZkZTRmMTQ1M2M3MjJjOTE=
12
12
  data.tar.gz: !binary |-
13
- MWQ5NTA1YTYzZGQ1NTM4OWNiYTEzYzc3ZDI2NzI2MTgyYTkxNDZkMDg3NzE5
14
- OGM0Y2I1MWMzM2JjMzI3MDQwZDQ2YTE0ODAzOTU2MDc1N2UwZTE4MThhODVi
15
- MTIwOTAyNzFlNjA1MjNiMWE5MDUwNWRmMzlmYzc1MmY3N2E2MmU=
13
+ N2VlZWI3NGRmYjc0ZjgxY2EwMWUwZmU3M2MxYTgxZTQ4MzhjNTRiNzQ4Mzgz
14
+ NjFhY2Y0MWY5MmE4MmNjZWRiMDMwNzJhMDk2M2FkMTJjNjQ3OGJkMDVkZTM0
15
+ ZTljNzlkYTQ3OWY3OTAwMDM1YzQ5M2VmMjJhZmU0YzdhNzc2MTc=
data/README.md CHANGED
@@ -46,6 +46,23 @@ Finally, initialize the editor:
46
46
  $('.wysiwyg').wysiHTML5N();
47
47
  ```
48
48
 
49
+ You can pass options to editor
50
+
51
+ ```javascript
52
+ # use only some editor tools
53
+ $('.wysiwyg').wysiHTML5N({toolbar: ['h1', 'h2', 'h3', 'p', 'bold', 'italic']})
54
+ ```
55
+
56
+ ### Font Awesome 3 vs 4
57
+
58
+ By default gem uses Font Awesome 3 (`<i class="icon-bold"></i>`).
59
+
60
+ To initialize editor with Font Awesome 4 icon style (`<i class="fa fa-bold"></i>`) :
61
+
62
+ ```javascript
63
+ $('.wysiwyg').wysiHTML5N({icon_style: 'font_awesome_4'})
64
+ ```
65
+
49
66
  ## Dependencies
50
67
 
51
68
  Wysihtml5n-rails depends on:
@@ -54,4 +71,4 @@ Wysihtml5n-rails depends on:
54
71
  * Rails 3.1+
55
72
  * SASS
56
73
 
57
- The Twitter Bootstrap CSS file that's bundled with Wysihtml5n-rails only contains styles for forms and buttons. If you're already using Twitter Bootstrap in your application there's no need to require it again.
74
+ The Twitter Bootstrap CSS file that's bundled with Wysihtml5n-rails only contains styles for forms and buttons. If you're already using Twitter Bootstrap in your application there's no need to require it again.
@@ -1,5 +1,5 @@
1
1
  module Wysihtml5n
2
2
  module Rails
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
@@ -1,6 +1,8 @@
1
1
  # Configure Rails Environment
2
2
  ENV["RAILS_ENV"] = "test"
3
3
 
4
+ FileUtils.mkdir_p File.expand_path("../dummy/tmp/cache/assets", __FILE__)
5
+
4
6
  require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
7
  require "rails/test_help"
6
8
  require 'minitest/spec'
@@ -10,3 +12,4 @@ Rails.backtrace_cleaner.remove_silencers!
10
12
 
11
13
  # Load support files
12
14
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
15
+
@@ -627,18 +627,40 @@
627
627
  */
628
628
  var WysiHTML5N = function(textarea, options){
629
629
 
630
+ // font awesome v3 and v4 icon styles
631
+ var font_awesom_icons = {
632
+ font_awesome_3: {
633
+ bold: 'icon-bold',
634
+ italic: 'icon-italic',
635
+ ol: 'icon-list-ol',
636
+ ul: 'icon-list-ul',
637
+ insertLink: 'icon-link',
638
+ insertImage: 'icon-picture',
639
+ },
640
+ font_awesome_4: {
641
+ bold: 'fa fa-bold',
642
+ italic: 'fa fa-italic',
643
+ ol: 'fa fa-list-ol',
644
+ ul: 'fa fa-list-ul',
645
+ insertLink: 'fa fa-link',
646
+ insertImage: 'fa fa-image',
647
+ }
648
+ }
649
+
650
+ var toolbar_icon = font_awesom_icons[options['icon_style']]
651
+
630
652
  // define editor toolbar HTML components
631
653
  var toolbar = {
632
654
  h1: '<li data-wysihtml5-command="formatBlock" data-wysihtml5-command-value="h1" title="Insert headline 1" class="command btn">H1</li>',
633
655
  h2: '<li data-wysihtml5-command="formatBlock" data-wysihtml5-command-value="h2" title="Insert headline 2" class="command btn">H2</li>',
634
656
  h3: '<li data-wysihtml5-command="formatBlock" data-wysihtml5-command-value="h3" title="Insert headline 3" class="command btn">H3</li>',
635
657
  p: '<li data-wysihtml5-command="formatBlock" data-wysihtml5-command-value="p" title="Insert paragraph" class="command btn">P</li>',
636
- bold: '<li data-wysihtml5-command="bold" title="Make text bold (CTRL + B)" class="command btn"><i class="icon-bold"></i></li>',
637
- italic: '<li data-wysihtml5-command="italic" title="Make text italic (CTRL + I)" class="command btn"><i class="icon-italic"></i></li>',
638
- ol: '<li data-wysihtml5-command="insertOrderedList" title="Insert an ordered list" class="command btn"><i class="icon-list-ol"></i></li>',
639
- ul: '<li data-wysihtml5-command="insertUnorderedList" title="Insert an unordered list" class="command btn"><i class="icon-list-ul"></i></li>',
640
- insertLink: '<li data-wysihtml5-command="createLink" title="Insert a link" class="command btn"><i class="icon-link"></i></li>',
641
- insertImage: '<li data-wysihtml5-command="insertImage" title="Insert an image" class="command btn"><i class="icon-picture"></i></li>',
658
+ bold: '<li data-wysihtml5-command="bold" title="Make text bold (CTRL + B)" class="command btn"><i class="' + toolbar_icon['bold'] + '"></i></li>',
659
+ italic: '<li data-wysihtml5-command="italic" title="Make text italic (CTRL + I)" class="command btn"><i class="' + toolbar_icon['italic'] + '"></i></li>',
660
+ ol: '<li data-wysihtml5-command="insertOrderedList" title="Insert an ordered list" class="command btn"><i class="' + toolbar_icon['ol'] + '"></i></li>',
661
+ ul: '<li data-wysihtml5-command="insertUnorderedList" title="Insert an unordered list" class="command btn"><i class="' + toolbar_icon['ul'] + '"></i></li>',
662
+ insertLink: '<li data-wysihtml5-command="createLink" title="Insert a link" class="command btn"><i class="' + toolbar_icon['insertLink'] + '"></i></li>',
663
+ insertImage: '<li data-wysihtml5-command="insertImage" title="Insert an image" class="command btn"><i class="' + toolbar_icon['insertImage'] + '"></i></li>',
642
664
  changeView: '<li data-wysihtml5-action="change_view" title="Show HTML" class="action btn">&lt;/&gt;</li>',
643
665
  modals: {
644
666
  insertLink:'<div class="modal" data-wysihtml5-dialog="createLink" style="display: none;">' +
@@ -769,8 +791,9 @@
769
791
 
770
792
  $.fn.wysiHTML5N.defaults = {
771
793
  toolbar: [
772
- 'h1', 'h2', 'h3', 'p', 'bold', 'italic', 'unordered', 'ordered', 'insertLink', 'insertImage', 'changeView'
794
+ 'h1', 'h2', 'h3', 'p', 'bold', 'italic', 'ul', 'ol', 'insertLink', 'insertImage', 'changeView'
773
795
  ],
796
+ icon_style: 'font_awesome_3',
774
797
  stylesheets: [],
775
798
  parserRules: parserRules,
776
799
  imageEditor: {
@@ -780,4 +803,4 @@
780
803
  }
781
804
  }
782
805
 
783
- }(window.jQuery));
806
+ }(window.jQuery));
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wysihtml5n-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zohar Arad
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-08 00:00:00.000000000 Z
11
+ date: 2014-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sass-rails