locomotive-aloha-rails 0.23.2.1 → 0.23.2.2

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 (39) hide show
  1. data/README.md +3 -3
  2. data/lib/aloha/rails/engine.rb +1 -1
  3. data/lib/aloha/rails/version.rb +2 -2
  4. data/lib/tasks/aloha-assets.rake +1 -1
  5. data/vendor/assets/javascripts/aloha/css/aloha-sidebar.css +41 -17
  6. data/vendor/assets/javascripts/aloha/css/aloha.css +2 -2
  7. data/vendor/assets/javascripts/aloha/lib/aloha/contenthandlermanager.js +19 -18
  8. data/vendor/assets/javascripts/aloha/lib/aloha/engine.js +168 -9
  9. data/vendor/assets/javascripts/aloha/lib/aloha/ephemera.js +8 -1
  10. data/vendor/assets/javascripts/aloha/lib/aloha/markup.js +3 -2
  11. data/vendor/assets/javascripts/aloha/lib/aloha/pluginmanager.js +8 -0
  12. data/vendor/assets/javascripts/aloha/lib/aloha/sidebar.js +1 -1
  13. data/vendor/assets/javascripts/aloha/lib/aloha/state-override.js +59 -37
  14. data/vendor/assets/javascripts/aloha/lib/util/arrays.js +53 -6
  15. data/vendor/assets/javascripts/aloha/lib/util/boundary-markers.js +86 -0
  16. data/vendor/assets/javascripts/aloha/lib/util/dom2.js +178 -19
  17. data/vendor/assets/javascripts/aloha/lib/util/html.js +77 -10
  18. data/vendor/assets/javascripts/aloha/lib/util/maps.js +23 -1
  19. data/vendor/assets/javascripts/aloha/lib/util/range-context.js +429 -181
  20. data/vendor/assets/javascripts/aloha/lib/util/strings.js +9 -1
  21. data/vendor/assets/javascripts/aloha/plugins/common/align/nls/de/i18n.js +4 -1
  22. data/vendor/assets/javascripts/aloha/plugins/common/block/lib/blockmanager.js +2 -5
  23. data/vendor/assets/javascripts/aloha/plugins/common/characterpicker/css/characterpicker.css +6 -3
  24. data/vendor/assets/javascripts/aloha/plugins/common/characterpicker/lib/characterpicker-plugin.js +29 -32
  25. data/vendor/assets/javascripts/aloha/plugins/common/contenthandler/lib/blockelementcontenthandler.js +41 -70
  26. data/vendor/assets/javascripts/aloha/plugins/common/dom-to-xhtml/lib/dom-to-xhtml.js +1 -1
  27. data/vendor/assets/javascripts/aloha/plugins/common/format/lib/format-plugin.js +22 -10
  28. data/vendor/assets/javascripts/aloha/plugins/common/link/css/link.css +2 -8
  29. data/vendor/assets/javascripts/aloha/plugins/common/table/lib/table-cell.js +7 -0
  30. data/vendor/assets/javascripts/aloha/plugins/common/table/lib/table-plugin.js +149 -131
  31. data/vendor/assets/javascripts/aloha/plugins/common/table/lib/table.js +77 -47
  32. data/vendor/assets/javascripts/aloha/plugins/common/ui/lib/port-helper-attribute-field.js +4 -8
  33. data/vendor/assets/javascripts/aloha/plugins/common/ui/nls/de/i18n.js +1 -0
  34. data/vendor/assets/javascripts/aloha/plugins/extra/cite/css/cite.css +0 -10
  35. data/vendor/assets/javascripts/aloha/plugins/extra/cite/lib/cite-plugin.js +4 -4
  36. data/vendor/assets/javascripts/aloha/plugins/extra/headerids/lib/headerids-plugin.js +84 -32
  37. data/vendor/assets/javascripts/aloha/plugins/extra/numerated-headers/nls/de/i18n.js +2 -1
  38. data/vendor/assets/javascripts/aloha/plugins/extra/numerated-headers/nls/i18n.js +2 -1
  39. metadata +15 -14
