wysihat-engine 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/.gitignore +1 -0
  2. data/CHANGELOG +17 -0
  3. data/README.textile +6 -2
  4. data/Rakefile +21 -4
  5. data/TODO +3 -1
  6. data/VERSION +1 -1
  7. data/app/controllers/wysihat_files_controller.rb +1 -0
  8. data/generators/wysihat/templates/css/facebox.css +43 -78
  9. data/generators/wysihat/templates/css/wysihat.css +29 -57
  10. data/generators/wysihat/templates/images/{b.png → facebox/b.png} +0 -0
  11. data/generators/wysihat/templates/images/{bl.png → facebox/bl.png} +0 -0
  12. data/generators/wysihat/templates/images/{br.png → facebox/br.png} +0 -0
  13. data/generators/wysihat/templates/images/{closelabel.gif → facebox/closelabel.gif} +0 -0
  14. data/generators/wysihat/templates/images/{loading.gif → facebox/loading.gif} +0 -0
  15. data/generators/wysihat/templates/images/{tl.png → facebox/tl.png} +0 -0
  16. data/generators/wysihat/templates/images/{tr.png → facebox/tr.png} +0 -0
  17. data/generators/wysihat/templates/images/{arrow_redo.png → icons/arrow_redo.png} +0 -0
  18. data/generators/wysihat/templates/images/{arrow_undo.png → icons/arrow_undo.png} +0 -0
  19. data/generators/wysihat/templates/images/{exclamation.png → icons/exclamation.png} +0 -0
  20. data/generators/wysihat/templates/images/{image.png → icons/image.png} +0 -0
  21. data/generators/wysihat/templates/images/{link.png → icons/link.png} +0 -0
  22. data/generators/wysihat/templates/images/{page_code.png → icons/page_code.png} +0 -0
  23. data/generators/wysihat/templates/images/{text_align_center.png → icons/text_align_center.png} +0 -0
  24. data/generators/wysihat/templates/images/{text_align_left.png → icons/text_align_left.png} +0 -0
  25. data/generators/wysihat/templates/images/{text_align_right.png → icons/text_align_right.png} +0 -0
  26. data/generators/wysihat/templates/images/{text_bold.png → icons/text_bold.png} +0 -0
  27. data/generators/wysihat/templates/images/{text_italic.png → icons/text_italic.png} +0 -0
  28. data/generators/wysihat/templates/images/{text_list_bullets.png → icons/text_list_bullets.png} +0 -0
  29. data/generators/wysihat/templates/images/{text_list_numbers.png → icons/text_list_numbers.png} +0 -0
  30. data/generators/wysihat/templates/images/{text_strikethrough.png → icons/text_strikethrough.png} +0 -0
  31. data/generators/wysihat/templates/images/{text_underline.png → icons/text_underline.png} +0 -0
  32. data/generators/wysihat/templates/javascripts/facebox.js +8 -18
  33. data/generators/wysihat/templates/javascripts/wysihat.js +2 -27
  34. data/generators/wysihat/templates/javascripts/wysihat_engine.js +38 -60
  35. data/generators/wysihat/templates/javascripts/wysihat_engine_pack.js +1 -1
  36. data/generators/wysihat/templates/sass/facebox.sass +5 -5
  37. data/generators/wysihat/templates/sass/wysihat.sass +18 -14
  38. data/generators/wysihat/wysihat_generator.rb +24 -27
  39. data/lib/wysihat-engine.rb +12 -17
  40. data/wysihat-engine.gemspec +29 -36
  41. metadata +27 -34
  42. data/generators/wysihat/templates/css/.sass-cache/242b5853f919a8e6346032f619374fe0847bac7b/facebox.cssc +0 -0
  43. data/generators/wysihat/templates/css/.sass-cache/242b5853f919a8e6346032f619374fe0847bac7b/wysihat.cssc +0 -0
  44. data/generators/wysihat/templates/images/film.png +0 -0
  45. data/generators/wysihat/templates/images/page_white_flash.png +0 -0
  46. data/generators/wysihat/templates/images/text_heading_1.png +0 -0
  47. data/generators/wysihat/templates/images/text_heading_2.png +0 -0
  48. data/generators/wysihat/templates/images/text_heading_3.png +0 -0
data/.gitignore CHANGED
@@ -1,5 +1,6 @@
1
1
  *.sw?
2
2
  .DS_Store
3
+ .sass-cache
3
4
  coverage
4
5
  rdoc
5
6
  pkg
