forked from AkkomaGang/akkoma-fe
change how "first" line is determined. Allow one mention in the
beginning for hellthread style
This commit is contained in:
parent
ffc501eb23
commit
c1bd36dc6f
2 changed files with 4 additions and 3 deletions
|
@ -126,7 +126,7 @@ export default Vue.component('RichContent', {
|
||||||
switch (Tag) {
|
switch (Tag) {
|
||||||
case 'span': // replace images with StillImage
|
case 'span': // replace images with StillImage
|
||||||
if (attrs['class'] && attrs['class'].includes('lastMentions')) {
|
if (attrs['class'] && attrs['class'].includes('lastMentions')) {
|
||||||
if (firstMentions.length > 0) {
|
if (firstMentions.length > 1) {
|
||||||
break
|
break
|
||||||
} else {
|
} else {
|
||||||
return ''
|
return ''
|
||||||
|
@ -231,6 +231,7 @@ const getLinkData = (attrs, children, index) => {
|
||||||
export const preProcessPerLine = (html, greentext) => {
|
export const preProcessPerLine = (html, greentext) => {
|
||||||
const lastMentions = []
|
const lastMentions = []
|
||||||
|
|
||||||
|
let nonEmptyIndex = 0
|
||||||
const newHtml = convertHtmlToLines(html).reverse().map((item, index, array) => {
|
const newHtml = convertHtmlToLines(html).reverse().map((item, index, array) => {
|
||||||
// Going over each line in reverse to detect last mentions,
|
// Going over each line in reverse to detect last mentions,
|
||||||
// keeping non-text stuff as-is
|
// keeping non-text stuff as-is
|
||||||
|
@ -295,7 +296,7 @@ export const preProcessPerLine = (html, greentext) => {
|
||||||
const result = [...tree].map(process)
|
const result = [...tree].map(process)
|
||||||
|
|
||||||
// Only check last (first since list is reversed) line
|
// Only check last (first since list is reversed) line
|
||||||
if (hasMentions && !hasLooseText && index === 0) {
|
if (hasMentions && !hasLooseText && nonEmptyIndex++ === 0) {
|
||||||
let mentionIndex = 0
|
let mentionIndex = 0
|
||||||
const process = (item) => {
|
const process = (item) => {
|
||||||
if (Array.isArray(item)) {
|
if (Array.isArray(item)) {
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
@parseReady="setHeadTailLinks"
|
@parseReady="setHeadTailLinks"
|
||||||
/>
|
/>
|
||||||
<MentionsLine
|
<MentionsLine
|
||||||
v-if="!hideMentions && lastMentions.length > 0 && firstMentions.length === 0"
|
v-if="!hideMentions && lastMentions.length > 0 && firstMentions.length <= 1"
|
||||||
:mentions="lastMentions"
|
:mentions="lastMentions"
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
|
|
Loading…
Reference in a new issue