We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b6f4bfd commit 11b0479Copy full SHA for 11b0479
apps/builder/app/builder/shared/code-editor-base.tsx
@@ -289,7 +289,20 @@ export const EditorContent = ({
289
290
useEffect(() => {
291
if (autoFocus) {
292
- viewRef.current?.focus();
+ // Select all text when editor is focused
293
+ const view = viewRef.current;
294
+ if (!view) {
295
+ return;
296
+ }
297
+ view.focus();
298
+ requestAnimationFrame(() => {
299
+ const doc = view.state.doc;
300
+ const transaction = view.state.update({
301
+ selection: { anchor: 0, head: doc.length },
302
+ scrollIntoView: true,
303
+ });
304
+ view.dispatch(transaction);
305
306
}
307
}, [autoFocus]);
308
0 commit comments