How to use the medium-editor.default.Extension function in medium-editor

To help you get started, we’ve selected a few medium-editor 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 tomchentw / medium-editor-tc-mention / src / index.js View on Github external
const parentNode = el.parentNode;
  MediumEditor.util.unwrap(el, doc);
    // Merge textNode
  let currentNode = parentNode.lastChild;
  let prevNode = currentNode.previousSibling;
  while (prevNode) {
    if (currentNode.nodeType === 3 && prevNode.nodeType === 3) {
      prevNode.textContent += currentNode.textContent;
      parentNode.removeChild(currentNode);
    }
    currentNode = prevNode;
    prevNode = currentNode.previousSibling;
  }
}

export const TCMention = MediumEditor.Extension.extend({
  name: `mention`,

  /* @deprecated: use extraPanelClassName. Will remove in next major (3.0.0) release
   * extraClassName: [string]
   *
   * Extra className to be added with the `medium-editor-mention-panel` element.
   */
  extraClassName: ``,

  /* @deprecated: use extraActivePanelClassName. Will remove in next major (3.0.0) release
   * extraActiveClassName: [string]
   *
   * Extra active className to be added with the `medium-editor-mention-panel-active` element.
   */
  extraActiveClassName: ``,