data/CHANGELOG CHANGED
@@ -1,3 +1,20 @@
1
+ 0.1.7 (November 6th, 2009) - Jeff Kreeftmeijer
2
+ * Toolbar didn't show up in IE. Fixed :)
3
+
4
+ 0.1.7 (November 1st, 2009) - Jeff Kreeftmeijer
5
+ * added the exclamation.png icon back in the generator.
6
+
7
+ 0.1.7 (October 28th, 2009) - Jeff Kreeftmeijer
8
+ * fixed a bug in the generator; it copied "loading.gif" to "loading.png". Thanks Eric!
9
+ * two functions in the rakefile were called cssify. One should've been called sassify. fixed :)
10
+ * added "render :layout => false" to WysihatFilesController#index
11
+ * put the "exclamation.png" icon back. Was pretty useful after all.
12
+
13
+ 0.1.7 (October 27th, 2009) - Jeff Kreeftmeijer
14
+ * put the facebox images & icons in a subdir
15
+ * created sassify & cssify rake tasks (like the minify one)
16
+ * removed the .sass_cache dir and added it to the .gitignore file.
17
+
1
18
  0.1.6 (October 21st, 2009) - Jeff Kreeftmeijer
2
19
  * fixed a bug that sanitized the output (onsumbit) rather than the input (on paste).
3
20
 
data/README.textile CHANGED
@@ -1,10 +1,14 @@
1
1
  h1. WysiHat Engine
2
2
 
3
- A Rails engine to help integrate the "37signals WyshiHat rich text editor":http://github.com/josh/wysihat/ to your application.
3
+ A Rails engine to help integrate the "37signals WysiHat rich text editor":http://github.com/josh/wysihat/ to your application.
4
4
 
5
5
  h2. Using the WysiHat Engine
6
6
 
7
- We've written an "Installation Guide":http://wiki.github.com/80beans/wysihat-engine/installation and some "Examples":http://wiki.github.com/80beans/wysihat-engine/examples to get you started. Any questions? Don't hesitate to "ask":http://github.com/inbox/new/jkreeftmeijer.
7
+ We've written an "Installation Guide":http://wiki.github.com/80beans/wysihat-engine/installation and some "Examples":http://wiki.github.com/80beans/wysihat-engine/examples to get you started. Any questions? Don't hesitate to "ask":http://github.com/inbox/new/jeffkreeftmeijer.
8
+
9
+ h2. Demo
10
+
11
+ There's a "demo rails app":http://github.com/80beans/wysihat-engine-demo so you can have a quick look around.
8
12
 
9
13
  h2. Contributing
10
14
 
data/Rakefile CHANGED
@@ -40,19 +40,36 @@ task :minify do
40
40
 
41
41
  pack.write(compressor.compress(string))
42
42
  pack.close
43
- end
43
+ end
44
+
45
+ desc 'create css files from the sass files. It will overwrite files if they already exist.'
46
+ task :cssify do
47
+ files = ['facebox', 'wysihat']
48
+ files.each do |file|
49
+ system "sass generators/wysihat/templates/sass/#{file}.sass generators/wysihat/templates/css/#{file}.css"
50
+ end
51
+ end
52
+
53
+ desc 'create sass files from the css files. It will overwrite files if they already exist.'
54
+ task :sassify do
55
+ files = ['facebox', 'wysihat']
56
+ files.each do |file|
57
+ system "css2sass generators/wysihat/templates/css/#{file}.css generators/wysihat/templates/sass/#{file}.sass"
58
+ end
59
+ end
60
+
44
61
 
45
62
  begin
46
63
  require 'jeweler'
47
64
  Jeweler::Tasks.new do |gem|
48
65
  gem.name = "wysihat-engine"
49
- gem.summary = "A Rails engine to help integrate the 37signals WyshiHat rich text editor to your application."
50
- gem.description = "A Rails engine to help integrate the 37signals WyshiHat rich text editor to your application."
66
+ gem.summary = "A Rails engine to help integrate the 37signals WysiHat rich text editor to your application."
67
+ gem.description = "A Rails engine to help integrate the 37signals WysiHat rich text editor to your application."
51
68
  gem.email = "jeff@80beans.com"
52
69
  gem.homepage = "http://www.80beans.com/2009/10/01/wysihat-engine/"
53
70
  gem.authors = ["Jeff Kreeftmeijer"]
54
71
  gem.add_development_dependency "yui-compressor", ">= 0.9.1"
