@tiptap/extension-character-count 2.0.0-beta.21 → 2.0.0-beta.22

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.
@@ -5292,8 +5292,8 @@ const CharacterCount = Extension.create({
5292
5292
  },
5293
5293
  addStorage() {
5294
5294
  return {
5295
- characters: undefined,
5296
- words: undefined,
5295
+ characters: () => 0,
5296
+ words: () => 0,
5297
5297
  };
5298
5298
  },
5299
5299
  onBeforeCreate() {
@@ -5320,14 +5320,13 @@ const CharacterCount = Extension.create({
5320
5320
  new Plugin({
5321
5321
  key: new PluginKey('characterCount'),
5322
5322
  filterTransaction: (transaction, state) => {
5323
- var _a, _b, _c, _d, _e, _f;
5324
5323
  const limit = this.options.limit;
5325
5324
  // Nothing has changed or no limit is defined. Ignore it.
5326
5325
  if (!transaction.docChanged || limit === 0) {
5327
5326
  return true;
5328
5327
  }
5329
- const oldSize = ((_b = (_a = this.storage).characters) === null || _b === void 0 ? void 0 : _b.call(_a, { node: state.doc })) || 0;
5330
- const newSize = ((_d = (_c = this.storage).characters) === null || _d === void 0 ? void 0 : _d.call(_c, { node: transaction.doc })) || 0;
5328
+ const oldSize = this.storage.characters({ node: state.doc });
5329
+ const newSize = this.storage.characters({ node: transaction.doc });
5331
5330
  // Everything is in the limit. Good.
5332
5331
  if (newSize <= limit) {
5333
5332
  return true;
@@ -5357,7 +5356,7 @@ const CharacterCount = Extension.create({
5357
5356
  // This happens e.g. when truncating within a complex node (e.g. table)
5358
5357
  // and ProseMirror has to close this node again.
5359
5358
  // If this is the case, we prevent the transaction completely.
5360
- const updatedSize = ((_f = (_e = this.storage).characters) === null || _f === void 0 ? void 0 : _f.call(_e, { node: transaction.doc })) || 0;
5359
+ const updatedSize = this.storage.characters({ node: transaction.doc });
5361
5360
  if (updatedSize > limit) {
5362
5361
  return false;
5363
5362
  }