Merge branch 'main' of github.com:ueberdosis/tiptap into main

This commit is contained in:
Hans Pagel 2021-05-11 19:23:48 +02:00
commit 9211ad2820
179 changed files with 3158 additions and 489 deletions

View File

@ -71,7 +71,7 @@
<script>
import { Editor, EditorContent } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
import { content } from './content.js'
export default {
@ -87,7 +87,9 @@ export default {
mounted() {
this.editor = new Editor({
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
content,
editorProps: {
attributes: {

View File

@ -22,7 +22,7 @@
<script>
import { Editor, EditorContent } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
import Collaboration from '@tiptap/extension-collaboration'
import CollaborationCursor from '@tiptap/extension-collaboration-cursor'
import TaskList from '@tiptap/extension-task-list'
@ -40,20 +40,9 @@ const getRandomElement = list => {
const getRandomRoom = () => {
return getRandomElement([
// HN killed it all
// 'room.one',
// 'room.two',
// 'room.three',
// 'room.four',
// 'room.five',
'room.six',
// 'room.seven',
// 'room.eight',
'room.nine',
// 'room.ten',
'room.eleven',
'room.twelve',
'room.thirteen',
'room.1',
'room.2',
'room.3',
])
}
@ -91,7 +80,9 @@ export default {
this.editor = new Editor({
extensions: [
...defaultExtensions().filter(extension => extension.name !== 'history'),
StarterKit.configure({
history: false,
}),
Highlight,
TaskList,
TaskItem,

View File

@ -1,6 +1,6 @@
import React from 'react'
import { useEditor, EditorContent } from '@tiptap/react'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
import './styles.scss'
const MenuBar = ({ editor }) => {
@ -125,7 +125,7 @@ const MenuBar = ({ editor }) => {
export default () => {
const editor = useEditor({
extensions: [
...defaultExtensions(),
StarterKit,
],
content: `
<h2>

View File

@ -71,7 +71,7 @@
<script>
import { Editor, EditorContent } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
export default {
components: {
@ -87,7 +87,7 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
...defaultExtensions(),
StarterKit,
],
content: `
<h2>

View File

@ -44,7 +44,7 @@
<script>
import { Editor, EditorContent } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
import TextAlign from '@tiptap/extension-text-align'
import Highlight from '@tiptap/extension-highlight'
@ -62,7 +62,7 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
...defaultExtensions(),
StarterKit,
TextAlign,
Highlight,
],

View File

@ -6,7 +6,7 @@
<script>
import { Editor, EditorContent } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
import Highlight from '@tiptap/extension-highlight'
import Typography from '@tiptap/extension-typography'
@ -41,7 +41,7 @@ export default {
</p>
`,
extensions: [
...defaultExtensions(),
StarterKit,
Highlight,
Typography,
],

View File

@ -5,13 +5,13 @@ import {
BubbleMenu,
FloatingMenu,
} from '@tiptap/react'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
import './styles.scss'
export default () => {
const editor = useEditor({
extensions: [
...defaultExtensions(),
StarterKit,
],
content: `
<p>

View File

@ -45,7 +45,7 @@ import {
BubbleMenu,
FloatingMenu,
} from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
export default {
components: {
@ -63,7 +63,7 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
...defaultExtensions(),
StarterKit,
],
content: `
<p>

View File

@ -64,7 +64,7 @@
<script>
import { Editor, EditorContent } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
import Table from '@tiptap/extension-table'
import TableRow from '@tiptap/extension-table-row'
import TableCell from '@tiptap/extension-table-cell'
@ -109,7 +109,7 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
...defaultExtensions(),
StarterKit,
Table.configure({
resizable: true,
}),

View File

@ -7,7 +7,7 @@
<script>
import tippy from 'tippy.js'
import { Editor, EditorContent, VueRenderer } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
import Commands from './commands'
import CommandsList from './CommandsList'
@ -25,7 +25,7 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
...defaultExtensions(),
StarterKit,
Commands.configure({
suggestion: {
items: query => {

View File

@ -20,7 +20,7 @@
<script>
import { Editor, EditorContent } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
import Details from './details'
import DetailsSummary from './details-summary'
@ -38,7 +38,7 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
...defaultExtensions(),
StarterKit,
Details,
DetailsSummary,
],

View File

@ -10,7 +10,7 @@
<script>
import { Editor, EditorContent } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
import Iframe from './iframe'
export default {
@ -27,7 +27,7 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
...defaultExtensions(),
StarterKit,
Iframe,
],
content: `

View File

@ -6,7 +6,7 @@
<script>
import { Editor, EditorContent } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
import DragHandle from './DragHandle.js'
export default {
@ -23,7 +23,7 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
...defaultExtensions(),
StarterKit,
DragHandle,
],
content: `

View File

@ -6,7 +6,7 @@
<script>
import { Editor, EditorContent } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
import { TrailingNode } from './trailing-node'
export default {
@ -23,7 +23,7 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
...defaultExtensions(),
StarterKit,
TrailingNode,
],
content: `

View File

@ -13,7 +13,7 @@
<script>
import { Editor, EditorContent } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
import { WordBreak } from './word-break'
export default {
@ -30,7 +30,7 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
...defaultExtensions(),
StarterKit,
WordBreak,
],
content: `

View File

@ -1,12 +1,12 @@
import React from 'react'
import { useEditor, EditorContent, BubbleMenu } from '@tiptap/react'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
import './styles.scss'
export default () => {
const editor = useEditor({
extensions: [
...defaultExtensions(),
StarterKit,
],
content: `
<p>

View File

@ -17,7 +17,7 @@
<script>
import { Editor, EditorContent, BubbleMenu } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
export default {
components: {
@ -34,7 +34,7 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
...defaultExtensions(),
StarterKit,
],
content: `
<p>

View File

@ -1,12 +1,12 @@
import React from 'react'
import { useEditor, EditorContent, FloatingMenu } from '@tiptap/react'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
import './styles.scss'
export default () => {
const editor = useEditor({
extensions: [
...defaultExtensions(),
StarterKit,
],
content: `
<p>

View File

@ -17,7 +17,7 @@
<script>
import { Editor, EditorContent, FloatingMenu } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
export default {
components: {
@ -34,7 +34,7 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
...defaultExtensions(),
StarterKit,
],
content: `
<p>

View File

@ -4,7 +4,7 @@
<script>
import { Editor, EditorContent } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
import Placeholder from '@tiptap/extension-placeholder'
export default {
@ -21,7 +21,7 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
...defaultExtensions(),
StarterKit,
Placeholder,
],
})

View File

@ -26,7 +26,7 @@
<script>
import { Editor, EditorContent } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
export default {
components: {
@ -47,7 +47,9 @@ export default {
Wow, this editor instance exports its content as HTML.
</p>
`,
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
})
// Get the initial content

View File

@ -26,7 +26,7 @@
<script>
import { Editor, EditorContent } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
export default {
components: {
@ -47,7 +47,9 @@ export default {
Wow, this editor instance exports its content as JSON.
</p>
`,
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
})
// Get the initial content

View File

@ -0,0 +1,7 @@
context('/demos/Guide/Content/GenerateJSON', () => {
before(() => {
cy.visit('/demos/Guide/Content/GenerateJSON')
})
// TODO: Write tests
})

View File

@ -0,0 +1,30 @@
<template>
<pre><code>{{ output }}</code></pre>
</template>
<script>
// Option 1: Browser + server-side
import { generateJSON } from '@tiptap/html'
// Option 2: Browser-only (lightweight)
// import { generateJSON } from '@tiptap/core'
import Document from '@tiptap/extension-document'
import Paragraph from '@tiptap/extension-paragraph'
import Text from '@tiptap/extension-text'
import Bold from '@tiptap/extension-bold'
const html = '<p>Example <strong>Text</strong></p>'
export default {
computed: {
output() {
return generateJSON(html, [
Document,
Paragraph,
Text,
Bold,
// other extensions
])
},
},
}
</script>

View File

@ -10,7 +10,7 @@
<script>
import { Editor, EditorContent } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
export default {
components: {
@ -35,7 +35,9 @@ export default {
If you want to check the state, you can call <code>editor.isEditable()</code>.
</p>
`,
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
})
},

View File

@ -4,7 +4,7 @@
<script>
import { Editor, EditorContent } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
export default {
components: {
@ -42,7 +42,9 @@ export default {
mounted() {
this.editor = new Editor({
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
content: this.value,
onUpdate: () => {
// HTML

View File

@ -6,7 +6,7 @@
<script>
import { Editor, EditorContent } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
import DraggableItem from './DraggableItem.js'
export default {
@ -23,7 +23,7 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
...defaultExtensions(),
StarterKit,
DraggableItem,
],
content: `

View File

@ -4,7 +4,7 @@
<script>
import { Editor, EditorContent } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
import NodeView from './Extension.js'
export default {
@ -21,7 +21,7 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
...defaultExtensions(),
StarterKit,
NodeView,
],
content: `

View File

@ -4,7 +4,7 @@
<script>
import { Editor, EditorContent } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
import NodeView from './Extension.js'
export default {
@ -21,7 +21,7 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
...defaultExtensions(),
StarterKit,
NodeView,
],
content: `

View File

@ -1,13 +1,13 @@
import React from 'react'
import { useEditor, EditorContent } from '@tiptap/react'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
import ReactComponent from './Extension.js'
import './styles.scss'
export default () => {
const editor = useEditor({
extensions: [
...defaultExtensions(),
StarterKit,
ReactComponent,
],
content: `

View File

@ -1,13 +1,13 @@
import React from 'react'
import { useEditor, EditorContent } from '@tiptap/react'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
import ReactComponent from './Extension.js'
import './styles.scss'
export default () => {
const editor = useEditor({
extensions: [
...defaultExtensions(),
StarterKit,
ReactComponent,
],
content: `

View File

@ -6,7 +6,7 @@
<script>
import { Editor, EditorContent } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
import TableOfContents from './TableOfContents.js'
export default {
@ -23,7 +23,7 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
...defaultExtensions(),
StarterKit,
TableOfContents,
],
content: `

View File

@ -4,7 +4,7 @@
<script>
import { Editor, EditorContent } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
import VueComponent from './Extension.js'
export default {
@ -21,7 +21,7 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
...defaultExtensions(),
StarterKit,
VueComponent,
],
content: `

View File

@ -4,7 +4,7 @@
<script>
import { Editor, EditorContent } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
import VueComponent from './Extension.js'
export default {
@ -21,7 +21,7 @@ export default {
mounted() {
this.editor = new Editor({
extensions: [
...defaultExtensions(),
StarterKit,
VueComponent,
],
content: `

View File

@ -4,7 +4,7 @@
<script>
import { Editor, EditorContent } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
export default {
components: {
@ -20,7 +20,9 @@ export default {
mounted() {
this.editor = new Editor({
content: '<p>Hello World! 🌎️</p>',
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
})
},

View File

@ -17,8 +17,7 @@ Dont confuse methods with [commands](/api/commands). Commands are used to cha
| `destroy()` | | Stops the editor instance and unbinds all events. |
| `getHTML()` | | Returns the current content as HTML. |
| `getJSON()` | | Returns the current content as JSON. |
| `getMarkAttributes()` | `name` Name of the mark | Get attributes of the currently selected mark. |
| `getNodeAttributes()` | `name` Name of the node | Get attributes of the currently selected node. |
| `getAttributes()` | `name` Name of the node or mark | Get attributes of the currently selected node or mark. |
| `isActive()` | `name` Name of the node or mark<br>`attrs` Attributes of the node or mark | Returns if the currently selected node or mark is active. |
| `isEditable()` | - | Returns whether the editor is editable. |
| `isEmpty()` | - | Check if there is no content. |
@ -34,11 +33,13 @@ The `element` specifies the HTML element the editor will be binded too. The foll
```js
import { Editor } from '@tiptap/core'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
new Editor({
element: document.querySelector('.element'),
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
})
```
@ -53,7 +54,7 @@ Its required to pass a list of extensions to the `extensions` property, even
```js
import { Editor } from '@tiptap/core'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
import Document from '@tiptap/extension-document'
import Paragraph from '@tiptap/extension-paragraph'
import Text from '@tiptap/extension-text'
@ -61,7 +62,9 @@ import Highlight from '@tiptap/extension-highlight'
new Editor({
// Use the default extensions
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
// … or use specific extensions
extensions: [
@ -72,7 +75,7 @@ new Editor({
// … or both
extensions: [
...defaultExtensions(),
StarterKit,
Highlight,
],
})
@ -83,11 +86,13 @@ With the `content` property you can provide the initial content for the editor.
```js
import { Editor } from '@tiptap/core'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
new Editor({
content: `<p>Example Text</p>`,
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
})
```
@ -96,11 +101,13 @@ The `editable` property determines if users can write into the editor.
```js
import { Editor } from '@tiptap/core'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
new Editor({
content: `<p>Example Text</p>`,
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
editable: false,
})
```
@ -110,10 +117,12 @@ With `autofocus` you can force the cursor to jump in the editor on initializatio
```js
import { Editor } from '@tiptap/core'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
new Editor({
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
autofocus: false,
})
```
@ -132,11 +141,13 @@ By default, tiptap enables all [input rules](/guide/custom-extensions/#input-rul
```js
import { Editor } from '@tiptap/core'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
new Editor({
content: `<p>Example Text</p>`,
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
enableInputRules: false,
})
```
@ -146,11 +157,13 @@ By default, tiptap enables all [paste rules](/guide/custom-extensions/#paste-rul
```js
import { Editor } from '@tiptap/core'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
new Editor({
content: `<p>Example Text</p>`,
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
enablePasteRules: false,
})
```
@ -160,10 +173,12 @@ By default, tiptap injects [a little bit of CSS](https://github.com/ueberdosis/t
```js
import { Editor } from '@tiptap/core'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
new Editor({
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
injectCSS: false,
})
```

View File

@ -22,7 +22,7 @@ There are also some extensions with more capabilities. We call them [nodes](/api
| [TextAlign](/api/extensions/text-align) | | [GitHub](https://github.com/ueberdosis/tiptap/blob/main/packages/extension-text-align/) |
| [Typography](/api/extensions/typography) | | [GitHub](https://github.com/ueberdosis/tiptap/blob/main/packages/extension-typography/) |
You dont have to use it, but we prepared a `@tiptap/starter-kit` which includes the most common extensions. Read more about [`defaultExtensions()`](/guide/configuration#default-extensions).
You dont have to use it, but we prepared a `@tiptap/starter-kit` which includes the most common extensions. Read more about [`StarterKit`](/guide/configuration#default-extensions).
## How extensions work
Although tiptap tries to hide most of the complexity of ProseMirror, its built on top of its APIs and we recommend you to read through the [ProseMirror Guide](https://ProseMirror.net/docs/guide/) for advanced usage. Youll have a better understanding of how everything works under the hood and get more familiar with many terms and jargon used by tiptap.

View File

@ -7,7 +7,7 @@
The node is very tiny though. It defines a name of the node (`document`), is configured to be a top node (`topNode: true`) and that it can contain multiple other nodes (`block+`). Thats all. But have a look yourself:
:::warning Breaking Change from 1.x → 2.x
tiptap 1 tried to hide that node from you, but it has always been there. You have to explicitly import it from now on (or use `defaultExtensions()`).
tiptap 1 tried to hide that node from you, but it has always been there. You have to explicitly import it from now on (or use `StarterKit`).
:::
## Installation

View File

@ -5,7 +5,7 @@
Yes, the schema is very strict. Without this extension you wont even be able to use paragraphs in the editor.
:::warning Breaking Change from 1.x → 2.x
tiptap 1 tried to hide that node from you, but it has always been there. You have to explicitly import it from now on (or use `defaultExtensions()`).
tiptap 1 tried to hide that node from you, but it has always been there. You have to explicitly import it from now on (or use `StarterKit`).
:::
## Installation

View File

@ -5,7 +5,7 @@
**The `Text` extension is required**, at least if you want to work with text of any kind and thats very likely. This extension is a little bit different, it doesnt even render HTML. Its plain text, thats all.
:::warning Breaking Change from 1.x → 2.x
tiptap 1 tried to hide that node from you, but it has always been there. You have to explicitly import it from now on (or use `defaultExtensions()`).
tiptap 1 tried to hide that node from you, but it has always been there. You have to explicitly import it from now on (or use `StarterKit`).
:::
## Installation

View File

@ -2,10 +2,15 @@
[![Version](https://img.shields.io/npm/v/@tiptap/html.svg?label=version)](https://www.npmjs.com/package/@tiptap/html)
[![Downloads](https://img.shields.io/npm/dm/@tiptap/html.svg)](https://npmcharts.com/compare/@tiptap/html?minimal=true)
The utility helps rendering JSON content as HTML without an editor instance, for example on the server side. All it needs is a JSON and an array of extensions.
The utility helps rendering JSON content as HTML, and generating JSON from HTML, without an editor instance, for example on the server side.
All it needs is JSON or a HTML string, and a list of extensions.
## Source code
[packages/html/](https://github.com/ueberdosis/tiptap/blob/main/packages/html/)
## Usage
## Generate HTML from JSON
<demo name="Guide/Content/GenerateHTML" highlight="6-7,42-48"/>
## Generate JSON from HTML
<demo name="Guide/Content/GenerateJSON" highlight="6-7,18-24"/>

View File

@ -82,23 +82,25 @@ new Editor({
Have a look at the documentation of the extension you use to learn more about their settings.
### Default extensions
We have put together a few of the most common extensions and provide a `defaultExtensions()` helper to load them. Here is how you to use that:
We have put together a few of the most common extensions and provide a `StarterKit` extension to load them. Here is how you to use that:
```js
import { Editor, defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
new Editor({
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
})
```
And you can even pass configuration for all default extensions as an object. Just prefix the configuration with the extension name:
```js
import { Editor, defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
new Editor({
extensions: defaultExtensions({
extensions: StarterKit.configure({
heading: {
levels: [1, 2, 3],
},
@ -106,15 +108,15 @@ new Editor({
})
```
The `defaultExtensions()` function returns an array, so if you want to load them and add some custom extensions you could write it like that:
The `StarterKit` extension contains a list of extensions. If you want to load them and add some custom extensions you could write it like that:
```js
import { Editor, defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
import Strike from '@tiptap/extension-strike'
new Editor({
extensions: [
...defaultExtensions(),
StarterKit,
Strike,
],
})
@ -123,11 +125,13 @@ new Editor({
Dont want to load a specific extension? Just filter it out:
```js
import { Editor, defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
new Editor({
extensions: [
...defaultExtensions().filter(extension => extension.name !== 'history'),
StarterKit.configure({
history: false,
}),
],
})
```

View File

@ -117,7 +117,11 @@ If you need to render the content on the server side, for example to generate th
Thats what the `generateHTML()` is for. Its a helper function which renders HTML without an actual editor instance.
<demo name="Guide/Content/GenerateHTML" highlight="6-7,42-48"/>
<demo name="Guide/Content/GenerateHTML" highlight="6-7,42-48" />
By the way, the other way is possible, too. The below examples shows how to generate JSON from HTML.
<demo name="Guide/Content/GenerateJSON" highlight="6-7,18-24"/>
## Migration
If youre migrating existing content to tiptap we would recommend to get your existing output to HTML. Thats probably the best format to get your initial content into tiptap, because ProseMirror ensures there is nothing wrong with it. Even if there are some tags or attributes that arent allowed (based on your configuration), tiptap just throws them away quietly.

View File

@ -45,11 +45,13 @@ Lets initialize the editor in JavaScript now:
```js
import { Editor } from '@tiptap/core'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
new Editor({
element: document.querySelector('.element'),
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
content: '<p>Hello World!</p>',
})
```

View File

@ -47,7 +47,7 @@ This is the fastest way to get tiptap up and running with Alpine.js. It will giv
```js
import alpinejs from 'alpinejs'
import { Editor } from '@tiptap/core'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
window.setupEditor = function(content) {
return {
@ -57,7 +57,9 @@ window.setupEditor = function(content) {
init(element) {
this.editor = new Editor({
element: element,
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
content: this.content,
onUpdate: ({ editor }) => {
this.content = editor.getHTML()

View File

@ -10,10 +10,12 @@ For testing purposes or demos, use our [Skypack](https://www.skypack.dev/) CDN b
<div class="element"></div>
<script type="module">
import { Editor } from 'https://cdn.skypack.dev/@tiptap/core?min'
import { defaultExtensions } from 'https://cdn.skypack.dev/@tiptap/starter-kit?min'
import StarterKit from 'https://cdn.skypack.dev/@tiptap/starter-kit?min'
const editor = new Editor({
element: document.querySelector('.element'),
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
content: '<p>Hello World!</p>',
})
</script>

View File

@ -40,8 +40,8 @@ TODO
## index.js
```js
import { Editor } from "@tiptap/core"
import { defaultExtensions } from "@tiptap/starter-kit"
import { Editor } from '@tiptap/core'
import StarterKit from '@tiptap/starter-kit'
window.setupEditor = function (content) {
return {
@ -51,7 +51,9 @@ window.setupEditor = function (content) {
init(element) {
this.editor = new Editor({
element: element,
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
content: this.content,
onUpdate: ({ editor }) => {
this.content = editor.getHTML()

View File

@ -51,7 +51,7 @@ This is the fastest way to get tiptap up and running with Vue. It will give you
<script>
import { Editor, EditorContent } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
export default {
components: {
@ -67,7 +67,9 @@ export default {
mounted() {
this.editor = new Editor({
content: '<p>Im running tiptap with Vue.js. 🎉</p>',
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
})
},

View File

@ -46,11 +46,13 @@ This is the fastest way to get tiptap up and running with React. It will give yo
```jsx
import { useEditor, EditorContent } from '@tiptap/react'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
const Tiptap = () => {
const editor = useEditor({
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
content: '<p>Hello World! 🌎️</p>',
})

View File

@ -51,7 +51,7 @@ This is the fastest way to get tiptap up and running with SvelteKit. It will giv
<script type="module">
import { onMount, onDestroy } from 'svelte'
import { Editor } from '@tiptap/core'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
let element
let editor
@ -59,7 +59,9 @@ This is the fastest way to get tiptap up and running with SvelteKit. It will giv
onMount(() => {
editor = new Editor({
element: element,
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
content: '<p>Hello World! 🌍️ </p>',
onTransaction: () => {
// force re-render so `editor.isActive` works as expected

View File

@ -52,7 +52,7 @@ This is the fastest way to get tiptap up and running with Vue. It will give you
<script>
import { Editor, EditorContent } from '@tiptap/vue-2'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
export default {
components: {
@ -68,7 +68,9 @@ export default {
mounted() {
this.editor = new Editor({
content: '<p>Im running tiptap with Vue.js. 🎉</p>',
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
})
},

View File

@ -52,7 +52,7 @@ This is the fastest way to get tiptap up and running with Vue. It will give you
<script>
import { Editor, EditorContent } from '@tiptap/vue-3'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
export default {
components: {
@ -68,7 +68,9 @@ export default {
mounted() {
this.editor = new Editor({
content: '<p>Im running tiptap with Vue.js. 🎉</p>',
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
})
},
@ -88,7 +90,7 @@ Alternatively, you can use the Composition API with the `useEditor` method.
<script>
import { useEditor, EditorContent } from '@tiptap/vue-3'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
export default {
components: {
@ -98,7 +100,9 @@ export default {
setup() {
const editor = useEditor({
content: '<p>Im running tiptap with Vue.js. 🎉</p>',
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
})
return { editor }
@ -141,7 +145,7 @@ Youre probably used to bind your data with `v-model` in forms, thats also
<script>
import { Editor, EditorContent } from '@tiptap/vue-3'
import { defaultExtensions } from '@tiptap/starter-kit'
import StarterKit from '@tiptap/starter-kit'
export default {
components: {
@ -176,7 +180,9 @@ export default {
mounted() {
this.editor = new Editor({
content: this.modelValue,
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
onUpdate: () => {
this.$emit('update:modelValue', this.editor.getHTML())
},

View File

@ -243,7 +243,7 @@
- title: unsetMark
link: /api/commands/unset-mark
type: draft
- title: updateAtttributes
- title: updateAttributes
link: /api/commands/update-attributes
- title: wrapInList
link: /api/commands/wrap-in-list

View File

@ -121,11 +121,13 @@
&lt;script type="module"&gt;
import { Editor } from 'https://cdn.skypack.dev/@tiptap/core?min'
import { defaultExtensions } from 'https://cdn.skypack.dev/@tiptap/starter-kit?min'
import StarterKit from 'https://cdn.skypack.dev/@tiptap/starter-kit?min'
const editor = new Editor({
element: document.querySelector('.element'),
extensions: defaultExtensions(),
extensions: [
StarterKit,
],
content: '&lt;p&gt;Hello World :-)&lt;/p&gt;',
})
&lt;/script&gt;

View File

@ -3,6 +3,128 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.55](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.54...@tiptap/core@2.0.0-beta.55) (2021-05-11)
### Bug Fixes
* fix a bug when configurating the same extension multiple times ([655c564](https://github.com/ueberdosis/tiptap/commit/655c5647f0951851f818a0cc2500c48969f20797))
### Features
* export mark helpers ([313ab0e](https://github.com/ueberdosis/tiptap/commit/313ab0eac7d9209c279f0925c2372735882de56a))
# [2.0.0-beta.54](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.53...@tiptap/core@2.0.0-beta.54) (2021-05-09)
### Bug Fixes
* set correct priority when extending extensions, fix [#1288](https://github.com/ueberdosis/tiptap/issues/1288) ([b4e2b6f](https://github.com/ueberdosis/tiptap/commit/b4e2b6fc9dd722cce5ee85eb2df994453a0f5d39))
# [2.0.0-beta.53](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.52...@tiptap/core@2.0.0-beta.53) (2021-05-07)
### Features
* add editor.getAttributes, deprecate editor.getNodeAttributes and editor.getMarkAttributes ([072905c](https://github.com/ueberdosis/tiptap/commit/072905cb95e022a37f5bc937889999bfbb33ad88))
# [2.0.0-beta.52](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.51...@tiptap/core@2.0.0-beta.52) (2021-05-07)
### Features
* expose node helpers to core ([6048f9b](https://github.com/ueberdosis/tiptap/commit/6048f9b31b996b305f704c4ae3ed176fa42eb943))
# [2.0.0-beta.51](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.50...@tiptap/core@2.0.0-beta.51) (2021-05-07)
### Bug Fixes
* add support for priority and nested extension for getSchema ([129ad83](https://github.com/ueberdosis/tiptap/commit/129ad83167900526d65c5c25da8249d0d65bcef7))
* remove editor from addExtensions context ([cbc0dd8](https://github.com/ueberdosis/tiptap/commit/cbc0dd8920ab7d36516387ceac59239f9162b4ec))
# [2.0.0-beta.50](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.49...@tiptap/core@2.0.0-beta.50) (2021-05-07)
**Note:** Version bump only for package @tiptap/core
# [2.0.0-beta.49](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.48...@tiptap/core@2.0.0-beta.49) (2021-05-07)
### Bug Fixes
* fix a bug that messed up pasted link attributes, fix [#1284](https://github.com/ueberdosis/tiptap/issues/1284) ([7da647d](https://github.com/ueberdosis/tiptap/commit/7da647d99f1dcefabc653347a8e2abfae3bb972e))
* revert adding exports ([bc320d0](https://github.com/ueberdosis/tiptap/commit/bc320d0b4b80b0e37a7e47a56e0f6daec6e65d98))
# [2.0.0-beta.48](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.47...@tiptap/core@2.0.0-beta.48) (2021-05-06)
### Bug Fixes
* revert adding type: module ([f8d6475](https://github.com/ueberdosis/tiptap/commit/f8d6475e2151faea6f96baecdd6bd75880d50d2c))
# [2.0.0-beta.47](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.46...@tiptap/core@2.0.0-beta.47) (2021-05-06)
### Bug Fixes
* add exports to package.json ([1277fa4](https://github.com/ueberdosis/tiptap/commit/1277fa47151e9c039508cdb219bdd0ffe647f4ee))
# [2.0.0-beta.46](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.45...@tiptap/core@2.0.0-beta.46) (2021-05-06)
### Features
* add addExtensions option ([26e672e](https://github.com/ueberdosis/tiptap/commit/26e672e2f02a8f94941c704f3cd6cc4adef40df7))
# [2.0.0-beta.45](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.44...@tiptap/core@2.0.0-beta.45) (2021-05-06)
**Note:** Version bump only for package @tiptap/core
# [2.0.0-beta.44](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.43...@tiptap/core@2.0.0-beta.44) (2021-05-05)

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/core",
"description": "headless rich text editor",
"version": "2.0.0-beta.44",
"version": "2.0.0-beta.55",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -1,8 +1,12 @@
import {
EditorState, Plugin, PluginKey, Transaction,
EditorState,
Plugin,
PluginKey,
Transaction,
} from 'prosemirror-state'
import { EditorView } from 'prosemirror-view'
import { Schema } from 'prosemirror-model'
import { Schema, MarkType, NodeType } from 'prosemirror-model'
import getAttributes from './helpers/getAttributes'
import getNodeAttributes from './helpers/getNodeAttributes'
import getMarkAttributes from './helpers/getMarkAttributes'
import isActive from './helpers/isActive'
@ -331,12 +335,21 @@ export class Editor extends EventEmitter {
})
}
/**
* Get attributes of the currently selected node or mark.
*/
public getAttributes(nameOrType: string | NodeType | MarkType): Record<string, any> {
return getAttributes(this.state, nameOrType)
}
/**
* Get attributes of the currently selected node.
*
* @param name Name of the node
*/
public getNodeAttributes(name: string): Record<string, any> {
console.warn('[tiptap warn]: editor.getNodeAttributes() is deprecated. please use editor.getAttributes() instead.')
return getNodeAttributes(this.state, name)
}
@ -346,6 +359,8 @@ export class Editor extends EventEmitter {
* @param name Name of the mark
*/
public getMarkAttributes(name: string): Record<string, any> {
console.warn('[tiptap warn]: editor.getMarkAttributes() is deprecated. please use editor.getAttributes() instead.')
return getMarkAttributes(this.state, name)
}

View File

@ -5,6 +5,7 @@ import { Node } from './Node'
import { Mark } from './Mark'
import mergeDeep from './utilities/mergeDeep'
import {
Extensions,
GlobalAttributes,
RawCommands,
ParentConfig,
@ -92,6 +93,15 @@ declare module '@tiptap/core' {
parent: ParentConfig<ExtensionConfig<Options>>['addProseMirrorPlugins'],
}) => Plugin[],
/**
* Extensions
*/
addExtensions?: (this: {
name: string,
options: Options,
parent: ParentConfig<ExtensionConfig<Options>>['addExtensions'],
}) => Extensions,
/**
* Extend Node Schema
*/
@ -226,7 +236,6 @@ export class Extension<Options = any> {
config: ExtensionConfig = {
name: this.name,
priority: 100,
defaultOptions: {},
}
@ -247,7 +256,9 @@ export class Extension<Options = any> {
configure(options: Partial<Options> = {}) {
this.options = mergeDeep(this.options, options) as Options
return this
// return a new instance so we can use the same extension
// with different calls of `configure`
return this.extend()
}
extend<ExtendedOptions = Options>(extendedConfig: Partial<ExtensionConfig<ExtendedOptions>> = {}) {

View File

@ -6,7 +6,7 @@ import { Plugin } from 'prosemirror-state'
import { Editor } from './Editor'
import { Extensions, RawCommands, AnyConfig } from './types'
import getExtensionField from './helpers/getExtensionField'
import getSchema from './helpers/getSchema'
import getSchemaByResolvedExtensions from './helpers/getSchemaByResolvedExtensions'
import getSchemaTypeByName from './helpers/getSchemaTypeByName'
import getNodeType from './helpers/getNodeType'
import splitExtensions from './helpers/splitExtensions'
@ -27,8 +27,8 @@ export default class ExtensionManager {
constructor(extensions: Extensions, editor: Editor) {
this.editor = editor
this.extensions = this.sort(extensions)
this.schema = getSchema(this.extensions)
this.extensions = ExtensionManager.resolve(extensions)
this.schema = getSchemaByResolvedExtensions(this.extensions)
this.extensions.forEach(extension => {
const context = {
@ -128,7 +128,35 @@ export default class ExtensionManager {
})
}
private sort(extensions: Extensions) {
static resolve(extensions: Extensions): Extensions {
return ExtensionManager.sort(ExtensionManager.flatten(extensions))
}
static flatten(extensions: Extensions): Extensions {
return extensions
.map(extension => {
const context = {
name: extension.name,
options: extension.options,
}
const addExtensions = getExtensionField<AnyConfig['addExtensions']>(
extension,
'addExtensions',
context,
)
if (addExtensions) {
return this.flatten(addExtensions())
}
return extension
})
// `Infinity` will break TypeScript so we set a number that is probably high enough
.flat(10)
}
static sort(extensions: Extensions): Extensions {
const defaultPriority = 100
return extensions.sort((a, b) => {

View File

@ -8,6 +8,7 @@ import { Plugin, Transaction } from 'prosemirror-state'
import { InputRule } from 'prosemirror-inputrules'
import mergeDeep from './utilities/mergeDeep'
import {
Extensions,
Attributes,
RawCommands,
GlobalAttributes,
@ -103,6 +104,15 @@ declare module '@tiptap/core' {
parent: ParentConfig<MarkConfig<Options>>['addProseMirrorPlugins'],
}) => Plugin[],
/**
* Extensions
*/
addExtensions?: (this: {
name: string,
options: Options,
parent: ParentConfig<MarkConfig<Options>>['addExtensions'],
}) => Extensions,
/**
* Extend Node Schema
*/
@ -323,7 +333,6 @@ export class Mark<Options = any> {
config: MarkConfig = {
name: this.name,
priority: 100,
defaultOptions: {},
}
@ -344,7 +353,9 @@ export class Mark<Options = any> {
configure(options: Partial<Options> = {}) {
this.options = mergeDeep(this.options, options) as Options
return this
// return a new instance so we can use the same extension
// with different calls of `configure`
return this.extend()
}
extend<ExtendedOptions = Options>(extendedConfig: Partial<MarkConfig<ExtendedOptions>> = {}) {

View File

@ -8,6 +8,7 @@ import { Plugin, Transaction } from 'prosemirror-state'
import { InputRule } from 'prosemirror-inputrules'
import mergeDeep from './utilities/mergeDeep'
import {
Extensions,
Attributes,
NodeViewRenderer,
GlobalAttributes,
@ -103,6 +104,15 @@ declare module '@tiptap/core' {
parent: ParentConfig<NodeConfig<Options>>['addProseMirrorPlugins'],
}) => Plugin[],
/**
* Extensions
*/
addExtensions?: (this: {
name: string,
options: Options,
parent: ParentConfig<NodeConfig<Options>>['addExtensions'],
}) => Extensions,
/**
* Extend Node Schema
*/
@ -404,7 +414,6 @@ export class Node<Options = any> {
config: NodeConfig = {
name: this.name,
priority: 100,
defaultOptions: {},
}
@ -425,7 +434,9 @@ export class Node<Options = any> {
configure(options: Partial<Options> = {}) {
this.options = mergeDeep(this.options, options) as Options
return this
// return a new instance so we can use the same extension
// with different calls of `configure`
return this.extend()
}
extend<ExtendedOptions = Options>(extendedConfig: Partial<NodeConfig<ExtendedOptions>> = {}) {

View File

@ -1,33 +0,0 @@
import { NodeType } from 'prosemirror-model'
import getNodeType from '../helpers/getNodeType'
import deleteProps from '../utilities/deleteProps'
import { Command, RawCommands } from '../types'
declare module '@tiptap/core' {
interface Commands {
resetNodeAttributes: {
/**
* Resets node attributes to the default value.
*/
resetNodeAttributes: (typeOrName: string | NodeType, attributes: string | string[]) => Command,
}
}
}
export const resetNodeAttributes: RawCommands['resetNodeAttributes'] = (typeOrName, attributes) => ({ tr, state, dispatch }) => {
console.warn('[tiptap warn]: resetNodeAttributes() is deprecated. please use resetAttributes() instead.')
const type = getNodeType(typeOrName, state.schema)
const { selection } = tr
const { ranges } = selection
ranges.forEach(range => {
state.doc.nodesBetween(range.$from.pos, range.$to.pos, (node, pos) => {
if (node.type === type && dispatch) {
tr.setNodeMarkup(pos, undefined, deleteProps(node.attrs, attributes))
}
})
})
return true
}

View File

@ -1,35 +0,0 @@
import { NodeType } from 'prosemirror-model'
import getNodeType from '../helpers/getNodeType'
import { Command, RawCommands } from '../types'
declare module '@tiptap/core' {
interface Commands {
updateNodeAttributes: {
/**
* Update attributes of a node.
*/
updateNodeAttributes: (typeOrName: string | NodeType, attributes: Record<string, any>) => Command,
}
}
}
export const updateNodeAttributes: RawCommands['updateNodeAttributes'] = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
console.warn('[tiptap warn]: updateNodeAttributes() is deprecated. please use updateAttributes() instead.')
const type = getNodeType(typeOrName, state.schema)
const { selection } = tr
const { ranges } = selection
ranges.forEach(range => {
state.doc.nodesBetween(range.$from.pos, range.$to.pos, (node, pos) => {
if (node.type === type && dispatch) {
tr.setNodeMarkup(pos, undefined, {
...node.attrs,
...attributes,
})
}
})
})
return true
}

View File

@ -23,7 +23,6 @@ import * as newlineInCode from '../commands/newlineInCode'
import * as replace from '../commands/replace'
import * as replaceRange from '../commands/replaceRange'
import * as resetAttributes from '../commands/resetAttributes'
import * as resetNodeAttributes from '../commands/resetNodeAttributes'
import * as scrollIntoView from '../commands/scrollIntoView'
import * as selectAll from '../commands/selectAll'
import * as selectNodeBackward from '../commands/selectNodeBackward'
@ -45,7 +44,6 @@ import * as undoInputRule from '../commands/undoInputRule'
import * as unsetAllMarks from '../commands/unsetAllMarks'
import * as unsetMark from '../commands/unsetMark'
import * as updateAttributes from '../commands/updateAttributes'
import * as updateNodeAttributes from '../commands/updateNodeAttributes'
import * as wrapIn from '../commands/wrapIn'
import * as wrapInList from '../commands/wrapInList'
@ -73,7 +71,6 @@ export { newlineInCode }
export { replace }
export { replaceRange }
export { resetAttributes }
export { resetNodeAttributes }
export { scrollIntoView }
export { selectAll }
export { selectNodeBackward }
@ -95,7 +92,6 @@ export { undoInputRule }
export { unsetAllMarks }
export { unsetMark }
export { updateAttributes }
export { updateNodeAttributes }
export { wrapIn }
export { wrapInList }
@ -128,7 +124,6 @@ export const Commands = Extension.create({
...replace,
...replaceRange,
...resetAttributes,
...resetNodeAttributes,
...scrollIntoView,
...selectAll,
...selectNodeBackward,
@ -150,7 +145,6 @@ export const Commands = Extension.create({
...unsetAllMarks,
...unsetMark,
...updateAttributes,
...updateNodeAttributes,
...wrapIn,
...wrapInList,
}

View File

@ -0,0 +1,13 @@
import { DOMParser } from 'prosemirror-model'
import getSchema from './getSchema'
import elementFromString from '../utilities/elementFromString'
import { Extensions } from '../types'
export default function generateJSON(html: string, extensions: Extensions): Record<string, any> {
const schema = getSchema(extensions)
const dom = elementFromString(html)
return DOMParser.fromSchema(schema)
.parse(dom)
.toJSON()
}

View File

@ -0,0 +1,27 @@
import { MarkType, NodeType } from 'prosemirror-model'
import { EditorState } from 'prosemirror-state'
import getSchemaTypeNameByName from './getSchemaTypeNameByName'
import getNodeAttributes from './getNodeAttributes'
import getMarkAttributes from './getMarkAttributes'
export default function getAttributes(
state: EditorState,
typeOrName: string | NodeType | MarkType,
): Record<string, any> {
const schemaType = getSchemaTypeNameByName(
typeof typeOrName === 'string'
? typeOrName
: typeOrName.name,
state.schema,
)
if (schemaType === 'node') {
return getNodeAttributes(state, typeOrName as NodeType)
}
if (schemaType === 'mark') {
return getMarkAttributes(state, typeOrName as MarkType)
}
return {}
}

View File

@ -1,138 +1,10 @@
import { NodeSpec, MarkSpec, Schema } from 'prosemirror-model'
import { AnyConfig, Extensions } from '../types'
import { NodeConfig, MarkConfig } from '..'
import splitExtensions from './splitExtensions'
import getAttributesFromExtensions from './getAttributesFromExtensions'
import getRenderedAttributes from './getRenderedAttributes'
import isEmptyObject from '../utilities/isEmptyObject'
import injectExtensionAttributesToParseRule from './injectExtensionAttributesToParseRule'
import callOrReturn from '../utilities/callOrReturn'
import getExtensionField from './getExtensionField'
function cleanUpSchemaItem<T>(data: T) {
return Object.fromEntries(Object.entries(data).filter(([key, value]) => {
if (key === 'attrs' && isEmptyObject(value)) {
return false
}
return value !== null && value !== undefined
})) as T
}
import { Schema } from 'prosemirror-model'
import getSchemaByResolvedExtensions from './getSchemaByResolvedExtensions'
import ExtensionManager from '../ExtensionManager'
import { Extensions } from '../types'
export default function getSchema(extensions: Extensions): Schema {
const allAttributes = getAttributesFromExtensions(extensions)
const { nodeExtensions, markExtensions } = splitExtensions(extensions)
const topNode = nodeExtensions.find(extension => getExtensionField(extension, 'topNode'))?.name
const resolvedExtensions = ExtensionManager.resolve(extensions)
const nodes = Object.fromEntries(nodeExtensions.map(extension => {
const extensionAttributes = allAttributes.filter(attribute => attribute.type === extension.name)
const context = {
name: extension.name,
options: extension.options,
}
const extraNodeFields = extensions.reduce((fields, e) => {
const extendNodeSchema = getExtensionField<AnyConfig['extendNodeSchema']>(
e,
'extendNodeSchema',
context,
)
return {
...fields,
...(extendNodeSchema ? extendNodeSchema(extension) : {}),
}
}, {})
const schema: NodeSpec = cleanUpSchemaItem({
...extraNodeFields,
content: callOrReturn(getExtensionField<NodeConfig['content']>(extension, 'content', context)),
marks: callOrReturn(getExtensionField<NodeConfig['marks']>(extension, 'marks', context)),
group: callOrReturn(getExtensionField<NodeConfig['group']>(extension, 'group', context)),
inline: callOrReturn(getExtensionField<NodeConfig['inline']>(extension, 'inline', context)),
atom: callOrReturn(getExtensionField<NodeConfig['atom']>(extension, 'atom', context)),
selectable: callOrReturn(getExtensionField<NodeConfig['selectable']>(extension, 'selectable', context)),
draggable: callOrReturn(getExtensionField<NodeConfig['draggable']>(extension, 'draggable', context)),
code: callOrReturn(getExtensionField<NodeConfig['code']>(extension, 'code', context)),
defining: callOrReturn(getExtensionField<NodeConfig['defining']>(extension, 'defining', context)),
isolating: callOrReturn(getExtensionField<NodeConfig['isolating']>(extension, 'isolating', context)),
attrs: Object.fromEntries(extensionAttributes.map(extensionAttribute => {
return [extensionAttribute.name, { default: extensionAttribute?.attribute?.default }]
})),
})
const parseHTML = callOrReturn(getExtensionField<NodeConfig['parseHTML']>(extension, 'parseHTML', context))
if (parseHTML) {
schema.parseDOM = parseHTML
.map(parseRule => injectExtensionAttributesToParseRule(parseRule, extensionAttributes))
}
const renderHTML = getExtensionField<NodeConfig['renderHTML']>(extension, 'renderHTML', context)
if (renderHTML) {
schema.toDOM = node => renderHTML({
node,
HTMLAttributes: getRenderedAttributes(node, extensionAttributes),
})
}
return [extension.name, schema]
}))
const marks = Object.fromEntries(markExtensions.map(extension => {
const extensionAttributes = allAttributes.filter(attribute => attribute.type === extension.name)
const context = {
name: extension.name,
options: extension.options,
}
const extraMarkFields = extensions.reduce((fields, e) => {
const extendMarkSchema = getExtensionField<AnyConfig['extendMarkSchema']>(
e,
'extendMarkSchema',
context,
)
return {
...fields,
...(extendMarkSchema ? extendMarkSchema(extension) : {}),
}
}, {})
const schema: MarkSpec = cleanUpSchemaItem({
...extraMarkFields,
inclusive: callOrReturn(getExtensionField<NodeConfig['inclusive']>(extension, 'inclusive', context)),
excludes: callOrReturn(getExtensionField<NodeConfig['excludes']>(extension, 'excludes', context)),
group: callOrReturn(getExtensionField<NodeConfig['group']>(extension, 'group', context)),
spanning: callOrReturn(getExtensionField<NodeConfig['spanning']>(extension, 'spanning', context)),
attrs: Object.fromEntries(extensionAttributes.map(extensionAttribute => {
return [extensionAttribute.name, { default: extensionAttribute?.attribute?.default }]
})),
})
const parseHTML = callOrReturn(getExtensionField<MarkConfig['parseHTML']>(extension, 'parseHTML', context))
if (parseHTML) {
schema.parseDOM = parseHTML
.map(parseRule => injectExtensionAttributesToParseRule(parseRule, extensionAttributes))
}
const renderHTML = getExtensionField<MarkConfig['renderHTML']>(extension, 'renderHTML', context)
if (renderHTML) {
schema.toDOM = mark => renderHTML({
mark,
HTMLAttributes: getRenderedAttributes(mark, extensionAttributes),
})
}
return [extension.name, schema]
}))
return new Schema({
topNode,
nodes,
marks,
})
return getSchemaByResolvedExtensions(resolvedExtensions)
}

View File

@ -0,0 +1,138 @@
import { NodeSpec, MarkSpec, Schema } from 'prosemirror-model'
import { AnyConfig, Extensions } from '../types'
import { NodeConfig, MarkConfig } from '..'
import splitExtensions from './splitExtensions'
import getAttributesFromExtensions from './getAttributesFromExtensions'
import getRenderedAttributes from './getRenderedAttributes'
import isEmptyObject from '../utilities/isEmptyObject'
import injectExtensionAttributesToParseRule from './injectExtensionAttributesToParseRule'
import callOrReturn from '../utilities/callOrReturn'
import getExtensionField from './getExtensionField'
function cleanUpSchemaItem<T>(data: T) {
return Object.fromEntries(Object.entries(data).filter(([key, value]) => {
if (key === 'attrs' && isEmptyObject(value)) {
return false
}
return value !== null && value !== undefined
})) as T
}
export default function getSchemaByResolvedExtensions(extensions: Extensions): Schema {
const allAttributes = getAttributesFromExtensions(extensions)
const { nodeExtensions, markExtensions } = splitExtensions(extensions)
const topNode = nodeExtensions.find(extension => getExtensionField(extension, 'topNode'))?.name
const nodes = Object.fromEntries(nodeExtensions.map(extension => {
const extensionAttributes = allAttributes.filter(attribute => attribute.type === extension.name)
const context = {
name: extension.name,
options: extension.options,
}
const extraNodeFields = extensions.reduce((fields, e) => {
const extendNodeSchema = getExtensionField<AnyConfig['extendNodeSchema']>(
e,
'extendNodeSchema',
context,
)
return {
...fields,
...(extendNodeSchema ? extendNodeSchema(extension) : {}),
}
}, {})
const schema: NodeSpec = cleanUpSchemaItem({
...extraNodeFields,
content: callOrReturn(getExtensionField<NodeConfig['content']>(extension, 'content', context)),
marks: callOrReturn(getExtensionField<NodeConfig['marks']>(extension, 'marks', context)),
group: callOrReturn(getExtensionField<NodeConfig['group']>(extension, 'group', context)),
inline: callOrReturn(getExtensionField<NodeConfig['inline']>(extension, 'inline', context)),
atom: callOrReturn(getExtensionField<NodeConfig['atom']>(extension, 'atom', context)),
selectable: callOrReturn(getExtensionField<NodeConfig['selectable']>(extension, 'selectable', context)),
draggable: callOrReturn(getExtensionField<NodeConfig['draggable']>(extension, 'draggable', context)),
code: callOrReturn(getExtensionField<NodeConfig['code']>(extension, 'code', context)),
defining: callOrReturn(getExtensionField<NodeConfig['defining']>(extension, 'defining', context)),
isolating: callOrReturn(getExtensionField<NodeConfig['isolating']>(extension, 'isolating', context)),
attrs: Object.fromEntries(extensionAttributes.map(extensionAttribute => {
return [extensionAttribute.name, { default: extensionAttribute?.attribute?.default }]
})),
})
const parseHTML = callOrReturn(getExtensionField<NodeConfig['parseHTML']>(extension, 'parseHTML', context))
if (parseHTML) {
schema.parseDOM = parseHTML
.map(parseRule => injectExtensionAttributesToParseRule(parseRule, extensionAttributes))
}
const renderHTML = getExtensionField<NodeConfig['renderHTML']>(extension, 'renderHTML', context)
if (renderHTML) {
schema.toDOM = node => renderHTML({
node,
HTMLAttributes: getRenderedAttributes(node, extensionAttributes),
})
}
return [extension.name, schema]
}))
const marks = Object.fromEntries(markExtensions.map(extension => {
const extensionAttributes = allAttributes.filter(attribute => attribute.type === extension.name)
const context = {
name: extension.name,
options: extension.options,
}
const extraMarkFields = extensions.reduce((fields, e) => {
const extendMarkSchema = getExtensionField<AnyConfig['extendMarkSchema']>(
e,
'extendMarkSchema',
context,
)
return {
...fields,
...(extendMarkSchema ? extendMarkSchema(extension) : {}),
}
}, {})
const schema: MarkSpec = cleanUpSchemaItem({
...extraMarkFields,
inclusive: callOrReturn(getExtensionField<NodeConfig['inclusive']>(extension, 'inclusive', context)),
excludes: callOrReturn(getExtensionField<NodeConfig['excludes']>(extension, 'excludes', context)),
group: callOrReturn(getExtensionField<NodeConfig['group']>(extension, 'group', context)),
spanning: callOrReturn(getExtensionField<NodeConfig['spanning']>(extension, 'spanning', context)),
attrs: Object.fromEntries(extensionAttributes.map(extensionAttribute => {
return [extensionAttribute.name, { default: extensionAttribute?.attribute?.default }]
})),
})
const parseHTML = callOrReturn(getExtensionField<MarkConfig['parseHTML']>(extension, 'parseHTML', context))
if (parseHTML) {
schema.parseDOM = parseHTML
.map(parseRule => injectExtensionAttributesToParseRule(parseRule, extensionAttributes))
}
const renderHTML = getExtensionField<MarkConfig['renderHTML']>(extension, 'renderHTML', context)
if (renderHTML) {
schema.toDOM = mark => renderHTML({
mark,
HTMLAttributes: getRenderedAttributes(mark, extensionAttributes),
})
}
return [extension.name, schema]
}))
return new Schema({
topNode,
nodes,
marks,
})
}

View File

@ -18,9 +18,16 @@ export { default as findChildren } from './helpers/findChildren'
export { default as findParentNode } from './helpers/findParentNode'
export { default as findParentNodeClosestToPos } from './helpers/findParentNodeClosestToPos'
export { default as generateHTML } from './helpers/generateHTML'
export { default as generateJSON } from './helpers/generateJSON'
export { default as getSchema } from './helpers/getSchema'
export { default as getHTMLFromFragment } from './helpers/getHTMLFromFragment'
export { default as getAttributes } from './helpers/getMarkAttributes'
export { default as getMarkAttributes } from './helpers/getMarkAttributes'
export { default as getMarkRange } from './helpers/getMarkRange'
export { default as getMarkType } from './helpers/getMarkType'
export { default as getMarksBetween } from './helpers/getMarksBetween'
export { default as getNodeAttributes } from './helpers/getNodeAttributes'
export { default as getNodeType } from './helpers/getNodeType'
export { default as isActive } from './helpers/isActive'
export { default as isMarkActive } from './helpers/isMarkActive'
export { default as isNodeActive } from './helpers/isNodeActive'

View File

@ -1,7 +1,11 @@
import { Plugin, PluginKey } from 'prosemirror-state'
import { Slice, Fragment, MarkType } from 'prosemirror-model'
export default function (regexp: RegExp, type: MarkType, getAttrs?: (match: any) => any): Plugin {
export default function (
regexp: RegExp,
type: MarkType,
getAttributes?: Record<string, any> | ((match: RegExpExecArray) => Record<string, any>),
): Plugin {
const handler = (fragment: Fragment, parent?: any) => {
const nodes: any[] = []
@ -22,7 +26,9 @@ export default function (regexp: RegExp, type: MarkType, getAttrs?: (match: any)
const matchEnd = matchStart + match[outerMatch].length
const textStart = matchStart + match[outerMatch].lastIndexOf(match[innerMatch])
const textEnd = textStart + match[innerMatch].length
const attrs = getAttrs instanceof Function ? getAttrs(match) : getAttrs
const attrs = getAttributes instanceof Function
? getAttributes(match)
: getAttributes
// adding text before markdown to nodes
if (matchStart > 0) {

View File

@ -3,6 +3,47 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.11](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-blockquote@2.0.0-beta.10...@tiptap/extension-blockquote@2.0.0-beta.11) (2021-05-07)
### Bug Fixes
* revert adding exports ([bc320d0](https://github.com/ueberdosis/tiptap/commit/bc320d0b4b80b0e37a7e47a56e0f6daec6e65d98))
# [2.0.0-beta.10](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-blockquote@2.0.0-beta.9...@tiptap/extension-blockquote@2.0.0-beta.10) (2021-05-06)
### Bug Fixes
* revert adding type: module ([f8d6475](https://github.com/ueberdosis/tiptap/commit/f8d6475e2151faea6f96baecdd6bd75880d50d2c))
# [2.0.0-beta.9](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-blockquote@2.0.0-beta.8...@tiptap/extension-blockquote@2.0.0-beta.9) (2021-05-06)
### Bug Fixes
* add exports to package.json ([1277fa4](https://github.com/ueberdosis/tiptap/commit/1277fa47151e9c039508cdb219bdd0ffe647f4ee))
# [2.0.0-beta.8](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-blockquote@2.0.0-beta.7...@tiptap/extension-blockquote@2.0.0-beta.8) (2021-05-06)
**Note:** Version bump only for package @tiptap/extension-blockquote
# [2.0.0-beta.7](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-blockquote@2.0.0-beta.6...@tiptap/extension-blockquote@2.0.0-beta.7) (2021-05-05)
**Note:** Version bump only for package @tiptap/extension-blockquote

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-blockquote",
"description": "blockquote extension for tiptap",
"version": "2.0.0-beta.7",
"version": "2.0.0-beta.11",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -3,6 +3,47 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.11](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-bold@2.0.0-beta.10...@tiptap/extension-bold@2.0.0-beta.11) (2021-05-07)
### Bug Fixes
* revert adding exports ([bc320d0](https://github.com/ueberdosis/tiptap/commit/bc320d0b4b80b0e37a7e47a56e0f6daec6e65d98))
# [2.0.0-beta.10](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-bold@2.0.0-beta.9...@tiptap/extension-bold@2.0.0-beta.10) (2021-05-06)
### Bug Fixes
* revert adding type: module ([f8d6475](https://github.com/ueberdosis/tiptap/commit/f8d6475e2151faea6f96baecdd6bd75880d50d2c))
# [2.0.0-beta.9](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-bold@2.0.0-beta.8...@tiptap/extension-bold@2.0.0-beta.9) (2021-05-06)
### Bug Fixes
* add exports to package.json ([1277fa4](https://github.com/ueberdosis/tiptap/commit/1277fa47151e9c039508cdb219bdd0ffe647f4ee))
# [2.0.0-beta.8](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-bold@2.0.0-beta.7...@tiptap/extension-bold@2.0.0-beta.8) (2021-05-06)
**Note:** Version bump only for package @tiptap/extension-bold
# [2.0.0-beta.7](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-bold@2.0.0-beta.6...@tiptap/extension-bold@2.0.0-beta.7) (2021-05-05)
**Note:** Version bump only for package @tiptap/extension-bold

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-bold",
"description": "bold extension for tiptap",
"version": "2.0.0-beta.7",
"version": "2.0.0-beta.11",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -3,6 +3,50 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.15](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-bubble-menu@2.0.0-beta.14...@tiptap/extension-bubble-menu@2.0.0-beta.15) (2021-05-07)
### Bug Fixes
* revert adding exports ([bc320d0](https://github.com/ueberdosis/tiptap/commit/bc320d0b4b80b0e37a7e47a56e0f6daec6e65d98))
# [2.0.0-beta.14](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-bubble-menu@2.0.0-beta.13...@tiptap/extension-bubble-menu@2.0.0-beta.14) (2021-05-06)
### Bug Fixes
* revert adding type: module ([f8d6475](https://github.com/ueberdosis/tiptap/commit/f8d6475e2151faea6f96baecdd6bd75880d50d2c))
# [2.0.0-beta.13](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-bubble-menu@2.0.0-beta.12...@tiptap/extension-bubble-menu@2.0.0-beta.13) (2021-05-06)
### Bug Fixes
* add exports to package.json ([1277fa4](https://github.com/ueberdosis/tiptap/commit/1277fa47151e9c039508cdb219bdd0ffe647f4ee))
# [2.0.0-beta.12](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-bubble-menu@2.0.0-beta.11...@tiptap/extension-bubble-menu@2.0.0-beta.12) (2021-05-06)
### Bug Fixes
* add CellSelection support for bubble menu ([6472d2c](https://github.com/ueberdosis/tiptap/commit/6472d2c2715bd29a061abae6a59963949c298e55))
# [2.0.0-beta.11](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-bubble-menu@2.0.0-beta.10...@tiptap/extension-bubble-menu@2.0.0-beta.11) (2021-05-05)
**Note:** Version bump only for package @tiptap/extension-bubble-menu

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-bubble-menu",
"description": "bubble-menu extension for tiptap",
"version": "2.0.0-beta.11",
"version": "2.0.0-beta.15",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -88,12 +88,11 @@ export class BubbleMenuView {
return
}
const {
from,
to,
empty,
$anchor,
} = selection
const { empty, $anchor, ranges } = selection
// support for CellSelections
const from = Math.min(...ranges.map(range => range.$from.pos))
const to = Math.max(...ranges.map(range => range.$to.pos))
// Sometime check for `empty` is not enough.
// Doubleclick an empty paragraph returns a node size of 2.

View File

@ -3,6 +3,47 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.11](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-bullet-list@2.0.0-beta.10...@tiptap/extension-bullet-list@2.0.0-beta.11) (2021-05-07)
### Bug Fixes
* revert adding exports ([bc320d0](https://github.com/ueberdosis/tiptap/commit/bc320d0b4b80b0e37a7e47a56e0f6daec6e65d98))
# [2.0.0-beta.10](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-bullet-list@2.0.0-beta.9...@tiptap/extension-bullet-list@2.0.0-beta.10) (2021-05-06)
### Bug Fixes
* revert adding type: module ([f8d6475](https://github.com/ueberdosis/tiptap/commit/f8d6475e2151faea6f96baecdd6bd75880d50d2c))
# [2.0.0-beta.9](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-bullet-list@2.0.0-beta.8...@tiptap/extension-bullet-list@2.0.0-beta.9) (2021-05-06)
### Bug Fixes
* add exports to package.json ([1277fa4](https://github.com/ueberdosis/tiptap/commit/1277fa47151e9c039508cdb219bdd0ffe647f4ee))
# [2.0.0-beta.8](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-bullet-list@2.0.0-beta.7...@tiptap/extension-bullet-list@2.0.0-beta.8) (2021-05-06)
**Note:** Version bump only for package @tiptap/extension-bullet-list
# [2.0.0-beta.7](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-bullet-list@2.0.0-beta.6...@tiptap/extension-bullet-list@2.0.0-beta.7) (2021-05-05)
**Note:** Version bump only for package @tiptap/extension-bullet-list

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-bullet-list",
"description": "bullet list extension for tiptap",
"version": "2.0.0-beta.7",
"version": "2.0.0-beta.11",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -3,6 +3,47 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.10](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-character-count@2.0.0-beta.9...@tiptap/extension-character-count@2.0.0-beta.10) (2021-05-07)
### Bug Fixes
* revert adding exports ([bc320d0](https://github.com/ueberdosis/tiptap/commit/bc320d0b4b80b0e37a7e47a56e0f6daec6e65d98))
# [2.0.0-beta.9](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-character-count@2.0.0-beta.8...@tiptap/extension-character-count@2.0.0-beta.9) (2021-05-06)
### Bug Fixes
* revert adding type: module ([f8d6475](https://github.com/ueberdosis/tiptap/commit/f8d6475e2151faea6f96baecdd6bd75880d50d2c))
# [2.0.0-beta.8](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-character-count@2.0.0-beta.7...@tiptap/extension-character-count@2.0.0-beta.8) (2021-05-06)
### Bug Fixes
* add exports to package.json ([1277fa4](https://github.com/ueberdosis/tiptap/commit/1277fa47151e9c039508cdb219bdd0ffe647f4ee))
# [2.0.0-beta.7](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-character-count@2.0.0-beta.6...@tiptap/extension-character-count@2.0.0-beta.7) (2021-05-06)
**Note:** Version bump only for package @tiptap/extension-character-count
# [2.0.0-beta.6](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-character-count@2.0.0-beta.5...@tiptap/extension-character-count@2.0.0-beta.6) (2021-05-05)
**Note:** Version bump only for package @tiptap/extension-character-count

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-character-count",
"description": "font family extension for tiptap",
"version": "2.0.0-beta.6",
"version": "2.0.0-beta.10",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -3,6 +3,47 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.18](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-code-block-lowlight@2.0.0-beta.17...@tiptap/extension-code-block-lowlight@2.0.0-beta.18) (2021-05-07)
### Bug Fixes
* revert adding exports ([bc320d0](https://github.com/ueberdosis/tiptap/commit/bc320d0b4b80b0e37a7e47a56e0f6daec6e65d98))
# [2.0.0-beta.17](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-code-block-lowlight@2.0.0-beta.16...@tiptap/extension-code-block-lowlight@2.0.0-beta.17) (2021-05-06)
### Bug Fixes
* revert adding type: module ([f8d6475](https://github.com/ueberdosis/tiptap/commit/f8d6475e2151faea6f96baecdd6bd75880d50d2c))
# [2.0.0-beta.16](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-code-block-lowlight@2.0.0-beta.15...@tiptap/extension-code-block-lowlight@2.0.0-beta.16) (2021-05-06)
### Bug Fixes
* add exports to package.json ([1277fa4](https://github.com/ueberdosis/tiptap/commit/1277fa47151e9c039508cdb219bdd0ffe647f4ee))
# [2.0.0-beta.15](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-code-block-lowlight@2.0.0-beta.14...@tiptap/extension-code-block-lowlight@2.0.0-beta.15) (2021-05-06)
**Note:** Version bump only for package @tiptap/extension-code-block-lowlight
# [2.0.0-beta.14](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-code-block-lowlight@2.0.0-beta.13...@tiptap/extension-code-block-lowlight@2.0.0-beta.14) (2021-05-05)
**Note:** Version bump only for package @tiptap/extension-code-block-lowlight

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-code-block-lowlight",
"description": "code block extension for tiptap",
"version": "2.0.0-beta.14",
"version": "2.0.0-beta.18",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",
@ -24,7 +24,7 @@
"@tiptap/core": "^2.0.0-beta.1"
},
"dependencies": {
"@tiptap/extension-code-block": "^2.0.0-beta.9",
"@tiptap/extension-code-block": "^2.0.0-beta.13",
"@types/lowlight": "^0.0.1",
"lowlight": "^1.20.0",
"prosemirror-model": "^1.14.1",

View File

@ -3,6 +3,47 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.13](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-code-block@2.0.0-beta.12...@tiptap/extension-code-block@2.0.0-beta.13) (2021-05-07)
### Bug Fixes
* revert adding exports ([bc320d0](https://github.com/ueberdosis/tiptap/commit/bc320d0b4b80b0e37a7e47a56e0f6daec6e65d98))
# [2.0.0-beta.12](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-code-block@2.0.0-beta.11...@tiptap/extension-code-block@2.0.0-beta.12) (2021-05-06)
### Bug Fixes
* revert adding type: module ([f8d6475](https://github.com/ueberdosis/tiptap/commit/f8d6475e2151faea6f96baecdd6bd75880d50d2c))
# [2.0.0-beta.11](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-code-block@2.0.0-beta.10...@tiptap/extension-code-block@2.0.0-beta.11) (2021-05-06)
### Bug Fixes
* add exports to package.json ([1277fa4](https://github.com/ueberdosis/tiptap/commit/1277fa47151e9c039508cdb219bdd0ffe647f4ee))
# [2.0.0-beta.10](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-code-block@2.0.0-beta.9...@tiptap/extension-code-block@2.0.0-beta.10) (2021-05-06)
**Note:** Version bump only for package @tiptap/extension-code-block
# [2.0.0-beta.9](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-code-block@2.0.0-beta.8...@tiptap/extension-code-block@2.0.0-beta.9) (2021-05-05)
**Note:** Version bump only for package @tiptap/extension-code-block

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-code-block",
"description": "code block extension for tiptap",
"version": "2.0.0-beta.9",
"version": "2.0.0-beta.13",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -3,6 +3,47 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.11](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-code@2.0.0-beta.10...@tiptap/extension-code@2.0.0-beta.11) (2021-05-07)
### Bug Fixes
* revert adding exports ([bc320d0](https://github.com/ueberdosis/tiptap/commit/bc320d0b4b80b0e37a7e47a56e0f6daec6e65d98))
# [2.0.0-beta.10](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-code@2.0.0-beta.9...@tiptap/extension-code@2.0.0-beta.10) (2021-05-06)
### Bug Fixes
* revert adding type: module ([f8d6475](https://github.com/ueberdosis/tiptap/commit/f8d6475e2151faea6f96baecdd6bd75880d50d2c))
# [2.0.0-beta.9](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-code@2.0.0-beta.8...@tiptap/extension-code@2.0.0-beta.9) (2021-05-06)
### Bug Fixes
* add exports to package.json ([1277fa4](https://github.com/ueberdosis/tiptap/commit/1277fa47151e9c039508cdb219bdd0ffe647f4ee))
# [2.0.0-beta.8](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-code@2.0.0-beta.7...@tiptap/extension-code@2.0.0-beta.8) (2021-05-06)
**Note:** Version bump only for package @tiptap/extension-code
# [2.0.0-beta.7](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-code@2.0.0-beta.6...@tiptap/extension-code@2.0.0-beta.7) (2021-05-05)
**Note:** Version bump only for package @tiptap/extension-code

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-code",
"description": "code extension for tiptap",
"version": "2.0.0-beta.7",
"version": "2.0.0-beta.11",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -3,6 +3,47 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.17](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-collaboration-cursor@2.0.0-beta.16...@tiptap/extension-collaboration-cursor@2.0.0-beta.17) (2021-05-07)
### Bug Fixes
* revert adding exports ([bc320d0](https://github.com/ueberdosis/tiptap/commit/bc320d0b4b80b0e37a7e47a56e0f6daec6e65d98))
# [2.0.0-beta.16](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-collaboration-cursor@2.0.0-beta.15...@tiptap/extension-collaboration-cursor@2.0.0-beta.16) (2021-05-06)
### Bug Fixes
* revert adding type: module ([f8d6475](https://github.com/ueberdosis/tiptap/commit/f8d6475e2151faea6f96baecdd6bd75880d50d2c))
# [2.0.0-beta.15](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-collaboration-cursor@2.0.0-beta.14...@tiptap/extension-collaboration-cursor@2.0.0-beta.15) (2021-05-06)
### Bug Fixes
* add exports to package.json ([1277fa4](https://github.com/ueberdosis/tiptap/commit/1277fa47151e9c039508cdb219bdd0ffe647f4ee))
# [2.0.0-beta.14](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-collaboration-cursor@2.0.0-beta.13...@tiptap/extension-collaboration-cursor@2.0.0-beta.14) (2021-05-06)
**Note:** Version bump only for package @tiptap/extension-collaboration-cursor
# [2.0.0-beta.13](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-collaboration-cursor@2.0.0-beta.12...@tiptap/extension-collaboration-cursor@2.0.0-beta.13) (2021-05-05)
**Note:** Version bump only for package @tiptap/extension-collaboration-cursor

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-collaboration-cursor",
"description": "collaboration cursor extension for tiptap",
"version": "2.0.0-beta.13",
"version": "2.0.0-beta.17",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -3,6 +3,58 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.16](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-collaboration@2.0.0-beta.15...@tiptap/extension-collaboration@2.0.0-beta.16) (2021-05-09)
### Bug Fixes
* add warn message when using collab and history extension together ([bf50af4](https://github.com/ueberdosis/tiptap/commit/bf50af4cf68cd883069cacabacc8deb2d07aca2a))
# [2.0.0-beta.15](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-collaboration@2.0.0-beta.14...@tiptap/extension-collaboration@2.0.0-beta.15) (2021-05-07)
### Bug Fixes
* revert adding exports ([bc320d0](https://github.com/ueberdosis/tiptap/commit/bc320d0b4b80b0e37a7e47a56e0f6daec6e65d98))
# [2.0.0-beta.14](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-collaboration@2.0.0-beta.13...@tiptap/extension-collaboration@2.0.0-beta.14) (2021-05-06)
### Bug Fixes
* revert adding type: module ([f8d6475](https://github.com/ueberdosis/tiptap/commit/f8d6475e2151faea6f96baecdd6bd75880d50d2c))
# [2.0.0-beta.13](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-collaboration@2.0.0-beta.12...@tiptap/extension-collaboration@2.0.0-beta.13) (2021-05-06)
### Bug Fixes
* add exports to package.json ([1277fa4](https://github.com/ueberdosis/tiptap/commit/1277fa47151e9c039508cdb219bdd0ffe647f4ee))
# [2.0.0-beta.12](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-collaboration@2.0.0-beta.11...@tiptap/extension-collaboration@2.0.0-beta.12) (2021-05-06)
**Note:** Version bump only for package @tiptap/extension-collaboration
# [2.0.0-beta.11](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-collaboration@2.0.0-beta.10...@tiptap/extension-collaboration@2.0.0-beta.11) (2021-05-05)
**Note:** Version bump only for package @tiptap/extension-collaboration

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-collaboration",
"description": "collaboration extension for tiptap",
"version": "2.0.0-beta.11",
"version": "2.0.0-beta.16",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -47,6 +47,12 @@ export const Collaboration = Extension.create<CollaborationOptions>({
fragment: null,
},
onCreate() {
if (this.editor.extensionManager.extensions.find(extension => extension.name === 'history')) {
console.warn('[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-history".')
}
},
addCommands() {
return {
undo: () => ({ tr, state, dispatch }) => {

View File

@ -3,6 +3,47 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.10](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-document@2.0.0-beta.9...@tiptap/extension-document@2.0.0-beta.10) (2021-05-07)
### Bug Fixes
* revert adding exports ([bc320d0](https://github.com/ueberdosis/tiptap/commit/bc320d0b4b80b0e37a7e47a56e0f6daec6e65d98))
# [2.0.0-beta.9](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-document@2.0.0-beta.8...@tiptap/extension-document@2.0.0-beta.9) (2021-05-06)
### Bug Fixes
* revert adding type: module ([f8d6475](https://github.com/ueberdosis/tiptap/commit/f8d6475e2151faea6f96baecdd6bd75880d50d2c))
# [2.0.0-beta.8](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-document@2.0.0-beta.7...@tiptap/extension-document@2.0.0-beta.8) (2021-05-06)
### Bug Fixes
* add exports to package.json ([1277fa4](https://github.com/ueberdosis/tiptap/commit/1277fa47151e9c039508cdb219bdd0ffe647f4ee))
# [2.0.0-beta.7](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-document@2.0.0-beta.6...@tiptap/extension-document@2.0.0-beta.7) (2021-05-06)
**Note:** Version bump only for package @tiptap/extension-document
# [2.0.0-beta.6](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-document@2.0.0-beta.5...@tiptap/extension-document@2.0.0-beta.6) (2021-05-05)
**Note:** Version bump only for package @tiptap/extension-document

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-document",
"description": "document extension for tiptap",
"version": "2.0.0-beta.6",
"version": "2.0.0-beta.10",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -3,6 +3,47 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.11](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-dropcursor@2.0.0-beta.10...@tiptap/extension-dropcursor@2.0.0-beta.11) (2021-05-07)
### Bug Fixes
* revert adding exports ([bc320d0](https://github.com/ueberdosis/tiptap/commit/bc320d0b4b80b0e37a7e47a56e0f6daec6e65d98))
# [2.0.0-beta.10](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-dropcursor@2.0.0-beta.9...@tiptap/extension-dropcursor@2.0.0-beta.10) (2021-05-06)
### Bug Fixes
* revert adding type: module ([f8d6475](https://github.com/ueberdosis/tiptap/commit/f8d6475e2151faea6f96baecdd6bd75880d50d2c))
# [2.0.0-beta.9](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-dropcursor@2.0.0-beta.8...@tiptap/extension-dropcursor@2.0.0-beta.9) (2021-05-06)
### Bug Fixes
* add exports to package.json ([1277fa4](https://github.com/ueberdosis/tiptap/commit/1277fa47151e9c039508cdb219bdd0ffe647f4ee))
# [2.0.0-beta.8](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-dropcursor@2.0.0-beta.7...@tiptap/extension-dropcursor@2.0.0-beta.8) (2021-05-06)
**Note:** Version bump only for package @tiptap/extension-dropcursor
# [2.0.0-beta.7](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-dropcursor@2.0.0-beta.6...@tiptap/extension-dropcursor@2.0.0-beta.7) (2021-05-05)
**Note:** Version bump only for package @tiptap/extension-dropcursor

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-dropcursor",
"description": "dropcursor extension for tiptap",
"version": "2.0.0-beta.7",
"version": "2.0.0-beta.11",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -3,6 +3,47 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.12](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-floating-menu@2.0.0-beta.11...@tiptap/extension-floating-menu@2.0.0-beta.12) (2021-05-07)
### Bug Fixes
* revert adding exports ([bc320d0](https://github.com/ueberdosis/tiptap/commit/bc320d0b4b80b0e37a7e47a56e0f6daec6e65d98))
# [2.0.0-beta.11](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-floating-menu@2.0.0-beta.10...@tiptap/extension-floating-menu@2.0.0-beta.11) (2021-05-06)
### Bug Fixes
* revert adding type: module ([f8d6475](https://github.com/ueberdosis/tiptap/commit/f8d6475e2151faea6f96baecdd6bd75880d50d2c))
# [2.0.0-beta.10](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-floating-menu@2.0.0-beta.9...@tiptap/extension-floating-menu@2.0.0-beta.10) (2021-05-06)
### Bug Fixes
* add exports to package.json ([1277fa4](https://github.com/ueberdosis/tiptap/commit/1277fa47151e9c039508cdb219bdd0ffe647f4ee))
# [2.0.0-beta.9](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-floating-menu@2.0.0-beta.8...@tiptap/extension-floating-menu@2.0.0-beta.9) (2021-05-06)
**Note:** Version bump only for package @tiptap/extension-floating-menu
# [2.0.0-beta.8](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-floating-menu@2.0.0-beta.7...@tiptap/extension-floating-menu@2.0.0-beta.8) (2021-05-05)
**Note:** Version bump only for package @tiptap/extension-floating-menu

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-floating-menu",
"description": "floating-menu extension for tiptap",
"version": "2.0.0-beta.8",
"version": "2.0.0-beta.12",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -3,6 +3,47 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.0.0-beta.16](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-focus@2.0.0-beta.15...@tiptap/extension-focus@2.0.0-beta.16) (2021-05-07)
### Bug Fixes
* revert adding exports ([bc320d0](https://github.com/ueberdosis/tiptap/commit/bc320d0b4b80b0e37a7e47a56e0f6daec6e65d98))
# [2.0.0-beta.15](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-focus@2.0.0-beta.14...@tiptap/extension-focus@2.0.0-beta.15) (2021-05-06)
### Bug Fixes
* revert adding type: module ([f8d6475](https://github.com/ueberdosis/tiptap/commit/f8d6475e2151faea6f96baecdd6bd75880d50d2c))
# [2.0.0-beta.14](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-focus@2.0.0-beta.13...@tiptap/extension-focus@2.0.0-beta.14) (2021-05-06)
### Bug Fixes
* add exports to package.json ([1277fa4](https://github.com/ueberdosis/tiptap/commit/1277fa47151e9c039508cdb219bdd0ffe647f4ee))
# [2.0.0-beta.13](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-focus@2.0.0-beta.12...@tiptap/extension-focus@2.0.0-beta.13) (2021-05-06)
**Note:** Version bump only for package @tiptap/extension-focus
# [2.0.0-beta.12](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-focus@2.0.0-beta.11...@tiptap/extension-focus@2.0.0-beta.12) (2021-05-05)
**Note:** Version bump only for package @tiptap/extension-focus

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/extension-focus",
"description": "focus extension for tiptap",
"version": "2.0.0-beta.12",
"version": "2.0.0-beta.16",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

Some files were not shown because too many files have changed in this diff Show More