mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 10:17:11 +03:00
Merge pull request #15011 from mehcode/gutter-marker-layer-bug
Check if incoming element is non-null before attempting to append to it
This commit is contained in:
commit
c50f73e9f5
@ -1762,13 +1762,13 @@ describe('TextEditorComponent', () => {
|
||||
expect(decorationNode3.firstChild).toBe(decorationElement2)
|
||||
|
||||
decoration1.setProperties({type: 'gutter', gutterName: 'a', class: 'c', item: decorationElement1})
|
||||
decoration2.setProperties({type: 'gutter', gutterName: 'a', item: decorationElement2})
|
||||
decoration2.setProperties({type: 'gutter', gutterName: 'a'})
|
||||
decoration3.destroy()
|
||||
await component.getNextUpdatePromise()
|
||||
expect(decorationNode1.className).toBe('decoration c')
|
||||
expect(decorationNode1.firstChild).toBe(decorationElement1)
|
||||
expect(decorationNode2.className).toBe('decoration')
|
||||
expect(decorationNode2.firstChild).toBe(decorationElement2)
|
||||
expect(decorationNode2.firstChild).toBeNull()
|
||||
expect(gutterB.getElement().firstChild.children.length).toBe(0)
|
||||
})
|
||||
})
|
||||
|
@ -3275,7 +3275,7 @@ class CustomGutterDecorationComponent {
|
||||
if (newProps.className !== oldProps.className) this.element.className = newProps.className || ''
|
||||
if (newProps.element !== oldProps.element) {
|
||||
if (this.element.firstChild) this.element.firstChild.remove()
|
||||
this.element.appendChild(newProps.element)
|
||||
if (newProps.element != null) this.element.appendChild(newProps.element)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user