Merge branch 'main' of github.com:ueberdosis/tiptap into main
This commit is contained in:
@@ -40,9 +40,20 @@ const getRandomElement = list => {
|
|||||||
|
|
||||||
const getRandomRoom = () => {
|
const getRandomRoom = () => {
|
||||||
return getRandomElement([
|
return getRandomElement([
|
||||||
'room.one',
|
// HN killed it all
|
||||||
'room.two',
|
// 'room.one',
|
||||||
'room.three',
|
// 'room.two',
|
||||||
|
// 'room.three',
|
||||||
|
// 'room.four',
|
||||||
|
// 'room.five',
|
||||||
|
'room.six',
|
||||||
|
// 'room.seven',
|
||||||
|
// 'room.eight',
|
||||||
|
'room.nine',
|
||||||
|
// 'room.ten',
|
||||||
|
'room.eleven',
|
||||||
|
'room.twelve',
|
||||||
|
'room.thirteen',
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,17 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
# [2.0.0-beta.37](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.36...@tiptap/core@2.0.0-beta.37) (2021-04-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* better merge mark attributes for existing marks, fix [#1039](https://github.com/ueberdosis/tiptap/issues/1039) ([cfd29fa](https://github.com/ueberdosis/tiptap/commit/cfd29fac86e03d72a0c05ec8d26aac905d19c5a2))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [2.0.0-beta.36](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.35...@tiptap/core@2.0.0-beta.36) (2021-04-22)
|
# [2.0.0-beta.36](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.35...@tiptap/core@2.0.0-beta.36) (2021-04-22)
|
||||||
|
|
||||||
**Note:** Version bump only for package @tiptap/core
|
**Note:** Version bump only for package @tiptap/core
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@tiptap/core",
|
"name": "@tiptap/core",
|
||||||
"description": "headless rich text editor",
|
"description": "headless rich text editor",
|
||||||
"version": "2.0.0-beta.36",
|
"version": "2.0.0-beta.37",
|
||||||
"homepage": "https://tiptap.dev",
|
"homepage": "https://tiptap.dev",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"tiptap",
|
"tiptap",
|
||||||
|
|||||||
@@ -18,18 +18,41 @@ export const setMark: RawCommands['setMark'] = (typeOrName, attributes = {}) =>
|
|||||||
const { selection } = tr
|
const { selection } = tr
|
||||||
const { empty, ranges } = selection
|
const { empty, ranges } = selection
|
||||||
const type = getMarkType(typeOrName, state.schema)
|
const type = getMarkType(typeOrName, state.schema)
|
||||||
const oldAttributes = getMarkAttributes(state, type)
|
|
||||||
const newAttributes = {
|
|
||||||
...oldAttributes,
|
|
||||||
...attributes,
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dispatch) {
|
if (dispatch) {
|
||||||
if (empty) {
|
if (empty) {
|
||||||
tr.addStoredMark(type.create(newAttributes))
|
const oldAttributes = getMarkAttributes(state, type)
|
||||||
|
|
||||||
|
tr.addStoredMark(type.create({
|
||||||
|
...oldAttributes,
|
||||||
|
...attributes,
|
||||||
|
}))
|
||||||
} else {
|
} else {
|
||||||
ranges.forEach(range => {
|
ranges.forEach(range => {
|
||||||
tr.addMark(range.$from.pos, range.$to.pos, type.create(newAttributes))
|
const from = range.$from.pos
|
||||||
|
const to = range.$to.pos
|
||||||
|
|
||||||
|
state.doc.nodesBetween(from, to, (node, pos) => {
|
||||||
|
const trimmedFrom = Math.max(pos, from)
|
||||||
|
const trimmedTo = Math.min(pos + node.nodeSize, to)
|
||||||
|
const someHasMark = node.marks.find(mark => mark.type === type)
|
||||||
|
|
||||||
|
// if there is already a mark of this type
|
||||||
|
// we know that we have to merge its attributes
|
||||||
|
// otherwise we add a fresh new mark
|
||||||
|
if (someHasMark) {
|
||||||
|
node.marks.forEach(mark => {
|
||||||
|
if (type === mark.type) {
|
||||||
|
tr.addMark(trimmedFrom, trimmedTo, type.create({
|
||||||
|
...mark.attrs,
|
||||||
|
...attributes,
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
tr.addMark(trimmedFrom, trimmedTo, type.create(attributes))
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,10 @@ export const updateAttributes: RawCommands['updateAttributes'] = (typeOrName, at
|
|||||||
|
|
||||||
if (dispatch) {
|
if (dispatch) {
|
||||||
tr.selection.ranges.forEach(range => {
|
tr.selection.ranges.forEach(range => {
|
||||||
state.doc.nodesBetween(range.$from.pos, range.$to.pos, (node, pos) => {
|
const from = range.$from.pos
|
||||||
|
const to = range.$to.pos
|
||||||
|
|
||||||
|
state.doc.nodesBetween(from, to, (node, pos) => {
|
||||||
if (nodeType && nodeType === node.type) {
|
if (nodeType && nodeType === node.type) {
|
||||||
tr.setNodeMarkup(pos, undefined, {
|
tr.setNodeMarkup(pos, undefined, {
|
||||||
...node.attrs,
|
...node.attrs,
|
||||||
@@ -51,7 +54,10 @@ export const updateAttributes: RawCommands['updateAttributes'] = (typeOrName, at
|
|||||||
if (markType && node.marks.length) {
|
if (markType && node.marks.length) {
|
||||||
node.marks.forEach(mark => {
|
node.marks.forEach(mark => {
|
||||||
if (markType === mark.type) {
|
if (markType === mark.type) {
|
||||||
tr.addMark(pos, pos + node.nodeSize, markType.create({
|
const trimmedFrom = Math.max(pos, from)
|
||||||
|
const trimmedTo = Math.min(pos + node.nodeSize, to)
|
||||||
|
|
||||||
|
tr.addMark(trimmedFrom, trimmedTo, markType.create({
|
||||||
...mark.attrs,
|
...mark.attrs,
|
||||||
...attributes,
|
...attributes,
|
||||||
}))
|
}))
|
||||||
|
|||||||
@@ -3,6 +3,14 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
# [2.0.0-beta.11](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-collaboration-cursor@2.0.0-beta.10...@tiptap/extension-collaboration-cursor@2.0.0-beta.11) (2021-04-23)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @tiptap/extension-collaboration-cursor
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [2.0.0-beta.10](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-collaboration-cursor@2.0.0-beta.9...@tiptap/extension-collaboration-cursor@2.0.0-beta.10) (2021-04-22)
|
# [2.0.0-beta.10](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-collaboration-cursor@2.0.0-beta.9...@tiptap/extension-collaboration-cursor@2.0.0-beta.10) (2021-04-22)
|
||||||
|
|
||||||
**Note:** Version bump only for package @tiptap/extension-collaboration-cursor
|
**Note:** Version bump only for package @tiptap/extension-collaboration-cursor
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@tiptap/extension-collaboration-cursor",
|
"name": "@tiptap/extension-collaboration-cursor",
|
||||||
"description": "collaboration cursor extension for tiptap",
|
"description": "collaboration cursor extension for tiptap",
|
||||||
"version": "2.0.0-beta.10",
|
"version": "2.0.0-beta.11",
|
||||||
"homepage": "https://tiptap.dev",
|
"homepage": "https://tiptap.dev",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"tiptap",
|
"tiptap",
|
||||||
|
|||||||
@@ -3,6 +3,14 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
# [2.0.0-beta.9](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-collaboration@2.0.0-beta.8...@tiptap/extension-collaboration@2.0.0-beta.9) (2021-04-23)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @tiptap/extension-collaboration
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [2.0.0-beta.8](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-collaboration@2.0.0-beta.7...@tiptap/extension-collaboration@2.0.0-beta.8) (2021-04-22)
|
# [2.0.0-beta.8](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-collaboration@2.0.0-beta.7...@tiptap/extension-collaboration@2.0.0-beta.8) (2021-04-22)
|
||||||
|
|
||||||
**Note:** Version bump only for package @tiptap/extension-collaboration
|
**Note:** Version bump only for package @tiptap/extension-collaboration
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@tiptap/extension-collaboration",
|
"name": "@tiptap/extension-collaboration",
|
||||||
"description": "collaboration extension for tiptap",
|
"description": "collaboration extension for tiptap",
|
||||||
"version": "2.0.0-beta.8",
|
"version": "2.0.0-beta.9",
|
||||||
"homepage": "https://tiptap.dev",
|
"homepage": "https://tiptap.dev",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"tiptap",
|
"tiptap",
|
||||||
|
|||||||
@@ -3,6 +3,14 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
# [2.0.0-beta.38](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-mention@2.0.0-beta.37...@tiptap/extension-mention@2.0.0-beta.38) (2021-04-23)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @tiptap/extension-mention
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [2.0.0-beta.37](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-mention@2.0.0-beta.36...@tiptap/extension-mention@2.0.0-beta.37) (2021-04-22)
|
# [2.0.0-beta.37](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-mention@2.0.0-beta.36...@tiptap/extension-mention@2.0.0-beta.37) (2021-04-22)
|
||||||
|
|
||||||
**Note:** Version bump only for package @tiptap/extension-mention
|
**Note:** Version bump only for package @tiptap/extension-mention
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@tiptap/extension-mention",
|
"name": "@tiptap/extension-mention",
|
||||||
"description": "mention extension for tiptap",
|
"description": "mention extension for tiptap",
|
||||||
"version": "2.0.0-beta.37",
|
"version": "2.0.0-beta.38",
|
||||||
"homepage": "https://tiptap.dev",
|
"homepage": "https://tiptap.dev",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"tiptap",
|
"tiptap",
|
||||||
@@ -25,6 +25,6 @@
|
|||||||
"@tiptap/core": "^2.0.0-beta.1"
|
"@tiptap/core": "^2.0.0-beta.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tiptap/suggestion": "^2.0.0-beta.37"
|
"@tiptap/suggestion": "^2.0.0-beta.38"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,14 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
# [2.0.0-beta.7](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-task-item@2.0.0-beta.6...@tiptap/extension-task-item@2.0.0-beta.7) (2021-04-23)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @tiptap/extension-task-item
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [2.0.0-beta.6](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-task-item@2.0.0-beta.5...@tiptap/extension-task-item@2.0.0-beta.6) (2021-04-22)
|
# [2.0.0-beta.6](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-task-item@2.0.0-beta.5...@tiptap/extension-task-item@2.0.0-beta.6) (2021-04-22)
|
||||||
|
|
||||||
**Note:** Version bump only for package @tiptap/extension-task-item
|
**Note:** Version bump only for package @tiptap/extension-task-item
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@tiptap/extension-task-item",
|
"name": "@tiptap/extension-task-item",
|
||||||
"description": "task item extension for tiptap",
|
"description": "task item extension for tiptap",
|
||||||
"version": "2.0.0-beta.6",
|
"version": "2.0.0-beta.7",
|
||||||
"homepage": "https://tiptap.dev",
|
"homepage": "https://tiptap.dev",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"tiptap",
|
"tiptap",
|
||||||
|
|||||||
@@ -3,6 +3,14 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
# [2.0.0-beta.37](https://github.com/ueberdosis/tiptap/compare/@tiptap/html@2.0.0-beta.36...@tiptap/html@2.0.0-beta.37) (2021-04-23)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @tiptap/html
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [2.0.0-beta.36](https://github.com/ueberdosis/tiptap/compare/@tiptap/html@2.0.0-beta.35...@tiptap/html@2.0.0-beta.36) (2021-04-22)
|
# [2.0.0-beta.36](https://github.com/ueberdosis/tiptap/compare/@tiptap/html@2.0.0-beta.35...@tiptap/html@2.0.0-beta.36) (2021-04-22)
|
||||||
|
|
||||||
**Note:** Version bump only for package @tiptap/html
|
**Note:** Version bump only for package @tiptap/html
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@tiptap/html",
|
"name": "@tiptap/html",
|
||||||
"description": "utility package to render tiptap JSON as HTML",
|
"description": "utility package to render tiptap JSON as HTML",
|
||||||
"version": "2.0.0-beta.36",
|
"version": "2.0.0-beta.37",
|
||||||
"homepage": "https://tiptap.dev",
|
"homepage": "https://tiptap.dev",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"tiptap",
|
"tiptap",
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tiptap/core": "^2.0.0-beta.36",
|
"@tiptap/core": "^2.0.0-beta.37",
|
||||||
"hostic-dom": "^0.8.6",
|
"hostic-dom": "^0.8.6",
|
||||||
"prosemirror-model": "^1.14.0"
|
"prosemirror-model": "^1.14.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,14 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
# [2.0.0-beta.33](https://github.com/ueberdosis/tiptap/compare/@tiptap/starter-kit@2.0.0-beta.32...@tiptap/starter-kit@2.0.0-beta.33) (2021-04-23)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @tiptap/starter-kit
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [2.0.0-beta.32](https://github.com/ueberdosis/tiptap/compare/@tiptap/starter-kit@2.0.0-beta.31...@tiptap/starter-kit@2.0.0-beta.32) (2021-04-22)
|
# [2.0.0-beta.32](https://github.com/ueberdosis/tiptap/compare/@tiptap/starter-kit@2.0.0-beta.31...@tiptap/starter-kit@2.0.0-beta.32) (2021-04-22)
|
||||||
|
|
||||||
**Note:** Version bump only for package @tiptap/starter-kit
|
**Note:** Version bump only for package @tiptap/starter-kit
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@tiptap/starter-kit",
|
"name": "@tiptap/starter-kit",
|
||||||
"description": "starter kit for tiptap",
|
"description": "starter kit for tiptap",
|
||||||
"version": "2.0.0-beta.32",
|
"version": "2.0.0-beta.33",
|
||||||
"homepage": "https://tiptap.dev",
|
"homepage": "https://tiptap.dev",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"tiptap",
|
"tiptap",
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tiptap/core": "^2.0.0-beta.36",
|
"@tiptap/core": "^2.0.0-beta.37",
|
||||||
"@tiptap/extension-blockquote": "^2.0.0-beta.5",
|
"@tiptap/extension-blockquote": "^2.0.0-beta.5",
|
||||||
"@tiptap/extension-bold": "^2.0.0-beta.5",
|
"@tiptap/extension-bold": "^2.0.0-beta.5",
|
||||||
"@tiptap/extension-bullet-list": "^2.0.0-beta.5",
|
"@tiptap/extension-bullet-list": "^2.0.0-beta.5",
|
||||||
|
|||||||
@@ -3,6 +3,14 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
# [2.0.0-beta.38](https://github.com/ueberdosis/tiptap/compare/@tiptap/suggestion@2.0.0-beta.37...@tiptap/suggestion@2.0.0-beta.38) (2021-04-23)
|
||||||
|
|
||||||
|
**Note:** Version bump only for package @tiptap/suggestion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [2.0.0-beta.37](https://github.com/ueberdosis/tiptap/compare/@tiptap/suggestion@2.0.0-beta.36...@tiptap/suggestion@2.0.0-beta.37) (2021-04-22)
|
# [2.0.0-beta.37](https://github.com/ueberdosis/tiptap/compare/@tiptap/suggestion@2.0.0-beta.36...@tiptap/suggestion@2.0.0-beta.37) (2021-04-22)
|
||||||
|
|
||||||
**Note:** Version bump only for package @tiptap/suggestion
|
**Note:** Version bump only for package @tiptap/suggestion
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@tiptap/suggestion",
|
"name": "@tiptap/suggestion",
|
||||||
"description": "suggestion plugin for tiptap",
|
"description": "suggestion plugin for tiptap",
|
||||||
"version": "2.0.0-beta.37",
|
"version": "2.0.0-beta.38",
|
||||||
"homepage": "https://tiptap.dev",
|
"homepage": "https://tiptap.dev",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"tiptap",
|
"tiptap",
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
"dist"
|
"dist"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tiptap/core": "^2.0.0-beta.36",
|
"@tiptap/core": "^2.0.0-beta.37",
|
||||||
"prosemirror-model": "^1.14.0",
|
"prosemirror-model": "^1.14.0",
|
||||||
"prosemirror-state": "^1.3.4",
|
"prosemirror-state": "^1.3.4",
|
||||||
"prosemirror-view": "^1.18.2"
|
"prosemirror-view": "^1.18.2"
|
||||||
|
|||||||
Reference in New Issue
Block a user