How to use the prosemirror-model.DOMParser function in prosemirror-model

To help you get started, we’ve selected a few prosemirror-model 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 pubpub / pubpub-editor / packages / pubpub-prose / dist / prosemirror-setup / clipboard.js View on Github external
var width = dom.getAttribute("width");
  if (width) {
    return width;
  }
  return undefined;
};

// require('split-html');
// Needs to lift out image blocks in their own div
var transformPastedHTML = function transformPastedHTML(htmlStr) {
  var markdown = (0, _markdownToHTML.markdowntoHTML)(htmlStr);
  return markdown;
  return htmlStr;
};

var clipboardParser = new _prosemirrorModel.DOMParser(_schema.schema, defaultRules);

exports.transformPastedHTML = transformPastedHTML;
exports.clipboardSerializer = clipboardSerializer;
exports.clipboardParser = clipboardParser;
github pubpub / pubpub-editor / src / schema / setup / clipboard.js View on Github external
};

  nodeSerializer.embed = function toDOM(node) {
    return null;
  };
  */

  const clipboardSerializer = new DOMSerializer(nodeSerializer, markSerializer);
  const defaultRules = DOMParser.schemaRules(schema);
  const transformPastedHTML = function(htmlStr) {
    return htmlStr;
    // const markdown = markdowntoHTML(htmlStr);
    // return markdown;
  }

  const clipboardParser = new DOMParser(schema, defaultRules);

  return { transformPastedHTML, clipboardSerializer, clipboardParser };

}
github pubpub / pubpub / src / components / AtomTypes / Document / proseEditor / clipboardSerializer.js View on Github external
nodeId: randomId,
  };
};

for (const rule of defaultRules) {

  if (rule.node === 'block_embed') {
    rule.tag = 'div.block-embed';
    rule.getAttrs = getNodeAttrs;
  } else if (rule.node === 'embed') {
    rule.tag = 'span.embed';
    rule.getAttrs = getNodeAttrs;
  }

}
const clipboardParser = new DOMParser(schema, defaultRules);


exports.clipboardSerializer = clipboardSerializer;
exports.clipboardParser = clipboardParser;