diff --git a/templates/repo/issue/fields/textarea.tmpl b/templates/repo/issue/fields/textarea.tmpl index 128da0b7dd9..0788baaa669 100644 --- a/templates/repo/issue/fields/textarea.tmpl +++ b/templates/repo/issue/fields/textarea.tmpl @@ -16,7 +16,7 @@ )}} {{if .root.IsAttachmentEnabled}} -
+
{{/*TODO: need to refactor the "repo/upload" template and remove this wrapper */}} {{template "repo/upload" .root}}
{{end}} diff --git a/templates/repo/upload.tmpl b/templates/repo/upload.tmpl index eef51994ab7..6b29838868d 100644 --- a/templates/repo/upload.tmpl +++ b/templates/repo/upload.tmpl @@ -1,5 +1,5 @@
('.ui.tab[data-tab-panel="markdown-previewer"]')!; // Fomantic Tab requires the "data-tab" to be globally unique. // So here it uses our defined "data-tab-for" and "data-tab-panel" to generate the "data-tab" attribute for Fomantic. @@ -222,12 +230,16 @@ export class ComboMarkdownEditor { initTabSwitcher(elTabular); this.tabEditor.addEventListener('click', () => { + this.updateEditorContainerTabPage('writer'); requestAnimationFrame(() => { this.focus(); }); }); this.tabPreviewer.addEventListener('click', async () => { + // use capture to get the event before Fomantic Tab switches the tab, so that we can set the minHeight of the previewer panel to avoid flickering. + panelPreviewer.style.minHeight = `${panelEditor?.clientHeight}px`; + this.updateEditorContainerTabPage('previewer'); const formData = new FormData(); formData.append('mode', this.previewMode); formData.append('context', this.previewContext); @@ -249,7 +261,7 @@ export class ComboMarkdownEditor { triggerEditorContentChanged(this.container); }); } - }); + }, {capture: true}); } generateMarkdownTable(rows: number, cols: number): string {