Commit df1eb4fa authored by Mike Greiling's avatar Mike Greiling

Move GFM autocomplete setup, delete dispatcher

parent 38000164
import './autosize';
import './bind_in_out';
import './markdown/render_gfm';
import initGFMInput from './markdown/gfm_auto_complete';
import initCopyAsGFM from './markdown/copy_as_gfm';
import initCopyToClipboard from './copy_to_clipboard';
import './details_behavior';
......@@ -12,6 +13,7 @@ import './toggler_behavior';
import './preview_markdown';
installGlEmojiElement();
initGFMInput();
initCopyAsGFM();
initCopyToClipboard();
initPageShortcuts();
/* eslint-disable consistent-return, no-new */
import $ from 'jquery';
import GfmAutoComplete from './gfm_auto_complete';
import { convertPermissionToBoolean } from './lib/utils/common_utils';
import { convertPermissionToBoolean } from '~/lib/utils/common_utils';
import GfmAutoComplete from '~/gfm_auto_complete';
function initGFMInput() {
export default function initGFMInput() {
$('.js-gfm-input:not(.js-vue-textarea)').each((i, el) => {
const gfm = new GfmAutoComplete(
gl.GfmAutoComplete && gl.GfmAutoComplete.dataSources,
);
const enableGFM = convertPermissionToBoolean(
el.dataset.supportsAutocomplete,
);
const gfm = new GfmAutoComplete(gl.GfmAutoComplete && gl.GfmAutoComplete.dataSources);
const enableGFM = convertPermissionToBoolean(el.dataset.supportsAutocomplete);
gfm.setup($(el), {
emojis: true,
members: enableGFM,
......@@ -22,10 +17,3 @@ function initGFMInput() {
});
});
}
export default () => {
const page = $('body').attr('data-page');
if (page) {
initGFMInput();
}
};
......@@ -26,7 +26,6 @@ import LazyLoader from './lazy_loader';
import initLogoAnimation from './logo';
import './frequent_items';
import initBreadcrumbs from './breadcrumb';
import initDispatcher from './dispatcher';
import initUsagePingConsent from './usage_ping_consent';
import initPerformanceBar from './performance_bar';
import initSearchAutocomplete from './search_autocomplete';
......@@ -274,6 +273,4 @@ document.addEventListener('DOMContentLoaded', () => {
// initialize field errors
$('.gl-show-field-errors').each((i, form) => new GlFieldErrors(form));
initDispatcher();
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment