Commit 6a949cd4 authored by Mike Greiling's avatar Mike Greiling

Remove sanitize-html dependency from the main bundle

parent 6717786f
import $ from 'jquery'; import $ from 'jquery';
import Vue from 'vue'; import Vue from 'vue';
import Translate from '~/vue_shared/translate'; import Translate from '~/vue_shared/translate';
import eventHub from '~/frequent_items/event_hub'; import eventHub from './event_hub';
import frequentItems from './components/app.vue';
Vue.use(Translate); Vue.use(Translate);
...@@ -17,7 +16,7 @@ const frequentItemDropdowns = [ ...@@ -17,7 +16,7 @@ const frequentItemDropdowns = [
}, },
]; ];
const initFrequentItemDropdowns = () => { export default function initFrequentItemDropdowns() {
frequentItemDropdowns.forEach(dropdown => { frequentItemDropdowns.forEach(dropdown => {
const { namespace, key } = dropdown; const { namespace, key } = dropdown;
const el = document.getElementById(`js-${namespace}-dropdown`); const el = document.getElementById(`js-${namespace}-dropdown`);
...@@ -37,7 +36,7 @@ const initFrequentItemDropdowns = () => { ...@@ -37,7 +36,7 @@ const initFrequentItemDropdowns = () => {
new Vue({ new Vue({
el, el,
components: { components: {
frequentItems, FrequentItems: () => import('./components/app.vue'),
}, },
data() { data() {
const { dataset } = this.$options.el; const { dataset } = this.$options.el;
...@@ -66,8 +65,4 @@ const initFrequentItemDropdowns = () => { ...@@ -66,8 +65,4 @@ const initFrequentItemDropdowns = () => {
}, },
}); });
}); });
}; }
document.addEventListener('DOMContentLoaded', () => {
requestIdleCallback(initFrequentItemDropdowns);
});
...@@ -28,7 +28,7 @@ import initLayoutNav from './layout_nav'; ...@@ -28,7 +28,7 @@ import initLayoutNav from './layout_nav';
import './feature_highlight/feature_highlight_options'; import './feature_highlight/feature_highlight_options';
import LazyLoader from './lazy_loader'; import LazyLoader from './lazy_loader';
import initLogoAnimation from './logo'; import initLogoAnimation from './logo';
import './frequent_items'; import initFrequentItemDropdowns from './frequent_items';
import initBreadcrumbs from './breadcrumb'; import initBreadcrumbs from './breadcrumb';
import initUsagePingConsent from './usage_ping_consent'; import initUsagePingConsent from './usage_ping_consent';
import initPerformanceBar from './performance_bar'; import initPerformanceBar from './performance_bar';
...@@ -107,6 +107,7 @@ function deferredInitialisation() { ...@@ -107,6 +107,7 @@ function deferredInitialisation() {
initUsagePingConsent(); initUsagePingConsent();
initUserPopovers(); initUserPopovers();
initBroadcastNotifications(); initBroadcastNotifications();
initFrequentItemDropdowns();
const recoverySettingsCallout = document.querySelector('.js-recovery-settings-callout'); const recoverySettingsCallout = document.querySelector('.js-recovery-settings-callout');
PersistentUserCallout.factory(recoverySettingsCallout); PersistentUserCallout.factory(recoverySettingsCallout);
......
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