From ffc0bdaed34af88bddc16d7eedb2cfeb635cd0d3 Mon Sep 17 00:00:00 2001 From: Maki Nishifuji Date: Sun, 19 Feb 2017 22:33:38 +0900 Subject: [PATCH] Use highlight.js from npm --- .meteor/versions | 1 - client/startup/startup.js | 4 ++++ package.json | 1 + .../client/views/integrationsIncoming.js | 4 +++- .../client/views/integrationsOutgoing.js | 3 ++- .../client/views/integrationsOutgoingHistory.js | 4 +++- packages/rocketchat-integrations/package.js | 1 - packages/rocketchat-markdown/markdowncode.coffee | 1 + packages/rocketchat-markdown/package.js | 1 - 9 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.meteor/versions b/.meteor/versions index 1c3adf80596..a412929b769 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -220,7 +220,6 @@ service-configuration@1.0.11 session@1.1.7 sha@1.0.9 shell-server@0.2.2 -simple:highlight.js@1.2.0 simple:json-routes@2.1.0 smoral:sweetalert@1.1.1 spacebars@1.0.13 diff --git a/client/startup/startup.js b/client/startup/startup.js index d7a5a050ba3..af6a3fe604a 100644 --- a/client/startup/startup.js +++ b/client/startup/startup.js @@ -2,6 +2,10 @@ import moment from 'moment'; import toastr from 'toastr'; +import hljs from 'highlight.js'; +import 'highlight.js/styles/github.css'; + +hljs.initHighlightingOnLoad(); if (window.DISABLE_ANIMATION) { toastr.options.timeOut = 1; diff --git a/package.json b/package.json index 71ceaaa048a..db7c159aa94 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,7 @@ "bcrypt": "^1.0.2", "codemirror": "^5.23.0", "file-type": "^4.1.0", + "highlight.js": "^9.9.0", "jquery": "^3.1.1", "mime-db": "^1.26.0", "mime-type": "^3.0.4", diff --git a/packages/rocketchat-integrations/client/views/integrationsIncoming.js b/packages/rocketchat-integrations/client/views/integrationsIncoming.js index 8749d7dbfc1..9b0a7c663bc 100644 --- a/packages/rocketchat-integrations/client/views/integrationsIncoming.js +++ b/packages/rocketchat-integrations/client/views/integrationsIncoming.js @@ -1,4 +1,6 @@ -/* global ChatIntegrations, hljs */ +/* global ChatIntegrations */ + +import hljs from 'highlight.js'; import toastr from 'toastr'; Template.integrationsIncoming.onCreated(function _incomingIntegrationsOnCreated() { diff --git a/packages/rocketchat-integrations/client/views/integrationsOutgoing.js b/packages/rocketchat-integrations/client/views/integrationsOutgoing.js index b45edce1993..11da03324fa 100644 --- a/packages/rocketchat-integrations/client/views/integrationsOutgoing.js +++ b/packages/rocketchat-integrations/client/views/integrationsOutgoing.js @@ -1,5 +1,6 @@ -/* global ChatIntegrations, hljs */ +/* global ChatIntegrations */ +import hljs from 'highlight.js'; import toastr from 'toastr'; Template.integrationsOutgoing.onCreated(function _integrationsOutgoingOnCreated() { diff --git a/packages/rocketchat-integrations/client/views/integrationsOutgoingHistory.js b/packages/rocketchat-integrations/client/views/integrationsOutgoingHistory.js index e2c2ddc0a1c..383b5d1ba9b 100644 --- a/packages/rocketchat-integrations/client/views/integrationsOutgoingHistory.js +++ b/packages/rocketchat-integrations/client/views/integrationsOutgoingHistory.js @@ -1,4 +1,6 @@ -/* global ChatIntegrations, ChatIntegrationHistory, hljs */ +/* global ChatIntegrations, ChatIntegrationHistory */ + +import hljs from 'highlight.js'; import moment from 'moment'; import toastr from 'toastr'; diff --git a/packages/rocketchat-integrations/package.js b/packages/rocketchat-integrations/package.js index 5570f3cf030..97a5024876c 100644 --- a/packages/rocketchat-integrations/package.js +++ b/packages/rocketchat-integrations/package.js @@ -11,7 +11,6 @@ Package.onUse(function(api) { api.use('underscore'); api.use('ecmascript'); api.use('babel-compiler'); - api.use('simple:highlight.js'); api.use('rocketchat:lib'); api.use('rocketchat:authorization'); api.use('rocketchat:api'); diff --git a/packages/rocketchat-markdown/markdowncode.coffee b/packages/rocketchat-markdown/markdowncode.coffee index e74877286cc..d1b906b71e3 100644 --- a/packages/rocketchat-markdown/markdowncode.coffee +++ b/packages/rocketchat-markdown/markdowncode.coffee @@ -2,6 +2,7 @@ # MarkdownCode is a named function that will parse `inline code` and ```codeblock``` syntaxes # @param {Object} message - The message object ### +import hljs from 'highlight.js'; class MarkdownCode constructor: (message) -> diff --git a/packages/rocketchat-markdown/package.js b/packages/rocketchat-markdown/package.js index 36babdcfad2..a329c83095d 100644 --- a/packages/rocketchat-markdown/package.js +++ b/packages/rocketchat-markdown/package.js @@ -12,7 +12,6 @@ Package.onUse(function(api) { 'underscore', 'templating', 'underscorestring:underscore.string', - 'simple:highlight.js', 'rocketchat:lib' ]);