@@ -218,7 +218,7 @@ define([
218
218
 
219
219
  function changeTargetBackground() {
220
220
  var target = $(targetObject);
221
- if (target && targetHighlightClass) {
221
+ if (targetHighlightClass) {
222
222
  target.addClass(targetHighlightClass);
223
223
  }
224
224
 
@@ -232,7 +232,7 @@ define([
232
232
  restoreTargetBackground();
233
233
 
234
234
  // set background color to give visual feedback which link is modified
235
- if (target && target.context && target.context.style &&
235
+ if (target.context && target.context.style &&
236
236
  target.context.style['background-color']) {
237
237
  target.attr('data-original-background-color',
238
238
  target.context.style['background-color']);
@@ -245,16 +245,12 @@ define([
245
245
  if (targetHighlightClass) {
246
246
  target.removeClass(targetHighlightClass);
247
247
  }
248
- if (noTargetHighlight || !target) {
248
+ if (noTargetHighlight) {
249
249
  return;
250
250
  }
251
251
  // Remove the highlighting and restore original color if was set before
252
252
  var color = target.attr('data-original-background-color');
253
- if (color) {
254
- target.css('background-color', color);
255
- } else {
256
- target.css('background-color', '');
257
- }
253
+ target.css('background-color', color || '');
258
254
  if (!target.attr('style')) {
259
255
  target.removeAttr('style');
260
256
  }
@@ -43,5 +43,6 @@ define({
43
43
  "tab.table.label": "Tabelle",
44
44
  "tab.col.label": "Tabellenspalte",
45
45
  "tab.row.label": "Tabellenzeile",
46
+ "tab.cell.label": "Tabellenzelle",
46
47
  "tab.wai-lang.label": "Sprachauszeichnung"
47
48
  });
@@ -37,13 +37,3 @@ box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 7px 0 rgba(0, 0, 0, 0.8) ins
37
37
  .aloha-cite-panel-btns button {
38
38
  width: 100%;
39
39
  }
40
-
41
- .aloha-cite-panel-field input,
42
- .aloha-cite-panel-field textarea {
43
- width: 190px;
44
- padding: 5px;
45
- color: #555;
46
- font-family: Arial, sans-serif;
47
- font-size: 12px;
48
- line-height: 1em;
49
- }
@@ -226,16 +226,16 @@ define([
226
226
  var additionalReferenceContainer = '';
227
227
 
228
228
  if (citePlugin.referenceContainer) {
229
- additionalReferenceContainer = '<div class="{panel-label}">Note:</div> ' +
229
+ additionalReferenceContainer = '<label class="{panel-label}" for="{note-field}-textarea">Note</label> ' +
230
230
  '<div class="{panel-field} {note-field}" ' +
231
231
  'style="margin: 5px;">' +
232
- '<textarea></textarea></div>';
232
+ '<textarea id="{note-field}-textarea"></textarea></div>';
233
233
  }
234
234
 
235
235
  var content = this.setContent(renderTemplate(
236
- '<div class="{panel-label}">Link:</div>' +
236
+ '<label class="{panel-label}" for="{link-field}-input">Link</label>' +
237
237
  '<div class="{panel-field} {link-field}" ' +
238
- 'style="margin: 5px;"><input type="text" /></div>' +
238
+ 'style="margin: 5px;"><input type="text" id="{link-field}-input" /></div>' +
239
239
  additionalReferenceContainer
240
240
  )).content;
241
241
 
@@ -25,20 +25,19 @@
25
25
  * recipients can access the Corresponding Source.
26
26
  */
27
27
  define([
28
+ 'aloha',
28
29
  'jquery',
29
30
  'aloha/plugin',
30
- 'i18n!headerids/nls/i18n',
31
- 'i18n!aloha/nls/i18n'
32
- ],
33
- function(jQuery, Plugin, i18n, i18nCore) {
34
- "use strict";
35
-
36
- var
37
- $ = jQuery,
38
- GENTICS = window.GENTICS,
39
- Aloha = window.Aloha;
40
-
31
+ 'i18n!headerids/nls/i18n'
32
+ ], function (
33
+ Aloha,
34
+ jQuery,
35
+ Plugin,
36
+ i18n
37
+ ) {
38
+ 'use strict';
41
39
 
40
+ var $ = jQuery;
42
41
 
43
42
  // namespace prefix for this plugin
44
43
  var ns = 'aloha-headerids';
@@ -61,7 +60,30 @@ function(jQuery, Plugin, i18n, i18nCore) {
61
60
  $.each(arguments, function () { strBldr.push(this == '' ? prx : prx + '-' + this); });
62
61
  return jQuery.trim(strBldr.join(' '));
63
62
  };
64
-
63
+
64
+ /**
65
+ * Returns a jQuery collection of all heading elements in the given editable
66
+ * which are safe to have their ids automatically set.
67
+ *
68
+ * Do not include heading elements which are annotated with the class
69
+ * "aloha-customized" because these have had their ids manually set.
70
+ *
71
+ * Do not include heading elements which are Aloha editables or blocks because
72
+ * implementations often use the ids of these elements to track them in the
73
+ * DOM.
74
+ *
75
+ * @param {jQuery.<HTMLElement>} $editable
76
+ * @return {jQuery.<HTMLHeadingElement>} A jQuery container with a
77
+ * collection of zero or more heading
78
+ * elements.
79
+ */
80
+ function getHeadingElements($element) {
81
+ return (
82
+ $element.find('h1,h2,h3,h4,h5,h6')
83
+ .not('.aloha-customized,.aloha-editable,.aloha-block')
84
+ );
85
+ }
86
+
65
87
  return Plugin.create('headerids', {
66
88
  _constructor: function(){
67
89
  this._super('headerids');
@@ -86,31 +108,61 @@ function(jQuery, Plugin, i18n, i18nCore) {
86
108
  that.initSidebar(Aloha.Sidebar.right);
87
109
  });
88
110
  },
89
-
90
- check: function(editable) {
91
- var that = this;
92
- var config = that.getEditableConfig(editable);
93
111
 
94
- if(jQuery.inArray('true',config) === -1) {
95
- // Return if the plugin should do nothing in this editable
96
- return false;
112
+ /**
113
+ * Automatically sets the id attribute of heading elements in the given
114
+ * editable element wherever it is safe to do so.
115
+ *
116
+ * @TODO: This function should be removed from being a plugin method and
117
+ * made a local closure function.
118
+ *
119
+ * @TODO: Rename to setHeadingIds()
120
+ *
121
+ * @param {jQuery.<HTMLElement>} $editable
122
+ */
123
+ check: function($editable) {
124
+ var plugin = this;
125
+ if($.inArray('true', plugin.getEditableConfig($editable)) > -1) {
126
+ getHeadingElements($editable).each(function (i, heading) {
127
+ plugin.processH(heading);
128
+ });
97
129
  }
98
-
99
- jQuery(editable).find('h1, h2, h3, h4, h5, h6').not('.aloha-customized').each(function(){
100
- that.processH(this);
101
- });
102
-
103
130
  },
104
-
105
- processH: function(h) {
106
- var that = this;
107
- jQuery(h).attr('id',that.sanitize(jQuery(h).text()));
131
+
132
+ /**
133
+ * Automatically sets the id of the given heading element to a sanitized
134
+ * version of the element's content text string.
135
+ *
136
+ * @TODO: Rename to setHeadingId()
137
+ *
138
+ * @TODO: Make this function a local closure function rather than a
139
+ * plugin method.
140
+ *
141
+ * @param {HTMLHeadingElement} heading One of the six HTML heading
142
+ * elements.
143
+ */
144
+ processH: function (heading) {
145
+ var $heading = $(heading);
146
+ $heading.attr('id', this.sanitize($heading.text()));
108
147
  },
109
-
110
- sanitize: function(str) {
111
- return (str.replace(/[^a-z0-9]+/gi,'_'));
148
+
149
+ /**
150
+ * Tranforms the given string into a ideal HTMLElement id attribute
151
+ * string by replacing non-alphanumeric characters with an underscore.
152
+ *
153
+ * @TODO: This method should be removed from being a plugin method and
154
+ * made into a local closure function.
155
+ *
156
+ * @TODO: The regular expression should be defined once (as a constant)
157
+ * outside of the scope of this function.
158
+ *
159
+ * @param {String} str
160
+ * @return {String} Santized copy of `str`.
161
+ */
162
+ sanitize: function (str) {
163
+ return str.replace(/[^a-z0-9]+/gi, '_');
112
164
  },
113
-
165
+
114
166
  //ns = headerids
115
167
  initSidebar: function(sidebar) {
116
168
  var pl = this;
@@ -1,5 +1,6 @@
1
1
  define({
2
2
  "headerids.label.target": "Ziel",
3
3
  "headerids.button.reset": "Zurücksetzen",
4
- "headerids.button.set": "Setzen"
4
+ "headerids.button.set": "Setzen",
5
+ "button.numeratedHeaders.tooltip": "Nummerierung von Überschriften umschalten"
5
6
  });
@@ -2,7 +2,8 @@ define({
2
2
  "root": {
3
3
  "headerids.label.target": "Target",
4
4
  "headerids.button.reset": "Reset",
5
- "headerids.button.set": "Set"
5
+ "headerids.button.set": "Set",
6
+ "button.numeratedHeaders.tooltip": "Toggle header numeration"
6
7
  },
7
8
  "ca": true,
8
9
  "de": true,
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: locomotive-aloha-rails
3
3
  version: !ruby/object:Gem::Version
4
+ version: 0.23.2.2
4
5
  prerelease:
5
- version: 0.23.2.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Didier Lafforgue
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-21 00:00:00.000000000 Z
12
+ date: 2013-05-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- type: :runtime
16
- version_requirements: !ruby/object:Gem::Requirement
15
+ name: actionpack
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
21
  version: 3.2.13
22
- name: actionpack
22
+ type: :runtime
23
23
  prerelease: false
24
- requirement: !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: 3.2.13
30
30
  - !ruby/object:Gem::Dependency
31
- type: :development
32
- version_requirements: !ruby/object:Gem::Requirement
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
35
  - - '='
36
36
  - !ruby/object:Gem::Version
37
37
  version: 0.9.2
38
- name: rake
38
+ type: :development
39
39
  prerelease: false
40
- requirement: !ruby/object:Gem::Requirement
40
+ version_requirements: !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - '='
@@ -120,6 +120,7 @@ files:
120
120
  - vendor/assets/javascripts/aloha/lib/require.js
121
121
  - vendor/assets/javascripts/aloha/lib/text.js
122
122
  - vendor/assets/javascripts/aloha/lib/util/arrays.js
123
+ - vendor/assets/javascripts/aloha/lib/util/boundary-markers.js
123
124
  - vendor/assets/javascripts/aloha/lib/util/browser.js
124
125
  - vendor/assets/javascripts/aloha/lib/util/class.js
125
126
  - vendor/assets/javascripts/aloha/lib/util/dom.js
@@ -882,19 +883,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
882
883
  requirements:
883
884
  - - ! '>='
884
885
  - !ruby/object:Gem::Version
886
+ version: '0'
885
887
  segments:
886
888
  - 0
887
- hash: -1843757229484811642
888
- version: '0'
889
+ hash: 558321058196106502
889
890
  required_rubygems_version: !ruby/object:Gem::Requirement
890
891
  none: false
891
892
  requirements:
892
893
  - - ! '>='
893
894
  - !ruby/object:Gem::Version
895
+ version: '0'
894
896
  segments:
895
897
  - 0
896
- hash: -1843757229484811642
897
- version: '0'
898
+ hash: 558321058196106502
898
899
  requirements: []
899
900
  rubyforge_project:
900
901
  rubygems_version: 1.8.23