0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-23 00:53:34 +01:00

Focus editor on "Write" tab click (#26714)

Focus the editor when clicking the "Write" tab. Works for both Textarea
and EasyMDE. Does for some reason not work without the
`requestAnimationFrame`.
This commit is contained in:
silverwind 2023-08-25 07:26:32 +02:00 committed by GitHub
parent 390ec619f3
commit 636b6eaf2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -135,6 +135,12 @@ class ComboMarkdownEditor {
$panelPreviewer.attr('data-tab', `markdown-previewer-${elementIdCounter}`);
elementIdCounter++;
$tabEditor[0].addEventListener('click', () => {
requestAnimationFrame(() => {
this.focus();
});
});
$tabs.tab();
this.previewUrl = $tabPreviewer.attr('data-preview-url');