mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-25 12:39:03 +08:00
Merge branch 'main' of github.com:ueberdosis/tiptap into main
This commit is contained in:
commit
9110258a4c
@ -40,9 +40,20 @@ const getRandomElement = list => {
|
||||
|
||||
const getRandomRoom = () => {
|
||||
return getRandomElement([
|
||||
'room.one',
|
||||
'room.two',
|
||||
'room.three',
|
||||
// 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',
|
||||
])
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,17 @@
|
||||
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.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/core
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/core",
|
||||
"description": "headless rich text editor",
|
||||
"version": "2.0.0-beta.36",
|
||||
"version": "2.0.0-beta.37",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
@ -18,18 +18,41 @@ export const setMark: RawCommands['setMark'] = (typeOrName, attributes = {}) =>
|
||||
const { selection } = tr
|
||||
const { empty, ranges } = selection
|
||||
const type = getMarkType(typeOrName, state.schema)
|
||||
const oldAttributes = getMarkAttributes(state, type)
|
||||
const newAttributes = {
|
||||
...oldAttributes,
|
||||
...attributes,
|
||||
}
|
||||
|
||||
if (dispatch) {
|
||||
if (empty) {
|
||||
tr.addStoredMark(type.create(newAttributes))
|
||||
const oldAttributes = getMarkAttributes(state, type)
|
||||
|
||||
tr.addStoredMark(type.create({
|
||||
...oldAttributes,
|
||||
...attributes,
|
||||
}))
|
||||
} else {
|
||||
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) {
|
||||
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) {
|
||||
tr.setNodeMarkup(pos, undefined, {
|
||||
...node.attrs,
|
||||
@ -51,7 +54,10 @@ export const updateAttributes: RawCommands['updateAttributes'] = (typeOrName, at
|
||||
if (markType && node.marks.length) {
|
||||
node.marks.forEach(mark => {
|
||||
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,
|
||||
...attributes,
|
||||
}))
|
||||
|
@ -3,6 +3,14 @@
|
||||
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-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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-collaboration-cursor
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-collaboration-cursor",
|
||||
"description": "collaboration cursor extension for tiptap",
|
||||
"version": "2.0.0-beta.10",
|
||||
"version": "2.0.0-beta.11",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
@ -3,6 +3,14 @@
|
||||
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.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-collaboration
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-collaboration",
|
||||
"description": "collaboration extension for tiptap",
|
||||
"version": "2.0.0-beta.8",
|
||||
"version": "2.0.0-beta.9",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
@ -3,6 +3,14 @@
|
||||
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.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-mention
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-mention",
|
||||
"description": "mention extension for tiptap",
|
||||
"version": "2.0.0-beta.37",
|
||||
"version": "2.0.0-beta.38",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
@ -25,6 +25,6 @@
|
||||
"@tiptap/core": "^2.0.0-beta.1"
|
||||
},
|
||||
"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.
|
||||
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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/extension-task-item
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/extension-task-item",
|
||||
"description": "task item extension for tiptap",
|
||||
"version": "2.0.0-beta.6",
|
||||
"version": "2.0.0-beta.7",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
|
@ -3,6 +3,14 @@
|
||||
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.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/html
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/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",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
@ -22,7 +22,7 @@
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@tiptap/core": "^2.0.0-beta.36",
|
||||
"@tiptap/core": "^2.0.0-beta.37",
|
||||
"hostic-dom": "^0.8.6",
|
||||
"prosemirror-model": "^1.14.0"
|
||||
}
|
||||
|
@ -3,6 +3,14 @@
|
||||
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.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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/starter-kit
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/starter-kit",
|
||||
"description": "starter kit for tiptap",
|
||||
"version": "2.0.0-beta.32",
|
||||
"version": "2.0.0-beta.33",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
@ -22,7 +22,7 @@
|
||||
"dist"
|
||||
],
|
||||
"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-bold": "^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.
|
||||
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)
|
||||
|
||||
**Note:** Version bump only for package @tiptap/suggestion
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@tiptap/suggestion",
|
||||
"description": "suggestion plugin for tiptap",
|
||||
"version": "2.0.0-beta.37",
|
||||
"version": "2.0.0-beta.38",
|
||||
"homepage": "https://tiptap.dev",
|
||||
"keywords": [
|
||||
"tiptap",
|
||||
@ -22,7 +22,7 @@
|
||||
"dist"
|
||||
],
|
||||
"dependencies": {
|
||||
"@tiptap/core": "^2.0.0-beta.36",
|
||||
"@tiptap/core": "^2.0.0-beta.37",
|
||||
"prosemirror-model": "^1.14.0",
|
||||
"prosemirror-state": "^1.3.4",
|
||||
"prosemirror-view": "^1.18.2"
|
||||
|
Loading…
Reference in New Issue
Block a user