locomotive-aloha-rails 0.20.1.2 → 0.20.1.3

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 (74) hide show
  1. data/Rakefile +1 -1
  2. data/lib/aloha/rails/version.rb +2 -2
  3. data/vendor/assets/javascripts/aloha/css/aloha.css +3 -0
  4. data/vendor/assets/javascripts/aloha/css/ext-aloha.css +3 -0
  5. data/vendor/assets/javascripts/aloha/lib/aloha-bootstrap.js +4565 -3934
  6. data/vendor/assets/javascripts/aloha/lib/aloha.js +1357 -702
  7. data/vendor/assets/javascripts/aloha/lib/aloha/command.js +16 -13
  8. data/vendor/assets/javascripts/aloha/lib/aloha/core.js +23 -3
  9. data/vendor/assets/javascripts/aloha/lib/aloha/ecma5shims.js +23 -7
  10. data/vendor/assets/javascripts/aloha/lib/aloha/editable.js +57 -14
  11. data/vendor/assets/javascripts/aloha/lib/aloha/engine.js +9 -5
  12. data/vendor/assets/javascripts/aloha/lib/aloha/floatingmenu.js +288 -96
  13. data/vendor/assets/javascripts/aloha/lib/aloha/jquery.js +11 -1
  14. data/vendor/assets/javascripts/aloha/lib/aloha/markup.js +318 -40
  15. data/vendor/assets/javascripts/aloha/lib/aloha/repositorymanager.js +11 -10
  16. data/vendor/assets/javascripts/aloha/lib/aloha/selection.js +20 -1
  17. data/vendor/assets/javascripts/aloha/lib/aloha/sidebar.js +11 -1
  18. data/vendor/assets/javascripts/aloha/lib/jquery-plugin.js +10 -7
  19. data/vendor/assets/javascripts/aloha/lib/util/dom.js +18 -6
  20. data/vendor/assets/javascripts/aloha/lib/util/range.js +6 -6
  21. data/vendor/assets/javascripts/aloha/lib/vendor/ext-3.2.1/ext-all-debug.js +26 -2
  22. data/vendor/assets/javascripts/aloha/lib/vendor/jquery.store.js +39 -15
  23. data/vendor/assets/javascripts/aloha/plugins/common/abbr/lib/abbr-plugin.js +1 -0
  24. data/vendor/assets/javascripts/aloha/plugins/common/align/lib/align-plugin.js +344 -334
  25. data/vendor/assets/javascripts/aloha/plugins/common/block/css/block.css +65 -12
  26. data/vendor/assets/javascripts/aloha/plugins/common/block/lib/block-plugin.js +12 -15
  27. data/vendor/assets/javascripts/aloha/plugins/common/block/lib/block.js +796 -180
  28. data/vendor/assets/javascripts/aloha/plugins/common/block/lib/blockcontenthandler.js +54 -13
  29. data/vendor/assets/javascripts/aloha/plugins/common/block/lib/blockmanager.js +315 -78
  30. data/vendor/assets/javascripts/aloha/plugins/common/block/lib/editor.js +111 -8
  31. data/vendor/assets/javascripts/aloha/plugins/common/block/lib/editormanager.js +2 -0
  32. data/vendor/assets/javascripts/aloha/plugins/common/block/lib/jquery-ui-1.8.16.custom.min.js +198 -0
  33. data/vendor/assets/javascripts/aloha/plugins/common/block/lib/sidebarattributeeditor.js +7 -20
  34. data/vendor/assets/javascripts/aloha/plugins/common/characterpicker/lib/characterpicker-plugin.js +15 -3
  35. data/vendor/assets/javascripts/aloha/plugins/common/contenthandler/lib/sanitizecontenthandler.js +3 -2
  36. data/vendor/assets/javascripts/aloha/plugins/common/contenthandler/lib/wordcontenthandler.js +111 -5
  37. data/vendor/assets/javascripts/aloha/plugins/common/dom-to-xhtml/lib/dom-to-xhtml-plugin.js +29 -0
  38. data/vendor/assets/javascripts/aloha/plugins/common/dom-to-xhtml/lib/dom-to-xhtml.js +306 -0
  39. data/vendor/assets/javascripts/aloha/plugins/common/format/lib/format-plugin.js +59 -5
  40. data/vendor/assets/javascripts/aloha/plugins/common/format/nls/i18n.js +1 -1
  41. data/vendor/assets/javascripts/aloha/plugins/common/horizontalruler/lib/horizontalruler-plugin.js +18 -3
  42. data/vendor/assets/javascripts/aloha/plugins/common/image/img/crop-buttons.gif +0 -0
  43. data/vendor/assets/javascripts/aloha/plugins/common/image/lib/image-plugin.js +1629 -1601
  44. data/vendor/assets/javascripts/aloha/plugins/common/image/vendor/jcrop/jquery.jcrop.css +11 -0
  45. data/vendor/assets/javascripts/aloha/plugins/common/link/extra/linklist.js +8 -6
  46. data/vendor/assets/javascripts/aloha/plugins/common/link/lib/link-plugin.js +26 -10
  47. data/vendor/assets/javascripts/aloha/plugins/common/list/nls/de/i18n.js +5 -1
  48. data/vendor/assets/javascripts/aloha/plugins/common/paste/lib/paste-plugin.js +3 -4
  49. data/vendor/assets/javascripts/aloha/plugins/common/table/lib/table-cell.js +13 -12
  50. data/vendor/assets/javascripts/aloha/plugins/common/table/lib/table-plugin.js +108 -61
  51. data/vendor/assets/javascripts/aloha/plugins/common/table/lib/table-selection.js +61 -1
  52. data/vendor/assets/javascripts/aloha/plugins/common/table/lib/table.js +1 -0
  53. data/vendor/assets/javascripts/aloha/plugins/common/table/nls/de/i18n.js +28 -1
  54. data/vendor/assets/javascripts/aloha/plugins/common/table/nls/i18n.js +36 -10
  55. data/vendor/assets/javascripts/aloha/plugins/extra/browser/css/browser.jqgrid.css +292 -292
  56. data/vendor/assets/javascripts/aloha/plugins/extra/browser/lib/browser.js +28 -5
  57. data/vendor/assets/javascripts/aloha/plugins/extra/browser/lib/locale.js +2 -2
  58. data/vendor/assets/javascripts/aloha/plugins/extra/browser/vendor/grid.locale.de.js +6 -1
  59. data/vendor/assets/javascripts/aloha/plugins/extra/browser/vendor/grid.locale.en.js +5 -0
  60. data/vendor/assets/javascripts/aloha/plugins/extra/browser/vendor/jquery.jqGrid.js +5 -0
  61. data/vendor/assets/javascripts/aloha/plugins/extra/browser/vendor/jquery.jstree.js +6 -1
  62. data/vendor/assets/javascripts/aloha/plugins/extra/browser/vendor/jquery.ui.js +6 -1
  63. data/vendor/assets/javascripts/aloha/plugins/extra/browser/vendor/ui-layout.js +6 -1
  64. data/vendor/assets/javascripts/aloha/plugins/extra/cite/lib/cite-plugin.js +18 -4
  65. data/vendor/assets/javascripts/aloha/plugins/extra/formatlesspaste/lib/formatlesspaste-plugin.js +1 -1
  66. data/vendor/assets/javascripts/aloha/plugins/extra/linkbrowser/lib/linkbrowser-plugin.js +14 -2
  67. data/vendor/assets/javascripts/aloha/plugins/extra/numerated-headers/demo/js/aloha-config.js +2 -2
  68. data/vendor/assets/javascripts/aloha/plugins/extra/toc/lib/toc-plugin.js +382 -0
  69. data/vendor/assets/javascripts/aloha/plugins/extra/toc/nls/de/i18n.js +3 -0
  70. data/vendor/assets/javascripts/aloha/plugins/extra/toc/nls/i18n.js +4 -0
  71. metadata +15 -11
  72. data/vendor/assets/javascripts/aloha/plugins/extra/toc/i18n/de.json +0 -1
  73. data/vendor/assets/javascripts/aloha/plugins/extra/toc/i18n/en.json +0 -1
  74. data/vendor/assets/javascripts/aloha/plugins/extra/toc/src/toc.js +0 -350
