mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-24 17:30:03 +00:00
Fixes multiple mentions issue (#929)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
db52006a9d
commit
9f9650f938
@ -38,15 +38,20 @@ function extractBacklinks (backlinkId: Ref<Doc>, backlinkClass: Ref<Class<Doc>>,
|
|||||||
nds.forEach((kid) => {
|
nds.forEach((kid) => {
|
||||||
if (kid.nodeType === Node.ELEMENT_NODE && (kid as HTMLElement).localName === 'span') {
|
if (kid.nodeType === Node.ELEMENT_NODE && (kid as HTMLElement).localName === 'span') {
|
||||||
const el = kid as HTMLElement
|
const el = kid as HTMLElement
|
||||||
result.push({
|
const ato = el.getAttribute('data-id') as Ref<Doc>
|
||||||
attachedTo: el.getAttribute('data-id') as Ref<Doc>,
|
const atoClass = el.getAttribute('data-objectclass') as Ref<Class<Doc>>
|
||||||
attachedToClass: el.getAttribute('data-objectclass') as Ref<Class<Doc>>,
|
const e = result.find(e => e.attachedTo === ato && e.attachedToClass === atoClass)
|
||||||
collection: 'backlinks',
|
if (e === undefined) {
|
||||||
backlinkId,
|
result.push({
|
||||||
backlinkClass,
|
attachedTo: ato,
|
||||||
message,
|
attachedToClass: atoClass,
|
||||||
attachedDocId
|
collection: 'backlinks',
|
||||||
})
|
backlinkId,
|
||||||
|
backlinkClass,
|
||||||
|
message,
|
||||||
|
attachedDocId
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
nodes.push(kid.childNodes)
|
nodes.push(kid.childNodes)
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user