$.fn.textSelection = function ( command, options ) {
var fn,
alternateFn,
- context,
- hasWikiEditor,
- needSave,
retval;
/**
// Return [start, end] instead of just start
startAndEnd: false
}, options );
- // FIXME: We may not need character position-based functions if we insert markers in the right places
break;
case 'setSelection':
options = $.extend( {
if ( options.end === undefined ) {
options.end = options.start;
}
- // FIXME: We may not need character position-based functions if we insert markers in the right places
break;
case 'scrollToCaretPosition':
options = $.extend( {
return;
}
- context = $( this ).data( 'wikiEditor-context' );
- hasWikiEditor = ( context !== undefined && context.$iframe !== undefined );
-
- // IE selection restore voodoo
- needSave = false;
- if ( hasWikiEditor && context.savedSelection !== null ) {
- context.fn.restoreSelection();
- needSave = true;
- }
retval = ( alternateFn && alternateFn[ command ] || fn[ command ] ).call( this, options );
- if ( hasWikiEditor && needSave ) {
- context.fn.saveSelection();
- }
return retval;
};