Skip to content
This repository was archived by the owner on Apr 15, 2026. It is now read-only.

Commit 9373f52

Browse files
committed
Pass the old widget value to WidgetType.updateDOM
FEATURE: `WidgetType.updateDOM` is now called with the previous widget value as third argument. See https://discuss.codemirror.net/t/accessing-other-instance-in-widgettype-updatedom/9693
1 parent 3d236d2 commit 9373f52

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/buildtile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ class TileCache {
324324
let tile = widgets[i]
325325
if (!this.reused.has(tile) &&
326326
(pass == 0 ? tile.widget.compare(widget)
327-
: tile.widget.constructor == widget.constructor && widget.updateDOM(tile.dom, this.view))) {
327+
: tile.widget.constructor == widget.constructor && widget.updateDOM(tile.dom, this.view, tile.widget))) {
328328
widgets.splice(i, 1)
329329
if (i < this.index[0]) this.index[0]--
330330
if (tile.widget == widget && tile.length == length && (tile.flags & (TileFlag.Widget | TileFlag.BreakAfter)) == flags) {

src/decoration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export abstract class WidgetType {
121121
/// true to indicate that it could update, false to indicate it
122122
/// couldn't (in which case the widget will be redrawn). The default
123123
/// implementation just returns false.
124-
updateDOM(dom: HTMLElement, view: EditorView): boolean { return false }
124+
updateDOM(dom: HTMLElement, view: EditorView, from: WidgetType): boolean { return false }
125125

126126
/// @internal
127127
compare(other: WidgetType): boolean {

0 commit comments

Comments
 (0)