mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-27 02:42:25 +08:00
fix(core): input not automatically focused (#10050)
Fix issue [AF-2161](https://linear.app/affine-design/issue/AF-2161).
This commit is contained in:
@@ -7,7 +7,7 @@ import { SignalWatcher, WithDisposable } from '@blocksuite/affine/global/utils';
|
|||||||
import { SearchIcon } from '@blocksuite/icons/lit';
|
import { SearchIcon } from '@blocksuite/icons/lit';
|
||||||
import type { DocMeta } from '@blocksuite/store';
|
import type { DocMeta } from '@blocksuite/store';
|
||||||
import { css, html } from 'lit';
|
import { css, html } from 'lit';
|
||||||
import { property, state } from 'lit/decorators.js';
|
import { property, query, state } from 'lit/decorators.js';
|
||||||
|
|
||||||
import type { DocSearchMenuConfig } from '../chat-config';
|
import type { DocSearchMenuConfig } from '../chat-config';
|
||||||
import type { ChatChip } from '../chat-context';
|
import type { ChatChip } from '../chat-context';
|
||||||
@@ -93,11 +93,20 @@ export class ChatPanelAddPopover extends SignalWatcher(
|
|||||||
@property({ attribute: false })
|
@property({ attribute: false })
|
||||||
accessor abortController!: AbortController;
|
accessor abortController!: AbortController;
|
||||||
|
|
||||||
|
@query('.search-input')
|
||||||
|
accessor searchInput!: HTMLInputElement;
|
||||||
|
|
||||||
override connectedCallback() {
|
override connectedCallback() {
|
||||||
super.connectedCallback();
|
super.connectedCallback();
|
||||||
this._updateDocGroup();
|
this._updateDocGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override firstUpdated() {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
this.searchInput.focus();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
override render() {
|
override render() {
|
||||||
const items = Array.isArray(this._docGroup.items)
|
const items = Array.isArray(this._docGroup.items)
|
||||||
? this._docGroup.items
|
? this._docGroup.items
|
||||||
|
|||||||
Reference in New Issue
Block a user