debian-mirror-gitlab/app/assets/javascripts/pages/projects/init_blob.js

39 lines
1.5 KiB
JavaScript
Raw Normal View History

2018-03-17 18:26:18 +05:30
import LineHighlighter from '~/line_highlighter';
import BlobLinePermalinkUpdater from '~/blob/blob_line_permalink_updater';
import ShortcutsNavigation from '~/shortcuts_navigation';
import ShortcutsBlob from '~/shortcuts_blob';
import BlobForkSuggestion from '~/blob/blob_fork_suggestion';
2018-03-27 19:54:05 +05:30
import initBlobBundle from '~/blob_edit/blob_bundle';
2018-03-17 18:26:18 +05:30
export default () => {
new LineHighlighter(); // eslint-disable-line no-new
2018-11-08 19:23:39 +05:30
// eslint-disable-next-line no-new
new BlobLinePermalinkUpdater(
2018-03-17 18:26:18 +05:30
document.querySelector('#blob-content-holder'),
'.diff-line-num[data-line-number]',
document.querySelectorAll('.js-data-file-blob-permalink-url, .js-blob-blame-link'),
);
const fileBlobPermalinkUrlElement = document.querySelector('.js-data-file-blob-permalink-url');
const fileBlobPermalinkUrl = fileBlobPermalinkUrlElement && fileBlobPermalinkUrlElement.getAttribute('href');
new ShortcutsNavigation(); // eslint-disable-line no-new
2018-11-08 19:23:39 +05:30
// eslint-disable-next-line no-new
new ShortcutsBlob({
2018-03-17 18:26:18 +05:30
skipResetBindings: true,
fileBlobPermalinkUrl,
});
2018-11-08 19:23:39 +05:30
new BlobForkSuggestion({
2018-03-17 18:26:18 +05:30
openButtons: document.querySelectorAll('.js-edit-blob-link-fork-toggler'),
forkButtons: document.querySelectorAll('.js-fork-suggestion-button'),
cancelButtons: document.querySelectorAll('.js-cancel-fork-suggestion-button'),
suggestionSections: document.querySelectorAll('.js-file-fork-suggestion-section'),
actionTextPieces: document.querySelectorAll('.js-file-fork-suggestion-section-action'),
}).init();
2018-03-27 19:54:05 +05:30
initBlobBundle();
2018-03-17 18:26:18 +05:30
};