Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
apply: (tr, decorationSet) => {
// Map the decoration based on the changes to the document.
decorationSet = decorationSet.map(tr.mapping, tr.doc);
// Get tracker updates from the meta data
const tracker = getPluginMeta(key, tr);
if (isNullOrUndefined(tracker)) {
return decorationSet;
}
if (tracker.add) {
const { defaultClassName, defaultElement } = this.options;
const { className, element = defaultElement } = tracker.add;
const widget = isString(element) ? document.createElement(element) : element;
const classNames = className ? [defaultClassName, className] : [defaultClassName];
widget.classList.add(...classNames);
const deco = Decoration.widget(tracker.add.pos, widget, {
id: tracker.add.id,
type: name,