How to use the prosemirror-model.Mark.none 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 ProseMirror / prosemirror-view / src / viewdesc.js View on Github external
iterDeco(this.node, this.innerDeco, (widget, i, insideNode) => {
      if (widget.spec.marks)
        updater.syncToMarks(widget.spec.marks, inline, view)
      else if (widget.type.side >= 0 && !insideNode)
        updater.syncToMarks(i == this.node.childCount ? Mark.none : this.node.child(i).marks, inline, view)
      // If the next node is a desc matching this widget, reuse it,
      // otherwise insert the widget as a new view desc.
      updater.placeWidget(widget, view, off)
    }, (child, outerDeco, innerDeco, i) => {
      // Make sure the wrapping mark descs match the node's marks.
github ProseMirror / prosemirror-state / src / transaction.js View on Github external
replaceSelectionWith(node, inheritMarks) {
    let selection = this.selection
    if (inheritMarks !== false)
      node = node.mark(this.storedMarks || (selection.empty ? selection.$from.marks() : (selection.$from.marksAcross(selection.$to) || Mark.none)))
    selection.replaceWith(this, node)
    return this
  }
github tinacms / tinacms / packages / tinacms / fields / src / Wysiwyg / Translator / MarkdownTranslator / from_markdown.ts View on Github external
closeNode() {
    if (this.marks.length) this.marks = Mark.none
    const info = this.stack.pop()
    if (!info) return //devWarn("Attempted to close a non-existent node.")
    return this.addNode(info.type, info.attrs, info.content)
  }
}
github netlify / netlify-cms / src / components / Widgets / Markdown / MarkdownControl / VisualEditor / parser.js View on Github external
import unified from 'unified';
import remarkToMarkdown from 'remark-parse';
import { Mark } from 'prosemirror-model';
import markdownToProseMirror from './markdownToProseMirror';

const state = { activeMarks: Mark.none, textsArray: [] };

/**
 * Uses unified to parse markdown and apply plugins.
 * @param {string} src raw markdown
 * @returns {Node} a ProseMirror Node
 */
function parser(src) {
  const result = unified()
    .use(remarkToMarkdown, { fences: true, footnotes: true, pedantic: true })
    .parse(src);

  return unified()
    .use(markdownToProseMirror, { state })
    .runSync(result);
}
github ProseMirror / prosemirror-markdown / src / from_markdown.js View on Github external
constructor(schema, tokenHandlers) {
    this.schema = schema
    this.stack = [{type: schema.topNodeType, content: []}]
    this.marks = Mark.none
    this.tokenHandlers = tokenHandlers
  }