55
- gem.add_dependency 'thoughtbot-paperclip', ">= 2.3.1"
72
+ gem.add_dependency 'paperclip', ">= 2.3.1"
56
73
  end
57
74
  rescue LoadError
58
75
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
data/TODO CHANGED
@@ -1,2 +1,4 @@
1
1
  * add a config.yml file and put some of the settings in there
2
- * put the facebox images & icons in a subdir
2
+ * use sprockets for javascripts, stylesheets and images
3
+ * add font selection
4
+ * figure out a way to do a "clean paste". (paste without any markup or styling)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.6
1
+ 0.1.7
@@ -1,6 +1,7 @@
1
1
  class WysihatFilesController < ApplicationController
2
2
  def index
3
3
  @wysihat_file, @wysihat_files = WysihatFile.new, WysihatFile.all
4
+ render :layout => false
4
5
  end
5
6
 
6
7
  def create
@@ -1,95 +1,60 @@
1
- #facebox .b {
2
- background:url(../images/b.png);
3
- }
4
-
5
- #facebox .tl {
6
- background:url(../images/tl.png);
7
- }
8
-
9
- #facebox .tr {
10
- background:url(../images/tr.png);
11
- }
12
-
13
- #facebox .bl {
14
- background:url(../images/bl.png);
15
- }
16
-
17
- #facebox .br {
18
- background:url(../images/br.png);
19
- }
20
-
21
1
  #facebox {
22
2
  position: absolute;
23
3
  top: 0;
24
4
  left: 0;
25
5
  z-index: 100;
26
- text-align: left;
27
- }
28
-
29
- #facebox .popup {
30
- position: relative;
31
- }
32
-
33
- #facebox table {
34
- border-collapse: collapse;
35
- }
36
-
37
- #facebox td {
38
- border-bottom: 0;
39
- padding: 0;
40
- }
41
-
42
- #facebox .body {
43
- padding: 10px;
44
- background: #fff;
45
- width: 370px;
46
- }
47
-
48
- #facebox .loading {
49
- text-align: center;
50
- }
51
-
52
- #facebox .image {
53
- text-align: center;
54
- }
55
-
56
- #facebox img {
57
- border: 0;
58
- margin: 0;
59
- }
60
-
61
- #facebox .footer {
62
- border-top: 1px solid #DDDDDD;
63
- padding-top: 5px;
64
- margin-top: 10px;
65
- text-align: right;
66
- }
67
-
68
- #facebox .tl, #facebox .tr, #facebox .bl, #facebox .br {
69
- height: 10px;
70
- width: 10px;
71
- overflow: hidden;
72
- padding: 0;
73
- }
6
+ text-align: left; }
7
+ #facebox .b {
8
+ background: url(../images/facebox/b.png); }
9
+ #facebox .tl {
10
+ background: url(../images/facebox/tl.png); }
11
+ #facebox .tr {
12
+ background: url(../images/facebox/tr.png); }
13
+ #facebox .bl {
14
+ background: url(../images/facebox/bl.png); }
15
+ #facebox .br {
16
+ background: url(../images/facebox/br.png); }
17
+ #facebox .popup {
18
+ position: relative; }
19
+ #facebox table {
20
+ border-collapse: collapse; }
21
+ #facebox td {
22
+ border-bottom: 0;
23
+ padding: 0; }
24
+ #facebox .body {
25
+ padding: 10px;
26
+ background: #fff;
27
+ width: 370px; }
28
+ #facebox .loading, #facebox .image {
29
+ text-align: center; }
30
+ #facebox img {
31
+ border: 0;
32
+ margin: 0; }
33
+ #facebox .footer {
34
+ border-top: 1px solid #DDDDDD;
35
+ padding-top: 5px;
36
+ margin-top: 10px;
37
+ text-align: right; }
38
+ #facebox .tl, #facebox .tr, #facebox .bl, #facebox .br {
39
+ height: 10px;
40
+ width: 10px;
41
+ overflow: hidden;
42
+ padding: 0; }
74
43
 
75
44
  #facebox_overlay {
76
45
  position: fixed;
77
46
  top: 0px;
78
47
  left: 0px;
79
- height:100%;
80
- width:100%;
81
- }
48
+ height: 100%;
49
+ width: 100%; }
82
50
 
83
51
  .facebox_hide {
84
- z-index:-100;
85
- }
52
+ z-index: -100; }
86
53
 
87
54
  .facebox_overlayBG {
88
55
  background-color: #000;
89
- z-index: 99;
90
- }
56
+ z-index: 99; }
91
57
 
