@tiptap/core 2.0.0-beta.141 → 2.0.0-beta.142

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.
@@ -0,0 +1,2 @@
1
+ import { ContentMatch, NodeType } from 'prosemirror-model';
2
+ export default function defaultBlockAt(match: ContentMatch): NodeType | null;
@@ -19,6 +19,7 @@ export { default as markPasteRule } from './pasteRules/markPasteRule';
19
19
  export { default as textPasteRule } from './pasteRules/textPasteRule';
20
20
  export { default as callOrReturn } from './utilities/callOrReturn';
21
21
  export { default as mergeAttributes } from './utilities/mergeAttributes';
22
+ export { default as defaultBlockAt } from './helpers/defaultBlockAt';
22
23
  export { default as getExtensionField } from './helpers/getExtensionField';
23
24
  export { default as findChildren } from './helpers/findChildren';
24
25
  export { default as findChildrenInRange } from './helpers/findChildrenInRange';
@@ -1183,7 +1183,7 @@ function getSplittedAttributes(extensionAttributes, typeName, attributes) {
1183
1183
  }));
1184
1184
  }
1185
1185
 
1186
- function defaultBlockAt(match) {
1186
+ function defaultBlockAt$1(match) {
1187
1187
  for (let i = 0; i < match.edgeCount; i += 1) {
1188
1188
  const { type } = match.edge(i);
1189
1189
  if (type.isTextblock && !type.hasRequiredAttrs()) {
@@ -1227,7 +1227,7 @@ const splitBlock = ({ keepMarks = true } = {}) => ({ tr, state, dispatch, editor
1227
1227
  }
1228
1228
  const deflt = $from.depth === 0
1229
1229
  ? undefined
1230
- : defaultBlockAt($from.node(-1).contentMatchAt($from.indexAfter(-1)));
1230
+ : defaultBlockAt$1($from.node(-1).contentMatchAt($from.indexAfter(-1)));
1231
1231
  let types = atEnd && deflt
1232
1232
  ? [{
1233
1233
  type: deflt,
@@ -3964,6 +3964,16 @@ function textPasteRule(config) {
3964
3964
  });
3965
3965
  }
3966
3966
 
3967
+ function defaultBlockAt(match) {
3968
+ for (let i = 0; i < match.edgeCount; i += 1) {
3969
+ const { type } = match.edge(i);
3970
+ if (type.isTextblock && !type.hasRequiredAttrs()) {
3971
+ return type;
3972
+ }
3973
+ }
3974
+ return null;
3975
+ }
3976
+
3967
3977
  function findChildren(node, predicate) {
3968
3978
  const nodesWithPos = [];
3969
3979
  node.descendants((child, pos) => {
@@ -4112,6 +4122,7 @@ exports.NodeView = NodeView;
4112
4122
  exports.PasteRule = PasteRule;
4113
4123
  exports.Tracker = Tracker;
4114
4124
  exports.callOrReturn = callOrReturn;
4125
+ exports.defaultBlockAt = defaultBlockAt;
4115
4126
  exports.extensions = extensions;
4116
4127
  exports.findChildren = findChildren;
4117
4128
  exports.findChildrenInRange = findChildrenInRange;