@abi-software/map-side-bar 1.3.26-staging → 1.3.27-staging

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/map-side-bar",
3
- "version": "1.3.26-staging",
3
+ "version": "1.3.27-staging",
4
4
  "main": "./dist/map-side-bar.common.js",
5
5
  "files": [
6
6
  "dist/*",
@@ -21,6 +21,8 @@
21
21
  "@abi-software/svg-sprite": "^0.1.14",
22
22
  "algoliasearch": "^4.10.5",
23
23
  "element-ui": "^2.13.0",
24
+ "isomorphic-dompurify": "^0.23.0",
25
+ "marked": "^4.1.1",
24
26
  "vue": "^2.6.10"
25
27
  },
26
28
  "devDependencies": {
@@ -5,11 +5,11 @@
5
5
  <div v-show="!showDetails" class="hide" @click="showDetails = !showDetails">Show information<i class="el-icon-arrow-down"></i></div>
6
6
  <el-card v-if="showDetails && Object.keys(contextData).length !== 0" v-loading="loading" class="context-card" >
7
7
  <div class="card-left">
8
- <img :src="entry.banner" class="context-image">
8
+ <img :src="banner" class="context-image">
9
9
  </div>
10
10
  <div class="card-right scrollbar">
11
11
  <div class="title">{{contextData.heading}}</div>
12
- <div v-html="contextData.description"/>
12
+ <div v-html="parseMarkdown(contextData.description)"/>
13
13
  <br/>
14
14
 
15
15
  <!-- Show sampeles and views seperately if they do not match -->
@@ -71,6 +71,9 @@ import locale from "element-ui/lib/locale";
71
71
  import EventBus from "./EventBus"
72
72
  import hardcoded_info from './hardcoded-context-info'
73
73
 
74
+ import { marked } from 'marked'
75
+ import DOMPurify from 'isomorphic-dompurify';
76
+
74
77
  locale.use(lang);
75
78
  Vue.use(Link);
76
79
  Vue.use(Icon);
@@ -161,6 +164,17 @@ export default {
161
164
  }
162
165
  else return false
163
166
  },
167
+ banner: function(){
168
+ if (this.contextData.banner){
169
+ console.log('found banner!')
170
+ return this.getFileFromPath(this.contextData.banner)
171
+ } else if (this.contextData && this.contextData.views && this.contextData.views.length > 0) {
172
+ if(this.contextData.views[0].thumbnail){
173
+ return this.getFileFromPath(this.contextData.views[0].thumbnail)
174
+ }
175
+ }
176
+ return this.entry.banner
177
+ }
164
178
  },
165
179
  methods: {
166
180
  samplesMatching: function(viewId){
@@ -248,6 +262,9 @@ export default {
248
262
  return `${this.envVars.ROOT_URL}/file/${sample.discoverId}/${sample.version}?path=${this.processPathForUrl(sample.path)}`
249
263
 
250
264
  },
265
+ parseMarkdown(markdown){
266
+ return DOMPurify.sanitize(marked.parse(markdown))
267
+ },
251
268
  openViewFile: function(view){
252
269
  // note that we assume that the view file is in the same directory as the scaffold (viewUrls take relative paths)
253
270
  this.entry.viewUrl = `${this.envVars.API_LOCATION}s3-resource/${this.entry.discoverId}/${this.entry.version}/${view.path}`