@@ -19,6 +19,16 @@
19
19
  */
20
20
 
21
21
  // define jquery and ext modules. They need to be available in global namespace
22
- define('aloha/jquery',[], function() {
22
+ define('aloha/jquery',[], function() {
23
+ // Work-around for http://bugs.jquery.com/ticket/9905
24
+ // and https://github.com/alohaeditor/Aloha-Editor/issues/397
25
+ if ( !Aloha.jQuery.support.getSetAttribute ) {
26
+ ( function( global ) {
27
+ Aloha.jQuery.removeAttr = function( elem, name ) {
28
+ elem.removeAttribute( name );
29
+ };
30
+ }( Aloha ));
31
+ }
32
+
23
33
  return Aloha.jQuery;
24
34
  });
@@ -18,13 +18,224 @@
18
18
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19
19
  */
20
20
 
21
- define(
22
- [ 'aloha/core', 'util/class', 'aloha/jquery' ],
23
- function( Aloha, Class, jQuery ) {
21
+ define([
22
+ 'aloha/core',
23
+ 'util/class',
24
+ 'aloha/jquery',
25
+ 'aloha/ecma5shims'
26
+ ],
27
+ function( Aloha, Class, jQuery, shims ) {
28
+
24
29
 
25
30
 
26
31
  var GENTICS = window.GENTICS;
27
32
 
33
+ var isOldIE = !!( jQuery.browser.msie &&
34
+ 9 > parseInt( jQuery.browser.version, 10 ) );
35
+
36
+ function isBR( node ) {
37
+ return 'BR' === node.nodeName;
38
+ }
39
+
40
+ function isBlock( node ) {
41
+ return 'false' === jQuery( node ).attr( 'contenteditable' );
42
+ }
43
+
44
+ function isTextNode( node ) {
45
+ return node && 3 === node.nodeType; // Node.TEXT_NODE
46
+ }
47
+
48
+ function nodeLength( node ) {
49
+ return !node ? 0
50
+ : ( isTextNode( node ) ? node.length
51
+ : node.childNodes.length );
52
+ }
53
+
54
+ function nextVisibleNode( node ) {
55
+ if ( !node ) {
56
+ return null;
57
+ }
58
+
59
+ if ( node.nextSibling ) {
60
+ // Skip over nodes that the user cannot see ...
61
+ if ( isTextNode( node.nextSibling ) &&
62
+ !isVisibleTextNode( node.nextSibling ) ) {
63
+ return nextVisibleNode( node.nextSibling );
64
+ }
65
+
66
+ // Skip over propping <br>s ...
67
+ if ( isBR( node.nextSibling ) &&
68
+ node.nextSibling === node.parentNode.lastChild ) {
69
+ return nextVisibleNode( node.nextSibling );
70
+ }
71
+
72
+ // Skip over empty editable elements ...
73
+ if ( '' === node.nextSibling.innerHTML &&
74
+ !isBlock( node.nextSibling ) ) {
75
+ return nextVisibleNode( node.nextSibling );
76
+ }
77
+
78
+ return node.nextSibling;
79
+ }
80
+
81
+ if ( node.parentNode ) {
82
+ return nextVisibleNode( node.parentNode );
83
+ }
84
+
85
+ return null;
86
+ }
87
+
88
+ function prevVisibleNode( node ) {
89
+ if ( !node ) {
90
+ return null;
91
+ }
92
+
93
+ if ( node.previousSibling ) {
94
+ // Skip over nodes that the user cannot see...
95
+ if ( isTextNode( node.previousSibling ) &&
96
+ !isVisibleTextNode( node.previousSibling ) ) {
97
+ return prevVisibleNode( node.previousSibling );
98
+ }
99
+
100
+ // Skip over empty editable elements ...
101
+ if ( '' === node.previousSibling.innerHTML &&
102
+ !isBlock( node.previousSibling ) ) {
103
+ return prevVisibleNode( node.previouSibling );
104
+ }
105
+
106
+ return node.previousSibling;
107
+ }
108
+
109
+ if ( node.parentNode ) {
110
+ return prevVisibleNode( node.parentNode );
111
+ }
112
+
113
+ return null;
114
+ }
115
+
116
+ /**
117
+ * Determines whether the given text node is visible to the the user,
118
+ * based on our understanding that browsers will not display
119
+ * superfluous white spaces.
120
+ *
121
+ * @param {HTMLEmenent} node The text node to be checked.
122
+ */
123
+ function isVisibleTextNode( node ) {
124
+ return 0 < node.data.replace( /\s+/g, '' ).length;
125
+ }
126
+
127
+ function isFrontPosition( node, offset ) {
128
+ return ( 0 === offset ) ||
129
+ ( offset <= node.data.length -
130
+ node.data.replace( /^\s+/, '' ).length );
131
+ }
132
+
133
+ function isBlockInsideEditable( $block ) {
134
+ return $block.parent().hasClass( 'aloha-editable' );
135
+ }
136
+
137
+ function isEndPosition( node, offset ) {
138
+ var length = nodeLength( node );
139
+
140
+ if ( length === offset ) {
141
+ return true;
142
+ }
143
+
144
+ var isText = isTextNode( node );
145
+
146
+ // If within a text node, then ignore superfluous white-spaces,
147
+ // since they are invisible to the user.
148
+ if ( isText &&
149
+ node.data.replace( /\s+$/, '' ).length === offset ) {
150
+ return true;
151
+ }
152
+
153
+ if ( 1 === length && !isText ) {
154
+ return isBR( node.childNodes[0] );
155
+ }
156
+
157
+ return false;
158
+ }
159
+
160
+ function blink( node ) {
161
+ jQuery( node )
162
+ .stop( true )
163
+ .css({ opacity: 0 })
164
+ .fadeIn( 0 ).delay( 100 )
165
+ .fadeIn(function () {
166
+ jQuery( node ).css({ opacity: 1 });
167
+ });
168
+
169
+ return node;
170
+ }
171
+
172
+ /**
173
+ * @TODO(petro): We need to be more intelligent about whether we insert a
174
+ * block-level placeholder or a phrasing level element.
175
+ * @TODO(petro): test with <pre>
176
+ */
177
+ function jumpBlock( block, isGoingLeft ) {
178
+ var range = new GENTICS.Utils.RangeObject();
179
+ var sibling = isGoingLeft ? prevVisibleNode( block )
180
+ : nextVisibleNode( block );
181
+
182
+ if ( !sibling || isBlock( sibling ) ) {
183
+ var $landing = jQuery( '<div>&nbsp;</div>' );
184
+
185
+ if ( isGoingLeft ) {
186
+ jQuery( block ).before( $landing );
187
+ } else {
188
+ jQuery( block ).after( $landing );
189
+ }
190
+
191
+ range.startContainer = range.endContainer = $landing[0];
192
+ range.startOffset = range.endOffset = 0;
193
+
194
+ // Clear out any old placeholder first ...
195
+ cleanupPlaceholders( range );
196
+
197
+ window.$_alohaPlaceholder = $landing;
198
+ } else {
199
+ range.startContainer = range.endContainer = sibling;
200
+ range.startOffset = range.endOffset = isGoingLeft ?
201
+ nodeLength( sibling ) : ( isOldIE ? 1 : 0 );
202
+
203
+ cleanupPlaceholders( range );
204
+ }
205
+
206
+ range.select();
207
+
208
+ Aloha.trigger( 'aloha-block-selected', block );
209
+ Aloha.Selection.preventSelectionChanged();
210
+ }
211
+
212
+ function nodeContains( node1, node2 ) {
213
+ return isOldIE ? ( shims.compareDocumentPosition( node1, node2 ) & 16 )
214
+ : 0 < jQuery( node1 ).find( node2 ).length;
215
+ }
216
+
217
+ function isInsidePlaceholder( range ) {
218
+ var start = range.startContainer;
219
+ var end = range.endContainer;
220
+ var $placeholder = window.$_alohaPlaceholder;
221
+
222
+ return $placeholder.is( start ) ||
223
+ $placeholder.is( end ) ||
224
+ nodeContains( $placeholder[0], start ) ||
225
+ nodeContains( $placeholder[0], end );
226
+ }
227
+
228
+ function cleanupPlaceholders( range ) {
229
+ if ( window.$_alohaPlaceholder && !isInsidePlaceholder( range ) ) {
230
+ if ( 0 === window.$_alohaPlaceholder.html()
231
+ .replace( /^(&nbsp;)*$/, '' ).length ) {
232
+ window.$_alohaPlaceholder.remove();
233
+ }
234
+
235
+ window.$_alohaPlaceholder = null;
236
+ }
237
+ }
238
+
28
239
  /**
29
240
  * Markup object
30
241
  */
@@ -106,9 +317,14 @@ Aloha.Markup = Class.extend( {
106
317
  }
107
318
  }
108
319
 
109
- // handle left (37) and right (39) keys for block detection
320
+ // LEFT (37), RIGHT (39) keys for block detection
110
321
  if ( event.keyCode === 37 || event.keyCode === 39 ) {
111
- return this.processCursor( rangeObject, event.keyCode );
322
+ if ( this.processCursor( rangeObject, event.keyCode ) ) {
323
+ cleanupPlaceholders( Aloha.Selection.rangeObject );
324
+ return true;
325
+ }
326
+
327
+ return false;
112
328
  }
113
329
 
114
330
  // BACKSPACE
@@ -139,55 +355,117 @@ Aloha.Markup = Class.extend( {
139
355
  },
140
356
 
141
357
  /**
142
- * Processing of cursor keys
143
- * will currently detect blocks (elements with contenteditable=false)
144
- * and selects them (normally the cursor would jump right past them)
358
+ * Processing of cursor keys.
359
+ * Detect blocks (elements with contenteditable=false) and will select them
360
+ * (normally the cursor would simply jump right past them).
145
361
  *
146
- * For each block an 'aloha-block-selected' event will be triggered.
362
+ * For each block that is selected, an 'aloha-block-selected' event will be
363
+ * triggered.
147
364
  *
148
- * @param range the current range object
149
- * @param keyCode keyCode of current keypress
150
- * @return false if a block was found to prevent further events, true otherwise
365
+ * @param {RangyRange} range A range object for the current selection.
366
+ * @param {number} keyCode Code of the currently pressed key.
367
+ * @return {boolean} False if a block was found, to prevent further events,
368
+ * true otherwise.
151
369
  */
152
370
  processCursor: function( range, keyCode ) {
153
- var rt = range.getRangeTree(), // RangeTree reference
154
- i = 0,
155
- cursorLeft = keyCode === 37,
156
- cursorRight = keyCode === 39,
157
- nextSiblingIsBlock = false, // check whether the next sibling is a block (contenteditable = false)
158
- cursorIsWithinBlock = false, // check whether the cursor is positioned within a block (contenteditable = false)
159
- cursorAtLastPos = false, // check if the cursor is within the last position of the currently active dom element
160
- obj; // will contain references to dom objects
161
-
162
371
  if ( !range.isCollapsed() ) {
163
372
  return true;
164
373
  }
165
374
 
166
- for ( ;i < rt.length; ++i ) {
167
- if ( typeof rt[i].domobj === 'undefined'
168
- || range.startOffset === rt[i].domobj.length ) {
169
- continue;
170
- }
375
+ var node = range.startContainer;
171
376
 
172
- nextSiblingIsBlock = jQuery( rt[i].domobj.nextSibling ).attr( 'contenteditable' ) === 'false';
173
- cursorIsWithinBlock = jQuery( rt[i].domobj ).parents( '[contenteditable=false]' ).length > 0;
377
+ if ( !node ) {
378
+ return true;
379
+ }
174
380
 
175
- if ( cursorRight && nextSiblingIsBlock ) {
176
- obj = rt[i].domobj.nextSibling;
177
- GENTICS.Utils.Dom.selectDomNode( obj );
178
- Aloha.trigger( 'aloha-block-selected', obj );
179
- Aloha.Selection.preventSelectionChanged();
180
- return false;
381
+ var sibling;
382
+
383
+ // Versions of Internet Explorer that are older that 9, will
384
+ // erroneously allow you to enter and edit inside elements which have
385
+ // their contenteditable attribute set to false...
386
+ if ( isOldIE ) {
387
+ var $parentBlock = jQuery( node ).parents(
388
+ '[contenteditable=false]' );
389
+ var isInsideBlock = $parentBlock.length > 0;
390
+
391
+ if ( isInsideBlock ) {
392
+ if ( isBlockInsideEditable( $parentBlock ) ) {
393
+ sibling = $parentBlock[0];
394
+ } else {
395
+ return true;
396
+ }
181
397
  }
398
+ }
399
+
400
+ if ( !sibling ) {
401
+ // True if keyCode denotes LEFT or UP arrow key, otherwise they
402
+ // keyCode is for RIGHT or DOWN in which this value will be false.
403
+ var isLeft = (37 === keyCode || 38 === keyCode);
404
+ var offset = range.startOffset;
405
+
406
+ if ( isTextNode( node ) ) {
407
+ if ( isLeft ) {
408
+ // FIXME(Petro): Please consider if you have a better idea
409
+ // of how we can work around this.
410
+ //
411
+ // Here is the problem... with Internet Explorer:
412
+ // ----------------------------------------------
413
+ //
414
+ // Versions of Internet Explorer older than 9, are buggy in
415
+ // how they `select()', or position a selection from cursor
416
+ // movements, when the following conditions are true:
417
+ //
418
+ // * The range is collapsed.
419
+ // * startContainer is a contenteditable text node.
420
+ // * startOffset is 1.
421
+ // * There is a non-conenteditable element left of the
422
+ // startContainer.
423
+ // * You attempt to move left to offset 0 (we consider a
424
+ // range to be at "frontposition" if it is at offset 0
425
+ // within its startContainer).
426
+ //
427
+ // What happens in IE 7, and IE 8, is that the selection
428
+ // will jump to the adjacent non-contenteditable
429
+ // element(s), instead moving to the front of the
430
+ // container, and the offset will be stuck at 1--even as
431
+ // the cursor is jumping around the screen!
432
+ //
433
+ // Our imperfect work-around is to reckon ourselves to be
434
+ // at the front of the next node (ie: offset 0 in other
435
+ // browsers), as soon as we detect that we are at offset 1
436
+ // in IEv<9.
437
+ //
438
+ // Considering the bug, I think this is acceptable because
439
+ // the user can still position themselve right between the
440
+ // block (non-contenteditable element) and the first
441
+ // characater of the text node by clicking there with the
442
+ // mouse, since this seems to work fine in all IE versions.
443
+ var isFrontPositionInIE = isOldIE && 1 === offset;
444
+
445
+ if ( !isFrontPositionInIE &&
446
+ !isFrontPosition( node, offset ) ) {
447
+ return true;
448
+ }
182
449
 
183
- if ( cursorLeft && cursorIsWithinBlock ) {
184
- obj = jQuery( rt[i].domobj ).parents( '[contenteditable=false]' ).get( 0 );
185
- GENTICS.Utils.Dom.selectDomNode( obj );
186
- Aloha.trigger( 'aloha-block-selected', obj );
187
- Aloha.Selection.preventSelectionChanged();
188
- return false;
450
+ } else if ( !isEndPosition( node, offset ) ) {
451
+ return true;
452
+ }
453
+
454
+ } else {
455
+ node = node.childNodes[
456
+ offset === nodeLength( node ) ? offset - 1 : offset ];
189
457
  }
458
+
459
+ sibling = isLeft ? prevVisibleNode( node )
460
+ : nextVisibleNode( node );
190
461
  }
462
+
463
+ if ( isBlock( sibling ) ) {
464
+ jumpBlock( sibling, isLeft );
465
+ return false;
466
+ }
467
+
468
+ return true;
191
469
  },
192
470
 
193
471
  /**
@@ -35,6 +35,7 @@ define( [
35
35
  Aloha.RepositoryManager = Class.extend( {
36
36
 
37
37
  repositories : [],
38
+ settings: {},
38
39
 
39
40
  /**
40
41
  * Initialize all registered repositories
@@ -51,15 +52,15 @@ define( [
51
52
  var repositories = this.repositories,
52
53
  i = 0,
53
54
  j = repositories.length,
54
- repository,
55
- settings;
55
+ repository;
56
56
 
57
57
  if ( Aloha.settings && Aloha.settings.repositories ) {
58
- settings = Aloha.settings.repositories;
59
- } else {
60
- settings = {};
58
+ this.settings = Aloha.settings.repositories;
61
59
  }
62
-
60
+
61
+ // use the configured repository manger query timeout or 5 sec
62
+ this.settings.timeout = this.settings.timeout || 5000;
63
+
63
64
  for ( ; i < j; ++i ) {
64
65
  repository = repositories[ i ];
65
66
 
@@ -67,10 +68,10 @@ define( [
67
68
  repository.settings = {};
68
69
  }
69
70
 
70
- if ( settings[ repository.repositoryId ] ) {
71
+ if ( this.settings[ repository.repositoryId ] ) {
71
72
  jQuery.extend(
72
73
  repository.settings,
73
- settings[ repository.repositoryId ]
74
+ this.settings[ repository.repositoryId ]
74
75
  );
75
76
  }
76
77
 
@@ -241,7 +242,7 @@ define( [
241
242
  // respond. 5 seconds is deemed to be the reasonable time to wait
242
243
  // when querying the repository manager in the context of something
243
244
  // like autocomplete
244
- var timeout = parseInt( params.timeout, 10 ) || 5000;
245
+ var timeout = parseInt( params.timeout, 10 ) || this.settings.timeout;
245
246
  timer = setTimeout( function() {
246
247
  numOpenCallbacks = 0;
247
248
  that.queryCallback( callback, allitems, allmetainfo, timer );
@@ -405,7 +406,7 @@ define( [
405
406
  repositories = this.repositories;
406
407
  }
407
408
 
408
- var timeout = parseInt( params.timeout, 10 ) || 5000;
409
+ var timeout = parseInt( params.timeout, 10 ) || this.settings.timeout;
409
410
  timer = setTimeout( function() {
410
411
  numOpenCallbacks = 0;
411
412
  that.getChildrenCallback( callback, allitems, timer );