debian-mirror-gitlab/app/assets/javascripts/behaviors/index.js

44 lines
1.2 KiB
JavaScript
Raw Normal View History

2020-11-24 15:15:51 +05:30
import $ from 'jquery';
2017-08-17 22:00:37 +05:30
import './autosize';
import './bind_in_out';
2018-05-09 12:01:36 +05:30
import './markdown/render_gfm';
import initCopyAsGFM from './markdown/copy_as_gfm';
2018-03-17 18:26:18 +05:30
import initCopyToClipboard from './copy_to_clipboard';
2017-09-10 17:25:29 +05:30
import installGlEmojiElement from './gl_emoji';
2017-08-17 22:00:37 +05:30
import './quick_submit';
import './requires_input';
2018-12-05 23:21:45 +05:30
import initPageShortcuts from './shortcuts';
2017-08-17 22:00:37 +05:30
import './toggler_behavior';
2018-12-05 23:21:45 +05:30
import './preview_markdown';
2020-07-28 23:09:34 +05:30
import initCollapseSidebarOnWindowResize from './collapse_sidebar_on_window_resize';
import initSelect2Dropdowns from './select2';
2021-01-03 14:25:43 +05:30
import { loadStartupCSS } from './load_startup_css';
loadStartupCSS();
2017-08-17 22:00:37 +05:30
installGlEmojiElement();
2020-11-24 15:15:51 +05:30
2018-03-17 18:26:18 +05:30
initCopyAsGFM();
initCopyToClipboard();
2020-11-24 15:15:51 +05:30
2018-12-05 23:21:45 +05:30
initPageShortcuts();
2020-07-28 23:09:34 +05:30
initCollapseSidebarOnWindowResize();
initSelect2Dropdowns();
2020-11-24 15:15:51 +05:30
document.addEventListener('DOMContentLoaded', () => {
window.requestIdleCallback(
() => {
// Check if we have to Load GFM Input
const $gfmInputs = $('.js-gfm-input:not(.js-gfm-input-initialized)');
if ($gfmInputs.length) {
import(/* webpackChunkName: 'initGFMInput' */ './markdown/gfm_auto_complete')
.then(({ default: initGFMInput }) => {
initGFMInput($gfmInputs);
})
.catch(() => {});
}
},
{ timeout: 500 },
);
});