Changeset 61579
- Timestamp:
- 02/02/2026 08:01:18 PM (7 weeks ago)
- File:
-
- 1 edited
-
trunk/src/js/_enqueues/wp/code-editor.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/wp/code-editor.js
r48650 r61579 2 2 * @output wp-admin/js/code-editor.js 3 3 */ 4 5 /* eslint-env es2020 */ 4 6 5 7 if ( 'undefined' === typeof window.wp ) { … … 316 318 lineBeforeCursor = codemirror.doc.getLine( codemirror.doc.getCursor().line ).substr( 0, codemirror.doc.getCursor().ch ); 317 319 if ( 'html' === innerMode || 'xml' === innerMode ) { 318 shouldAutocomplete = 320 shouldAutocomplete = ( 319 321 '<' === event.key || 320 '/' === event.key && 'tag' === token.type || 321 isAlphaKey && 'tag' === token.type || 322 isAlphaKey && 'attribute' === token.type || 323 '=' === token.string && token.state.htmlState && token.state.htmlState.tagName; 322 ( '/' === event.key && 'tag' === token.type ) || 323 ( isAlphaKey && 'tag' === token.type ) || 324 ( isAlphaKey && 'attribute' === token.type ) || 325 ( '=' === event.key && ( 326 token.state.htmlState?.tagName || 327 token.state.curState?.htmlState?.tagName 328 ) ) 329 ); 324 330 } else if ( 'css' === innerMode ) { 325 331 shouldAutocomplete = 326 332 isAlphaKey || 327 333 ':' === event.key || 328 ' ' === event.key && /:\s+$/.test( lineBeforeCursor);334 ( ' ' === event.key && /:\s+$/.test( lineBeforeCursor ) ); 329 335 } else if ( 'javascript' === innerMode ) { 330 336 shouldAutocomplete = isAlphaKey || '.' === event.key; 331 337 } else if ( 'clike' === innerMode && 'php' === codemirror.options.mode ) { 332 shouldAutocomplete = 'keyword' === token.type || 'variable' === token.type;338 shouldAutocomplete = isAlphaKey && ( 'keyword' === token.type || 'variable' === token.type ); 333 339 } 334 340 if ( shouldAutocomplete ) {
Note: See TracChangeset
for help on using the changeset viewer.