wp/wp-admin/js/code-editor.js
changeset 16 a86126ab1dd4
parent 9 177826044cd9
--- a/wp/wp-admin/js/code-editor.js	Tue Oct 22 16:11:46 2019 +0200
+++ b/wp/wp-admin/js/code-editor.js	Tue Dec 15 13:49:49 2020 +0100
@@ -39,12 +39,12 @@
 	 * Configure linting.
 	 *
 	 * @param {CodeMirror} editor - Editor.
-	 * @param {object}     settings - Code editor settings.
-	 * @param {object}     settings.codeMirror - Settings for CodeMirror.
+	 * @param {Object}     settings - Code editor settings.
+	 * @param {Object}     settings.codeMirror - Settings for CodeMirror.
 	 * @param {Function}   settings.onChangeLintingErrors - Callback for when there are changes to linting errors.
 	 * @param {Function}   settings.onUpdateErrorNotice - Callback to update error notice.
 	 *
-	 * @returns {void}
+	 * @return {void}
 	 */
 	function configureLinting( editor, settings ) { // eslint-disable-line complexity
 		var currentErrorAnnotations = [], previouslyShownErrorAnnotations = [];
@@ -52,7 +52,7 @@
 		/**
 		 * Call the onUpdateErrorNotice if there are new errors to show.
 		 *
-		 * @returns {void}
+		 * @return {void}
 		 */
 		function updateErrorNotice() {
 			if ( settings.onUpdateErrorNotice && ! _.isEqual( currentErrorAnnotations, previouslyShownErrorAnnotations ) ) {
@@ -64,7 +64,7 @@
 		/**
 		 * Get lint options.
 		 *
-		 * @returns {object} Lint options.
+		 * @return {Object} Lint options.
 		 */
 		function getLintOptions() { // eslint-disable-line complexity
 			var options = editor.getOption( 'lint' );
@@ -79,7 +79,11 @@
 				options = $.extend( {}, options );
 			}
 
-			// Note that rules must be sent in the "deprecated" lint.options property to prevent linter from complaining about unrecognized options. See <https://github.com/codemirror/CodeMirror/pull/4944>.
+			/*
+			 * Note that rules must be sent in the "deprecated" lint.options property 
+			 * to prevent linter from complaining about unrecognized options.
+			 * See <https://github.com/codemirror/CodeMirror/pull/4944>.
+			 */
 			if ( ! options.options ) {
 				options.options = {};
 			}
@@ -209,12 +213,12 @@
 	 * Configure tabbing.
 	 *
 	 * @param {CodeMirror} codemirror - Editor.
-	 * @param {object}     settings - Code editor settings.
-	 * @param {object}     settings.codeMirror - Settings for CodeMirror.
+	 * @param {Object}     settings - Code editor settings.
+	 * @param {Object}     settings.codeMirror - Settings for CodeMirror.
 	 * @param {Function}   settings.onTabNext - Callback to handle tabbing to the next tabbable element.
 	 * @param {Function}   settings.onTabPrevious - Callback to handle tabbing to the previous tabbable element.
 	 *
-	 * @returns {void}
+	 * @return {void}
 	 */
 	function configureTabbing( codemirror, settings ) {
 		var $textarea = $( codemirror.getTextArea() );
@@ -263,17 +267,17 @@
 	 * @since 4.9.0
 	 *
 	 * @param {string|jQuery|Element} textarea - The HTML id, jQuery object, or DOM Element for the textarea that is used for the editor.
-	 * @param {object}                [settings] - Settings to override defaults.
+	 * @param {Object}                [settings] - Settings to override defaults.
 	 * @param {Function}              [settings.onChangeLintingErrors] - Callback for when the linting errors have changed.
 	 * @param {Function}              [settings.onUpdateErrorNotice] - Callback for when error notice should be displayed.
 	 * @param {Function}              [settings.onTabPrevious] - Callback to handle tabbing to the previous tabbable element.
 	 * @param {Function}              [settings.onTabNext] - Callback to handle tabbing to the next tabbable element.
-	 * @param {object}                [settings.codemirror] - Options for CodeMirror.
-	 * @param {object}                [settings.csslint] - Rules for CSSLint.
-	 * @param {object}                [settings.htmlhint] - Rules for HTMLHint.
-	 * @param {object}                [settings.jshint] - Rules for JSHint.
+	 * @param {Object}                [settings.codemirror] - Options for CodeMirror.
+	 * @param {Object}                [settings.csslint] - Rules for CSSLint.
+	 * @param {Object}                [settings.htmlhint] - Rules for HTMLHint.
+	 * @param {Object}                [settings.jshint] - Rules for JSHint.
 	 *
-	 * @returns {CodeEditorInstance} Instance.
+	 * @return {CodeEditorInstance} Instance.
 	 */
 	wp.codeEditor.initialize = function initialize( textarea, settings ) {
 		var $textarea, codemirror, instanceSettings, instance;
@@ -324,7 +328,7 @@
 						' ' === event.key && /:\s+$/.test( lineBeforeCursor );
 				} else if ( 'javascript' === innerMode ) {
 					shouldAutocomplete = isAlphaKey || '.' === event.key;
-				} else if ( 'clike' === innerMode && 'application/x-httpd-php' === codemirror.options.mode ) {
+				} else if ( 'clike' === innerMode && 'php' === codemirror.options.mode ) {
 					shouldAutocomplete = 'keyword' === token.type || 'variable' === token.type;
 				}
 				if ( shouldAutocomplete ) {