mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-13 03:40:48 +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) => {
|
||||
if (kid.nodeType === Node.ELEMENT_NODE && (kid as HTMLElement).localName === 'span') {
|
||||
const el = kid as HTMLElement
|
||||
result.push({
|
||||
attachedTo: el.getAttribute('data-id') as Ref<Doc>,
|
||||
attachedToClass: el.getAttribute('data-objectclass') as Ref<Class<Doc>>,
|
||||
collection: 'backlinks',
|
||||
backlinkId,
|
||||
backlinkClass,
|
||||
message,
|
||||
attachedDocId
|
||||
})
|
||||
const ato = el.getAttribute('data-id') as Ref<Doc>
|
||||
const atoClass = el.getAttribute('data-objectclass') as Ref<Class<Doc>>
|
||||
const e = result.find(e => e.attachedTo === ato && e.attachedToClass === atoClass)
|
||||
if (e === undefined) {
|
||||
result.push({
|
||||
attachedTo: ato,
|
||||
attachedToClass: atoClass,
|
||||
collection: 'backlinks',
|
||||
backlinkId,
|
||||
backlinkClass,
|
||||
message,
|
||||
attachedDocId
|
||||
})
|
||||
}
|
||||
}
|
||||
nodes.push(kid.childNodes)
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user