Every extension

comment

Mark 0.33 kB gzipped

Threaded comments, anchored to ranges.

The thread itself — author, body, replies, resolution — belongs to the host application, not the document. All that lives here is the anchor: a mark carrying a thread id. That separation is deliberate. Comment bodies in the document would travel with every copy, paste and export of the text, and would need migrating whenever the comment schema changed.

Because the anchor is a mark, position mapping keeps it correct for free: edit the paragraph around a comment and the highlight follows the words.

Adding it

import { createEditor, document, paragraph, text, comment } from '@matrajs/core'

const editor = createEditor({
  extensions: [document, paragraph, text, comment],
  element: document.querySelector('#editor'),
})

There is no separate package · comment is already in @matrajs/core, and an extension you do not import is not in your bundle. document, paragraph and text are the floor every document needs.

Commands

Attributes

HTML

Styles

This one needs a stylesheet to look right, and ships the minimum as a string rather than a file · nothing is loaded unless you load it.


          import { commentCSS } from '@matrajs/core'

const style = document.createElement('style')
style.textContent = commentCSS
document.head.append(style)
        

← All 81 extensions

Edit this page on GitHub