Remove vue-highlightjs, lightweight highlight.js

This commit is contained in:
Kristian Polso 2018-06-01 10:52:47 +03:00
parent 084f65963d
commit 6d7b9bb1a4
5 changed files with 28 additions and 16 deletions

View file

@ -41,12 +41,9 @@
<script> <script>
import Vue from 'vue' import Vue from 'vue'
import VueHighlightJS from 'vue-highlightjs'
import EventBus from '../event-bus'; import EventBus from '../event-bus';
Vue.use(VueHighlightJS)
export default { export default {
data () { data () {
return { return {

View file

@ -14,7 +14,7 @@
</header> </header>
<div class="xs12" v-if="exampleCode != ''"> <div class="xs12" v-if="exampleCode != ''">
<pre v-highlightjs="exampleCode"><code class="bash"></code></pre> <pre><code class="bash"><span v-html="highlight('bash',exampleCode)"></span></code></pre>
</div> </div>
<div class="xs12" v-if="isLoading"> <div class="xs12" v-if="isLoading">
@ -23,7 +23,7 @@
<div class="xs12" v-if="jsonData"> <div class="xs12" v-if="jsonData">
<p>Success! Here is the response for <strong>lbry://{{ address }}</strong>:</p> <p>Success! Here is the response for <strong>lbry://{{ address }}</strong>:</p>
<pre v-highlightjs="jsonData" class="json-example"><code class="json"></code></pre> <pre class="json-example"><code class="json"><span v-html="highlight('json',jsonData)"></span></code></pre>
<a href="#" class="__button-black" v-on:click="goTo(2)">Go to next step</a> <a href="#" class="__button-black" v-on:click="goTo(2)">Go to next step</a>
</div> </div>
@ -76,6 +76,7 @@
<script> <script>
import EventBus from '../event-bus'; import EventBus from '../event-bus';
import hljs from 'highlight.js';
export default { export default {
data () { data () {
@ -86,6 +87,13 @@ export default {
exampleCode: '' exampleCode: ''
} }
}, },
mounted () {
hljs.configure({
languages: ['bash', 'json']
});
},
methods: { methods: {
fetchMetadata () { fetchMetadata () {
var component = this; var component = this;
@ -104,6 +112,9 @@ export default {
}, },
goTo (page) { goTo (page) {
EventBus.$emit('HookStepUpdate', page); EventBus.$emit('HookStepUpdate', page);
},
highlight (language, text) {
return hljs.highlight(language, text).value;
} }
}, },
name: 'Step1' name: 'Step1'

View file

@ -16,7 +16,7 @@
</header> </header>
<div class="xs12" v-if="exampleCode != ''"> <div class="xs12" v-if="exampleCode != ''">
<pre v-highlightjs="exampleCode"><code class="bash"></code></pre> <pre><code class="bash"><span v-html="highlight('bash',exampleCode)"></span></code></pre>
</div> </div>
<div class="xs12" v-if="isLoading"> <div class="xs12" v-if="isLoading">
@ -25,7 +25,7 @@
<div class="xs12" v-if="jsonData"> <div class="xs12" v-if="jsonData">
<p>Success! Here is the response:</p> <p>Success! Here is the response:</p>
<pre v-highlightjs="jsonData" class="json-example"><code class="json"></code></pre> <pre class="json-example"><code class="json"><span v-html="highlight('json',jsonData)"></span></code></pre>
</div> </div>
<template v-if="!isLoading && !jsonData"> <template v-if="!isLoading && !jsonData">
@ -77,6 +77,7 @@
<script> <script>
import EventBus from '../event-bus'; import EventBus from '../event-bus';
import hljs from 'highlight.js';
export default { export default {
data () { data () {
@ -88,6 +89,13 @@ export default {
jsonData: '' jsonData: ''
} }
}, },
mounted () {
hljs.configure({
languages: ['bash', 'json']
});
},
methods: { methods: {
send () { send () {
var component = this; var component = this;
@ -106,10 +114,13 @@ export default {
}, },
goTo (page) { goTo (page) {
EventBus.$emit('HookStepUpdate', page); EventBus.$emit('HookStepUpdate', page);
},
highlight (language, text) {
return hljs.highlight(language, text).value;
} }
}, },
name: 'Step3' name: 'Step3'
} };
</script> </script>
<style lang="scss"> <style lang="scss">

View file

@ -27,7 +27,6 @@
"sass-loader": "^7.0.1", "sass-loader": "^7.0.1",
"slack-node": "^0.1.8", "slack-node": "^0.1.8",
"vue": "^2.5.16", "vue": "^2.5.16",
"vue-highlightjs": "^1.3.3",
"vue-images-loaded": "^1.1.2", "vue-images-loaded": "^1.1.2",
"vue-moment": "^3.2.0", "vue-moment": "^3.2.0",
"vue-resource": "^1.5.0", "vue-resource": "^1.5.0",

View file

@ -3014,7 +3014,7 @@ heroku-ssl-redirect@0.0.4:
version "0.0.4" version "0.0.4"
resolved "https://registry.yarnpkg.com/heroku-ssl-redirect/-/heroku-ssl-redirect-0.0.4.tgz#21ba0707aa503b50a412a0946abfaa88ef7d082c" resolved "https://registry.yarnpkg.com/heroku-ssl-redirect/-/heroku-ssl-redirect-0.0.4.tgz#21ba0707aa503b50a412a0946abfaa88ef7d082c"
highlight.js@*, highlight.js@^9.12.0: highlight.js@^9.12.0:
version "9.12.0" version "9.12.0"
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.12.0.tgz#e6d9dbe57cbefe60751f02af336195870c90c01e" resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.12.0.tgz#e6d9dbe57cbefe60751f02af336195870c90c01e"
@ -6624,12 +6624,6 @@ vm-browserify@0.0.4:
dependencies: dependencies:
indexof "0.0.1" indexof "0.0.1"
vue-highlightjs@^1.3.3:
version "1.3.3"
resolved "https://registry.yarnpkg.com/vue-highlightjs/-/vue-highlightjs-1.3.3.tgz#29a0d57132fc1ce15cfa61e896918f5b718c5d52"
dependencies:
highlight.js "*"
vue-hot-reload-api@^2.3.0: vue-hot-reload-api@^2.3.0:
version "2.3.0" version "2.3.0"
resolved "https://registry.yarnpkg.com/vue-hot-reload-api/-/vue-hot-reload-api-2.3.0.tgz#97976142405d13d8efae154749e88c4e358cf926" resolved "https://registry.yarnpkg.com/vue-hot-reload-api/-/vue-hot-reload-api-2.3.0.tgz#97976142405d13d8efae154749e88c4e358cf926"