@tiptap/core 2.0.0-beta.141 → 2.0.0-beta.145
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/packages/core/src/commands/focus.d.ts +3 -1
- package/dist/packages/core/src/helpers/defaultBlockAt.d.ts +2 -0
- package/dist/packages/core/src/index.d.ts +1 -0
- package/dist/tiptap-core.cjs.js +32 -32
- package/dist/tiptap-core.cjs.js.map +1 -1
- package/dist/tiptap-core.esm.js +32 -33
- package/dist/tiptap-core.esm.js.map +1 -1
- package/dist/tiptap-core.umd.js +32 -32
- package/dist/tiptap-core.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/Extension.ts +7 -14
- package/src/Mark.ts +7 -14
- package/src/Node.ts +7 -14
- package/src/commands/focus.ts +16 -3
- package/src/helpers/defaultBlockAt.ts +13 -0
- package/src/index.ts +1 -0
- package/src/utilities/isPlainObject.ts +4 -1
package/dist/tiptap-core.esm.js
CHANGED
|
@@ -11,8 +11,9 @@ function getType(value) {
|
|
|
11
11
|
return Object.prototype.toString.call(value).slice(8, -1);
|
|
12
12
|
}
|
|
13
13
|
function isPlainObject(value) {
|
|
14
|
-
if (getType(value) !== 'Object')
|
|
14
|
+
if (getType(value) !== 'Object') {
|
|
15
15
|
return false;
|
|
16
|
+
}
|
|
16
17
|
return value.constructor === Object && Object.getPrototypeOf(value) === Object.prototype;
|
|
17
18
|
}
|
|
18
19
|
|
|
@@ -127,15 +128,9 @@ class Extension {
|
|
|
127
128
|
if (extendedConfig.defaultOptions) {
|
|
128
129
|
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
129
130
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
: extension.parent.options;
|
|
134
|
-
if (extendedConfig.addOptions) {
|
|
135
|
-
extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {
|
|
136
|
-
name: extension.name,
|
|
137
|
-
}));
|
|
138
|
-
}
|
|
131
|
+
extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {
|
|
132
|
+
name: extension.name,
|
|
133
|
+
}));
|
|
139
134
|
extension.storage = callOrReturn(getExtensionField(extension, 'addStorage', {
|
|
140
135
|
name: extension.name,
|
|
141
136
|
options: extension.options,
|
|
@@ -527,7 +522,11 @@ function resolveSelection(state, position = null) {
|
|
|
527
522
|
to: position,
|
|
528
523
|
};
|
|
529
524
|
}
|
|
530
|
-
const focus = (position = null) => ({ editor, view, tr, dispatch, }) => {
|
|
525
|
+
const focus = (position = null, options) => ({ editor, view, tr, dispatch, }) => {
|
|
526
|
+
options = {
|
|
527
|
+
scrollIntoView: true,
|
|
528
|
+
...options,
|
|
529
|
+
};
|
|
531
530
|
const delayedFocus = () => {
|
|
532
531
|
// focus within `requestAnimationFrame` breaks focus on iOS
|
|
533
532
|
// so we have to call this
|
|
@@ -539,7 +538,9 @@ const focus = (position = null) => ({ editor, view, tr, dispatch, }) => {
|
|
|
539
538
|
requestAnimationFrame(() => {
|
|
540
539
|
if (!editor.isDestroyed) {
|
|
541
540
|
view.focus();
|
|
542
|
-
|
|
541
|
+
if (options === null || options === void 0 ? void 0 : options.scrollIntoView) {
|
|
542
|
+
editor.commands.scrollIntoView();
|
|
543
|
+
}
|
|
543
544
|
}
|
|
544
545
|
});
|
|
545
546
|
};
|
|
@@ -1179,7 +1180,7 @@ function getSplittedAttributes(extensionAttributes, typeName, attributes) {
|
|
|
1179
1180
|
}));
|
|
1180
1181
|
}
|
|
1181
1182
|
|
|
1182
|
-
function defaultBlockAt(match) {
|
|
1183
|
+
function defaultBlockAt$1(match) {
|
|
1183
1184
|
for (let i = 0; i < match.edgeCount; i += 1) {
|
|
1184
1185
|
const { type } = match.edge(i);
|
|
1185
1186
|
if (type.isTextblock && !type.hasRequiredAttrs()) {
|
|
@@ -1223,7 +1224,7 @@ const splitBlock = ({ keepMarks = true } = {}) => ({ tr, state, dispatch, editor
|
|
|
1223
1224
|
}
|
|
1224
1225
|
const deflt = $from.depth === 0
|
|
1225
1226
|
? undefined
|
|
1226
|
-
: defaultBlockAt($from.node(-1).contentMatchAt($from.indexAfter(-1)));
|
|
1227
|
+
: defaultBlockAt$1($from.node(-1).contentMatchAt($from.indexAfter(-1)));
|
|
1227
1228
|
let types = atEnd && deflt
|
|
1228
1229
|
? [{
|
|
1229
1230
|
type: deflt,
|
|
@@ -3417,15 +3418,9 @@ class Node {
|
|
|
3417
3418
|
if (extendedConfig.defaultOptions) {
|
|
3418
3419
|
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
3419
3420
|
}
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
: extension.parent.options;
|
|
3424
|
-
if (extendedConfig.addOptions) {
|
|
3425
|
-
extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {
|
|
3426
|
-
name: extension.name,
|
|
3427
|
-
}));
|
|
3428
|
-
}
|
|
3421
|
+
extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {
|
|
3422
|
+
name: extension.name,
|
|
3423
|
+
}));
|
|
3429
3424
|
extension.storage = callOrReturn(getExtensionField(extension, 'addStorage', {
|
|
3430
3425
|
name: extension.name,
|
|
3431
3426
|
options: extension.options,
|
|
@@ -3488,15 +3483,9 @@ class Mark {
|
|
|
3488
3483
|
if (extendedConfig.defaultOptions) {
|
|
3489
3484
|
console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${extension.name}".`);
|
|
3490
3485
|
}
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
: extension.parent.options;
|
|
3495
|
-
if (extendedConfig.addOptions) {
|
|
3496
|
-
extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {
|
|
3497
|
-
name: extension.name,
|
|
3498
|
-
}));
|
|
3499
|
-
}
|
|
3486
|
+
extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {
|
|
3487
|
+
name: extension.name,
|
|
3488
|
+
}));
|
|
3500
3489
|
extension.storage = callOrReturn(getExtensionField(extension, 'addStorage', {
|
|
3501
3490
|
name: extension.name,
|
|
3502
3491
|
options: extension.options,
|
|
@@ -3960,6 +3949,16 @@ function textPasteRule(config) {
|
|
|
3960
3949
|
});
|
|
3961
3950
|
}
|
|
3962
3951
|
|
|
3952
|
+
function defaultBlockAt(match) {
|
|
3953
|
+
for (let i = 0; i < match.edgeCount; i += 1) {
|
|
3954
|
+
const { type } = match.edge(i);
|
|
3955
|
+
if (type.isTextblock && !type.hasRequiredAttrs()) {
|
|
3956
|
+
return type;
|
|
3957
|
+
}
|
|
3958
|
+
}
|
|
3959
|
+
return null;
|
|
3960
|
+
}
|
|
3961
|
+
|
|
3963
3962
|
function findChildren(node, predicate) {
|
|
3964
3963
|
const nodesWithPos = [];
|
|
3965
3964
|
node.descendants((child, pos) => {
|
|
@@ -4099,5 +4098,5 @@ function posToDOMRect(view, from, to) {
|
|
|
4099
4098
|
};
|
|
4100
4099
|
}
|
|
4101
4100
|
|
|
4102
|
-
export { Editor, Extension, InputRule, Mark, Node, NodeView, PasteRule, Tracker, callOrReturn, extensions, findChildren, findChildrenInRange, findParentNode, findParentNodeClosestToPos, generateHTML, generateJSON, generateText, getAttributes, getDebugJSON, getExtensionField, getHTMLFromFragment, getMarkAttributes, getMarkRange, getMarkType, getMarksBetween, getNodeAttributes, getNodeType, getSchema, getText, getTextBetween, inputRulesPlugin, isActive, isList, isMarkActive, isNodeActive, isNodeEmpty, isNodeSelection, isTextSelection, markInputRule, markPasteRule, mergeAttributes, nodeInputRule, pasteRulesPlugin, posToDOMRect, textInputRule, textPasteRule, textblockTypeInputRule, wrappingInputRule };
|
|
4101
|
+
export { Editor, Extension, InputRule, Mark, Node, NodeView, PasteRule, Tracker, callOrReturn, defaultBlockAt, extensions, findChildren, findChildrenInRange, findParentNode, findParentNodeClosestToPos, generateHTML, generateJSON, generateText, getAttributes, getDebugJSON, getExtensionField, getHTMLFromFragment, getMarkAttributes, getMarkRange, getMarkType, getMarksBetween, getNodeAttributes, getNodeType, getSchema, getText, getTextBetween, inputRulesPlugin, isActive, isList, isMarkActive, isNodeActive, isNodeEmpty, isNodeSelection, isTextSelection, markInputRule, markPasteRule, mergeAttributes, nodeInputRule, pasteRulesPlugin, posToDOMRect, textInputRule, textPasteRule, textblockTypeInputRule, wrappingInputRule };
|
|
4103
4102
|
//# sourceMappingURL=tiptap-core.esm.js.map
|