Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit 47328f7

Browse files
feat: improve fields focus on Android when keyboard will be displayed
1 parent 9a2c28f commit 47328f7

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

studio/src/app/components/editor/app-editor-toolbar/app-editor-toolbar.tsx

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,7 @@ export class AppEditorToolbar {
8282
private initWindowResize() {
8383
if (window) {
8484
window.addEventListener('resize', Utils.debounce(async () => {
85-
if (this.selectedElement) {
86-
await this.select(this.selectedElement);
87-
}
85+
await this.moveToolbar();
8886
}, 100));
8987
}
9088
}
@@ -271,14 +269,7 @@ export class AppEditorToolbar {
271269
return;
272270
}
273271

274-
const toolbar: HTMLElement = this.el.querySelector('div.editor-toolbar');
275-
276-
if (!toolbar) {
277-
resolve();
278-
return;
279-
}
280-
281-
await this.setElementPosition(element, toolbar, 0);
272+
await this.moveToolbar();
282273

283274
this.displayed = true;
284275

@@ -308,6 +299,26 @@ export class AppEditorToolbar {
308299
});
309300
}
310301

302+
private moveToolbar(): Promise<void> {
303+
return new Promise<void>(async (resolve) => {
304+
if (!this.selectedElement) {
305+
resolve();
306+
return;
307+
}
308+
309+
const toolbar: HTMLElement = this.el.querySelector('div.editor-toolbar');
310+
311+
if (!toolbar) {
312+
resolve();
313+
return;
314+
}
315+
316+
await this.setElementPosition(this.selectedElement, toolbar, 0);
317+
318+
resolve();
319+
});
320+
}
321+
311322
private setElementPosition(src: HTMLElement, applyTo: HTMLElement, offsetWidth: number): Promise<void> {
312323
return new Promise<void>((resolve) => {
313324
const top: number = src.offsetTop > 0 ? src.offsetTop : 0;

0 commit comments

Comments
 (0)