Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add popup to hashed comments/pull requests/issues in file editing/adding preview tab #24040

Merged
merged 13 commits into from
Apr 12, 2023
Merged
14 changes: 9 additions & 5 deletions web_src/js/features/comp/ComboMarkdownEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,7 @@ class ComboMarkdownEditor {
text: this.value(),
wiki: this.previewWiki,
}, (data) => {
$panelPreviewer.html(data);
initMarkupContent();

const refIssues = $panelPreviewer.find('p .ref-issue');
attachRefIssueContextPopup(refIssues);
showPreviewerWithData($panelPreviewer, data);
});
});
}
Expand Down Expand Up @@ -381,3 +377,11 @@ export async function initComboMarkdownEditor(container, options = {}) {
await editor.init();
return editor;
}

export function showPreviewerWithData($panelPreviewer, data) {
delvh marked this conversation as resolved.
Show resolved Hide resolved
$panelPreviewer.html(data);
initMarkupContent();

const refIssues = $panelPreviewer.find('p .ref-issue');
attachRefIssueContextPopup(refIssues);
}
5 changes: 2 additions & 3 deletions web_src/js/features/repo-editor.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import $ from 'jquery';
import {htmlEscape} from 'escape-goat';
import {initMarkupContent} from '../markup/content.js';
import {createCodeEditor} from './codeeditor.js';
import {hideElem, showElem} from '../utils/dom.js';
import {showPreviewerWithData} from './comp/ComboMarkdownEditor.js';

const {csrfToken} = window.config;

Expand All @@ -28,8 +28,7 @@ function initEditPreviewTab($form) {
file_path: treePathEl.val(),
}, (data) => {
const $previewPanel = $form.find(`.tab[data-tab="${$tabMenu.data('preview')}"]`);
$previewPanel.html(data);
initMarkupContent();
showPreviewerWithData($previewPanel, data);
});
});
}
Expand Down