Questions tagged [prose-mirror]

ProseMirror is an in-browser semantic rich text editor component.

Definition:

ProseMirror is an in-browser semantic rich-text editor component.

The Official Documentation describes ProseMirror as:

An ideal content editor produces structured, semantically meaningful documents, but does so in a way that is easy for users to understand. ProseMirror tries to bridge the gap between Markdown text editing and classical WYSIWYG editors.

It does this by implementing a WYSIWYG-style editing interface for documents more constrained and structured than plain HTML. You can customize the shape and structure of the documents your editor creates, and tailor them to your application's needs.

Example Usage:

import {EditorState} from "prosemirror-state"
import {EditorView} from "prosemirror-view"
import {Schema, DOMParser} from "prosemirror-model"
import {schema} from "prosemirror-schema-basic"
import {addListNodes} from "prosemirror-schema-list"
import {exampleSetup} from "prosemirror-example-setup"

const mySchema = new Schema({
    nodes: addListNodes(schema.spec.nodes, "paragraph block*", "block"),
    marks: schema.spec.marks
})

window.view = new EditorView(document.querySelector("#editor"), {
    state: EditorState.create({
        doc: DOMParser.fromSchema(mySchema).parse(document.querySelector("#content")),
        plugins: exampleSetup({schema: mySchema})
    })
})

ProseMirror Example

Important Links:

78 questions
9
votes
1 answer

tiptap - Insert node below / at the end of the current one

I'm trying to create a text editor with tiptap using reactjs. I would like to create a button next to each "block" of the editor (paragraph block, blockquote block, codeblock block, ...) that allows the user to add a new empty block just before the…
pierre-lgb
  • 842
  • 1
  • 6
  • 15
9
votes
2 answers

prosemirror: converting JSON output into HTML

I'm trying to convert ProseMirror's JSON output back to HTML (to save it from one db to another). I am new with ProseMirror and I'm not sure I fully understand the relation between model, state and schema. Judging from what I have read…
sockpuppet
  • 211
  • 2
  • 5
8
votes
3 answers

Caret position and selection height for inline elements in Chrome

I'm looking into building an editor with Slate or ProseMirror and seeing some strange behavior with Chrome around the caret position and selection area when using an inline element. Issue 1 is shown in the first picture below. When the text cursor…
mowwwalker
  • 16,634
  • 25
  • 104
  • 157
6
votes
2 answers

simply replace a node's content in prosemirror

I'm in a function that receives a string as input: (text) => { } I have access to the editor via Vue props (props.editor). I would like to replace the current node's content with this text. I cannot seem to find out how to do this. I'm using…
tyler-g
  • 509
  • 1
  • 6
  • 15
5
votes
1 answer

How to replace currently selected content in ProseMirror

A little lost in ProseMirror at the moment and trying to understand the correct way to replace the text of the current selection. I want to be able to toggle the case between lower/upper case. state.selection.content(); will return slice of the…
Samuel Goldenbaum
  • 18,391
  • 17
  • 66
  • 104
5
votes
0 answers

Slate vs ProseMirror

I need to build a rich text editor for my React app. After a month of playing with Draft.js, I discovered it isn't configurable enough to suit my needs. I am deciding between Slate and ProseMirror. What are the pros and cons of either of them?
Adam Libuša
  • 685
  • 7
  • 24
4
votes
0 answers

How to make node in tiptap to can add place another node inside

This code works but absolutely no effect (node not created) const PageNode = Node.create({ name: 'PageNode', // content: 'block+', content: 'inline*', marks: '_', inline: true, group: "inline", draggable: true, code: true, …
psy21d
  • 43
  • 1
  • 8
4
votes
1 answer

simple tiptap extension or prosemirror plugin

i would like to use the tiptap editor for vuejs that work with the prosemirror editor. I have read many about tiptap but the documentation is not the best and prosemirror itself is very complex for me. I hope you can help me. I would like to…
Basti G.
  • 411
  • 1
  • 5
  • 26
4
votes
1 answer

How to get deeply nested object structure from array of values with Javascript

I have JSON representing some content in a text editor. Here's a sample: { "type": "doc", "content": [ { "type": "paragraph", "content": [ { "type": "text", "marks": [ { "type": "bold" } ], "text": "Testing" }, { "type": "text", "text": " " }, {…
Nathaniel
  • 394
  • 1
  • 6
  • 14
4
votes
6 answers

Building and Running ProseMirror

I am wanting to build a website that will utilize a WYSIWYG such as ProseMirror. Their documentation is a bit clear that it is not such an easy process to build everything yet, as they have focused on other parts of development first. However, they…
Ridge Robinson
  • 738
  • 1
  • 8
  • 19
3
votes
0 answers

Remove text color and background color in Tiptap/Prosemirror on paste

How can I remove the color and background color from pasted text in tiptap/prosemirror, in a clean way? I have a specific palette of colors that are allowed for the text in the editor, and I don't want people pasting from other places to be able to…
Titus Popovici
  • 149
  • 2
  • 11
3
votes
1 answer

How can I change the behavior of tiptap when pasting plain text?

I'm currently trying to implement a visual editor using a library called tiptap. https://v1.tiptap.dev/ I think v2 is the most common tiptap, but there are circumstances where v1 must be used. However, I was not satisfied with the behavior when I…
sonick
  • 31
  • 1
  • 2
3
votes
3 answers

TipTap/VueJS - How to detect a keypress

I have a collaborative chat application that uses tiptap for it's messaging area. I found it useful as it can support multiple formats already and can add some flexibility. However, I found myself stuck when looking for an event listener that…
SMPLYJR
  • 854
  • 1
  • 11
  • 23
3
votes
0 answers

How to show a caret immediately after a Prosemirror editor is turned editable?

I have a use-case where the ProseMirror editor is not editable at first (readonly mode). Once the user double-clicks the editor, the editor becomes editable. /** * The schema is defined to have paragraphs within a document. */ const state =…
pepsighan
  • 798
  • 9
  • 17
3
votes
1 answer

Trying to extend rich markdown editor

I'm working on trying to extend this markdown editor library - which itself extends Prosemirror. I'd like to build my own Node which has the following schema: attrs: { id: number } and returns the following HTML
user2497586
1
2 3 4 5 6