bundles/org.eclipse.orion.client.editor/web/orion/editor/actions.js
function(quotation) {
			if (!this.autoPairQuotation) { return false; }
			var editor = this.editor;
			var textView = editor.getTextView();
			if (textView.getOptions("readonly")) { return false; } //$NON-NLS-0$
			var isQuotation = new RegExp("^\"$|^'$"); //$NON-NLS-0$
			var isAlpha = new RegExp("\\w"); //$NON-NLS-0$
			var isClosingBracket = new RegExp("^$|[)}\\]>]"); //$NON-NLS-0$ // matches any empty string and closing bracket
			var model = editor.getModel();
			forEachSelection(this, false, function(selection, setText) {
				var prevChar = (selection.start === 0) ? "" : model.getText(selection.start - 1, selection.start).trim(); //$NON-NLS-0$
				var nextChar = (selection.start === model.getCharCount()) ? "" : model.getText(selection.start, selection.start + 1).trim(); //$NON-NLS-0$
				function insertQuotation() {
					setText(quotation, selection.start, selection.end);
					selection.start = selection.end = selection.start + quotation.length;
				}
				// Wrap the selected text with the specified opening and closing quotation marks and keep selection on text
				if (selection.start !== selection.end) {
					var text = model.getText(selection.start, selection.end);
					if (isQuotation.test(text)) {
						insertQuotation();
					} else {
						setText(quotation + text + quotation, selection.start, selection.end);
						selection.start += 1;
						selection.end += 1;
					}
				} else if (nextChar === quotation) {
					// Skip over the next character if it matches the specified quotation mark
					selection.start = selection.end = selection.start + 1;
				} else if (prevChar === quotation || isQuotation.test(nextChar) || isAlpha.test(prevChar) || !isClosingBracket.test(nextChar)) {
					insertQuotation();
				} else {
					// No selection - wrap the caret with the opening and closing quotation marks, and maintain the caret position inbetween the quotations
					setText(quotation + quotation, selection.start, selection.end);
					selection.start = selection.end = selection.start + quotation.length;
				}
			});
			return true;
		}
function(quotation) {
			if (!this.autoPairQuotation) { return false; }
			var editor = this.editor;
			var textView = editor.getTextView();
			if (textView.getOptions("readonly")) { return false; } //$NON-NLS-0$
			var isQuotation = new RegExp("^\"$|^'$"); //$NON-NLS-0$
			var isAlpha = new RegExp("\\w"); //$NON-NLS-0$
			var isClosingBracket = new RegExp("^$|[)}\\]>]"); //$NON-NLS-0$ // matches any empty string and closing bracket
			var model = editor.getModel();
			forEachSelection(this, false, function(selection, setText) {
				var prevChar = (selection.start === 0) ? "" : model.getText(selection.start - 1, selection.start).trim(); //$NON-NLS-0$
				var nextChar = (selection.start === model.getCharCount()) ? "" : model.getText(selection.start, selection.start + 1).trim(); //$NON-NLS-0$
				function insertQuotation() {
					setText(quotation, selection.start, selection.end);
					selection.start = selection.end = selection.start + quotation.length;
				}
				// Wrap the selected text with the specified opening and closing quotation marks and keep selection on text
				if (selection.start !== selection.end) {
					var text = model.getText(selection.start, selection.end);
					if (isQuotation.test(text)) {
						insertQuotation();
					} else {
						setText(quotation + text + quotation, selection.start, selection.end);
						selection.start += 1;
						selection.end += 1;
					}
				} else if (nextChar === quotation) {
					// Skip over the next character if it matches the specified quotation mark
					selection.start = selection.end = selection.start + 1;
				} else if (prevChar === quotation || isQuotation.test(nextChar) || isAlpha.test(prevChar) || !isClosingBracket.test(nextChar)) {
					insertQuotation();
				} else {
					// No selection - wrap the caret with the opening and closing quotation marks, and maintain the caret position inbetween the quotations
					setText(quotation + quotation, selection.start, selection.end);
					selection.start = selection.end = selection.start + quotation.length;
				}
			});
			return true;
		}
function ( quotation ) { if ( ! this . autoPairQuotation ) { return false ; } var editor = this . editor ; var textView = editor . getTextView ( ) ; if ( textView . getOptions ( "readonly" ) ) { return false ; } //$NON-NLS-0$
 var isQuotation = new RegExp ( "^\"$|^'$" ) ; //$NON-NLS-0$
 var isAlpha = new RegExp ( "\\w" ) ; //$NON-NLS-0$
 var isClosingBracket = new RegExp ( "^$|[)}\\]>]" ) ; //$NON-NLS-0$ // matches any empty string and closing bracket
 var model = editor . getModel ( ) ; forEachSelection ( this , false , function ( selection , setText ) { var prevChar = ( selection . start === 0 ) ? "" : model . getText ( selection . start - 1 , selection . start ) . trim ( ) ; //$NON-NLS-0$
 var nextChar = ( selection . start === model . getCharCount ( ) ) ? "" : model . getText ( selection . start , selection . start + 1 ) . trim ( ) ; //$NON-NLS-0$
 function insertQuotation ( ) { setText ( quotation , selection . start , selection . end ) ; selection . start = selection . end = selection . start + quotation . length ; } // Wrap the selected text with the specified opening and closing quotation marks and keep selection on text
 if ( selection . start !== selection . end ) { var text = model . getText ( selection . start , selection . end ) ; if ( isQuotation . test ( text ) ) { insertQuotation ( ) ; } else { setText ( quotation + text + quotation , selection . start , selection . end ) ; selection . start += 1 ; selection . end += 1 ; } } else if ( nextChar === quotation ) { // Skip over the next character if it matches the specified quotation mark
 selection . start = selection . end = selection . start + 1 ; } else if ( prevChar === quotation || isQuotation . test ( nextChar ) || isAlpha . test ( prevChar ) || ! isClosingBracket . test ( nextChar ) ) { insertQuotation ( ) ; } else { // No selection - wrap the caret with the opening and closing quotation marks, and maintain the caret position inbetween the quotations
 setText ( quotation + quotation , selection . start , selection . end ) ; selection . start = selection . end = selection . start + quotation . length ; } } ) ; return true ; }
Called on a quotation mark keypress.
Automatically inserts a pair of the specified quotation around the caret the caret or selected text.
Called on a quotation mark keypress . Automatically inserts a pair of the specified quotation around the caret the caret or selected text .