92
- * html #facebox_overlay { /* ie6 hack */
58
+ * html #facebox_overlay {
93
59
  position: absolute;
94
- height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
95
- }
60
+ height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'); }
@@ -1,72 +1,44 @@
1
- div.editor_toolbar a{
2
- float:left;
3
- width:16px;
4
- height:16px;
5
- margin:5px;
6
- background-repeat: no-repeat;
7
- }
8
-
9
- div.editor_toolbar span{
10
- display:none;
11
- }
12
-
1
+ div.editor_toolbar a {
2
+ float: left;
3
+ width: 16px;
4
+ height: 16px;
5
+ margin: 5px;
6
+ background-repeat: no-repeat; }
7
+ div.editor_toolbar span {
8
+ display: none; }
9
+
10
+ .editor_toolbar .button {
11
+ background-image: url('../images/icons/exclamation.png'); }
13
12
  .editor_toolbar .bold {
14
- background-image: url('../images/text_bold.png');
15
- }
16
-
13
+ background-image: url('../images/icons/text_bold.png'); }
17
14
  .editor_toolbar .italic {
18
- background-image: url('../images/text_italic.png');
19
- }
20
-
15
+ background-image: url('../images/icons/text_italic.png'); }
21
16
  .editor_toolbar .underline {
22
- background-image: url('../images/text_underline.png');
23
- }
24
-
17
+ background-image: url('../images/icons/text_underline.png'); }
25
18
  .editor_toolbar .strikethrough {
26
- background-image: url('../images/text_strikethrough.png');
27
- }
28
-
19
+ background-image: url('../images/icons/text_strikethrough.png'); }
29
20
  .editor_toolbar .justifyleft {
30
- background-image: url('../images/text_align_left.png');
31
- }
32
-
21
+ background-image: url('../images/icons/text_align_left.png'); }
33
22
  .editor_toolbar .justifycenter {
34
- background-image: url('../images/text_align_center.png');
35
- }
36
-
23
+ background-image: url('../images/icons/text_align_center.png'); }
37
24
  .editor_toolbar .justifyright {
38
- background-image: url('../images/text_align_right.png');
39
- }
40
-
25
+ background-image: url('../images/icons/text_align_right.png'); }
41
26
  .editor_toolbar .undo {
42
- background-image: url('../images/arrow_undo.png');
43
- }
44
-
27
+ background-image: url('../images/icons/arrow_undo.png'); }
45
28
  .editor_toolbar .redo {
46
- background-image: url('../images/arrow_redo.png');
47
- }
48
-
29
+ background-image: url('../images/icons/arrow_redo.png'); }
49
30
  .editor_toolbar .insertorderedlist {
50
- background-image: url('../images/text_list_numbers.png');
51
- }
52
-
31
+ background-image: url('../images/icons/text_list_numbers.png'); }
53
32
  .editor_toolbar .insertunorderedlist {
54
- background-image: url('../images/text_list_bullets.png');
55
- }
56
-
33
+ background-image: url('../images/icons/text_list_bullets.png'); }
57
34
  .editor_toolbar .link {
58
- background-image: url('../images/link.png');
59
- }
60
-
35
+ background-image: url('../images/icons/link.png'); }
61
36
  .editor_toolbar .image {
62
- background-image: url('../images/image.png');
63
- }
64
-
37
+ background-image: url('../images/icons/image.png'); }
65
38
  .editor_toolbar .html {
66
- background-image: url('../images/page_code.png');
67
- }
39
+ background-image: url('../images/icons/page_code.png'); }
68
40
 
69
- iframe.editor{
70
- height:400px;
71
- width:100%;
72
- }
41
+ iframe.editor {
42
+ border: 1px solid #999;
43
+ height: 400px;
44
+ width: 100%; }
@@ -1,26 +1,16 @@
1
- /* Facebox for Prototype, version 2.0
2
- * By Robert Gaal - http://wakoopa.com
1
+ /* Facebox for Prototype
3
2
  *
4
- * Heavily based on Facebox by Chris Wanstrath - http://famspam.com/facebox
5
- * First ported to Prototype by Phil Burrows - http://blog.philburrows.com
3
+ * This is a slightly updated version of jeffkreeftmeijer's branch of facebox-for-prototype
4
+ * (http://github.com/jeffkreeftmeijer/facebox-for-prototype). The image locations are
5
+ * changed -- from /images/ to /images/facebox/ -- to keep the engine nice and tidy.
6
6
  *
7
- * Licensed under the MIT:
8
- * http://www.opensource.org/licenses/mit-license.php
9
- *
10
- * Need help? Join the Google Groups mailing list:
11
- * http://groups.google.com/group/facebox/
12
- *
13
- * Dependencies: prototype & script.aculo.us + images & CSS files from original facebox
14
- * Usage: Append 'rel="facebox"' to an element to call it inside a so-called facebox
15
- *
16
- *--------------------------------------------------------------------------*/
17
-
7
+ */
18
8
 
