UNPKG

@atlaskit/editor-plugin-show-diff

Version:

ShowDiff plugin for @atlaskit/editor-core

11 lines (10 loc) • 478 B
// prosemirror-view does not type `Decoration.type`; a widget's `type.toDOM` is the node passed to // `Decoration.widget()` (an element or a factory — the `WidgetConstructor` union). // The element a widget renders, or undefined if it renders via a factory. export const getWidgetElement = decoration => { var _type; const { toDOM } = (_type = decoration.type) !== null && _type !== void 0 ? _type : {}; return toDOM instanceof HTMLElement ? toDOM : undefined; };