mercury-rails 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/README.rdoc +81 -50
  2. data/VERSION +1 -1
  3. data/app/assets/javascripts/mercury/dialog.js.coffee +4 -4
  4. data/app/assets/javascripts/mercury/dialogs/backcolor.js.coffee +3 -3
  5. data/app/assets/javascripts/mercury/dialogs/forecolor.js.coffee +3 -3
  6. data/app/assets/javascripts/mercury/dialogs/formatblock.js.coffee +1 -1
  7. data/app/assets/javascripts/mercury/dialogs/objectspanel.js.coffee +3 -3
  8. data/app/assets/javascripts/mercury/dialogs/style.js.coffee +1 -1
  9. data/app/assets/javascripts/mercury/history_buffer.js.coffee +2 -2
  10. data/app/assets/javascripts/mercury/mercury.js.coffee +47 -54
  11. data/app/assets/javascripts/mercury/modal.js.coffee +13 -13
  12. data/app/assets/javascripts/mercury/modals/htmleditor.js.coffee +2 -2
  13. data/app/assets/javascripts/mercury/modals/insertcharacter.js.coffee +2 -2
  14. data/app/assets/javascripts/mercury/modals/insertlink.js.coffee +7 -7
  15. data/app/assets/javascripts/mercury/modals/insertmedia.js.coffee +5 -5
  16. data/app/assets/javascripts/mercury/modals/insertsnippet.js.coffee +2 -2
  17. data/app/assets/javascripts/mercury/modals/inserttable.js.coffee +14 -15
  18. data/app/assets/javascripts/mercury/native_extensions.js.coffee +2 -1
  19. data/app/assets/javascripts/mercury/page_editor.js.coffee +27 -27
  20. data/app/assets/javascripts/mercury/palette.js.coffee +6 -6
  21. data/app/assets/javascripts/mercury/panel.js.coffee +4 -4
  22. data/app/assets/javascripts/mercury/region.js.coffee +9 -9
  23. data/app/assets/javascripts/mercury/regions/editable.js.coffee +71 -71
  24. data/app/assets/javascripts/mercury/regions/markupable.js.coffee +51 -42
  25. data/app/assets/javascripts/mercury/regions/snippetable.js.coffee +7 -8
  26. data/app/assets/javascripts/mercury/select.js.coffee +8 -8
  27. data/app/assets/javascripts/mercury/snippet.js.coffee +6 -6
  28. data/app/assets/javascripts/mercury/snippet_toolbar.js.coffee +7 -7
  29. data/app/assets/javascripts/mercury/statusbar.js.coffee +7 -3
  30. data/app/assets/javascripts/mercury/table_editor.js.coffee +24 -24
  31. data/app/assets/javascripts/mercury/toolbar.button.js.coffee +20 -21
  32. data/app/assets/javascripts/mercury/toolbar.button_group.js.coffee +2 -2
  33. data/app/assets/javascripts/mercury/toolbar.expander.js.coffee +9 -9
  34. data/app/assets/javascripts/mercury/toolbar.js.coffee +12 -13
  35. data/app/assets/javascripts/mercury/tooltip.js.coffee +7 -7
  36. data/app/assets/javascripts/mercury/uploader.js.coffee +12 -13
  37. data/app/assets/javascripts/mercury_loader.js +98 -0
  38. data/app/assets/stylesheets/mercury/modal.scss +5 -5
  39. data/app/assets/stylesheets/mercury/toolbar.scss +62 -64
  40. data/app/views/layouts/mercury.html.haml +0 -4
  41. data/app/views/mercury/modals/character.html.haml +1 -1
  42. data/app/views/mercury/modals/htmleditor.html.haml +1 -1
  43. data/app/views/mercury/modals/table.html.haml +10 -10
  44. data/config/routes.rb +2 -2
  45. data/mercury-rails.gemspec +17 -20
  46. data/spec/javascripts/mercury/dialogs/backcolor_spec.js.coffee +3 -3
  47. data/spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee +3 -3
  48. data/spec/javascripts/mercury/dialogs/objectspanel_spec.js.coffee +3 -3
  49. data/spec/javascripts/mercury/modals/htmleditor_spec.js.coffee +4 -4
  50. data/spec/javascripts/mercury/modals/insertcharacter_spec.js.coffee +2 -2
  51. data/spec/javascripts/mercury/modals/insertlink_spec.js.coffee +10 -10
  52. data/spec/javascripts/mercury/modals/insertmedia_spec.js.coffee +7 -7
  53. data/spec/javascripts/mercury/modals/insertsnippet_spec.js.coffee +4 -4
  54. data/spec/javascripts/mercury/modals/inserttable_spec.js.coffee +17 -17
  55. data/spec/javascripts/mercury/page_editor_spec.js.coffee +5 -6
  56. data/spec/javascripts/mercury/region_spec.js.coffee +5 -5
  57. data/spec/javascripts/mercury/regions/editable_spec.js.coffee +398 -0
  58. data/spec/javascripts/mercury/regions/snippetable_spec.js.coffee +18 -14
  59. data/spec/javascripts/mercury/snippet_spec.js.coffee +1 -1
  60. data/spec/javascripts/mercury/toolbar.button_spec.js.coffee +16 -16
  61. data/spec/javascripts/templates/mercury/modals/inserttable.html +11 -11
  62. data/spec/javascripts/templates/mercury/regions/editable.html +3 -0
  63. data/spec/javascripts/templates/mercury/toolbar.button.html +8 -8
  64. data/vendor/assets/javascripts/{jquery-ui-1.8.13.sortable.custom.js → jquery-ui-1.8.13.custom.js} +250 -0
  65. data/vendor/assets/javascripts/jquery.additions.js +151 -0
  66. data/vendor/assets/javascripts/showdown.js +1254 -1276
  67. metadata +26 -29
  68. data/app/assets/javascripts/mercury/websocket.js.coffee +0 -34
  69. data/spec/javascripts/mercury/regions/_editable_.js.coffee +0 -0
  70. data/vendor/assets/javascripts/jquery-ui-1.8.13.custom.min.js +0 -249
  71. data/vendor/assets/javascripts/jquery.easing.js +0 -173
  72. data/vendor/assets/javascripts/jquery.json2.js +0 -178
  73. data/vendor/assets/javascripts/jquery.serialize_object.js +0 -16
  74. data/vendor/assets/javascripts/jquery.ujs.js +0 -289