19
9
  var Facebox = Class.create({
20
10
  initialize : function(extra_set){
21
11
  this.settings = {
22
- loading_image : '/images/loading.gif',
23
- close_image : '/images/closelabel.gif',
12
+ loading_image : '/images/facebox/loading.gif',
13
+ close_image : '/images/facebox/closelabel.gif',
24
14
  image_types : new RegExp('\.' + ['png', 'jpg', 'jpeg', 'gif'].join('|') + '$', 'i'),
25
15
  inited : true,
26
16
  facebox_html : '\
@@ -38,7 +28,7 @@ var Facebox = Class.create({
38
28
  </div> \
39
29
  <div class="footer"> \
40
30
  <a href="#" class="close"> \
41
- <img src="/images/closelabel.gif" title="close" class="close_image" /> \
31
+ <img src="/images/facebox/closelabel.gif" title="close" class="close_image" /> \
42
32
  </a> \
43
33
  </div> \
44
34
  </td> \
@@ -447,7 +447,7 @@ WysiHat.Window = (function() {
447
447
  }
448
448
 
449
449
  function getWindow() {
450
- if (this.contentDocument)
450
+ if (this.contentDocument && this.contentDocument.defaultView)
451
451
  return this.contentDocument.defaultView;
452
452
  else if (this.contentWindow.document)
453
453
  return this.contentWindow;
@@ -554,31 +554,6 @@ WysiHat.iFrame.Methods = {
554
554
  return this;
555
555
  },
556
556
 
557
-
558
- linkStyleSheet: function(href) {
559
- this.whenReady(function(editor){
560
- var document = editor.getDocument();
561
- if(document.createStyleSheet) { // IE
562
- document.createStyleSheet(css);
563
- } else {
564
- var head = document.documentElement.getElementsByTagName('head')[0];
565
- if (!head) {
566
- head=document.createElement('head');
567
- document.documentElement.insertBefore(head,document.getElementsByTagName('body')[0]);
568
- }
569
- var link='<link href="'+href+'" media="screen" rel="stylesheet" type="text/css"/>';
570
- head=$(head);
571
- if (head.insert) { // Safari
572
- $(head).insert(link);
573
- } else { // everyone else
574
- head.innerHTML=head.innerHTML+link;
575
- }
576
- }
577
- });
578
- },
579
-
580
-
581
-
582
557
  /**
583
558
  * WysiHat.iFrame.Methods#getStyle(style) -> string
584
559
  * - style specificication (i.e. backgroundColor)
@@ -2017,7 +1992,7 @@ WysiHat.Toolbar = Class.create((function() {
2017
1992
  }
2018
1993
 
2019
1994
  function createButtonElement(toolbar, options) {
2020
- var button = Element('a', {
1995
+ var button = new Element('a', {
2021
1996
  'class': 'button', 'href': '#'
2022
1997
  });
2023
1998
  button.update('<span>' + options.get('label') + '</span>');
@@ -4,12 +4,12 @@ var WysihatHelper = {
4
4
  faceboxFile: function()
5
5
  {
6
6
  facebox.loading();
7
- new Effect.Appear($('facebox'), {duration: .3});
7
+ new Effect.Appear($('facebox'), {duration: 0.3});
8
8
 
9
9
  var fb = facebox;
10
- var url = '/wysihat_files/?editor=' + this.id
10
+ var url = '/wysihat_files/?editor=' + this.id;
11
11
 
12
- new Ajax.Request(url, {
12
+ new Ajax.Request(url, {
13
13
  method : 'get',
14
14
  onFailure : function(transport){
15
15
  fb.reveal(transport.responseText, null);
@@ -26,8 +26,8 @@ var WysihatHelper = {
26
26
  this.unlinkSelection();
27
27
  } else {
28
28
  facebox.loading();
29
- new Effect.Appear($('facebox'), {duration: .3});
30
- iframe = this
29
+ new Effect.Appear($('facebox'), {duration: 0.3});
30
+ iframe = this;
31
31
  facebox.reveal('<input type=\"text\" id=\"link_field\" style=\"width:100%;\"/>', null);
32
32
  Event.observe('link_field', 'change', function(event) {
33
33
  iframe.linkSelection($('link_field').value);
@@ -38,64 +38,42 @@ var WysihatHelper = {
38
38
  faceboxHTML: function()
39
39
  {
40
40
  facebox.loading();
41
- new Effect.Appear($('facebox'), {duration: .3});
42
- iframe = this
41
+ new Effect.Appear($('facebox'), {duration: 0.3});
42
+ iframe = this;
43
43
  facebox.reveal('<textarea id=\"html_editor\" style=\"width:100%; height:400px;\">' + iframe.contentWindow.document.body.innerHTML + '</textarea>', null);
44
44
  Event.observe('html_editor', 'change', function(event) {
45
45
  iframe.contentWindow.document.body.innerHTML = $('html_editor').value;
46
46
  });
47
- },
48
- }
49
-
50
- WysiHat.Editor.include(WysihatHelper);
51
-
52
- Event.observe(window, 'load', function() {
53
- $$('textarea.wysihat_editor').each(function(i){
54
- var editor = WysiHat.Editor.attach(i.id);
55
- var toolbar = new WysiHat.Toolbar(editor);
56
- toolbars[i.id] = toolbar;
57
-
58
- editor.inputFilter = function(text) {
59
- return text.formatHTMLOutput().sanitize({
60
- tags: ['span', 'p', 'br', 'strong', 'em', 'a'],
61
- attributes: ['id', 'href']
62
- });
63
- };
64
-
65
- editor.observe("wysihat:paste", function(event) {
66
- setTimeout(function() {
67
- event.target.reload();
68
- }, 1);
69
- });
70
-
71
- $$('form').each(function(f){
72
- f.onsubmit = function(){
73
- editor.save();
74
- }
75
- });
76
- });
77
- });
47
+ }
48
+ };
78
49
 
79
- function addButtons(tag_id, buttons){
80
- Event.observe(window, 'load', function() {
81
- buttons.each(function(button){
50
+ function wysiHatify(tag_id, buttons){
51
+ WysiHat.Editor.include(WysihatHelper);
52
+ var editor = WysiHat.Editor.attach(tag_id);
53
+ var toolbar = new WysiHat.Toolbar(editor);
54
+
55
+ $$('form').each(function(i){
56
+ i.onsubmit = function(){
57
+ editor.save();
58
+ };
59
+ });
82
60
 
83
- switch(button.toLowerCase()){
84
- case 'image':
85
- toolbars[tag_id].addButton({label : button.gsub('_','-').camelize().capitalize(), handler: function(editor) { return editor.faceboxFile(editor); }});
86
- break;
87
- case 'link':
88
- toolbars[tag_id].addButton({label : button.gsub('_','-').camelize().capitalize(), handler: function(editor) { return editor.faceboxLink(editor); }});
89
- break;
90
- case 'html':
91
- toolbars[tag_id].addButton({label : button.gsub('_','-').camelize().capitalize(), handler: function(editor) { return editor.faceboxHTML(editor); }});
92
- break;
93
- case 'paste':
94
- toolbars[tag_id].addButton({label : button.gsub('_','-').camelize().capitalize(), handler: function(editor) { return editor.faceboxPaste(editor); }});
95
- break;
96
- default:
97
- toolbars[tag_id].addButton({label : button.gsub('_','-').camelize().capitalize()});
98
- }
99
- })
100
- })
101
- }
61
+ buttons.each(function(button){
62
+ switch(button.toLowerCase()){
63
+ case 'image':
64
+ toolbar.addButton({label : button.gsub('_','-').camelize().capitalize(), handler: function(editor) { return editor.faceboxFile(editor); }});
65
+ break;
66
+ case 'link':
67
+ toolbar.addButton({label : button.gsub('_','-').camelize().capitalize(), handler: function(editor) { return editor.faceboxLink(editor); }});
68
+ break;
69
+ case 'html':
70
+ toolbar.addButton({label : button.gsub('_','-').camelize().capitalize(), handler: function(editor) { return editor.faceboxHTML(editor); }});
71
+ break;
72
+ case 'paste':
73
+ toolbar.addButton({label : button.gsub('_','-').camelize().capitalize(), handler: function(editor) { return editor.faceboxPaste(editor); }});
74
+ break;
75
+ default:
76
+ toolbar.addButton({label : button.gsub('_','-').camelize().capitalize()});
77
+ }
78
+ });
79
+ }