Fix UrlBar wrapping on focus

This commit is contained in:
Gregory Schier
2025-01-22 06:40:34 -08:00
parent 4ae045cf18
commit 82b1ad35ff

View File

@@ -167,8 +167,8 @@ export const Editor = forwardRef<EditorView | undefined, EditorProps>(function E
function configurePlaceholder() { function configurePlaceholder() {
if (cm.current === null) return; if (cm.current === null) return;
const ext = placeholderExt(placeholderElFromText(placeholder ?? '', type)); const ext = placeholderExt(placeholderElFromText(placeholder ?? '', type));
const effect = placeholderCompartment.current.reconfigure(ext); const effects = placeholderCompartment.current.reconfigure(ext);
cm.current?.view.dispatch({ effects: effect }); cm.current?.view.dispatch({ effects });
}, },
[placeholder, type], [placeholder, type],
); );
@@ -186,8 +186,8 @@ export const Editor = forwardRef<EditorView | undefined, EditorProps>(function E
if (settings.editorKeymap === 'emacs' && current === keymapExtensions['emacs']) return; // Nothing to do if (settings.editorKeymap === 'emacs' && current === keymapExtensions['emacs']) return; // Nothing to do
const ext = keymapExtensions[settings.editorKeymap] ?? keymapExtensions['default']; const ext = keymapExtensions[settings.editorKeymap] ?? keymapExtensions['default'];
const effect = keymapCompartment.current.reconfigure(ext); const effects = keymapCompartment.current.reconfigure(ext);
cm.current.view.dispatch({ effects: effect }); cm.current.view.dispatch({ effects });
}, },
[settings.editorKeymap], [settings.editorKeymap],
); );
@@ -202,9 +202,9 @@ export const Editor = forwardRef<EditorView | undefined, EditorProps>(function E
if (wrapLines && current !== emptyExtension) return; // Nothing to do if (wrapLines && current !== emptyExtension) return; // Nothing to do
if (!wrapLines && current === emptyExtension) return; // Nothing to do if (!wrapLines && current === emptyExtension) return; // Nothing to do
const ext = wrapLines ? EditorView.lineWrapping : []; const ext = wrapLines ? EditorView.lineWrapping : emptyExtension;
const effect = wrapLinesCompartment.current.reconfigure(ext); const effects = wrapLinesCompartment.current.reconfigure(ext);
cm.current?.view.dispatch({ effects: effect }); cm.current?.view.dispatch({ effects });
}, },
[wrapLines], [wrapLines],
); );
@@ -344,7 +344,7 @@ export const Editor = forwardRef<EditorView | undefined, EditorProps>(function E
placeholderCompartment.current.of( placeholderCompartment.current.of(
placeholderExt(placeholderElFromText(placeholder ?? '', type)), placeholderExt(placeholderElFromText(placeholder ?? '', type)),
), ),
wrapLinesCompartment.current.of(wrapLines ? EditorView.lineWrapping : []), wrapLinesCompartment.current.of(wrapLines ? EditorView.lineWrapping : emptyExtension),
keymapCompartment.current.of( keymapCompartment.current.of(
keymapExtensions[settings.editorKeymap] ?? keymapExtensions['default'], keymapExtensions[settings.editorKeymap] ?? keymapExtensions['default'],
), ),