tetrons 2.1.6 → 2.1.7

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.js CHANGED
@@ -1,39 +1,10 @@
1
1
  "use strict";
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
- var __defProps = Object.defineProperties;
5
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
6
  var __getProtoOf = Object.getPrototypeOf;
10
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
11
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
- var __spreadValues = (a, b) => {
14
- for (var prop in b || (b = {}))
15
- if (__hasOwnProp.call(b, prop))
16
- __defNormalProp(a, prop, b[prop]);
17
- if (__getOwnPropSymbols)
18
- for (var prop of __getOwnPropSymbols(b)) {
19
- if (__propIsEnum.call(b, prop))
20
- __defNormalProp(a, prop, b[prop]);
21
- }
22
- return a;
23
- };
24
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
- var __objRest = (source, exclude) => {
26
- var target = {};
27
- for (var prop in source)
28
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
29
- target[prop] = source[prop];
30
- if (source != null && __getOwnPropSymbols)
31
- for (var prop of __getOwnPropSymbols(source)) {
32
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
33
- target[prop] = source[prop];
34
- }
35
- return target;
36
- };
37
8
  var __export = (target, all) => {
38
9
  for (var name in all)
39
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -64,6 +35,9 @@ __export(index_exports, {
64
35
  });
65
36
  module.exports = __toCommonJS(index_exports);
66
37
 
38
+ // src/components/tetrons/EditorContent.tsx
39
+ var import_react15 = __toESM(require("react"));
40
+
67
41
  // node_modules/orderedmap/dist/index.js
68
42
  function OrderedMap(content) {
69
43
  this.content = content;
@@ -8640,7 +8614,8 @@ function createChainableState(config) {
8640
8614
  let { selection } = transaction;
8641
8615
  let { doc: doc3 } = transaction;
8642
8616
  let { storedMarks } = transaction;
8643
- return __spreadProps(__spreadValues({}, state), {
8617
+ return {
8618
+ ...state,
8644
8619
  apply: state.apply.bind(state),
8645
8620
  applyTransaction: state.applyTransaction.bind(state),
8646
8621
  plugins: state.plugins,
@@ -8662,7 +8637,7 @@ function createChainableState(config) {
8662
8637
  storedMarks = transaction.storedMarks;
8663
8638
  return transaction;
8664
8639
  }
8665
- });
8640
+ };
8666
8641
  }
8667
8642
  var CommandManager = class {
8668
8643
  constructor(props) {
@@ -8710,17 +8685,18 @@ var CommandManager = class {
8710
8685
  }
8711
8686
  return callbacks.every((callback) => callback === true);
8712
8687
  };
8713
- const chain = __spreadProps(__spreadValues({}, Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
8714
- const chainedCommand = (...args) => {
8715
- const props = this.buildProps(tr, shouldDispatch);
8716
- const callback = command2(...args)(props);
8717
- callbacks.push(callback);
8718
- return chain;
8719
- };
8720
- return [name, chainedCommand];
8721
- }))), {
8688
+ const chain = {
8689
+ ...Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
8690
+ const chainedCommand = (...args) => {
8691
+ const props = this.buildProps(tr, shouldDispatch);
8692
+ const callback = command2(...args)(props);
8693
+ callbacks.push(callback);
8694
+ return chain;
8695
+ };
8696
+ return [name, chainedCommand];
8697
+ })),
8722
8698
  run
8723
- });
8699
+ };
8724
8700
  return chain;
8725
8701
  }
