We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9a12572 commit e9b7c7eCopy full SHA for e9b7c7e
1 file changed
src/widget.ts
@@ -14,6 +14,16 @@ if (typeof window !== 'undefined') {
14
global.React = React;
15
}
16
17
+Widget.prototype.removeLocalDomNodes = function() {
18
+ // If this widget has directly created DOM nodes, delete them and exit.
19
+ if (this.domNodes.length > 0) {
20
+ $tw.utils.each(this.domNodes, function(domNode) {
21
+ domNode?.parentNode?.removeChild?.(domNode);
22
+ });
23
+ this.domNodes = [];
24
+ }
25
+};
26
+
27
class ReactWidgetImpl<
28
IProps extends ITWReactProps = ITWReactPropsDefault,
29
> extends Widget implements IReactWidget<IProps> {
@@ -82,7 +92,6 @@ class ReactWidgetImpl<
82
92
83
93
destroy() {
84
94
// this only works after tiddlywiki 5.3.0
85
- this.domNodes = [];
86
95
super.destroy?.();
87
96
this.root?.unmount?.();
88
97
0 commit comments