From dec5333014fde21a886b690edf218a09af535163 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Tue, 5 Dec 2017 15:14:38 +0000 Subject: Export old code as ES6 odules Rever project find file changes --- app/assets/javascripts/main.js | 3 - .../merge_conflicts/merge_conflicts_bundle.js | 3 +- app/assets/javascripts/merge_request_tabs.js | 3 +- app/assets/javascripts/render_gfm.js | 3 +- .../javascripts/repo/components/repo_preview.vue | 3 +- app/assets/javascripts/single_file_diff.js | 3 +- app/assets/javascripts/syntax_highlight.js | 14 ++-- spec/javascripts/syntax_highlight_spec.js | 74 +++++++++++----------- 8 files changed, 52 insertions(+), 54 deletions(-) diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js index dcc0fa63b63..80fbad2a41b 100644 --- a/app/assets/javascripts/main.js +++ b/app/assets/javascripts/main.js @@ -64,10 +64,7 @@ import './notifications_form'; import './pager'; import './preview_markdown'; import './project_find_file'; -import './project_import'; import './projects_dropdown'; -import './projects_list'; -import './syntax_highlight'; import './render_gfm'; import './right_sidebar'; import './search'; diff --git a/app/assets/javascripts/merge_conflicts/merge_conflicts_bundle.js b/app/assets/javascripts/merge_conflicts/merge_conflicts_bundle.js index 17591829b76..372b2b520e8 100644 --- a/app/assets/javascripts/merge_conflicts/merge_conflicts_bundle.js +++ b/app/assets/javascripts/merge_conflicts/merge_conflicts_bundle.js @@ -3,6 +3,7 @@ import Vue from 'vue'; import Flash from '../flash'; import initIssuableSidebar from '../init_issuable_sidebar'; +import syntaxHighlight from '../syntax_highlight'; import './merge_conflict_store'; import './merge_conflict_service'; import './mixins/line_conflict_utils'; @@ -53,7 +54,7 @@ $(() => { mergeConflictsStore.setLoadingState(false); this.$nextTick(() => { - $('.js-syntax-highlight').syntaxHighlight(); + syntaxHighlight($('.js-syntax-highlight')); }); }); }, diff --git a/app/assets/javascripts/merge_request_tabs.js b/app/assets/javascripts/merge_request_tabs.js index 54c1b7a268e..e9254acbfd7 100644 --- a/app/assets/javascripts/merge_request_tabs.js +++ b/app/assets/javascripts/merge_request_tabs.js @@ -13,6 +13,7 @@ import { } from './lib/utils/common_utils'; import initDiscussionTab from './image_diff/init_discussion_tab'; import Diff from './diff'; +import syntaxHighlight from './syntax_highlight'; /* eslint-disable max-len */ // MergeRequestTabs @@ -294,7 +295,7 @@ import Diff from './diff'; } gl.utils.localTimeAgo($('.js-timeago', 'div#diffs')); - $('#diffs .js-syntax-highlight').syntaxHighlight(); + syntaxHighlight($('#diffs .js-syntax-highlight')); if (this.diffViewType() === 'parallel' && this.isDiffAction(this.currentAction)) { this.expandViewContainer(); diff --git a/app/assets/javascripts/render_gfm.js b/app/assets/javascripts/render_gfm.js index c91a0d9ba41..05a623ca6d9 100644 --- a/app/assets/javascripts/render_gfm.js +++ b/app/assets/javascripts/render_gfm.js @@ -1,12 +1,13 @@ import renderMath from './render_math'; import renderMermaid from './render_mermaid'; +import syntaxHighlight from './syntax_highlight'; // Render Gitlab flavoured Markdown // // Delegates to syntax highlight and render math & mermaid diagrams. // $.fn.renderGFM = function renderGFM() { - this.find('.js-syntax-highlight').syntaxHighlight(); + syntaxHighlight(this.find('.js-syntax-highlight')); renderMath(this.find('.js-render-math')); renderMermaid(this.find('.js-render-mermaid')); return this; diff --git a/app/assets/javascripts/repo/components/repo_preview.vue b/app/assets/javascripts/repo/components/repo_preview.vue index 6ce9267f598..425c55fafb5 100644 --- a/app/assets/javascripts/repo/components/repo_preview.vue +++ b/app/assets/javascripts/repo/components/repo_preview.vue @@ -1,6 +1,7 @@