customize search bar
Hunter
Thursday, January 15th, 2026 at 1:08 PM
388
389 const {EditorView, EditorState, Compartment, keymap, defaultKeymap, indentWithTab, html, githubDark, indentUnit, placeholder, undo, redo, history, closeBrackets, search, searchKeymap, closeSearchPanel, openSearchPanel, lineNumbers} = window.CodeMirror;
390
391 + // Custom phrase overrides for CodeMirror UI (search panel)
392 + const customPhrases = EditorState.phrases.of({
393 + "Find": "Find..."
394 + });
395 +
396 // Load saved content and editor settings
397 const savedContent = loadFromStorage();
398 loadEditorSettings();
408 state: EditorState.create({
409 doc: savedContent,
410 extensions: [
411 + customPhrases,
412 history(),
413 search(),
414 closeBrackets(),
512 closeSearchPanel(editorView) || openSearchPanel(editorView);
513 }
514 });
515 +
516 + // Disable browser autocomplete on search panel inputs when they appear
517 + const editorElement = document.getElementById('editor');
518 + const searchInputObserver = new MutationObserver((mutations) => {
519 + for (const mutation of mutations) {
520 + for (const node of mutation.addedNodes) {
521 + if (node.nodeType === Node.ELEMENT_NODE) {
522 + const searchInputs = node.querySelectorAll?.('.cm-search input[name="search"], .cm-search input[name="replace"]');
523 + searchInputs?.forEach(input => input.setAttribute('autocomplete', 'off'));
524 + }
525 + }
526 + }
527 + });
528 + searchInputObserver.observe(editorElement, { childList: true, subtree: true });
529 }
530
531 // Mobile keyboard detection