Fix broken instance description if it contains a line break
This commit is contained in:
parent
dc29098f54
commit
fae4ba08e8
|
@ -0,0 +1 @@
|
||||||
|
Fix broken instance description if it contains a line break #1673
|
|
@ -39,23 +39,24 @@
|
||||||
>
|
>
|
||||||
<div class="ui stackable grid">
|
<div class="ui stackable grid">
|
||||||
<div class="eight wide column">
|
<div class="eight wide column">
|
||||||
<p v-if="!truncatedDescription">
|
<p v-if="!renderedDescription">
|
||||||
<translate translate-context="Content/Home/Paragraph">
|
<translate translate-context="Content/Home/Paragraph">
|
||||||
No description available.
|
No description available.
|
||||||
</translate>
|
</translate>
|
||||||
</p>
|
</p>
|
||||||
<template v-if="truncatedDescription || rules">
|
<template v-if="renderedDescription || rules">
|
||||||
<div
|
<div
|
||||||
v-if="truncatedDescription"
|
v-if="renderedDescription"
|
||||||
v-html="truncatedDescription"
|
id="renderedDescription"
|
||||||
|
v-html="renderedDescription"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
v-if="truncatedDescription"
|
v-if="renderedDescription"
|
||||||
class="ui hidden divider"
|
class="ui hidden divider"
|
||||||
/>
|
/>
|
||||||
<div class="ui relaxed list">
|
<div class="ui relaxed list">
|
||||||
<div
|
<div
|
||||||
v-if="truncatedDescription"
|
v-if="renderedDescription"
|
||||||
class="item"
|
class="item"
|
||||||
>
|
>
|
||||||
<i class="arrow right icon" />
|
<i class="arrow right icon" />
|
||||||
|
@ -324,7 +325,6 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import $ from 'jquery'
|
|
||||||
import _ from '@/lodash'
|
import _ from '@/lodash'
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
import showdown from 'showdown'
|
import showdown from 'showdown'
|
||||||
|
@ -372,22 +372,12 @@ export default {
|
||||||
rules () {
|
rules () {
|
||||||
return _.get(this.nodeinfo, 'metadata.rules')
|
return _.get(this.nodeinfo, 'metadata.rules')
|
||||||
},
|
},
|
||||||
truncatedDescription () {
|
renderedDescription () {
|
||||||
if (!this.longDescription) {
|
if (!this.longDescription) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const doc = this.markdown.makeHtml(this.longDescription)
|
const doc = this.markdown.makeHtml(this.longDescription)
|
||||||
const nodes = $.parseHTML(doc)
|
return doc
|
||||||
const excerptParts = []
|
|
||||||
let handled = 0
|
|
||||||
nodes.forEach((n) => {
|
|
||||||
const content = n.innerHTML || n.nodeValue
|
|
||||||
if (handled < this.excerptLength && content.trim()) {
|
|
||||||
excerptParts.push(n)
|
|
||||||
handled += 1
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return excerptParts.map((p) => { return p.outerHTML }).join('')
|
|
||||||
},
|
},
|
||||||
stats () {
|
stats () {
|
||||||
const data = {
|
const data = {
|
||||||
|
|
|
@ -31,3 +31,18 @@
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#renderedDescription {
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-line-clamp: 5;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
#renderedDescription p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#renderedDescription *:not(:first-child) {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue