@atlaskit/editor-plugin-show-diff
Version:
ShowDiff plugin for @atlaskit/editor-core
10 lines (9 loc) • 511 B
JavaScript
// 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 var getWidgetElement = function getWidgetElement(decoration) {
var _type;
var _ref = (_type = decoration.type) !== null && _type !== void 0 ? _type : {},
toDOM = _ref.toDOM;
return toDOM instanceof HTMLElement ? toDOM : undefined;
};