@tiptap/extension-table 2.0.0-beta.43 → 2.0.0-beta.47

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.
@@ -99,7 +99,7 @@ Fragment.prototype.descendants = function descendants (f) {
99
99
  this.nodesBetween(0, this.size, f);
100
100
  };
101
101
 
102
- // :: (number, number, ?string, ?string | ?(leafNode: Node) -> string) → string
102
+ // :: (number, number, ?string, ?union<string, (leafNode: Node) string>) → string
103
103
  // Extract the text between `from` and `to`. See the same method on
104
104
  // [`Node`](#model.Node.textBetween).
105
105
  Fragment.prototype.textBetween = function textBetween (from, to, blockSeparator, leafText) {
@@ -1076,7 +1076,7 @@ Node.prototype.nodesBetween = function nodesBetween (from, to, f, startPos) {
1076
1076
  this.content.nodesBetween(from, to, f, startPos, this);
1077
1077
  };
1078
1078
 
1079
- // :: ((node: Node, pos: number, parent: Node) → ?bool)
1079
+ // :: ((node: Node, pos: number, parent: Node, index: number) → ?bool)
1080
1080
  // Call the given callback for every descendant node. Doesn't
1081
1081
  // descend into a node when the callback returns `false`.
1082
1082
  Node.prototype.descendants = function descendants (f) {
@@ -1088,10 +1088,10 @@ Node.prototype.descendants = function descendants (f) {
1088
1088
  // children.
1089
1089
  prototypeAccessors$3$1.textContent.get = function () { return this.textBetween(0, this.content.size, "") };
1090
1090
 
1091
- // :: (number, number, ?string, ?string | ?(leafNode: Node) -> string) → string
1091
+ // :: (number, number, ?string, ?union<string, ?(leafNode: Node) -> string>) → string
1092
1092
  // Get all text between positions `from` and `to`. When
1093
- // `blockSeparator` is given, it will be inserted whenever a new
1094
- // block node is started. When `leafText` is given, it'll be
1093
+ // `blockSeparator` is given, it will be inserted to separate text
1094
+ // from different block nodes. When `leafText` is given, it'll be
1095
1095
  // inserted for every non-text leaf node encountered.
1096
1096
  Node.prototype.textBetween = function textBetween (from, to, blockSeparator, leafText) {
1097
1097
  return this.content.textBetween(from, to, blockSeparator, leafText)
@@ -1865,7 +1865,7 @@ var NodeType = function NodeType(name, schema, spec) {
1865
1865
  this.isText = name == "text";
1866
1866
  };
1867
1867
 
1868
- var prototypeAccessors$5 = { isInline: { configurable: true },isTextblock: { configurable: true },isLeaf: { configurable: true },isAtom: { configurable: true } };
1868
+ var prototypeAccessors$5 = { isInline: { configurable: true },isTextblock: { configurable: true },isLeaf: { configurable: true },isAtom: { configurable: true },whitespace: { configurable: true } };
1869
1869
 
1870
1870
  // :: bool
1871
1871
  // True if this is an inline type.
@@ -1885,6 +1885,10 @@ prototypeAccessors$5.isLeaf.get = function () { return this.contentMatch == Cont
1885
1885
  // directly editable content.
1886
1886
  prototypeAccessors$5.isAtom.get = function () { return this.isLeaf || this.spec.atom };
1887
1887
 
1888
+ // :: union<"pre", "normal">
1889
+ // The node type's [whitespace](#view.NodeSpec.whitespace) option.
1890
+ prototypeAccessors$5.whitespace.get = function () { return this.spec.whitespace || (this.spec.code ? "pre" : "normal") };
1891
+
1888
1892
  // :: () → bool
1889
1893
  // Tells you whether this node type has any required attributes.
1890
1894
  NodeType.prototype.hasRequiredAttrs = function hasRequiredAttrs () {
@@ -2100,8 +2104,10 @@ var listTags = {ol: true, ul: true};
2100
2104
  // Using a bitfield for node context options
2101
2105
  var OPT_PRESERVE_WS = 1, OPT_PRESERVE_WS_FULL = 2, OPT_OPEN_LEFT = 4;
2102
2106
 
2103
- function wsOptionsFor(preserveWhitespace) {
2104
- return (preserveWhitespace ? OPT_PRESERVE_WS : 0) | (preserveWhitespace === "full" ? OPT_PRESERVE_WS_FULL : 0)
2107
+ function wsOptionsFor(type, preserveWhitespace, base) {
2108
+ if (preserveWhitespace != null) { return (preserveWhitespace ? OPT_PRESERVE_WS : 0) |
2109
+ (preserveWhitespace === "full" ? OPT_PRESERVE_WS_FULL : 0) }
2110
+ return type && type.whitespace == "pre" ? OPT_PRESERVE_WS | OPT_PRESERVE_WS_FULL : base & ~OPT_OPEN_LEFT
2105
2111
  }
2106
2112
 
2107
2113
  var NodeContext = function NodeContext(type, attrs, marks, pendingMarks, solid, match, options) {
@@ -2183,7 +2189,7 @@ var ParseContext = function ParseContext(parser, options, open) {
2183
2189
  this.options = options;
2184
2190
  this.isOpen = open;
2185
2191
  var topNode = options.topNode, topContext;
2186
- var topOptions = wsOptionsFor(options.preserveWhitespace) | (open ? OPT_OPEN_LEFT : 0);
2192
+ var topOptions = wsOptionsFor(null, options.preserveWhitespace, 0) | (open ? OPT_OPEN_LEFT : 0);
2187
2193
  if (topNode)
2188
2194
  { topContext = new NodeContext(topNode.type, topNode.attrs, Mark.none, Mark.none, true,
2189
2195
  options.topMatch || topNode.type.contentMatch, topOptions); }
@@ -2429,7 +2435,7 @@ ParseContext.prototype.enterInner = function enterInner (type, attrs, solid, pre
2429
2435
  var top = this.top;
2430
2436
  top.applyPending(type);
2431
2437
  top.match = top.match && top.match.matchType(type, attrs);
2432
- var options = preserveWS == null ? top.options & ~OPT_OPEN_LEFT : wsOptionsFor(preserveWS);
2438
+ var options = wsOptionsFor(type, preserveWS, top.options);
2433
2439
  if ((top.options & OPT_OPEN_LEFT) && top.content.length == 0) { options |= OPT_OPEN_LEFT; }
2434
2440
  this.nodes.push(new NodeContext(type, attrs, top.activeMarks, top.pendingMarks, solid, null, options));
2435
2441
  this.open++;