@tiptap/core 3.4.5 → 3.5.0

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/index.cjs CHANGED
@@ -1689,8 +1689,10 @@ var import_model7 = require("@tiptap/pm/model");
1689
1689
  var import_state5 = require("@tiptap/pm/state");
1690
1690
  var InputRule = class {
1691
1691
  constructor(config) {
1692
+ var _a;
1692
1693
  this.find = config.find;
1693
1694
  this.handler = config.handler;
1695
+ this.undoable = (_a = config.undoable) != null ? _a : true;
1694
1696
  }
1695
1697
  };
1696
1698
  var inputRuleMatcherHandler = (text, find) => {
@@ -1762,12 +1764,14 @@ function run(config) {
1762
1764
  if (handler === null || !tr.steps.length) {
1763
1765
  return;
1764
1766
  }
1765
- tr.setMeta(plugin, {
1766
- transform: tr,
1767
- from,
1768
- to,
1769
- text
1770
- });
1767
+ if (rule.undoable) {
1768
+ tr.setMeta(plugin, {
1769
+ transform: tr,
1770
+ from,
1771
+ to,
1772
+ text
1773
+ });
1774
+ }
1771
1775
  view.dispatch(tr);
1772
1776
  matched = true;
1773
1777
  });
@@ -4978,7 +4982,8 @@ function markInputRule(config) {
4978
4982
  tr.addMark(range.from + startSpaces, markEnd, config.type.create(attributes || {}));
4979
4983
  tr.removeStoredMark(config.type);
4980
4984
  }
4981
- }
4985
+ },
4986
+ undoable: config.undoable
4982
4987
  });
4983
4988
  }
4984
4989
 
@@ -5008,7 +5013,8 @@ function nodeInputRule(config) {
5008
5013
  tr.insert(insertionStart, config.type.create(attributes)).delete(tr.mapping.map(start), tr.mapping.map(end));
5009
5014
  }
5010
5015
  tr.scrollIntoView();
5011
- }
5016
+ },
5017
+ undoable: config.undoable
5012
5018
  });
5013
5019
  }
5014
5020
 
@@ -5023,7 +5029,8 @@ function textblockTypeInputRule(config) {
5023
5029
  return null;
5024
5030
  }
5025
5031
  state.tr.delete(range.from, range.to).setBlockType(range.from, range.from, config.type, attributes);
5026
- }
5032
+ },
5033
+ undoable: config.undoable
5027
5034
  });
5028
5035
  }
5029
5036
 
@@ -5046,7 +5053,8 @@ function textInputRule(config) {
5046
5053
  }
5047
5054
  }
5048
5055
  state.tr.insertText(insert, start, end);
5049
- }
5056
+ },
5057
+ undoable: config.undoable
5050
5058
  });
5051
5059
  }
5052
5060
 
@@ -5082,7 +5090,8 @@ function wrappingInputRule(config) {
5082
5090
  if (before && before.type === config.type && (0, import_transform10.canJoin)(tr.doc, range.from - 1) && (!config.joinPredicate || config.joinPredicate(match, before))) {
5083
5091
  tr.join(range.from - 1);
5084
5092
  }
5085
- }
5093
+ },
5094
+ undoable: config.undoable
5086
5095
  });
5087
5096
  }
5088
5097