How to use the @remirror/core-utils.getPluginMeta function in @remirror/core-utils

To help you get started, we’ve selected a few @remirror/core-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ifiokjr / remirror / @remirror / core-extensions / src / extensions / position-tracker-extension.ts View on Github external
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,