@tiptap/extension-horizontal-rule
Advanced tools
Comparing version 2.0.0-beta.30 to 2.0.0-beta.31
@@ -33,11 +33,10 @@ 'use strict'; | ||
if (dispatch) { | ||
const { parent, pos } = tr.selection.$from; | ||
const posAfter = pos + 1; | ||
const nodeAfter = tr.doc.nodeAt(posAfter); | ||
if (nodeAfter) { | ||
tr.setSelection(prosemirrorState.TextSelection.create(tr.doc, posAfter)); | ||
const { $to } = tr.selection; | ||
const posAfter = $to.end(); | ||
if ($to.nodeAfter) { | ||
tr.setSelection(prosemirrorState.TextSelection.create(tr.doc, $to.pos)); | ||
} | ||
else { | ||
// add node after horizontal rule if it’s the end of the document | ||
const node = (_a = parent.type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.create(); | ||
const node = (_a = $to.parent.type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.create(); | ||
if (node) { | ||
@@ -44,0 +43,0 @@ tr.insert(posAfter, node); |
@@ -29,11 +29,10 @@ import { Node, mergeAttributes, nodeInputRule } from '@tiptap/core'; | ||
if (dispatch) { | ||
const { parent, pos } = tr.selection.$from; | ||
const posAfter = pos + 1; | ||
const nodeAfter = tr.doc.nodeAt(posAfter); | ||
if (nodeAfter) { | ||
tr.setSelection(TextSelection.create(tr.doc, posAfter)); | ||
const { $to } = tr.selection; | ||
const posAfter = $to.end(); | ||
if ($to.nodeAfter) { | ||
tr.setSelection(TextSelection.create(tr.doc, $to.pos)); | ||
} | ||
else { | ||
// add node after horizontal rule if it’s the end of the document | ||
const node = (_a = parent.type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.create(); | ||
const node = (_a = $to.parent.type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.create(); | ||
if (node) { | ||
@@ -40,0 +39,0 @@ tr.insert(posAfter, node); |
@@ -32,11 +32,10 @@ (function (global, factory) { | ||
if (dispatch) { | ||
const { parent, pos } = tr.selection.$from; | ||
const posAfter = pos + 1; | ||
const nodeAfter = tr.doc.nodeAt(posAfter); | ||
if (nodeAfter) { | ||
tr.setSelection(prosemirrorState.TextSelection.create(tr.doc, posAfter)); | ||
const { $to } = tr.selection; | ||
const posAfter = $to.end(); | ||
if ($to.nodeAfter) { | ||
tr.setSelection(prosemirrorState.TextSelection.create(tr.doc, $to.pos)); | ||
} | ||
else { | ||
// add node after horizontal rule if it’s the end of the document | ||
const node = (_a = parent.type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.create(); | ||
const node = (_a = $to.parent.type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.create(); | ||
if (node) { | ||
@@ -43,0 +42,0 @@ tr.insert(posAfter, node); |
{ | ||
"name": "@tiptap/extension-horizontal-rule", | ||
"description": "horizontal rule extension for tiptap", | ||
"version": "2.0.0-beta.30", | ||
"version": "2.0.0-beta.31", | ||
"homepage": "https://tiptap.dev", | ||
@@ -34,3 +34,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "621cfa2f7e98a48525fa22f9d97a92fc08368966" | ||
"gitHead": "28b8f610fb8330067c94ea7c7de6726ccc6bb9d5" | ||
} |
@@ -52,11 +52,10 @@ import { | ||
if (dispatch) { | ||
const { parent, pos } = tr.selection.$from | ||
const posAfter = pos + 1 | ||
const nodeAfter = tr.doc.nodeAt(posAfter) | ||
const { $to } = tr.selection | ||
const posAfter = $to.end() | ||
if (nodeAfter) { | ||
tr.setSelection(TextSelection.create(tr.doc, posAfter)) | ||
if ($to.nodeAfter) { | ||
tr.setSelection(TextSelection.create(tr.doc, $to.pos)) | ||
} else { | ||
// add node after horizontal rule if it’s the end of the document | ||
const node = parent.type.contentMatch.defaultType?.create() | ||
const node = $to.parent.type.contentMatch.defaultType?.create() | ||
@@ -63,0 +62,0 @@ if (node) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
23279
279