This commit is contained in:
Hans Pagel 2021-11-11 12:47:26 +01:00
commit c64f845cec
16 changed files with 93 additions and 20 deletions

View File

@ -3,6 +3,18 @@
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.138](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.137...@tiptap/core@2.0.0-beta.138) (2021-11-10)
### Bug Fixes
* prevent removing inline nodes when using insertContentAt, fix [#2156](https://github.com/ueberdosis/tiptap/issues/2156) ([53ffce5](https://github.com/ueberdosis/tiptap/commit/53ffce501835f727dbc39f07a8759903245a3f30))
* update getJSON return type to JSONContent ([#2153](https://github.com/ueberdosis/tiptap/issues/2153)) ([6583ede](https://github.com/ueberdosis/tiptap/commit/6583edeb1f2a015f31cea378f5440fa6a31a47f6))
# [2.0.0-beta.137](https://github.com/ueberdosis/tiptap/compare/@tiptap/core@2.0.0-beta.136...@tiptap/core@2.0.0-beta.137) (2021-11-09)

View File

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

View File

@ -1,4 +1,4 @@
import { ParseOptions } from 'prosemirror-model'
import { Fragment, Node as ProseMirrorNode, ParseOptions } from 'prosemirror-model'
import createNodeFromContent from '../helpers/createNodeFromContent'
import selectionToInsertionEnd from '../helpers/selectionToInsertionEnd'
import {
@ -25,6 +25,10 @@ declare module '@tiptap/core' {
}
}
const isFragment = (nodeOrFragment: ProseMirrorNode | Fragment): nodeOrFragment is Fragment => {
return nodeOrFragment.toString().startsWith('<')
}
export const insertContentAt: RawCommands['insertContentAt'] = (position, value, options) => ({ tr, dispatch, editor }) => {
if (dispatch) {
options = {
@ -50,8 +54,11 @@ export const insertContentAt: RawCommands['insertContentAt'] = (position, value,
: position
let isOnlyBlockContent = true
const nodes = isFragment(content)
? content
: [content]
content.forEach(node => {
nodes.forEach(node => {
isOnlyBlockContent = isOnlyBlockContent
? node.isBlock
: false
@ -63,10 +70,10 @@ export const insertContentAt: RawCommands['insertContentAt'] = (position, value,
// replace an empty paragraph by an inserted image
// instead of inserting the image below the paragraph
if (from === to && isOnlyBlockContent) {
const $from = tr.doc.resolve(from)
const isEmptyTextBlock = $from.parent.isTextblock
&& !$from.parent.type.spec.code
&& !$from.parent.textContent
const { parent } = tr.doc.resolve(from)
const isEmptyTextBlock = parent.isTextblock
&& !parent.type.spec.code
&& !parent.childCount
if (isEmptyTextBlock) {
from -= 1

View File

@ -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.44](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-floating-menu@2.0.0-beta.43...@tiptap/extension-floating-menu@2.0.0-beta.44) (2021-11-10)
### Bug Fixes
* remove composition check for floating menu ([#2137](https://github.com/ueberdosis/tiptap/issues/2137)) ([d0d0696](https://github.com/ueberdosis/tiptap/commit/d0d069626626d173f9fd038d1b231d15a17a43bb))
# [2.0.0-beta.43](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-floating-menu@2.0.0-beta.42...@tiptap/extension-floating-menu@2.0.0-beta.43) (2021-11-09)
**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.43",
"version": "2.0.0-beta.44",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",

View File

@ -119,12 +119,12 @@ export class FloatingMenuView {
}
update(view: EditorView, oldState?: EditorState) {
const { state, composing } = view
const { state } = view
const { doc, selection } = state
const { from, to } = selection
const isSame = oldState && oldState.doc.eq(doc) && oldState.selection.eq(selection)
if (composing || isSame) {
if (isSame) {
return
}

View File

@ -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.137](https://github.com/ueberdosis/tiptap/compare/@tiptap/html@2.0.0-beta.136...@tiptap/html@2.0.0-beta.137) (2021-11-10)
### Bug Fixes
* update zeed dom ([#2155](https://github.com/ueberdosis/tiptap/issues/2155)) ([75e55e5](https://github.com/ueberdosis/tiptap/commit/75e55e548d31078689c1b511edabd0299b755e62))
# [2.0.0-beta.136](https://github.com/ueberdosis/tiptap/compare/@tiptap/html@2.0.0-beta.135...@tiptap/html@2.0.0-beta.136) (2021-11-09)
**Note:** Version bump only for package @tiptap/html

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/html",
"description": "utility package to render tiptap JSON as HTML",
"version": "2.0.0-beta.136",
"version": "2.0.0-beta.137",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",
@ -21,7 +21,7 @@
"dist"
],
"dependencies": {
"@tiptap/core": "^2.0.0-beta.137",
"@tiptap/core": "^2.0.0-beta.138",
"prosemirror-model": "^1.15.0",
"zeed-dom": "^0.9.16"
},

View File

@ -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.93](https://github.com/ueberdosis/tiptap/compare/@tiptap/react@2.0.0-beta.92...@tiptap/react@2.0.0-beta.93) (2021-11-10)
**Note:** Version bump only for package @tiptap/react
# [2.0.0-beta.92](https://github.com/ueberdosis/tiptap/compare/@tiptap/react@2.0.0-beta.91...@tiptap/react@2.0.0-beta.92) (2021-11-09)
**Note:** Version bump only for package @tiptap/react

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/react",
"description": "React components for tiptap",
"version": "2.0.0-beta.92",
"version": "2.0.0-beta.93",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",
@ -33,7 +33,7 @@
},
"dependencies": {
"@tiptap/extension-bubble-menu": "^2.0.0-beta.49",
"@tiptap/extension-floating-menu": "^2.0.0-beta.43",
"@tiptap/extension-floating-menu": "^2.0.0-beta.44",
"prosemirror-view": "^1.22.0"
},
"repository": {

View File

@ -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.140](https://github.com/ueberdosis/tiptap/compare/@tiptap/starter-kit@2.0.0-beta.139...@tiptap/starter-kit@2.0.0-beta.140) (2021-11-10)
**Note:** Version bump only for package @tiptap/starter-kit
# [2.0.0-beta.139](https://github.com/ueberdosis/tiptap/compare/@tiptap/starter-kit@2.0.0-beta.138...@tiptap/starter-kit@2.0.0-beta.139) (2021-11-09)
**Note:** Version bump only for package @tiptap/starter-kit

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/starter-kit",
"description": "starter kit for tiptap",
"version": "2.0.0-beta.139",
"version": "2.0.0-beta.140",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",
@ -21,7 +21,7 @@
"dist"
],
"dependencies": {
"@tiptap/core": "^2.0.0-beta.137",
"@tiptap/core": "^2.0.0-beta.138",
"@tiptap/extension-blockquote": "^2.0.0-beta.24",
"@tiptap/extension-bold": "^2.0.0-beta.24",
"@tiptap/extension-bullet-list": "^2.0.0-beta.23",

View File

@ -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.68](https://github.com/ueberdosis/tiptap/compare/@tiptap/vue-2@2.0.0-beta.67...@tiptap/vue-2@2.0.0-beta.68) (2021-11-10)
**Note:** Version bump only for package @tiptap/vue-2
# [2.0.0-beta.67](https://github.com/ueberdosis/tiptap/compare/@tiptap/vue-2@2.0.0-beta.66...@tiptap/vue-2@2.0.0-beta.67) (2021-11-09)
**Note:** Version bump only for package @tiptap/vue-2

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/vue-2",
"description": "Vue components for tiptap",
"version": "2.0.0-beta.67",
"version": "2.0.0-beta.68",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",
@ -29,7 +29,7 @@
},
"dependencies": {
"@tiptap/extension-bubble-menu": "^2.0.0-beta.49",
"@tiptap/extension-floating-menu": "^2.0.0-beta.43",
"@tiptap/extension-floating-menu": "^2.0.0-beta.44",
"prosemirror-view": "^1.22.0"
},
"repository": {

View File

@ -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.80](https://github.com/ueberdosis/tiptap/compare/@tiptap/vue-3@2.0.0-beta.79...@tiptap/vue-3@2.0.0-beta.80) (2021-11-10)
**Note:** Version bump only for package @tiptap/vue-3
# [2.0.0-beta.79](https://github.com/ueberdosis/tiptap/compare/@tiptap/vue-3@2.0.0-beta.78...@tiptap/vue-3@2.0.0-beta.79) (2021-11-09)
**Note:** Version bump only for package @tiptap/vue-3

View File

@ -1,7 +1,7 @@
{
"name": "@tiptap/vue-3",
"description": "Vue components for tiptap",
"version": "2.0.0-beta.79",
"version": "2.0.0-beta.80",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",
@ -29,7 +29,7 @@
},
"dependencies": {
"@tiptap/extension-bubble-menu": "^2.0.0-beta.49",
"@tiptap/extension-floating-menu": "^2.0.0-beta.43",
"@tiptap/extension-floating-menu": "^2.0.0-beta.44",
"prosemirror-state": "^1.3.4",
"prosemirror-view": "^1.22.0"
},