diff options
| author | Henry Jameson <me@hjkos.com> | 2021-06-12 16:15:22 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2021-06-12 16:15:22 +0300 |
| commit | c1bd36dc6f5700eb13c4b86fcd353a07a7c2fc08 (patch) | |
| tree | fa7e964330caae4c81cf63971b872512fa2fa2cf /src | |
| parent | ffc501eb236a7ec088c058d24396a2dccc8f3a8b (diff) | |
change how "first" line is determined. Allow one mention in the
beginning for hellthread style
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/rich_content/rich_content.jsx | 5 | ||||
| -rw-r--r-- | src/components/status_body/status_body.vue | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/components/rich_content/rich_content.jsx b/src/components/rich_content/rich_content.jsx index 78af0d9e..a489689b 100644 --- a/src/components/rich_content/rich_content.jsx +++ b/src/components/rich_content/rich_content.jsx @@ -126,7 +126,7 @@ export default Vue.component('RichContent', { switch (Tag) { case 'span': // replace images with StillImage if (attrs['class'] && attrs['class'].includes('lastMentions')) { - if (firstMentions.length > 0) { + if (firstMentions.length > 1) { break } else { return '' @@ -231,6 +231,7 @@ const getLinkData = (attrs, children, index) => { export const preProcessPerLine = (html, greentext) => { const lastMentions = [] + let nonEmptyIndex = 0 const newHtml = convertHtmlToLines(html).reverse().map((item, index, array) => { // Going over each line in reverse to detect last mentions, // keeping non-text stuff as-is @@ -295,7 +296,7 @@ export const preProcessPerLine = (html, greentext) => { const result = [...tree].map(process) // Only check last (first since list is reversed) line - if (hasMentions && !hasLooseText && index === 0) { + if (hasMentions && !hasLooseText && nonEmptyIndex++ === 0) { let mentionIndex = 0 const process = (item) => { if (Array.isArray(item)) { diff --git a/src/components/status_body/status_body.vue b/src/components/status_body/status_body.vue index 45d899fb..7e699a45 100644 --- a/src/components/status_body/status_body.vue +++ b/src/components/status_body/status_body.vue @@ -54,7 +54,7 @@ @parseReady="setHeadTailLinks" /> <MentionsLine - v-if="!hideMentions && lastMentions.length > 0 && firstMentions.length === 0" + v-if="!hideMentions && lastMentions.length > 0 && firstMentions.length <= 1" :mentions="lastMentions" /> </span> |