8726
8702
  createCan(startTr) {
@@ -8729,11 +8705,12 @@ var CommandManager = class {
8729
8705
  const tr = startTr || state.tr;
8730
8706
  const props = this.buildProps(tr, dispatch);
8731
8707
  const formattedCommands = Object.fromEntries(Object.entries(rawCommands).map(([name, command2]) => {
8732
- return [name, (...args) => command2(...args)(__spreadProps(__spreadValues({}, props), { dispatch: void 0 }))];
8708
+ return [name, (...args) => command2(...args)({ ...props, dispatch: void 0 })];
8733
8709
  }));
8734
- return __spreadProps(__spreadValues({}, formattedCommands), {
8710
+ return {
8711
+ ...formattedCommands,
8735
8712
  chain: () => this.createChain(tr, dispatch)
8736
- });
8713
+ };
8737
8714
  }
8738
8715
  buildProps(tr, shouldDispatch = true) {
8739
8716
  const { rawCommands, editor, state } = this;
@@ -8763,9 +8740,10 @@ function getExtensionField(extension, field, context) {
8763
8740
  return getExtensionField(extension.parent, field, context);
8764
8741
  }
8765
8742
  if (typeof extension.config[field] === "function") {
8766
- const value = extension.config[field].bind(__spreadProps(__spreadValues({}, context), {
8743
+ const value = extension.config[field].bind({
8744
+ ...context,
8767
8745
  parent: extension.parent ? getExtensionField(extension.parent, field, context) : null
8768
- }));
8746
+ });
8769
8747
  return value;
8770
8748
  }
8771
8749
  return extension.config[field];
@@ -8791,7 +8769,7 @@ function getNodeType(nameOrType, schema) {
8791
8769
  }
8792
8770
  function mergeAttributes(...objects) {
8793
8771
  return objects.filter((item) => !!item).reduce((items, item) => {
8794
- const mergedAttributes = __spreadValues({}, items);
8772
+ const mergedAttributes = { ...items };
8795
8773
  Object.entries(item).forEach(([key, value]) => {
8796
8774
  const exists = mergedAttributes[key];
8797
8775
  if (!exists) {
@@ -8854,7 +8832,7 @@ function isPlainObject(value) {
8854
8832
  return value.constructor === Object && Object.getPrototypeOf(value) === Object.prototype;
8855
8833
  }
8856
8834
  function mergeDeep(target, source) {
8857
- const output = __spreadValues({}, target);
8835
+ const output = { ...target };
8858
8836
  if (isPlainObject(target) && isPlainObject(source)) {
8859
8837
  Object.keys(source).forEach((key) => {
8860
8838
  if (isPlainObject(source[key]) && isPlainObject(target[key])) {
@@ -8876,7 +8854,10 @@ var Mark2 = class _Mark {
8876
8854
  name: this.name,
8877
8855
  defaultOptions: {}
8878
8856
  };
8879
- this.config = __spreadValues(__spreadValues({}, this.config), config);
8857
+ this.config = {
8858
+ ...this.config,
8859
+ ...config
8860
+ };
8880
8861
  this.name = this.config.name;
8881
8862
  if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) {
8882
8863
  console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`);
@@ -8896,11 +8877,12 @@ var Mark2 = class _Mark {
8896
8877
  return new _Mark(config);
8897
8878
  }
8898
8879
  configure(options = {}) {
8899
- const extension = this.extend(__spreadProps(__spreadValues({}, this.config), {
8880
+ const extension = this.extend({
8881
+ ...this.config,
8900
8882
  addOptions: () => {
8901
8883
  return mergeDeep(this.options, options);
8902
8884
  }
8903
- }));
8885
+ });
8904
8886
  extension.name = this.name;
8905
8887
  extension.parent = this.parent;
8906
8888
  return extension;
@@ -8959,7 +8941,10 @@ var Extension = class _Extension {
8959
8941
  name: this.name,
8960
8942
  defaultOptions: {}
8961
8943
  };
8962
- this.config = __spreadValues(__spreadValues({}, this.config), config);
8944
+ this.config = {
8945
+ ...this.config,
8946
+ ...config
8947
+ };
8963
8948
  this.name = this.config.name;
8964
8949
  if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) {
8965
8950
  console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`);
@@ -8979,17 +8964,18 @@ var Extension = class _Extension {
8979
8964
  return new _Extension(config);
8980
8965
  }
8981
8966
  configure(options = {}) {
8982
- const extension = this.extend(__spreadProps(__spreadValues({}, this.config), {
8967
+ const extension = this.extend({
8968
+ ...this.config,
8983
8969
  addOptions: () => {
8984
8970
  return mergeDeep(this.options, options);
8985
8971
  }
8986
- }));
8972
+ });
8987
8973
  extension.name = this.name;
8988
8974
  extension.parent = this.parent;
8989
8975
  return extension;
8990
8976
  }
8991
8977
  extend(extendedConfig = {}) {
8992
- const extension = new _Extension(__spreadValues(__spreadValues({}, this.config), extendedConfig));
8978
+ const extension = new _Extension({ ...this.config, ...extendedConfig });
8993
8979
  extension.parent = this;
8994
8980
  this.child = extension;
8995
8981
  extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;
@@ -9058,9 +9044,10 @@ var ClipboardTextSerializer = Extension.create({
9058
9044
  const to = Math.max(...ranges.map((range2) => range2.$to.pos));
9059
9045
  const textSerializers = getTextSerializersFromSchema(schema);
9060
9046
  const range = { from: from2, to };
9061
- return getTextBetween(doc3, range, __spreadProps(__spreadValues({}, this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {}), {
9047
+ return getTextBetween(doc3, range, {
9048
+ ...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
9062
9049
  textSerializers
9063
- }));
9050
+ });
9064
9051
  }
9065
9052
  }
9066
9053
  })
@@ -9308,9 +9295,10 @@ function isiOS() {
9308
9295
  ].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
9309
9296
  }
9310
9297
  var focus = (position = null, options = {}) => ({ editor, view, tr, dispatch }) => {
9311
- options = __spreadValues({
9312
- scrollIntoView: true
9313
- }, options);
9298
+ options = {
9299
+ scrollIntoView: true,
9300
+ ...options
9301
+ };
9314
9302
  const delayedFocus = () => {
9315
9303
  if (isiOS() || isAndroid()) {
9316
9304
  view.dom.focus();
@@ -9345,7 +9333,7 @@ var focus = (position = null, options = {}) => ({ editor, view, tr, dispatch })
9345
9333
  return true;
9346
9334
  };
9347
9335
  var forEach = (items, fn) => (props) => {
9348
- return items.every((item, index) => fn(item, __spreadProps(__spreadValues({}, props), { index })));
9336
+ return items.every((item, index) => fn(item, { ...props, index }));
9349
9337
  };
9350
9338
  var insertContent = (value, options) => ({ tr, commands: commands2 }) => {
9351
9339
  return commands2.insertContentAt({ from: tr.selection.from, to: tr.selection.to }, value, options);
@@ -9371,10 +9359,11 @@ function createNodeFromContent(content, schema, options) {
9371
9359
  if (content instanceof Node || content instanceof Fragment) {
9372
9360
  return content;
9373
9361
  }
9374
- options = __spreadValues({
9362
+ options = {
9375
9363
  slice: true,
9376
- parseOptions: {}
9377
- }, options);
9364
+ parseOptions: {},
9365
+ ...options
9366
+ };
9378
9367
  const isJSONContent = typeof content === "object" && content !== null;
9379
9368
  const isTextContent = typeof content === "string";
9380
9369
  if (isJSONContent) {
@@ -9463,18 +9452,20 @@ var isFragment = (nodeOrFragment) => {
9463
9452
  var insertContentAt = (position, value, options) => ({ tr, dispatch, editor }) => {
9464
9453
  var _a;
9465
9454
  if (dispatch) {
9466
- options = __spreadValues({
9455
+ options = {
9467
9456
  parseOptions: editor.options.parseOptions,
9468
9457
  updateSelection: true,
9469
9458
  applyInputRules: false,
9470
- applyPasteRules: false
9471
- }, options);
9459
+ applyPasteRules: false,
9460
+ ...options
9461
+ };
9472
9462
  let content;
9473
9463
  try {
9474
9464
  content = createNodeFromContent(value, editor.schema, {
9475
- parseOptions: __spreadValues({
9476
- preserveWhitespace: "full"
9477
- }, options.parseOptions),
9465
+ parseOptions: {
9466
+ preserveWhitespace: "full",
9467
+ ...options.parseOptions
9468
+ },
9478
9469
  errorOnInvalidContent: (_a = options.errorOnInvalidContent) !== null && _a !== void 0 ? _a : editor.options.enableContentCheck
9479
9470
  });
9480
9471
  } catch (e) {
@@ -9563,7 +9554,7 @@ var joinItemBackward = () => ({ state, dispatch, tr }) => {
9563
9554
  dispatch(tr);
9564
9555
  }
9565
9556
  return true;
9566
- } catch (e) {
9557
+ } catch {
9567
9558
  return false;
9568
9559
  }
9569
9560
  };
@@ -9578,7 +9569,7 @@ var joinItemForward = () => ({ state, dispatch, tr }) => {
9578
9569
  dispatch(tr);
9579
9570
  }
9580
9571
  return true;
9581
- } catch (e) {
9572
+ } catch {
9582
9573
  return false;
9583
9574
  }
9584
9575
  };
@@ -9827,7 +9818,7 @@ function getMarkAttributes(state, typeOrName) {
9827
9818
  if (!mark) {
9828
9819
  return {};
9829
9820
  }
9830
- return __spreadValues({}, mark.attrs);
9821
+ return { ...mark.attrs };
9831
9822
  }
9832
9823
  function defaultBlockAt2(match) {
9833
9824
  for (let i = 0; i < match.edgeCount; i += 1) {
@@ -9863,9 +9854,10 @@ function getMarksBetween(from2, to, doc3) {
9863
9854
  if (!range) {
9864
9855
  return;
9865
9856
  }
9866
- marks.push(__spreadValues({
9867
- mark
9868
- }, range));
9857
+ marks.push({
9858
+ mark,
9859
+ ...range
9860
+ });
9869
9861
  });
9870
9862
  } else {
9871
9863
  doc3.nodesBetween(from2, to, (node, pos) => {
@@ -10029,7 +10021,10 @@ var setMark = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
10029
10021
  if (dispatch) {
10030
10022
  if (empty2) {
10031
10023
  const oldAttributes = getMarkAttributes(state, type);
10032
- tr.addStoredMark(type.create(__spreadValues(__spreadValues({}, oldAttributes), attributes)));
10024
+ tr.addStoredMark(type.create({
10025
+ ...oldAttributes,
10026
+ ...attributes
10027
+ }));
10033
10028
  } else {
10034
10029
  ranges.forEach((range) => {
10035
10030
  const from2 = range.$from.pos;
@@ -10041,7 +10036,10 @@ var setMark = (typeOrName, attributes = {}) => ({ tr, state, dispatch }) => {
10041
10036
  if (someHasMark) {
10042
10037
  node.marks.forEach((mark) => {
10043
10038
  if (type === mark.type) {
10044
- tr.addMark(trimmedFrom, trimmedTo, type.create(__spreadValues(__spreadValues({}, mark.attrs), attributes)));
10039
+ tr.addMark(trimmedFrom, trimmedTo, type.create({
10040
+ ...mark.attrs,
10041
+ ...attributes
10042
+ }));
10045
10043
  }
10046
10044
  });
10047
10045
  } else {
@@ -10068,13 +10066,13 @@ var setNode = (typeOrName, attributes = {}) => ({ state, dispatch, chain }) => {
10068
10066
  return false;
10069
10067
  }
10070
10068
  return chain().command(({ commands: commands2 }) => {
10071
- const canSetBlock = setBlockType2(type, __spreadValues(__spreadValues({}, attributesToCopy), attributes))(state);
10069
+ const canSetBlock = setBlockType2(type, { ...attributesToCopy, ...attributes })(state);
10072
10070
  if (canSetBlock) {
10073
10071
  return true;
10074
10072
  }
10075
10073
  return commands2.clearNodes();
10076
10074
  }).command(({ state: updatedState }) => {
10077
- return setBlockType2(type, __spreadValues(__spreadValues({}, attributesToCopy), attributes))(updatedState, dispatch);
10075
+ return setBlockType2(type, { ...attributesToCopy, ...attributes })(updatedState, dispatch);
10078
10076
  }).run();
10079
10077
  };
10080
10078
  var setNodeSelection = (position) => ({ tr, dispatch }) => {
@@ -10193,7 +10191,10 @@ var splitListItem = (typeOrName, overrideAttrs = {}) => ({ tr, state, dispatch,
10193
10191
  wrap2 = Fragment.from($from.node(d).copy(wrap2));
10194
10192
  }
10195
10193
  const depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1 : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3;
10196
- const newNextTypeAttributes2 = __spreadValues(__spreadValues({}, getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs)), overrideAttrs);
10194
+ const newNextTypeAttributes2 = {
10195
+ ...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),
10196
+ ...overrideAttrs
10197
+ };
10197
10198
  const nextType2 = ((_a = type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.createAndFill(newNextTypeAttributes2)) || void 0;
10198
10199
  wrap2 = wrap2.append(Fragment.from(type.createAndFill(null, nextType2) || void 0));
10199
10200
  const start = $from.before($from.depth - (depthBefore - 1));
@@ -10215,8 +10216,14 @@ var splitListItem = (typeOrName, overrideAttrs = {}) => ({ tr, state, dispatch,
10215
10216
  return true;
10216
10217
  }
10217
10218
  const nextType = $to.pos === $from.end() ? grandParent.contentMatchAt(0).defaultType : null;
10218
- const newTypeAttributes = __spreadValues(__spreadValues({}, getSplittedAttributes(extensionAttributes, grandParent.type.name, grandParent.attrs)), overrideAttrs);
10219
- const newNextTypeAttributes = __spreadValues(__spreadValues({}, getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs)), overrideAttrs);
10219
+ const newTypeAttributes = {
10220
+ ...getSplittedAttributes(extensionAttributes, grandParent.type.name, grandParent.attrs),
10221
+ ...overrideAttrs
10222
+ };
10223
+ const newNextTypeAttributes = {
10224
+ ...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),
10225
+ ...overrideAttrs
10226
+ };
10220
10227
  tr.delete($from.pos, $to.pos);
10221
10228
  const types = nextType ? [
10222
10229
  { type, attrs: newTypeAttributes },
@@ -10334,7 +10341,7 @@ var toggleNode = (typeOrName, toggleTypeOrName, attributes = {}) => ({ state, co
10334
10341
  if (isActive) {
10335
10342
  return commands2.setNode(toggleType, attributesToCopy);
10336
10343
  }
10337
- return commands2.setNode(type, __spreadValues(__spreadValues({}, attributesToCopy), attributes));
10344
+ return commands2.setNode(type, { ...attributesToCopy, ...attributes });
10338
10345
  };
10339
10346
  var toggleWrap = (typeOrName, attributes = {}) => ({ state, commands: commands2 }) => {
10340
10347
  const type = getNodeType(typeOrName, state.schema);
@@ -10447,14 +10454,20 @@ var updateAttributes = (typeOrName, attributes = {}) => ({ tr, state, dispatch }
10447
10454
  }
10448
10455
  if (pos >= from2 && pos <= to) {
10449
10456
  if (nodeType && nodeType === node.type) {
10450
- tr.setNodeMarkup(pos, void 0, __spreadValues(__spreadValues({}, node.attrs), attributes));
10457
+ tr.setNodeMarkup(pos, void 0, {
10458
+ ...node.attrs,
10459
+ ...attributes
10460
+ });
10451
10461
  }
10452
10462
  if (markType && node.marks.length) {
10453
10463
  node.marks.forEach((mark) => {
10454
10464
  if (markType === mark.type) {
10455
10465
  const trimmedFrom2 = Math.max(pos, from2);
10456
10466
  const trimmedTo2 = Math.min(pos + node.nodeSize, to);
10457
- tr.addMark(trimmedFrom2, trimmedTo2, markType.create(__spreadValues(__spreadValues({}, mark.attrs), attributes)));
10467
+ tr.addMark(trimmedFrom2, trimmedTo2, markType.create({
10468
+ ...mark.attrs,
10469
+ ...attributes
10470
+ }));
10458
10471
  }
10459
10472
  });
10460
10473
  }
@@ -10463,12 +10476,18 @@ var updateAttributes = (typeOrName, attributes = {}) => ({ tr, state, dispatch }
10463
10476
  }
10464
10477
  if (lastNode) {
10465
10478
  if (lastPos !== void 0) {
10466
- tr.setNodeMarkup(lastPos, void 0, __spreadValues(__spreadValues({}, lastNode.attrs), attributes));
10479
+ tr.setNodeMarkup(lastPos, void 0, {
10480
+ ...lastNode.attrs,
10481
+ ...attributes
10482
+ });
10467
10483
  }
10468
10484
  if (markType && lastNode.marks.length) {
10469
10485
  lastNode.marks.forEach((mark) => {
10470
10486
  if (markType === mark.type) {
10471
- tr.addMark(trimmedFrom, trimmedTo, markType.create(__spreadValues(__spreadValues({}, mark.attrs), attributes)));
10487
+ tr.addMark(trimmedFrom, trimmedTo, markType.create({
10488
+ ...mark.attrs,
10489
+ ...attributes
10490
+ }));
10472
10491
  }
10473
10492
  });
10474
10493
  }
@@ -10549,7 +10568,9 @@ var commands = /* @__PURE__ */ Object.freeze({
10549
10568
  var Commands = Extension.create({
10550
10569
  name: "commands",
10551
10570
  addCommands() {
10552
- return __spreadValues({}, commands);
10571
+ return {
10572
+ ...commands
10573
+ };
10553
10574
  }
10554
10575
  });
10555
10576
  var Drop = Extension.create({
@@ -10658,8 +10679,11 @@ var Keymap = Extension.create({
10658
10679
  "Mod-Delete": handleDelete,
10659
10680
  "Mod-a": () => this.editor.commands.selectAll()
10660
10681
  };
10661
- const pcKeymap = __spreadValues({}, baseKeymap);
10662
- const macKeymap = __spreadProps(__spreadValues({}, baseKeymap), {
10682
+ const pcKeymap = {
10683
+ ...baseKeymap
10684
+ };
10685
+ const macKeymap = {
10686
+ ...baseKeymap,
10663
10687
  "Ctrl-h": handleBackspace,
10664
10688
  "Alt-Backspace": handleBackspace,
10665
10689
  "Ctrl-d": handleDelete,
@@ -10668,7 +10692,7 @@ var Keymap = Extension.create({
10668
10692
  "Alt-d": handleDelete,
10669
10693
  "Ctrl-a": () => this.editor.commands.selectTextblockStart(),
10670
10694
  "Ctrl-e": () => this.editor.commands.selectTextblockEnd()
10671
- });
10695
+ };
10672
10696
  if (isiOS() || isMacOS()) {
10673
10697
  return macKeymap;
10674
10698
  }
@@ -10873,7 +10897,10 @@ var Node2 = class _Node {
10873
10897
  name: this.name,
10874
10898
  defaultOptions: {}
10875
10899
  };
10876
- this.config = __spreadValues(__spreadValues({}, this.config), config);
10900
+ this.config = {
10901
+ ...this.config,
10902
+ ...config
10903
+ };
10877
10904
  this.name = this.config.name;
10878
10905
  if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) {
10879
10906
  console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`);
@@ -10893,11 +10920,12 @@ var Node2 = class _Node {
10893
10920
  return new _Node(config);
10894
10921
  }
10895
10922
  configure(options = {}) {
10896
- const extension = this.extend(__spreadProps(__spreadValues({}, this.config), {
10923
+ const extension = this.extend({
10924
+ ...this.config,
10897
10925
  addOptions: () => {
10898
10926
  return mergeDeep(this.options, options);
10899
10927
  }
10900
- }));
10928
+ });
10901
10929
  extension.name = this.name;
10902
10930
  extension.parent = this.parent;
10903
10931
  return extension;
@@ -11004,8 +11032,8 @@ var Comment = Mark2.create({
11004
11032
  });
11005
11033
 
11006
11034
  // src/components/tetrons/EditorContent.tsx
11007
- var import_react15 = require("react");
11008
- var import_react16 = require("@tiptap/react");
11035
+ var import_react16 = require("react");
11036
+ var import_react17 = require("@tiptap/react");
11009
11037
 
11010
11038
  // node_modules/@tiptap/extension-document/dist/index.js
11011
11039
  var Document = Node2.create({
@@ -12062,8 +12090,11 @@ var Heading = Node2.create({
12062
12090
  };
12063
12091
  },
12064
12092
  addKeyboardShortcuts() {
12065
- return this.options.levels.reduce((items, level) => __spreadValues(__spreadValues({}, items), {
12066
- [`Mod-Alt-${level}`]: () => this.editor.commands.toggleHeading({ level })
12093
+ return this.options.levels.reduce((items, level) => ({
12094
+ ...items,
12095
+ ...{
12096
+ [`Mod-Alt-${level}`]: () => this.editor.commands.toggleHeading({ level })
12097
+ }
12067
12098
  }), {});
12068
12099
  },
12069
12100
  addInputRules() {
@@ -12356,7 +12387,7 @@ var OrderedList = Node2.create({
12356
12387
  ];
12357
12388
  },
12358
12389
  renderHTML({ HTMLAttributes }) {
12359
- const _a = HTMLAttributes, { start } = _a, attributesWithoutStart = __objRest(_a, ["start"]);
12390
+ const { start, ...attributesWithoutStart } = HTMLAttributes;
12360
12391
  return start === 1 ? ["ol", mergeAttributes(this.options.HTMLAttributes, attributesWithoutStart), 0] : ["ol", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
12361
12392
  },
12362
12393
  addCommands() {
@@ -12387,7 +12418,7 @@ var OrderedList = Node2.create({
12387
12418
  type: this.type,
12388
12419
  keepMarks: this.options.keepMarks,
12389
12420
  keepAttributes: this.options.keepAttributes,
12390
- getAttributes: (match) => __spreadValues({ start: +match[1] }, this.editor.getAttributes(TextStyleName2)),
12421
+ getAttributes: (match) => ({ start: +match[1], ...this.editor.getAttributes(TextStyleName2) }),
12391
12422
  joinPredicate: (match, node) => node.childCount + node.attrs.start === +match[1],
12392
12423
  editor: this.editor
12393
12424
  });
@@ -12783,7 +12814,7 @@ function nextCell($pos, axis, dir) {
12783
12814
  return moved == null ? null : $pos.node(0).resolve(tableStart + moved);
12784
12815
  }
12785
12816
  function removeColSpan(attrs, pos, n = 1) {
12786
- const result = __spreadProps(__spreadValues({}, attrs), { colspan: attrs.colspan - n });
12817
+ const result = { ...attrs, colspan: attrs.colspan - n };
12787
12818
  if (result.colwidth) {
12788
12819
  result.colwidth = result.colwidth.slice();
12789
12820
  result.colwidth.splice(pos, n);
@@ -12884,9 +12915,10 @@ var CellSelection = class _CellSelection extends Selection {
12884
12915
  }
12885
12916
  }
12886
12917
  if (cellRect.top < rect.top || cellRect.bottom > rect.bottom) {
12887
- const attrs = __spreadProps(__spreadValues({}, cell.attrs), {
12918
+ const attrs = {
12919
+ ...cell.attrs,
12888
12920
  rowspan: Math.min(cellRect.bottom, rect.bottom) - Math.max(cellRect.top, rect.top)
12889
- });
12921
+ };
12890
12922
  if (cellRect.top < rect.top) {
12891
12923
  cell = cell.type.createAndFill(attrs);
12892
12924
  } else {
@@ -13165,15 +13197,17 @@ function fixTable(state, table, tablePos, tr) {
13165
13197
  } else if (prob.type == "overlong_rowspan") {
13166
13198
  const cell = table.nodeAt(prob.pos);
13167
13199
  if (!cell) continue;
13168
- tr.setNodeMarkup(tr.mapping.map(tablePos + 1 + prob.pos), null, __spreadProps(__spreadValues({}, cell.attrs), {
13200
+ tr.setNodeMarkup(tr.mapping.map(tablePos + 1 + prob.pos), null, {
13201
+ ...cell.attrs,
13169
13202
  rowspan: cell.attrs.rowspan - prob.n
13170
- }));
13203
+ });
13171
13204
  } else if (prob.type == "colwidth mismatch") {
13172
13205
  const cell = table.nodeAt(prob.pos);
13173
13206
  if (!cell) continue;
13174
- tr.setNodeMarkup(tr.mapping.map(tablePos + 1 + prob.pos), null, __spreadProps(__spreadValues({}, cell.attrs), {
13207
+ tr.setNodeMarkup(tr.mapping.map(tablePos + 1 + prob.pos), null, {
13208
+ ...cell.attrs,
13175
13209
  colwidth: prob.colwidth
13176
- }));
13210
+ });
13177
13211
  } else if (prob.type == "zero_sized") {
13178
13212
  const pos = tr.mapping.map(tablePos);
13179
13213
  tr.delete(pos, pos + table.nodeSize);
@@ -13216,7 +13250,7 @@ function selectedRect(state) {
13216
13250
  sel.$anchorCell.pos - tableStart,
13217
13251
  sel.$headCell.pos - tableStart
13218
13252
  ) : map2.findCell($pos.pos - tableStart);
13219
- return __spreadProps(__spreadValues({}, rect), { tableStart, map: map2, table });
13253
+ return { ...rect, tableStart, map: map2, table };
13220
13254
  }
13221
13255
  function deprecated_toggleHeader(type) {
13222
13256
  return function(state, dispatch) {
@@ -13439,9 +13473,10 @@ function clipCells({ width, height, rows }, newWidth, newHeight) {
13439
13473
  let cell = source.child(j);
13440
13474
  if (row + cell.attrs.rowspan > newHeight)
13441
13475
  cell = cell.type.create(
13442
- __spreadProps(__spreadValues({}, cell.attrs), {
13476
+ {
13477
+ ...cell.attrs,
13443
13478
  rowspan: Math.max(1, newHeight - cell.attrs.rowspan)
13444
- }),
13479
+ },
13445
13480
  cell.content
13446
13481
  );
13447
13482
  cells.push(cell);
@@ -13494,14 +13529,16 @@ function isolateHorizontal(tr, map2, table, start, left, right, top, mapFrom) {
13494
13529
  found2 = true;
13495
13530
  const cell = table.nodeAt(pos);
13496
13531
  const { top: cellTop, left: cellLeft } = map2.findCell(pos);
13497
- tr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos + start), null, __spreadProps(__spreadValues({}, cell.attrs), {
13532
+ tr.setNodeMarkup(tr.mapping.slice(mapFrom).map(pos + start), null, {
13533
+ ...cell.attrs,
13498
13534
  rowspan: top - cellTop
13499
- }));
13535
+ });
13500
13536
  tr.insert(
13501
13537
  tr.mapping.slice(mapFrom).map(map2.positionAt(top, cellLeft, table)),
13502
- cell.type.createAndFill(__spreadProps(__spreadValues({}, cell.attrs), {
13538
+ cell.type.createAndFill({
13539
+ ...cell.attrs,
13503
13540
  rowspan: cellTop + cell.attrs.rowspan - top
13504
- }))
13541
+ })
13505
13542
  );
13506
13543
  col += cell.attrs.colspan - 1;
13507
13544
  }
@@ -14073,7 +14110,7 @@ function updateColumnWidth(view, cell, width) {
14073
14110
  if (attrs.colwidth && attrs.colwidth[index] == width) continue;
14074
14111
  const colwidth = attrs.colwidth ? attrs.colwidth.slice() : zeroes(attrs.colspan);
14075
14112
  colwidth[index] = width;
14076
- tr.setNodeMarkup(start + pos, null, __spreadProps(__spreadValues({}, attrs), { colwidth }));
14113
+ tr.setNodeMarkup(start + pos, null, { ...attrs, colwidth });
14077
14114
  }
14078
14115
  if (tr.docChanged) view.dispatch(tr);
14079
14116
  }
@@ -14177,10 +14214,10 @@ function tableEditing({
14177
14214
  // src/components/tetrons/toolbar/extensions/ResizableTable.ts
14178
14215
  var ResizableTable = import_extension_table.Table.extend({
14179
14216
  addOptions() {
14180
- var _a;
14181
- return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
14217
+ return {
14218
+ ...this.parent?.(),
14182
14219
  resizable: true
14183
- });
14220
+ };
14184
14221
  },
14185
14222
  addProseMirrorPlugins() {
14186
14223
  return [columnResizing({ handleWidth: 5 }), tableEditing()];
@@ -14261,10 +14298,11 @@ var Embed = Node2.create({
14261
14298
  window.removeEventListener("mousemove", onMouseMove);
14262
14299
  window.removeEventListener("mouseup", onMouseUp);
14263
14300
  editor.commands.command(({ tr }) => {
14264
- tr.setNodeMarkup(getPos(), void 0, __spreadProps(__spreadValues({}, node.attrs), {
14301
+ tr.setNodeMarkup(getPos(), void 0, {
14302
+ ...node.attrs,
14265
14303
  width: container.offsetWidth,
14266
14304
  height: container.offsetHeight
14267
- }));
14305
+ });
14268
14306
  return true;
14269
14307
  });
14270
14308
  };
@@ -14358,8 +14396,8 @@ var ToolbarButton = import_react.default.forwardRef(
14358
14396
  ref,
14359
14397
  onClick,
14360
14398
  disabled,
14361
- title: title != null ? title : label,
14362
- "aria-label": title != null ? title : label,
14399
+ title: title ?? label,
14400
+ "aria-label": title ?? label,
14363
14401
  className: `p-2 rounded hover:bg-gray-200 disabled:opacity-50 disabled:cursor-not-allowed ${isActive ? "bg-gray-300" : ""}`
14364
14402
  },
14365
14403
  /* @__PURE__ */ import_react.default.createElement(Icon, { size: 20 })
@@ -14623,14 +14661,13 @@ function FontStyleGroup({ editor }) {
14623
14661
  (0, import_react3.useEffect)(() => {
14624
14662
  if (!editor) return;
14625
14663
  const updateStates = () => {
14626
- var _a, _b, _c;
14627
14664
  const highlight = editor.getAttributes("highlight");
14628
- setHighlightColor((highlight == null ? void 0 : highlight.color) || "#ffff00");
14629
- const color = (_a = editor.getAttributes("textStyle")) == null ? void 0 : _a.color;
14665
+ setHighlightColor(highlight?.color || "#ffff00");
14666
+ const color = editor.getAttributes("textStyle")?.color;
14630
14667
  setTextColor(color || "#000000");
14631
- const fontAttr = ((_b = editor.getAttributes("fontFamily")) == null ? void 0 : _b.font) || "Arial";
14668
+ const fontAttr = editor.getAttributes("fontFamily")?.font || "Arial";
14632
14669
  setFontFamily(fontAttr);
14633
- const sizeAttr = ((_c = editor.getAttributes("fontSize")) == null ? void 0 : _c.size) || "16px";
14670
+ const sizeAttr = editor.getAttributes("fontSize")?.size || "16px";
14634
14671
  setFontSize(sizeAttr);
14635
14672
  };
14636
14673
  updateStates();
@@ -14828,8 +14865,7 @@ function InsertGroup({ editor }) {
14828
14865
  setSelectedCols(1);
14829
14866
  };
14830
14867
  const handleImageUpload = (e) => {
14831
- var _a;
14832
- const file = (_a = e.target.files) == null ? void 0 : _a[0];
14868
+ const file = e.target.files?.[0];
14833
14869
  if (file) {
14834
14870
  const reader = new FileReader();
14835
14871
  reader.onload = () => {
@@ -14839,8 +14875,7 @@ function InsertGroup({ editor }) {
14839
14875
  }
14840
14876
  };
14841
14877
  const handleVideoUpload = (e) => {
14842
- var _a;
14843
- const file = (_a = e.target.files) == null ? void 0 : _a[0];
14878
+ const file = e.target.files?.[0];
14844
14879
  if (file) {
14845
14880
  const reader = new FileReader();
14846
14881
  reader.onload = () => {
@@ -14875,7 +14910,7 @@ function InsertGroup({ editor }) {
14875
14910
  return url.replace("/maps/", "/maps/embed/");
14876
14911
  }
14877
14912
  return url;
14878
- } catch (e) {
14913
+ } catch {
14879
14914
  return url;
14880
14915
  }
14881
14916
  }
@@ -14934,20 +14969,14 @@ function InsertGroup({ editor }) {
14934
14969
  {
14935
14970
  icon: import_md4.MdInsertPhoto,
14936
14971
  label: "Insert Image",
14937
- onClick: () => {
14938
- var _a;
14939
- return (_a = imageInputRef.current) == null ? void 0 : _a.click();
14940
- }
14972
+ onClick: () => imageInputRef.current?.click()
14941
14973
  }
14942
14974
  ), /* @__PURE__ */ import_react4.default.createElement(
14943
14975
  ToolbarButton_default,
14944
14976
  {
14945
14977
  icon: import_md4.MdVideoLibrary,
14946
14978
  label: "Insert Video",
14947
- onClick: () => {
14948
- var _a;
14949
- return (_a = videoInputRef.current) == null ? void 0 : _a.click();
14950
- }
14979
+ onClick: () => videoInputRef.current?.click()
14951
14980
  }
14952
14981
  ), /* @__PURE__ */ import_react4.default.createElement(
14953
14982
  ToolbarButton_default,
@@ -15168,12 +15197,10 @@ function FileGroup({ editor }) {
15168
15197
  }
15169
15198
  };
15170
15199
  const handleOpen = () => {
15171
- var _a;
15172
- (_a = fileInputRef.current) == null ? void 0 : _a.click();
15200
+ fileInputRef.current?.click();
15173
15201
  };
15174
15202
  const handleFileChange = async (e) => {
15175
- var _a;
15176
- const file = (_a = e.target.files) == null ? void 0 : _a[0];
15203
+ const file = e.target.files?.[0];
15177
15204
  if (!file) return;
15178
15205
  try {
15179
15206
  const text = await file.text();
@@ -15295,8 +15322,8 @@ var ResizableImageComponent = ({
15295
15322
  {
15296
15323
  ref: imgRef,
15297
15324
  src,
15298
- alt: alt != null ? alt : "",
15299
- title: title != null ? title : "",
15325
+ alt: alt ?? "",
15326
+ title: title ?? "",
15300
15327
  loading: "lazy",
15301
15328
  style: {
15302
15329
  width: width ? `${width}px` : "auto",
@@ -15316,26 +15343,27 @@ var ResizableImageComponent_default = ResizableImageComponent;
15316
15343
  var ResizableImage = import_extension_image.default.extend({
15317
15344
  name: "resizableImage",
15318
15345
  addAttributes() {
15319
- var _a;
15320
- return __spreadProps(__spreadValues({}, (_a = this.parent) == null ? void 0 : _a.call(this)), {
15346
+ return {
15347
+ ...this.parent?.(),
15321
15348
  width: {
15322
15349
  default: null
15323
15350
  },
15324
15351
  height: {
15325
15352
  default: null
15326
15353
  }
15327
- });
15354
+ };
15328
15355
  },
15329
15356
  renderHTML({ HTMLAttributes }) {
15330
- const _a = HTMLAttributes, { width, height } = _a, rest = __objRest(_a, ["width", "height"]);
15357
+ const { width, height, ...rest } = HTMLAttributes;
15331
15358
  const style = [];
15332
15359
  if (width) style.push(`width: ${width}px`);
15333
15360
  if (height) style.push(`height: ${height}px`);
15334
15361
  return [
15335
15362
  "img",
15336
- __spreadProps(__spreadValues({}, rest), {
15363
+ {
15364
+ ...rest,
15337
15365
  style: style.join("; ")
15338
- })
15366
+ }
15339
15367
  ];
15340
15368
  },
15341
15369
  addNodeView() {
@@ -15424,11 +15452,11 @@ var ResizableVideo = Node2.create({
15424
15452
  return [{ tag: "video[src]" }];
15425
15453
  },
15426
15454
  renderHTML({ HTMLAttributes }) {
15427
- const _a = HTMLAttributes, { width, height } = _a, rest = __objRest(_a, ["width", "height"]);
15455
+ const { width, height, ...rest } = HTMLAttributes;
15428
15456
  const style = [];
15429
15457
  if (width) style.push(`width: ${width}px`);
15430
15458
  if (height) style.push(`height: ${height}px`);
15431
- return ["video", __spreadProps(__spreadValues({}, rest), { style: style.join("; ") })];
15459
+ return ["video", { ...rest, style: style.join("; ") }];
15432
15460
  },
15433
15461
  addCommands() {
15434
15462
  return {
@@ -17055,11 +17083,9 @@ var lowlight = (0, import_lowlight.createLowlight)();
17055
17083
  lowlight.register("js", javascript);
17056
17084
  lowlight.register("ts", typescript);
17057
17085
  function EditorContent() {
17058
- const [versions, setVersions] = (0, import_react15.useState)([]);
17059
- const [currentVersionIndex, setCurrentVersionIndex] = (0, import_react15.useState)(
17060
- null
17061
- );
17062
- const editor = (0, import_react16.useEditor)({
17086
+ const [versions, setVersions] = import_react15.default.useState([]);
17087
+ const [currentVersionIndex, setCurrentVersionIndex] = import_react15.default.useState(null);
17088
+ const editor = (0, import_react17.useEditor)({
17063
17089
  extensions: [
17064
17090
  Document,
17065
17091
  Paragraph,
@@ -17114,12 +17140,13 @@ function EditorContent() {
17114
17140
  class: "min-h-full focus:outline-none p-0",
17115
17141
  "data-placeholder": "Start typing here..."
17116
17142
  }
17117
- }
17143
+ },
17144
+ immediatelyRender: false
17118
17145
  });
17119
- const wrapperRef = (0, import_react15.useRef)(null);
17120
- (0, import_react15.useEffect)(() => {
17146
+ const wrapperRef = (0, import_react16.useRef)(null);
17147
+ (0, import_react16.useEffect)(() => {
17121
17148
  return () => {
17122
- editor == null ? void 0 : editor.destroy();
17149
+ editor?.destroy();
17123
17150
  };
17124
17151
  }, [editor]);
17125
17152
  const handleEditorClick = () => {
@@ -17141,7 +17168,7 @@ function EditorContent() {
17141
17168
  setCurrentVersionIndex(index);
17142
17169
  }
17143
17170
  };
17144
- return /* @__PURE__ */ React.createElement("div", { className: "flex flex-col h-full" }, /* @__PURE__ */ React.createElement("div", { className: "p-2 border-b border-gray-300 bg-gray-50 flex flex-wrap items-center gap-3" }, /* @__PURE__ */ React.createElement(
17171
+ return /* @__PURE__ */ import_react15.default.createElement("div", { className: "flex flex-col h-full" }, /* @__PURE__ */ import_react15.default.createElement("div", { className: "p-2 border-b border-gray-300 bg-gray-50 flex flex-wrap items-center gap-3" }, /* @__PURE__ */ import_react15.default.createElement(
17145
17172
  "button",
17146
17173
  {
17147
17174
  onClick: saveVersion,
@@ -17149,7 +17176,7 @@ function EditorContent() {
17149
17176
  className: "px-3 py-1 bg-blue-600 text-white rounded hover:bg-blue-700 disabled:opacity-50"
17150
17177
  },
17151
17178
  "Save Version"
17152
- ), /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2 overflow-x-auto max-w-full" }, versions.length === 0 && /* @__PURE__ */ React.createElement("span", { className: "text-gray-500 text-sm" }, "No saved versions"), versions.map((_, idx) => /* @__PURE__ */ React.createElement(
17179
+ ), /* @__PURE__ */ import_react15.default.createElement("div", { className: "flex items-center gap-2 overflow-x-auto max-w-full" }, versions.length === 0 && /* @__PURE__ */ import_react15.default.createElement("span", { className: "text-gray-500 text-sm" }, "No saved versions"), versions.map((_, idx) => /* @__PURE__ */ import_react15.default.createElement(
17153
17180
  "button",
17154
17181
  {
17155
17182
  key: idx,
@@ -17158,14 +17185,14 @@ function EditorContent() {
17158
17185
  title: `Restore Version ${idx + 1}`
17159
17186
  },
17160
17187
  `V${idx + 1}`
17161
- )))), editor && /* @__PURE__ */ React.createElement(TetronsToolbar, { editor }), /* @__PURE__ */ React.createElement(
17188
+ )))), editor && /* @__PURE__ */ import_react15.default.createElement(TetronsToolbar, { editor }), /* @__PURE__ */ import_react15.default.createElement(
17162
17189
  "div",
17163
17190
  {
17164
17191
  ref: wrapperRef,
17165
17192
  className: "flex-grow p-4 md:p-6 bg-white border border-gray-300 rounded shadow-sm overflow-auto min-h-0 prose relative",
17166
17193
  onClick: handleEditorClick
17167
17194
  },
17168
- editor ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(import_react16.EditorContent, { editor }), editor && /* @__PURE__ */ React.createElement(TableContextMenu, { editor })) : /* @__PURE__ */ React.createElement("div", { className: "text-gray-500" }, "Loading editor...")
17195
+ editor ? /* @__PURE__ */ import_react15.default.createElement(import_react15.default.Fragment, null, /* @__PURE__ */ import_react15.default.createElement(import_react17.EditorContent, { editor }), editor && /* @__PURE__ */ import_react15.default.createElement(TableContextMenu, { editor })) : /* @__PURE__ */ import_react15.default.createElement("div", { className: "text-gray-500" }, "Loading editor...")
17169
17196
  ));
17170
17197
  }
17171
17198