@tiptap/extension-horizontal-rule
Advanced tools
Comparing version 2.0.0-beta.9 to 2.0.0-beta.10
@@ -6,2 +6,10 @@ # Change Log | ||
# [2.0.0-beta.10](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-horizontal-rule@2.0.0-beta.9...@tiptap/extension-horizontal-rule@2.0.0-beta.10) (2021-05-05) | ||
**Note:** Version bump only for package @tiptap/extension-horizontal-rule | ||
# [2.0.0-beta.9](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-horizontal-rule@2.0.0-beta.8...@tiptap/extension-horizontal-rule@2.0.0-beta.9) (2021-05-05) | ||
@@ -8,0 +16,0 @@ |
@@ -24,20 +24,24 @@ 'use strict'; | ||
return { | ||
setHorizontalRule: () => ({ tr, dispatch }) => { | ||
var _a; | ||
if (dispatch) { | ||
tr.replaceSelectionWith(this.type.create()); | ||
const { parent, pos } = tr.selection.$from; | ||
const posAfter = pos + 1; | ||
const nodeAfter = tr.doc.nodeAt(posAfter); | ||
// end of document | ||
if (!nodeAfter) { | ||
const node = (_a = parent.type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.create(); | ||
if (node) { | ||
tr.insert(posAfter, node); | ||
tr.setSelection(prosemirrorState.TextSelection.create(tr.doc, posAfter)); | ||
setHorizontalRule: () => ({ chain }) => { | ||
return chain() | ||
.insertContent({ type: this.name }) | ||
.command(({ tr, dispatch }) => { | ||
var _a; | ||
if (dispatch) { | ||
const { parent, pos } = tr.selection.$from; | ||
const posAfter = pos + 1; | ||
const nodeAfter = tr.doc.nodeAt(posAfter); | ||
// end of document | ||
if (!nodeAfter) { | ||
const node = (_a = parent.type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.create(); | ||
if (node) { | ||
tr.insert(posAfter, node); | ||
tr.setSelection(prosemirrorState.TextSelection.create(tr.doc, posAfter)); | ||
} | ||
} | ||
tr.scrollIntoView(); | ||
} | ||
tr.scrollIntoView(); | ||
} | ||
return true; | ||
return true; | ||
}) | ||
.run(); | ||
}, | ||
@@ -44,0 +48,0 @@ }; |
@@ -20,20 +20,24 @@ import { Node, mergeAttributes, nodeInputRule } from '@tiptap/core'; | ||
return { | ||
setHorizontalRule: () => ({ tr, dispatch }) => { | ||
var _a; | ||
if (dispatch) { | ||
tr.replaceSelectionWith(this.type.create()); | ||
const { parent, pos } = tr.selection.$from; | ||
const posAfter = pos + 1; | ||
const nodeAfter = tr.doc.nodeAt(posAfter); | ||
// end of document | ||
if (!nodeAfter) { | ||
const node = (_a = parent.type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.create(); | ||
if (node) { | ||
tr.insert(posAfter, node); | ||
tr.setSelection(TextSelection.create(tr.doc, posAfter)); | ||
setHorizontalRule: () => ({ chain }) => { | ||
return chain() | ||
.insertContent({ type: this.name }) | ||
.command(({ tr, dispatch }) => { | ||
var _a; | ||
if (dispatch) { | ||
const { parent, pos } = tr.selection.$from; | ||
const posAfter = pos + 1; | ||
const nodeAfter = tr.doc.nodeAt(posAfter); | ||
// end of document | ||
if (!nodeAfter) { | ||
const node = (_a = parent.type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.create(); | ||
if (node) { | ||
tr.insert(posAfter, node); | ||
tr.setSelection(TextSelection.create(tr.doc, posAfter)); | ||
} | ||
} | ||
tr.scrollIntoView(); | ||
} | ||
tr.scrollIntoView(); | ||
} | ||
return true; | ||
return true; | ||
}) | ||
.run(); | ||
}, | ||
@@ -40,0 +44,0 @@ }; |
@@ -23,20 +23,24 @@ (function (global, factory) { | ||
return { | ||
setHorizontalRule: () => ({ tr, dispatch }) => { | ||
var _a; | ||
if (dispatch) { | ||
tr.replaceSelectionWith(this.type.create()); | ||
const { parent, pos } = tr.selection.$from; | ||
const posAfter = pos + 1; | ||
const nodeAfter = tr.doc.nodeAt(posAfter); | ||
// end of document | ||
if (!nodeAfter) { | ||
const node = (_a = parent.type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.create(); | ||
if (node) { | ||
tr.insert(posAfter, node); | ||
tr.setSelection(prosemirrorState.TextSelection.create(tr.doc, posAfter)); | ||
setHorizontalRule: () => ({ chain }) => { | ||
return chain() | ||
.insertContent({ type: this.name }) | ||
.command(({ tr, dispatch }) => { | ||
var _a; | ||
if (dispatch) { | ||
const { parent, pos } = tr.selection.$from; | ||
const posAfter = pos + 1; | ||
const nodeAfter = tr.doc.nodeAt(posAfter); | ||
// end of document | ||
if (!nodeAfter) { | ||
const node = (_a = parent.type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.create(); | ||
if (node) { | ||
tr.insert(posAfter, node); | ||
tr.setSelection(prosemirrorState.TextSelection.create(tr.doc, posAfter)); | ||
} | ||
} | ||
tr.scrollIntoView(); | ||
} | ||
tr.scrollIntoView(); | ||
} | ||
return true; | ||
return true; | ||
}) | ||
.run(); | ||
}, | ||
@@ -43,0 +47,0 @@ }; |
{ | ||
"name": "@tiptap/extension-horizontal-rule", | ||
"description": "horizontal rule extension for tiptap", | ||
"version": "2.0.0-beta.9", | ||
"version": "2.0.0-beta.10", | ||
"homepage": "https://tiptap.dev", | ||
@@ -18,3 +18,2 @@ "keywords": [ | ||
"module": "dist/tiptap-extension-horizontal-rule.esm.js", | ||
"unpkg": "dist/tiptap-extension-horizontal-rule.bundle.umd.min.js", | ||
"types": "dist/packages/extension-horizontal-rule/src/index.d.ts", | ||
@@ -31,3 +30,3 @@ "files": [ | ||
}, | ||
"gitHead": "9b32e15a8f1d0d33998f431b792e7f364de15083" | ||
"gitHead": "c64520b74dab6b127c78960c1bd0af237b1f68fb" | ||
} |
@@ -45,24 +45,27 @@ import { | ||
return { | ||
setHorizontalRule: () => ({ tr, dispatch }) => { | ||
if (dispatch) { | ||
tr.replaceSelectionWith(this.type.create()) | ||
setHorizontalRule: () => ({ chain }) => { | ||
return chain() | ||
.insertContent({ type: this.name }) | ||
.command(({ tr, dispatch }) => { | ||
if (dispatch) { | ||
const { parent, pos } = tr.selection.$from | ||
const posAfter = pos + 1 | ||
const nodeAfter = tr.doc.nodeAt(posAfter) | ||
const { parent, pos } = tr.selection.$from | ||
const posAfter = pos + 1 | ||
const nodeAfter = tr.doc.nodeAt(posAfter) | ||
// end of document | ||
if (!nodeAfter) { | ||
const node = parent.type.contentMatch.defaultType?.create() | ||
// end of document | ||
if (!nodeAfter) { | ||
const node = parent.type.contentMatch.defaultType?.create() | ||
if (node) { | ||
tr.insert(posAfter, node) | ||
tr.setSelection(TextSelection.create(tr.doc, posAfter)) | ||
} | ||
} | ||
if (node) { | ||
tr.insert(posAfter, node) | ||
tr.setSelection(TextSelection.create(tr.doc, posAfter)) | ||
tr.scrollIntoView() | ||
} | ||
} | ||
tr.scrollIntoView() | ||
} | ||
return true | ||
return true | ||
}) | ||
.run() | ||
}, | ||
@@ -69,0 +72,0 @@ } |
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
1
27321
14
250