@@ -329,8 +329,8 @@ define(function (require, exports, module) {
329
329
330
330
// Determine the $relativeElement by traversing the sibling list and
331
331
// stop at the first divider found
332
+ // TODO: simplify using nextUntil()/prevUntil()
332
333
var $sectionMarker = this . _getMenuItemForCommand ( CommandManager . get ( relativeID . sectionMarker ) ) ;
333
- var $sectionItems = $sectionMarker . siblings ( ) ;
334
334
var $listElem = $sectionMarker ;
335
335
$relativeElement = $listElem ;
336
336
while ( true ) {
@@ -343,7 +343,12 @@ define(function (require, exports, module) {
343
343
$relativeElement = $listElem ;
344
344
}
345
345
}
346
+
346
347
} else {
348
+ if ( relativeID . hasOwnProperty ( "sectionMarker" ) ) {
349
+ console . log ( "Bad Parameter in _getRelativeMenuItem(): if relativeID is a MenuSection, position must be FIRST_IN_SECTION or LAST_IN_SECTION" ) ;
350
+ }
351
+
347
352
// handle FIRST, LAST, BEFORE, & AFTER
348
353
var command = CommandManager . get ( relativeID ) ;
349
354
if ( command ) {
@@ -354,8 +359,9 @@ define(function (require, exports, module) {
354
359
}
355
360
356
361
return $relativeElement ;
357
- } else {
358
- console . log ( "Bad Parameter in _getRelativeMenuItem(): relativeID not specified" ) ;
362
+
363
+ } else if ( position && position !== FIRST && position !== LAST ) {
364
+ console . log ( "Bad Parameter in _getRelativeMenuItem(): relative position specified with no relativeID" ) ;
359
365
}
360
366
361
367
return $relativeElement ;
@@ -910,7 +916,7 @@ define(function (require, exports, module) {
910
916
inline_editor_cmenu . addMenuDivider ( ) ;
911
917
inline_editor_cmenu . addMenuItem ( Commands . QUICK_EDIT_PREV_MATCH ) ;
912
918
inline_editor_cmenu . addMenuItem ( Commands . QUICK_EDIT_NEXT_MATCH ) ;
913
-
919
+
914
920
/**
915
921
* Context menu for code editors (both full-size and inline)
916
922
* Auto selects the word the user clicks if the click does not occur over
0 commit comments