@@ -42,52 +42,6 @@ library, etc.) so here's a list of some other editors that you might want to che
42
42
  * {NicEdit}[http://nicedit.com/]
43
43
 
44
44
 
45
- == Project Details
46
-
47
- === WYSIWYG Editors Suck
48
-
49
- They just do. Which as I've learned, is primarily due to the browser implementations. Don't get me wrong, what the
50
- browsers have implemented is amazing, because it's hard stuff, plain and simple. But if you're expecting a WYSIWYG
51
- editor to solve all your content problems you're wrong. A better perception is that it will solve many of them, but
52
- shifts some into a new area.
53
-
54
- With that being said, Mercury tries to solve many of those issues and succeeds to a great degree, but alas, it's nearly
55
- impossible to address everything, and the browsers don't expose enough to fix some things. This is true for every
56
- editor that I've looked into as well.
57
-
58
- It's important to understand this, and the details are more suited for long nerdy blog posts, so they won't be covered
59
- here.
60
-
61
- === The Code and Why
62
-
63
- ==== CoffeeScript
64
-
65
- Mercury has been written entirely in CoffeeScript because it simplifies a lot of the patterns that are used, and allows
66
- for very readable code. The goal was to provide good readable code that could be adjusted based on need, instead of a
67
- complex configuration that makes the code harder to understand and tweak.
68
-
69
- ==== jQuery
70
-
71
- jQuery was used as the javascript library, but is primarily used for the selectors, traversing, and manipulating the
72
- DOM. Chaining is kept to a minimum for readability, and even though much of Mercury could've been written as jQuery
73
- plugins, it was not.
74
-
75
- ==== Rails
76
-
77
- With the asset handling that comes bundled with Rails 3.1, Rails Engines, and the gem tools, there really wasn't any
78
- other option. The javascript from Mercury can be used by any back end system, and isn't limited to Rails. Many of the
79
- features do require a back end, and that stuff would have to be rewritten in whatever language you wanted support for.
80
- The coffeescript files can be found in the repo, and I would be fully supportive of anyone who wanted to add support for
81
- different back end frameworks or languages.
82
-
83
- ==== Specs / Integration Tests
84
-
85
- Mercury is fully tested using Jasmine (via Evergreen) and Cucumber. You can clone the project to run the full suite.
86
-
87
- rake spec:javascripts
88
- rake cucumber
89
-
90
-
91
45
  == Features
92
46
 
93
47
  The feature list is actually pretty long, so here's a short list that need highlighting.
@@ -113,9 +67,6 @@ There's a migration for images that you'll need as well.
113
67
  rake mercury_engine:install:migrations
114
68
  rake db:migrate
115
69
 
116
- To access the editor on any page simply browse to any existing content page and prefix it's url with /edit, so for
117
- instance, localhost:3000/edit/content/page to edit the content on /content/page.
118
-
119
70
 
120
71
  == Usage
121
72
 
@@ -128,6 +79,33 @@ Region types are outlined below.
128
79
  default content
129
80
  </div>
130
81
 
82
+ There's two methods to initialize Mercury Editor, and each one has it's benefits.
83
+
84
+ === Script Method
85
+
86
+ Include the mercury_loader.js file. The loader will reload the page and enable Mercury in full page editing mode, so
87
+ you may want to wrap this in conditional logic (eg. only admins or something).
88
+
89
+ javascript_include_tag 'mercury_loader.js'
90
+
91
+ Even though many efforts have been made to keep conflicts with javascript libraries from happening, we can't avoid all
92
+ of them. If you use this method, understand that there may be conflicts with javascript and css. You should use the
93
+ route method if you see any issues.
94
+
95
+ === Route Method
96
+
97
+ The other way to initialize Mercury, which provides some slight performance improvements to the script method, is to
98
+ access the editor route. There's a glob route that captures everything beginning with /editor, so for instance to edit
99
+ an /about_us content page, you should access it at the /editor/about_us path. Again, you may want to define this route
100
+ in your own routes file to restrict access to it.
101
+
102
+ If you use this method, you may want to notify Mercury when the page is ready to be initialized. To do this just
103
+ trigger the initialize:frame event. You can do this when the dom is ready to be interacted with (eg. dom:loaded,
104
+ document.ready), or at the bottom of your body tag. It's recommended that you do this because it gives you some load
105
+ performance improvements, but it's not required.
106
+
107
+ top.Mercury.trigger('initialize:frame');
108
+
131
109
 
132
110
  == Region Types
133
111
 
@@ -154,4 +132,57 @@ defined by a developer and placed into content regions later. More on this belo
154
132
  Snippets are reusable and configurable chunks of markup. They can be defined by developers, and then placed anywhere in
155
133
  content regions. When you drag a snippet into a region you'll be prompted to enter options, and after entering options
156
134
  the snippet will be rendered into the page as a preview. Snippets can be dragged around (in snippetable regions) and
157
- edited or removed.
135
+ edited or removed.
136
+
137
+ Mercury does very little to save content and snippets for you, but it does provide the ability to load snippets from
138
+ your own storage implementation. Here's an example of loading existing snippet options back into Mercury.
139
+
140
+ top.Mercury.Snippet.load({
141
+ 'snippet_1': {name: 'example', options: {'options[favorite_beer]': "Bells Hopslam", 'options[first_name]': "Jeremy"}},
142
+ });
143
+
144
+
145
+ == Project Details
146
+
147
+ === WYSIWYG Editors Suck
148
+
149
+ They just do. Which as I've learned, is primarily due to the browser implementations. Don't get me wrong, what the
150
+ browsers have implemented is amazing, because it's hard stuff, plain and simple. But if you're expecting a WYSIWYG
151
+ editor to solve all your content problems you're wrong. A better perception is that it will solve many of them, but
152
+ shifts some into a new area.
153
+
154
+ With that being said, Mercury tries to solve many of those issues and succeeds to a great degree, but alas, it's nearly
155
+ impossible to address everything, and the browsers don't expose enough to fix some things. This is true for every
156
+ editor that I've looked into as well.
157
+
158
+ It's important to understand this, and the details are more suited for long nerdy blog posts, so they won't be covered
159
+ here.
160
+
161
+ === The Code and Why
162
+
163
+ ==== CoffeeScript
164
+
165
+ Mercury has been written entirely in CoffeeScript because it simplifies a lot of the patterns that are used, and allows
166
+ for very readable code. The goal was to provide good readable code that could be adjusted based on need, instead of a
167
+ complex configuration that makes the code harder to understand and tweak.
168
+
169
+ ==== jQuery
170
+
171
+ jQuery was used as the javascript library, but is primarily used for the selectors, traversing, and manipulating the
172
+ DOM. Chaining is kept to a minimum for readability, and even though much of Mercury could've been written as jQuery
173
+ plugins, it was not.
174
+
175
+ ==== Rails
176
+
177
+ With the asset handling that comes bundled with Rails 3.1, Rails Engines, and the gem tools, there really wasn't any
178
+ other option. The javascript from Mercury can be used by any back end system, and isn't limited to Rails. Many of the
179
+ features do require a back end, and that stuff would have to be rewritten in whatever language you wanted support for.
180
+ The coffeescript files can be found in the repo, and I would be fully supportive of anyone who wanted to add support for
181
+ different back end frameworks or languages.
182
+
183
+ ==== Specs / Integration Tests
184
+
185
+ Mercury is fully tested using Jasmine (via Evergreen) and Cucumber. You can clone the project to run the full suite.
186
+
187
+ rake spec:javascripts
188
+ rake cucumber
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -9,8 +9,8 @@ class @Mercury.Dialog
9
9
 
10
10
 
11
11
  build: ->
12
- @element = $('<div>', {class: "mercury-dialog mercury-#{@name}-dialog loading", style: 'display:none'})
13
- @element.appendTo($(@options.appendTo).get(0) ? 'body')
12
+ @element = jQuery('<div>', {class: "mercury-dialog mercury-#{@name}-dialog loading", style: 'display:none'})
13
+ @element.appendTo(jQuery(@options.appendTo).get(0) ? 'body')
14
14
 
15
15
 
16
16
  bindEvents: ->
@@ -46,7 +46,7 @@ class @Mercury.Dialog
46
46
 
47
47
  appear: ->
48
48
  @element.css({display: 'block', opacity: 0})
49
- @element.animate {opacity: .95}, 200, 'easeInOutSine', =>
49
+ @element.animate {opacity: 0.95}, 200, 'easeInOutSine', =>
50
50
  @load(=> @resize()) unless @loaded
51
51
 
52
52
 
@@ -57,7 +57,7 @@ class @Mercury.Dialog
57
57
 
58
58
  load: (callback) ->
59
59
  return unless @url
60
- $.ajax @url, {
60
+ jQuery.ajax @url, {
61
61
  success: (data) =>
62
62
  @loadContent(data)
63
63
  Mercury.dialogHandlers[@name].call(@) if Mercury.dialogHandlers[@name]
@@ -1,6 +1,6 @@
1
- @Mercury.dialogHandlers.backcolor = ->
1
+ @Mercury.dialogHandlers.backColor = ->
2
2
  @element.find('.picker, .last-picked').click (event) =>
3
- color = $(event.target).css('background-color')
3
+ color = jQuery(event.target).css('background-color')
4
4
  @element.find('.last-picked').css({background: color})
5
5
  @button.css({backgroundColor: color})
6
- Mercury.trigger('action', {action: 'backcolor', value: color})
6
+ Mercury.trigger('action', {action: 'backColor', value: color})
@@ -1,6 +1,6 @@
1
- @Mercury.dialogHandlers.forecolor = ->
1
+ @Mercury.dialogHandlers.foreColor = ->
2
2
  @element.find('.picker, .last-picked').click (event) =>
3
- color = $(event.target).css('background-color')
3
+ color = jQuery(event.target).css('background-color')
4
4
  @element.find('.last-picked').css({background: color})
5
5
  @button.css({backgroundColor: color})
6
- Mercury.trigger('action', {action: 'forecolor', value: color})
6
+ Mercury.trigger('action', {action: 'foreColor', value: color})
@@ -1,4 +1,4 @@
1
1
  @Mercury.dialogHandlers.formatblock = ->
2
2
  @element.find('[data-tag]').click (event) =>
3
- tag = $(event.target).data('tag')
3
+ tag = jQuery(event.target).data('tag')
4
4
  Mercury.trigger('action', {action: 'formatblock', value: tag})
@@ -1,10 +1,10 @@
1
- @Mercury.dialogHandlers.objectspanel = ->
1
+ @Mercury.dialogHandlers.objectsPanel = ->
2
2
  # make the filter work
3
3
  @element.find('input.filter').keyup =>
4
4
  value = @element.find('input.filter').val()
5
5
  for snippet in @element.find('li[data-filter]')
6
- if LiquidMetal.score($(snippet).data('filter'), value) == 0 then $(snippet).hide() else $(snippet).show()
6
+ if LiquidMetal.score(jQuery(snippet).data('filter'), value) == 0 then jQuery(snippet).hide() else jQuery(snippet).show()
7
7
 
8
8
  # when an element is dragged, set it so we have a global object
9
9
  @element.find('img[data-snippet]').bind 'dragstart', (event) ->
10
- Mercury.snippet = $(@).data('snippet')
10
+ Mercury.snippet = jQuery(@).data('snippet')
@@ -1,4 +1,4 @@
1
1
  @Mercury.dialogHandlers.style = ->
2
2
  @element.find('[data-class]').click (event) =>
3
- className = $(event.target).data('class')
3
+ className = jQuery(event.target).data('class')
4
4
  Mercury.trigger('action', {action: 'style', value: className})
@@ -7,9 +7,9 @@ class @Mercury.HistoryBuffer
7
7
 
8
8
 
9
9
  push: (item) ->
10
- if $.type(item) == 'string'
10
+ if jQuery.type(item) == 'string'
11
11
  return if @stack[@index] && @stack[@index].replace(@markerRegExp, '') == item.replace(@markerRegExp, '')
12
- else if $.type(item) == 'object' && item.html
12
+ else if jQuery.type(item) == 'object' && item.html
13
13
  return if @stack[@index] && @stack[@index].html == item.html
14
14
 
15
15
  @stack = @stack[0...@index + 1]
@@ -1,12 +1,9 @@
1
1
  #
2
2
  #= require jquery-1.6
3
- #= require jquery-ui-1.8.13.custom.min
4
- #= require jquery-ui-1.8.13.sortable.custom
5
- #= require jquery.easing
6
- #= require jquery.json2
7
- #= require jquery.ujs
8
- #= require jquery.serialize_object
3
+ #= require jquery-ui-1.8.13.custom
4
+ #= require jquery.additions
9
5
  #= require liquidmetal
6
+ #= require showdown
10
7
  #
11
8
  #= require_self
12
9
  #= require ./native_extensions
@@ -32,24 +29,22 @@
32
29
  #= require_tree ./dialogs
33
30
  #= require_tree ./modals
34
31
  #
35
- #= require showdown
36
- #
37
32
 
38
- @Mercury = {
33
+ @Mercury =
39
34
 
40
- version: 1.0
35
+ version: '0.1.1'
41
36
 
42
37
 
43
38
  # No IE support yet because it doesn't follow the W3C standards for HTML5 contentEditable (aka designMode).
44
- supported: document.getElementById && document.designMode && !$.browser.konqueror && !$.browser.msie
39
+ supported: document.getElementById && document.designMode && !jQuery.browser.konqueror && !jQuery.browser.msie
45
40
 
46
41
 
47
42
  # Silent mode disables things like asking about unsaved changes before leaving the page.
48
- silent: true
43
+ silent: false
49
44
 
50
45
 
51
46
  # Turning debug mode on will log events and other various things (using console.log if available).
52
- debug: true
47
+ debug: false
53
48
 
54
49
 
55
50
  # Configuration
@@ -137,15 +132,15 @@
137
132
  undo: ['Undo', 'Undo your last action']
138
133
  redo: ['Redo', 'Redo your last action']
139
134
  sep: ' '
140
- insertlink: ['Link', 'Insert Link', {modal: '/mercury/modals/link', regions: ['editable', 'markupable']}]
141
- insertmedia: ['Media', 'Insert Media (images and videos)', {modal: '/mercury/modals/media', regions: ['editable', 'markupable']}]
142
- inserttable: ['Table', 'Insert Table', {modal: '/mercury/modals/table', regions: ['editable', 'markupable']}]
143
- insertcharacter: ['Character', 'Special Characters', {modal: '/mercury/modals/character', regions: ['editable', 'markupable']}]
144
- objectspanel: ['Snippet', 'Snippet Panel', {panel: '/mercury/panels/snippets'}]
135
+ insertLink: ['Link', 'Insert Link', {modal: '/mercury/modals/link', regions: ['editable', 'markupable']}]
136
+ insertMedia: ['Media', 'Insert Media (images and videos)', {modal: '/mercury/modals/media', regions: ['editable', 'markupable']}]
137
+ insertTable: ['Table', 'Insert Table', {modal: '/mercury/modals/table', regions: ['editable', 'markupable']}]
138
+ insertCharacter: ['Character', 'Special Characters', {modal: '/mercury/modals/character', regions: ['editable', 'markupable']}]
139
+ objectsPanel: ['Snippet', 'Snippet Panel', {panel: '/mercury/panels/snippets'}]
145
140
  sep2: ' '
146
- historypanel: ['History', 'Page Version History', {panel: '/mercury/panels/history'}]
141
+ historyPanel: ['History', 'Page Version History', {panel: '/mercury/panels/history'}]
147
142
  sep3: ' '
148
- notespanel: ['Notes', 'Page Notes', {panel: '/mercury/panels/notes'}]
143
+ notesPanel: ['Notes', 'Page Notes', {panel: '/mercury/panels/notes'}]
149
144
 
150
145
  editable:
151
146
  _regions: ['editable', 'markupable']
@@ -156,9 +151,9 @@
156
151
  sep2: '-'
157
152
  colors:
158
153
  _regions: ['editable']
159
- backcolor: ['Background Color', null, {palette: '/mercury/palettes/backcolor', context: true, preload: true}]
154
+ backColor: ['Background Color', null, {palette: '/mercury/palettes/backcolor', context: true, preload: true}]
160
155
  sep1: ' '
161
- forecolor: ['Text Color', null, {palette: '/mercury/palettes/forecolor', context: true, preload: true}]
156
+ foreColor: ['Text Color', null, {palette: '/mercury/palettes/forecolor', context: true, preload: true}]
162
157
  sep2: '-'
163
158
  decoration:
164
159
  bold: ['Bold', null, {context: true}]
@@ -173,14 +168,14 @@
173
168
  sep: '-'
174
169
  justify:
175
170
  _regions: ['editable']
176
- justifyleft: ['Align Left', null, {context: true}]
177
- justifycenter: ['Center', null, {context: true}]
178
- justifyright: ['Align Right', null, {context: true}]
179
- justifyfull: ['Justify Full', null, {context: true}]
171
+ justifyLeft: ['Align Left', null, {context: true}]
172
+ justifyCenter: ['Center', null, {context: true}]
173
+ justifyRight: ['Align Right', null, {context: true}]
174
+ justifyFull: ['Justify Full', null, {context: true}]
180
175
  sep: '-'
181
176
  list:
182
- insertunorderedlist: ['Unordered List', null, {context: true}]
183
- insertorderedlist: ['Numbered List', null, {context: true}]
177
+ insertUnorderedList: ['Unordered List', null, {context: true}]
178
+ insertOrderedList: ['Numbered List', null, {context: true}]
184
179
  sep: '-'
185
180
  indent:
186
181
  outdent: ['Decrease Indentation', null]
@@ -189,35 +184,35 @@
189
184
  table:
190
185
  _context: true
191
186
  _regions: ['editable']
192
- insertrowbefore: ['Insert Table Row', 'Insert a table row before the cursor']
193
- insertrowafter: ['Insert Table Row', 'Insert a table row after the cursor']
194
- deleterow: ['Delete Table Row', 'Delete this table row']
195
- insertcolumnbefore: ['Insert Table Column', 'Insert a table column before the cursor']
196
- insertcolumnafter: ['Insert Table Column', 'Insert a table column after the cursor']
197
- deletecolumn: ['Delete Table Column', 'Delete this table column']
187
+ insertRowBefore: ['Insert Table Row', 'Insert a table row before the cursor']
188
+ insertRowAfter: ['Insert Table Row', 'Insert a table row after the cursor']
189
+ deleteRow: ['Delete Table Row', 'Delete this table row']
190
+ insertColumnBefore: ['Insert Table Column', 'Insert a table column before the cursor']
191
+ insertColumnAfter: ['Insert Table Column', 'Insert a table column after the cursor']
192
+ deleteColumn: ['Delete Table Column', 'Delete this table column']
198
193
  sep1: ' '
199
- increasecolspan: ['Increase Cell Columns', 'Increase the cells colspan']
200
- decreasecolspan: ['Decrease Cell Columns', 'Decrease the cells colspan and add a new cell']
201
- increaserowspan: ['Increase Cell Rows', 'Increase the cells rowspan']
202
- decreaserowspan: ['Decrease Cell Rows', 'Decrease the cells rowspan and add a new cell']
194
+ increaseColspan: ['Increase Cell Columns', 'Increase the cells colspan']
195
+ decreaseColspan: ['Decrease Cell Columns', 'Decrease the cells colspan and add a new cell']
196
+ increaseRowspan: ['Increase Cell Rows', 'Increase the cells rowspan']
197
+ decreaseRowspan: ['Decrease Cell Rows', 'Decrease the cells rowspan and add a new cell']
203
198
  sep2: '-'
204
199
  rules:
205
- horizontalrule: ['Horizontal Rule', 'Insert a horizontal rule']
200
+ horizontalRule: ['Horizontal Rule', 'Insert a horizontal rule']
206
201
  sep1: '-'
207
202
  formatting:
208
203
  _regions: ['editable']
209
- removeformatting: ['Remove Formatting', 'Remove formatting for the selection']
204
+ removeFormatting: ['Remove Formatting', 'Remove formatting for the selection']
210
205
  sep2: ' '
211
206
  editors:
212
207
  _regions: ['editable']
213
- htmleditor: ['Edit HTML', 'Edit the HTML content'] # example behavior below
208
+ htmlEditor: ['Edit HTML', 'Edit the HTML content'] # example behavior below
214
209
 
215
210
  snippetable:
216
211
  _custom: true
217
212
  actions:
218
- editsnippet: ['Edit Snippet Settings', null]
213
+ editSnippet: ['Edit Snippet Settings', null]
219
214
  sep1: ' '
220
- removesnippet: ['Remove Snippet', null]
215
+ removeSnippet: ['Remove Snippet', null]
221
216
 
222
217
 
223
218
  # Behaviors
@@ -228,15 +223,15 @@
228
223
  #
229
224
  # You can see how the behavior matches up directly with the button name. It's also important to note that the
230
225
  # callback functions are executed within the scope of the given region, so you have access to all it's methods.
231
- # todo: figure out how this impacts different regions.. should they go away, or should they get moved into region types?
226
+ # todo: figure out how this impacts different regions.. should they go away, or should they get moved into regions?
232
227
  behaviors:
233
- horizontalrule: (selection) -> selection.replace('<hr/>')
228
+ horizontalRule: (selection) -> selection.replace('<hr/>')
234
229
 
235
- htmleditor: ->
230
+ htmlEditor: ->
236
231
  Mercury.modal '/mercury/modals/htmleditor', {
237
- title: 'HTML Editor',
238
- fullHeight: true,
239
- handler: 'htmleditor'
232
+ title: 'HTML Editor'
233
+ fullHeight: true
234
+ handler: 'htmlEditor'
240
235
  }
241
236
 
242
237
 
@@ -263,7 +258,7 @@
263
258
  .mercury-region, .mercury-textarea { min-height: 10px; outline: 1px dotted #09F }
264
259
  .mercury-textarea { box-sizing: border-box; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; resize: vertical; }
265
260
  .mercury-region:focus, .mercury-region.focus, .mercury-textarea.focus { outline: none; -webkit-box-shadow: 0 0 10px #09F, 0 0 1px #045; box-shadow: 0 0 10px #09F, 0 0 1px #045 }
266
- .mercury-region:after { content: '\00a0'; display: block; visibility: hidden; clear: both; height: 0; overflow: hidden; }
261
+ .mercury-region:after { content: '.'; display: block; visibility: hidden; clear: both; height: 0; overflow: hidden; }
267
262
  .mercury-region table, .mercury-region td { border: 1px dotted red; }
268
263
  '''
269
264
  }
@@ -271,12 +266,12 @@
271
266
 
272
267
  # Custom event and logging methods
273
268
  bind: (eventName, callback) ->
274
- $(document).bind("mercury:#{eventName}", callback)
269
+ jQuery(document).bind("mercury:#{eventName}", callback)
275
270
 
276
271
 
277
272
  trigger: (eventName, options) ->
278
273
  Mercury.log(eventName, options)
279
- $(document).trigger("mercury:#{eventName}", options)
274
+ jQuery(document).trigger("mercury:#{eventName}", options)
280
275
 
281
276
 
282
277
  log: ->
@@ -289,5 +284,3 @@
289
284
  Regions: {}
290
285
  modalHandlers: {}
291
286
  dialogHandlers: {}
292
-
293
- }