@harbour-enterprises/superdoc 0.17.1-next.1 → 0.18.0-next.1

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.
Files changed (51) hide show
  1. package/dist/chunks/{PdfViewer-D3Mx67L7.cjs → PdfViewer-CNZTqGHw.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-Bh-V1GAU.es.js → PdfViewer-D5cujgSt.es.js} +1 -1
  3. package/dist/chunks/{index-DyfNSlgn.es.js → index-BDwD6Uex.es.js} +3 -2
  4. package/dist/chunks/{index-Dh6A5pUX.cjs → index-BDysJRQU.cjs} +3 -2
  5. package/dist/chunks/{super-editor.es-hh18Joow.es.js → super-editor.es-BoCmoEkp.es.js} +469 -254
  6. package/dist/chunks/{super-editor.es-DYmLwal7.cjs → super-editor.es-aOm7eWFU.cjs} +468 -253
  7. package/dist/core/SuperDoc.d.ts.map +1 -1
  8. package/dist/index.d.ts +2 -1
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/super-editor/ai-writer.es.js +2 -2
  11. package/dist/super-editor/chunks/{converter-4gJFeq_J.js → converter-DvdFP4MZ.js} +337 -144
  12. package/dist/super-editor/chunks/{docx-zipper-Cceby9KI.js → docx-zipper-CxFpxZUz.js} +1 -1
  13. package/dist/super-editor/chunks/{editor-Isy5ZiWC.js → editor-CeWNMKjc.js} +31 -3
  14. package/dist/super-editor/chunks/{toolbar-Bg9sFUKb.js → toolbar-Di2oAvyr.js} +2 -2
  15. package/dist/super-editor/converter.es.js +1 -1
  16. package/dist/super-editor/docx-zipper.es.js +2 -2
  17. package/dist/super-editor/editor.es.js +3 -3
  18. package/dist/super-editor/file-zipper.es.js +1 -1
  19. package/dist/super-editor/src/core/super-converter/exporter.d.ts +17 -0
  20. package/dist/super-editor/src/core/super-converter/v2/importer/lineBreakImporter.d.ts +3 -5
  21. package/dist/super-editor/src/core/super-converter/v2/importer/tabImporter.d.ts +2 -1
  22. package/dist/super-editor/src/core/super-converter/v2/importer/types/index.d.ts +75 -0
  23. package/dist/super-editor/src/core/super-converter/v2/types/index.d.ts +8 -0
  24. package/dist/super-editor/src/core/super-converter/v3/handlers/index.d.ts +8 -0
  25. package/dist/super-editor/src/core/super-converter/v3/handlers/w/br/attributes/index.d.ts +2 -0
  26. package/dist/super-editor/src/core/super-converter/v3/handlers/w/br/attributes/w-clear.d.ts +2 -0
  27. package/dist/super-editor/src/core/super-converter/v3/handlers/w/br/attributes/w-line-break-type.d.ts +2 -0
  28. package/dist/super-editor/src/core/super-converter/v3/handlers/w/br/br-translator.d.ts +7 -0
  29. package/dist/super-editor/src/core/super-converter/v3/handlers/w/br/index.d.ts +1 -0
  30. package/dist/super-editor/src/core/super-converter/v3/handlers/w/tab/attributes/index.d.ts +3 -0
  31. package/dist/super-editor/src/core/super-converter/v3/handlers/w/tab/attributes/w-tab-leader.d.ts +2 -0
  32. package/dist/super-editor/src/core/super-converter/v3/handlers/w/tab/attributes/w-tab-pos.d.ts +2 -0
  33. package/dist/super-editor/src/core/super-converter/v3/handlers/w/tab/attributes/w-tab-size.d.ts +2 -0
  34. package/dist/super-editor/src/core/super-converter/v3/handlers/w/tab/index.d.ts +1 -0
  35. package/dist/super-editor/src/core/super-converter/v3/handlers/w/tab/tab-translator.d.ts +7 -0
  36. package/dist/super-editor/src/core/super-converter/v3/node-translator/index.d.ts +1 -0
  37. package/dist/super-editor/src/core/super-converter/v3/node-translator/node-translator.d.ts +203 -0
  38. package/dist/super-editor/src/extensions/block-node/block-node.d.ts +0 -1
  39. package/dist/super-editor/src/index.d.ts +2 -1
  40. package/dist/super-editor/super-editor.es.js +12 -7
  41. package/dist/super-editor/toolbar.es.js +2 -2
  42. package/dist/super-editor.cjs +2 -1
  43. package/dist/super-editor.es.js +2 -1
  44. package/dist/superdoc.cjs +3 -2
  45. package/dist/superdoc.es.js +3 -2
  46. package/dist/superdoc.umd.js +590 -374
  47. package/dist/superdoc.umd.js.map +1 -1
  48. package/package.json +1 -1
  49. package/dist/super-editor/src/core/super-converter/v2/handlers/index.d.ts +0 -1
  50. package/dist/super-editor/src/extensions/field-annotation/field-annotation-marks-impl.d.ts +0 -5
  51. /package/dist/super-editor/src/{extensions/document-attributes → core/super-converter/v3/handlers/types}/index.d.ts +0 -0
@@ -1878,14 +1878,14 @@ function requireEvents() {
1878
1878
  err.context = er;
1879
1879
  throw err;
1880
1880
  }
1881
- var handler = events2[type2];
1882
- if (handler === void 0)
1881
+ var handler2 = events2[type2];
1882
+ if (handler2 === void 0)
1883
1883
  return false;
1884
- if (typeof handler === "function") {
1885
- ReflectApply(handler, this, args);
1884
+ if (typeof handler2 === "function") {
1885
+ ReflectApply(handler2, this, args);
1886
1886
  } else {
1887
- var len = handler.length;
1888
- var listeners = arrayClone(handler, len);
1887
+ var len = handler2.length;
1888
+ var listeners = arrayClone(handler2, len);
1889
1889
  for (var i = 0; i < len; ++i)
1890
1890
  ReflectApply(listeners[i], this, args);
1891
1891
  }
@@ -2125,9 +2125,9 @@ function requireEvents() {
2125
2125
  }
2126
2126
  });
2127
2127
  }
2128
- function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
2128
+ function addErrorHandlerIfEventEmitter(emitter, handler2, flags) {
2129
2129
  if (typeof emitter.on === "function") {
2130
- eventTargetAgnosticAddListener(emitter, "error", handler, flags);
2130
+ eventTargetAgnosticAddListener(emitter, "error", handler2, flags);
2131
2131
  }
2132
2132
  }
2133
2133
  function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
@@ -6909,15 +6909,15 @@ function requireBrowser() {
6909
6909
  hasRequiredBrowser = 1;
6910
6910
  browser = deprecate;
6911
6911
  function deprecate(fn2, msg2) {
6912
- if (config("noDeprecation")) {
6912
+ if (config2("noDeprecation")) {
6913
6913
  return fn2;
6914
6914
  }
6915
6915
  var warned = false;
6916
6916
  function deprecated() {
6917
6917
  if (!warned) {
6918
- if (config("throwDeprecation")) {
6918
+ if (config2("throwDeprecation")) {
6919
6919
  throw new Error(msg2);
6920
- } else if (config("traceDeprecation")) {
6920
+ } else if (config2("traceDeprecation")) {
6921
6921
  console.trace(msg2);
6922
6922
  } else {
6923
6923
  console.warn(msg2);
@@ -6928,7 +6928,7 @@ function requireBrowser() {
6928
6928
  }
6929
6929
  return deprecated;
6930
6930
  }
6931
- function config(name) {
6931
+ function config2(name) {
6932
6932
  try {
6933
6933
  if (!commonjsGlobal.localStorage) return false;
6934
6934
  } catch (_2) {
@@ -9303,7 +9303,7 @@ function requireSax() {
9303
9303
  this._parser.end();
9304
9304
  return true;
9305
9305
  };
9306
- SAXStream.prototype.on = function(ev, handler) {
9306
+ SAXStream.prototype.on = function(ev, handler2) {
9307
9307
  var me = this;
9308
9308
  if (!me._parser["on" + ev] && streamWraps.indexOf(ev) !== -1) {
9309
9309
  me._parser["on" + ev] = function() {
@@ -9312,7 +9312,7 @@ function requireSax() {
9312
9312
  me.emit.apply(me, args);
9313
9313
  };
9314
9314
  }
9315
- return Stream.prototype.on.call(me, ev, handler);
9315
+ return Stream.prototype.on.call(me, ev, handler2);
9316
9316
  };
9317
9317
  var CDATA = "[CDATA[";
9318
9318
  var DOCTYPE = "DOCTYPE";
@@ -11526,8 +11526,8 @@ function requireHe() {
11526
11526
  "useNamedReferences": false,
11527
11527
  "decimal": false
11528
11528
  };
11529
- var decode = function(html, options) {
11530
- options = merge2(options, decode.options);
11529
+ var decode2 = function(html, options) {
11530
+ options = merge2(options, decode2.options);
11531
11531
  var strict = options.strict;
11532
11532
  if (strict && regexInvalidEntity.test(html)) {
11533
11533
  parseError("malformed character reference");
@@ -11586,7 +11586,7 @@ function requireHe() {
11586
11586
  return $0;
11587
11587
  });
11588
11588
  };
11589
- decode.options = {
11589
+ decode2.options = {
11590
11590
  "isAttributeValue": false,
11591
11591
  "strict": false
11592
11592
  };
@@ -11598,9 +11598,9 @@ function requireHe() {
11598
11598
  var he2 = {
11599
11599
  "version": "1.2.0",
11600
11600
  "encode": encode2,
11601
- "decode": decode,
11601
+ "decode": decode2,
11602
11602
  "escape": escape,
11603
- "unescape": decode
11603
+ "unescape": decode2
11604
11604
  };
11605
11605
  if (freeExports2 && !freeExports2.nodeType) {
11606
11606
  if (freeModule2) {
@@ -17366,24 +17366,24 @@ class FieldDesc {
17366
17366
  }
17367
17367
  const baseFields = [
17368
17368
  new FieldDesc("doc", {
17369
- init(config) {
17370
- return config.doc || config.schema.topNodeType.createAndFill();
17369
+ init(config2) {
17370
+ return config2.doc || config2.schema.topNodeType.createAndFill();
17371
17371
  },
17372
17372
  apply(tr) {
17373
17373
  return tr.doc;
17374
17374
  }
17375
17375
  }),
17376
17376
  new FieldDesc("selection", {
17377
- init(config, instance) {
17378
- return config.selection || Selection.atStart(instance.doc);
17377
+ init(config2, instance) {
17378
+ return config2.selection || Selection.atStart(instance.doc);
17379
17379
  },
17380
17380
  apply(tr) {
17381
17381
  return tr.selection;
17382
17382
  }
17383
17383
  }),
17384
17384
  new FieldDesc("storedMarks", {
17385
- init(config) {
17386
- return config.storedMarks || null;
17385
+ init(config2) {
17386
+ return config2.storedMarks || null;
17387
17387
  },
17388
17388
  apply(tr, _marks, _old, state2) {
17389
17389
  return state2.selection.$cursor ? tr.storedMarks : null;
@@ -17419,8 +17419,8 @@ class EditorState {
17419
17419
  /**
17420
17420
  @internal
17421
17421
  */
17422
- constructor(config) {
17423
- this.config = config;
17422
+ constructor(config2) {
17423
+ this.config = config2;
17424
17424
  }
17425
17425
  /**
17426
17426
  The schema of the state's document.
@@ -17511,11 +17511,11 @@ class EditorState {
17511
17511
  /**
17512
17512
  Create a new state.
17513
17513
  */
17514
- static create(config) {
17515
- let $config = new Configuration(config.doc ? config.doc.type.schema : config.schema, config.plugins);
17514
+ static create(config2) {
17515
+ let $config = new Configuration(config2.doc ? config2.doc.type.schema : config2.schema, config2.plugins);
17516
17516
  let instance = new EditorState($config);
17517
17517
  for (let i = 0; i < $config.fields.length; i++)
17518
- instance[$config.fields[i].name] = $config.fields[i].init(config, instance);
17518
+ instance[$config.fields[i].name] = $config.fields[i].init(config2, instance);
17519
17519
  return instance;
17520
17520
  }
17521
17521
  /**
@@ -17526,12 +17526,12 @@ class EditorState {
17526
17526
  [`init`](https://prosemirror.net/docs/ref/#state.StateField.init) method, passing in the new
17527
17527
  configuration object..
17528
17528
  */
17529
- reconfigure(config) {
17530
- let $config = new Configuration(this.schema, config.plugins);
17529
+ reconfigure(config2) {
17530
+ let $config = new Configuration(this.schema, config2.plugins);
17531
17531
  let fields = $config.fields, instance = new EditorState($config);
17532
17532
  for (let i = 0; i < fields.length; i++) {
17533
17533
  let name = fields[i].name;
17534
- instance[name] = this.hasOwnProperty(name) ? this[name] : fields[i].init(config, instance);
17534
+ instance[name] = this.hasOwnProperty(name) ? this[name] : fields[i].init(config2, instance);
17535
17535
  }
17536
17536
  return instance;
17537
17537
  }
@@ -17563,31 +17563,31 @@ class EditorState {
17563
17563
  to deserialize the state of plugins, by associating plugin
17564
17564
  instances with the property names they use in the JSON object.
17565
17565
  */
17566
- static fromJSON(config, json, pluginFields) {
17566
+ static fromJSON(config2, json, pluginFields) {
17567
17567
  if (!json)
17568
17568
  throw new RangeError("Invalid input for EditorState.fromJSON");
17569
- if (!config.schema)
17569
+ if (!config2.schema)
17570
17570
  throw new RangeError("Required config field 'schema' missing");
17571
- let $config = new Configuration(config.schema, config.plugins);
17571
+ let $config = new Configuration(config2.schema, config2.plugins);
17572
17572
  let instance = new EditorState($config);
17573
17573
  $config.fields.forEach((field) => {
17574
17574
  if (field.name == "doc") {
17575
- instance.doc = Node$1$1.fromJSON(config.schema, json.doc);
17575
+ instance.doc = Node$1$1.fromJSON(config2.schema, json.doc);
17576
17576
  } else if (field.name == "selection") {
17577
17577
  instance.selection = Selection.fromJSON(instance.doc, json.selection);
17578
17578
  } else if (field.name == "storedMarks") {
17579
17579
  if (json.storedMarks)
17580
- instance.storedMarks = json.storedMarks.map(config.schema.markFromJSON);
17580
+ instance.storedMarks = json.storedMarks.map(config2.schema.markFromJSON);
17581
17581
  } else {
17582
17582
  if (pluginFields)
17583
17583
  for (let prop in pluginFields) {
17584
17584
  let plugin2 = pluginFields[prop], state2 = plugin2.spec.state;
17585
17585
  if (plugin2.key == field.name && state2 && state2.fromJSON && Object.prototype.hasOwnProperty.call(json, prop)) {
17586
- instance[field.name] = state2.fromJSON.call(plugin2, config, json[prop], instance);
17586
+ instance[field.name] = state2.fromJSON.call(plugin2, config2, json[prop], instance);
17587
17587
  return;
17588
17588
  }
17589
17589
  }
17590
- instance[field.name] = field.init(config, instance);
17590
+ instance[field.name] = field.init(config2, instance);
17591
17591
  }
17592
17592
  });
17593
17593
  return instance;
@@ -23840,11 +23840,11 @@ function mergeSeparateLists(container) {
23840
23840
  return tempCont;
23841
23841
  }
23842
23842
  class InputRule {
23843
- constructor(config) {
23843
+ constructor(config2) {
23844
23844
  __publicField$2(this, "match");
23845
23845
  __publicField$2(this, "handler");
23846
- this.match = config.match;
23847
- this.handler = config.handler;
23846
+ this.match = config2.match;
23847
+ this.handler = config2.handler;
23848
23848
  }
23849
23849
  }
23850
23850
  const inputRuleMatcherHandler = (text, match) => {
@@ -23867,8 +23867,8 @@ const inputRuleMatcherHandler = (text, match) => {
23867
23867
  }
23868
23868
  return result;
23869
23869
  };
23870
- const run = (config) => {
23871
- const { editor, from: from2, to, text, rules, plugin: plugin2 } = config;
23870
+ const run = (config2) => {
23871
+ const { editor, from: from2, to, text, rules, plugin: plugin2 } = config2;
23872
23872
  const { view } = editor;
23873
23873
  if (view.composing) {
23874
23874
  return false;
@@ -23897,7 +23897,7 @@ const run = (config) => {
23897
23897
  editor,
23898
23898
  state: state2
23899
23899
  });
23900
- const handler = rule.handler({
23900
+ const handler2 = rule.handler({
23901
23901
  state: state2,
23902
23902
  range: range2,
23903
23903
  match,
@@ -23905,7 +23905,7 @@ const run = (config) => {
23905
23905
  chain,
23906
23906
  can
23907
23907
  });
23908
- if (handler === null || !tr.steps.length) {
23908
+ if (handler2 === null || !tr.steps.length) {
23909
23909
  return;
23910
23910
  }
23911
23911
  tr.setMeta(plugin2, {
@@ -25394,6 +25394,241 @@ const generateSdtPrTagForDocumentSection = (id, title, tag) => {
25394
25394
  ]
25395
25395
  };
25396
25396
  };
25397
+ const TranslatorTypes = Object.freeze({
25398
+ NODE: "node",
25399
+ ATTRIBUTE: "attribute"
25400
+ });
25401
+ const _NodeTranslator = class _NodeTranslator2 {
25402
+ /**
25403
+ * @param {string} xmlName
25404
+ * @param {string} sdNodeOrKeyName
25405
+ * @param {NodeTranslatorEncodeFn} encode
25406
+ * @param {NodeTranslatorDecodeFn} decode
25407
+ * @param {number} [priority]
25408
+ * @param {MatchesEncodeFn} [matchesEncode]
25409
+ * @param {MatchesDecodeFn} [matchesDecode]
25410
+ * @param {AttributesHandlerList[]} [attributes]
25411
+ */
25412
+ constructor(xmlName, sdNodeOrKeyName, encode2, decode2, priority, matchesEncode, matchesDecode, attributes) {
25413
+ __publicField$2(this, "xmlName");
25414
+ __publicField$2(this, "sdNodeOrKeyName");
25415
+ __publicField$2(this, "priority");
25416
+ __publicField$2(this, "encodeFn");
25417
+ __publicField$2(this, "decodeFn");
25418
+ __publicField$2(this, "matchesEncode");
25419
+ __publicField$2(this, "matchesDecode");
25420
+ __publicField$2(this, "attributes");
25421
+ this.xmlName = xmlName;
25422
+ this.sdNodeOrKeyName = sdNodeOrKeyName;
25423
+ this.encodeFn = encode2;
25424
+ this.decodeFn = decode2;
25425
+ this.attributes = attributes || [];
25426
+ this.priority = typeof priority === "number" ? priority : 0;
25427
+ this.matchesEncode = typeof matchesEncode === "function" ? matchesEncode : () => true;
25428
+ this.matchesDecode = typeof matchesDecode === "function" ? matchesDecode : () => true;
25429
+ }
25430
+ /**
25431
+ * Encode the attributes for the node.
25432
+ * @param {SCEncoderConfig} params
25433
+ * @returns {Object} Encoded attributes object.
25434
+ */
25435
+ encodeAttributes(params2) {
25436
+ const { nodes = [] } = params2 || {};
25437
+ const node2 = nodes[0];
25438
+ const { attributes = {} } = node2 || {};
25439
+ const encodedAttrs = {};
25440
+ this.attributes.forEach(({ sdName, encode: encode2 }) => {
25441
+ if (!encode2) return;
25442
+ const encodedAttr = encode2(attributes);
25443
+ if (encodedAttr !== void 0 && encodedAttr !== null) {
25444
+ encodedAttrs[sdName] = encodedAttr;
25445
+ }
25446
+ });
25447
+ return encodedAttrs;
25448
+ }
25449
+ /**
25450
+ * Decode the attributes for the node.
25451
+ * @param {SCDecoderConfig} params
25452
+ * @returns {Object} Decoded attributes object.
25453
+ */
25454
+ decodeAttributes(params2) {
25455
+ const { node: node2 } = params2 || {};
25456
+ const { attrs = {} } = node2 || {};
25457
+ const decodedAttrs = {};
25458
+ this.attributes.forEach(({ xmlName, decode: decode2 }) => {
25459
+ if (!decode2) return;
25460
+ const decodedAttr = decode2(attrs);
25461
+ if (decodedAttr !== void 0 && decodedAttr !== null) {
25462
+ decodedAttrs[xmlName] = decodedAttr;
25463
+ }
25464
+ });
25465
+ return decodedAttrs;
25466
+ }
25467
+ /**
25468
+ * Decode the attributes for the node.
25469
+ * @param {SCDecoderConfig} params
25470
+ * @returns {Object} Decoded attributes object.
25471
+ */
25472
+ decode(params2) {
25473
+ const decodedAttrs = this.decodeAttributes(params2);
25474
+ return this.decodeFn ? this.decodeFn(params2, decodedAttrs) : void 0;
25475
+ }
25476
+ /**
25477
+ * Encode the attributes for the node.
25478
+ * @param {SCEncoderConfig} params
25479
+ * @returns {Object} Encoded attributes object.
25480
+ */
25481
+ encode(params2) {
25482
+ const encodedAttrs = this.encodeAttributes(params2);
25483
+ return this.encodeFn ? this.encodeFn(params2, encodedAttrs) : void 0;
25484
+ }
25485
+ /**
25486
+ * Create a new NodeTranslator instance from a configuration object.
25487
+ * @param {NodeTranslatorConfig} config - The configuration object.
25488
+ * @returns {NodeTranslator} The created NodeTranslator instance.
25489
+ */
25490
+ static from(config2) {
25491
+ const { xmlName, sdNodeOrKeyName, encode: encode2, decode: decode2, priority = 0, matchesEncode, matchesDecode, attributes } = config2;
25492
+ if (typeof encode2 !== "function" || !!decode2 && typeof decode2 !== "function") {
25493
+ throw new TypeError(`${xmlName}: encode/decode must be functions`);
25494
+ }
25495
+ const inst = new _NodeTranslator2(
25496
+ xmlName,
25497
+ sdNodeOrKeyName,
25498
+ encode2,
25499
+ decode2,
25500
+ priority,
25501
+ matchesEncode,
25502
+ matchesDecode,
25503
+ attributes
25504
+ );
25505
+ return Object.freeze(inst);
25506
+ }
25507
+ /**
25508
+ * Convert the NodeTranslator instance to a string representation.
25509
+ * @returns {string} - The string representation of the NodeTranslator instance.
25510
+ */
25511
+ toString() {
25512
+ return `NodeTranslator(${this.xmlName}, priority=${this.priority})`;
25513
+ }
25514
+ };
25515
+ __publicField$2(_NodeTranslator, "translatorTypes", TranslatorTypes);
25516
+ let NodeTranslator = _NodeTranslator;
25517
+ const lineBreakTypeEncoder = (attributes) => {
25518
+ return attributes["w:type"];
25519
+ };
25520
+ const lineBreakTypeDecoder = (attrs) => {
25521
+ const { lineBreakType } = attrs;
25522
+ return lineBreakType;
25523
+ };
25524
+ const wClearEncoder = (attributes) => {
25525
+ const xmlAttrValue = attributes["w:clear"];
25526
+ return xmlAttrValue;
25527
+ };
25528
+ const wClearDecoder = (attrs) => {
25529
+ const { clear } = attrs;
25530
+ return clear;
25531
+ };
25532
+ const XML_NODE_NAME$1 = "w:br";
25533
+ const SD_NODE_NAME$1 = "lineBreak";
25534
+ const validXmlAttributes$1 = [
25535
+ { xmlName: "w:type", sdName: "lineBreakType", encode: lineBreakTypeEncoder, decode: lineBreakTypeDecoder },
25536
+ { xmlName: "w:clear", sdName: "clear", encode: wClearEncoder, decode: wClearDecoder }
25537
+ ];
25538
+ const encode$1 = (_2, encodedAttrs) => {
25539
+ const isPageBreak = encodedAttrs?.lineBreakType === "page";
25540
+ const translated = {
25541
+ type: isPageBreak ? "hardBreak" : "lineBreak"
25542
+ };
25543
+ if (encodedAttrs) {
25544
+ translated.attrs = { ...encodedAttrs };
25545
+ }
25546
+ return translated;
25547
+ };
25548
+ const decode$1 = (params2, decodedAttrs) => {
25549
+ const { node: node2 } = params2;
25550
+ if (!node2) return;
25551
+ const wBreak = { name: "w:br" };
25552
+ if (decodedAttrs) {
25553
+ wBreak.attributes = { ...decodedAttrs };
25554
+ }
25555
+ const isPageBreak = node2.type === "hardBreak";
25556
+ if (isPageBreak && (!wBreak.attributes || !wBreak.attributes["w:type"])) {
25557
+ wBreak.attributes = { ...wBreak.attributes, "w:type": "page" };
25558
+ }
25559
+ const translated = {
25560
+ name: "w:r",
25561
+ elements: [wBreak]
25562
+ };
25563
+ return translated;
25564
+ };
25565
+ const config$1 = {
25566
+ xmlName: XML_NODE_NAME$1,
25567
+ sdNodeOrKeyName: SD_NODE_NAME$1,
25568
+ type: NodeTranslator.translatorTypes.NODE,
25569
+ encode: encode$1,
25570
+ decode: decode$1,
25571
+ attributes: validXmlAttributes$1
25572
+ };
25573
+ const translator$1 = NodeTranslator.from(config$1);
25574
+ const tabSizeEncoder = (attributes) => {
25575
+ return attributes["w:val"];
25576
+ };
25577
+ const tabSizeDecoder = (attrs) => {
25578
+ const { tabSize } = attrs;
25579
+ return tabSize;
25580
+ };
25581
+ const tabLeaderEncoder = (attributes) => {
25582
+ return attributes["w:leader"];
25583
+ };
25584
+ const tabLeaderDecoder = (attrs) => {
25585
+ const { leader } = attrs;
25586
+ return leader;
25587
+ };
25588
+ const tabPositionEncoder = (attributes) => {
25589
+ return attributes["w:pos"];
25590
+ };
25591
+ const tabPositionDecoder = (attrs) => {
25592
+ const { pos } = attrs;
25593
+ return pos;
25594
+ };
25595
+ const XML_NODE_NAME = "w:tab";
25596
+ const SD_NODE_NAME = "tab";
25597
+ const validXmlAttributes = [
25598
+ { xmlName: "w:val", sdName: "tabSize", encode: tabSizeEncoder, decode: tabSizeDecoder },
25599
+ { xmlName: "w:pos", sdName: "pos", encode: tabPositionEncoder, decode: tabPositionDecoder },
25600
+ { xmlName: "w:leader", sdName: "leader", encode: tabLeaderEncoder, decode: tabLeaderDecoder }
25601
+ ];
25602
+ const encode$2 = (_2, encodedAttrs = {}) => {
25603
+ const translated = { type: "tab" };
25604
+ if (encodedAttrs) translated.attrs = { ...encodedAttrs };
25605
+ return translated;
25606
+ };
25607
+ const decode = (params2, decodedAttrs = {}) => {
25608
+ const { node: node2 } = params2 || {};
25609
+ if (!node2) return;
25610
+ const wTab = { name: "w:tab" };
25611
+ if (decodedAttrs) wTab.attributes = { ...decodedAttrs };
25612
+ const translated = {
25613
+ name: "w:r",
25614
+ elements: [wTab]
25615
+ };
25616
+ const { marks: nodeMarks = [] } = node2;
25617
+ const outputMarks = processOutputMarks(nodeMarks);
25618
+ if (outputMarks.length) {
25619
+ translated.elements.unshift(generateRunProps(outputMarks));
25620
+ }
25621
+ return translated;
25622
+ };
25623
+ const config = {
25624
+ xmlName: XML_NODE_NAME,
25625
+ sdNodeOrKeyName: SD_NODE_NAME,
25626
+ type: NodeTranslator.translatorTypes.NODE,
25627
+ encode: encode$2,
25628
+ decode,
25629
+ attributes: validXmlAttributes
25630
+ };
25631
+ const translator = NodeTranslator.from(config);
25397
25632
  function exportSchemaToJson(params2) {
25398
25633
  const { type: type2 } = params2.node || {};
25399
25634
  const router = {
@@ -25404,15 +25639,15 @@ function exportSchemaToJson(params2) {
25404
25639
  text: translateTextNode,
25405
25640
  bulletList: translateList,
25406
25641
  orderedList: translateList,
25407
- lineBreak: translateLineBreak,
25642
+ lineBreak: translator$1,
25408
25643
  table: translateTable,
25409
25644
  tableRow: translateTableRow,
25410
25645
  tableCell: translateTableCell,
25411
25646
  bookmarkStart: translateBookmarkStart,
25412
25647
  fieldAnnotation: translateFieldAnnotation,
25413
- tab: translateTab,
25648
+ tab: translator,
25414
25649
  image: translateImageNode,
25415
- hardBreak: translateHardBreak,
25650
+ hardBreak: translator$1,
25416
25651
  commentRangeStart: () => translateCommentNode(params2, "Start"),
25417
25652
  commentRangeEnd: () => translateCommentNode(params2, "End"),
25418
25653
  commentReference: () => null,
@@ -25425,11 +25660,15 @@ function exportSchemaToJson(params2) {
25425
25660
  "page-number": translatePageNumberNode,
25426
25661
  "total-page-number": translateTotalPageNumberNode
25427
25662
  };
25428
- if (!router[type2]) {
25663
+ let handler2 = router[type2];
25664
+ if (handler2 && "decode" in handler2 && typeof handler2.decode === "function") {
25665
+ return handler2.decode(params2);
25666
+ }
25667
+ if (!handler2) {
25429
25668
  console.error("No translation function found for node type:", type2);
25430
25669
  return null;
25431
25670
  }
25432
- return router[type2](params2);
25671
+ return handler2(params2);
25433
25672
  }
25434
25673
  function translateBodyNode(params2) {
25435
25674
  let sectPr = params2.bodyNode?.elements.find((n) => n.name === "w:sectPr") || {};
@@ -25623,9 +25862,10 @@ function generateParagraphProperties(node2) {
25623
25862
  const { tabStops } = attrs;
25624
25863
  if (tabStops && tabStops.length > 0) {
25625
25864
  const tabElements = tabStops.map((tab) => {
25865
+ const posValue = tab.originalPos !== void 0 ? tab.originalPos : pixelsToTwips(tab.pos).toString();
25626
25866
  const tabAttributes = {
25627
25867
  "w:val": tab.val || "start",
25628
- "w:pos": pixelsToTwips(tab.pos).toString()
25868
+ "w:pos": posValue
25629
25869
  };
25630
25870
  if (tab.leader) {
25631
25871
  tabAttributes["w:leader"] = tab.leader;
@@ -26049,23 +26289,6 @@ const generateNumPrTag = (numId, level) => {
26049
26289
  ]
26050
26290
  };
26051
26291
  };
26052
- function translateLineBreak(params2) {
26053
- const attributes = {};
26054
- const { lineBreakType } = params2.node?.attrs || {};
26055
- if (lineBreakType) {
26056
- attributes["w:type"] = lineBreakType;
26057
- }
26058
- return {
26059
- name: "w:r",
26060
- elements: [
26061
- {
26062
- name: "w:br",
26063
- attributes
26064
- }
26065
- ],
26066
- attributes
26067
- };
26068
- }
26069
26292
  function translateTable(params2) {
26070
26293
  params2.node = preProcessVerticalMergeCells(params2.node, params2);
26071
26294
  const elements = translateChildNodes(params2);
@@ -26112,14 +26335,6 @@ function preProcessVerticalMergeCells(table, { editorSchema }) {
26112
26335
  }
26113
26336
  return table;
26114
26337
  }
26115
- function translateTab(params2) {
26116
- const { marks = [] } = params2.node;
26117
- const outputMarks = processOutputMarks(marks);
26118
- const tabNode = {
26119
- name: "w:tab"
26120
- };
26121
- return wrapTextInRun(tabNode, outputMarks);
26122
- }
26123
26338
  function generateTableProperties(node2) {
26124
26339
  const elements = [];
26125
26340
  const { attrs } = node2;
@@ -26958,22 +27173,6 @@ function translateFieldAnnotation(params2) {
26958
27173
  };
26959
27174
  return result;
26960
27175
  }
26961
- function translateHardBreak(params2) {
26962
- const { node: node2 = {} } = params2;
26963
- const { attrs = {} } = node2;
26964
- const { pageBreakSource } = attrs;
26965
- if (pageBreakSource === "sectPr") return null;
26966
- return {
26967
- name: "w:r",
26968
- elements: [
26969
- {
26970
- name: "w:br",
26971
- type: "element",
26972
- attributes: { "w:type": "page" }
26973
- }
26974
- ]
26975
- };
26976
- }
26977
27176
  function translateShapeContainer(params2) {
26978
27177
  const { node: node2 } = params2;
26979
27178
  const elements = translateChildNodes(params2);
@@ -28473,10 +28672,14 @@ const handleParagraphNode = (params2) => {
28473
28672
  } else if (val == "right") {
28474
28673
  val = "end";
28475
28674
  }
28675
+ const rawPos = tab.attributes["w:pos"];
28476
28676
  const tabStop = {
28477
28677
  val,
28478
- pos: twipsToPixels(tab.attributes["w:pos"])
28678
+ pos: twipsToPixels(rawPos)
28479
28679
  };
28680
+ if (rawPos !== void 0) {
28681
+ tabStop.originalPos = rawPos;
28682
+ }
28480
28683
  if (tab.attributes["w:leader"]) {
28481
28684
  tabStop.leader = tab.attributes["w:leader"];
28482
28685
  }
@@ -28829,8 +29032,8 @@ const handleDocPartObj = (params2) => {
28829
29032
  return { nodes: [], consumed: 0 };
28830
29033
  }
28831
29034
  const content = node2?.elements.find((el) => el.name === "w:sdtContent");
28832
- const handler = validGalleryTypeMap[docPartGalleryType];
28833
- const result = handler({ ...params2, nodes: [content] });
29035
+ const handler2 = validGalleryTypeMap[docPartGalleryType];
29036
+ const result = handler2({ ...params2, nodes: [content] });
28834
29037
  return {
28835
29038
  nodes: result,
28836
29039
  consumed: 1
@@ -29096,25 +29299,21 @@ const standardNodeHandlerEntity = {
29096
29299
  handlerName: "standardNodeHandler",
29097
29300
  handler: handleStandardNode
29098
29301
  };
29099
- const handleLineBreakNode = (params2) => {
29302
+ const handler = (params2) => {
29100
29303
  const { nodes } = params2;
29101
29304
  if (nodes.length === 0 || nodes[0].name !== "w:br") {
29102
29305
  return { nodes: [], consumed: 0 };
29103
29306
  }
29104
- const lineBreakType = nodes[0].attributes?.["w:type"];
29105
- const breakType = lineBreakType === "page" ? "hardBreak" : "lineBreak";
29307
+ const result = translator$1.encode(params2);
29308
+ if (!result) return { nodes: [], consumed: 0 };
29106
29309
  return {
29107
- nodes: [
29108
- {
29109
- type: breakType
29110
- }
29111
- ],
29310
+ nodes: [result],
29112
29311
  consumed: 1
29113
29312
  };
29114
29313
  };
29115
29314
  const lineBreakNodeHandlerEntity = {
29116
29315
  handlerName: "lineBreakNodeHandler",
29117
- handler: handleLineBreakNode
29316
+ handler
29118
29317
  };
29119
29318
  const handleBookmarkNode = (params2) => {
29120
29319
  const { nodes, nodeListHandler: nodeListHandler2, editor } = params2;
@@ -29239,34 +29438,6 @@ const autoTotalPageCountEntity = {
29239
29438
  handlerName: "autoTotalPageCountEntity",
29240
29439
  handler: handleAutoTotalPageNumber
29241
29440
  };
29242
- const handleTabNode = (params2) => {
29243
- const { nodes, docx, parentStyleId } = params2;
29244
- if (nodes.length === 0 || nodes[0].name !== "w:tab") {
29245
- return { nodes: [], consumed: 0 };
29246
- }
29247
- const node2 = nodes[0];
29248
- const styles = docx["word/styles.xml"];
29249
- if (styles && styles.elements?.length) {
29250
- const style2 = styles.elements[0]?.elements?.find((s) => s.attributes?.["w:styleId"] === parentStyleId);
29251
- const pPr = style2?.elements?.find((s) => s.name === "w:pPr");
29252
- const tabsDef = pPr?.elements?.find((s) => s.name === "w:tabs");
29253
- const firstTab = tabsDef?.elements?.find((s) => s.name === "w:tab");
29254
- twipsToPixels(firstTab?.attributes?.["w:pos"]);
29255
- }
29256
- const { attributes = {} } = node2;
29257
- const processedNode = {
29258
- type: "tab",
29259
- attrs: {
29260
- tabSize: attributes["w:val"] || 48
29261
- },
29262
- content: []
29263
- };
29264
- return { nodes: [processedNode], consumed: 1 };
29265
- };
29266
- const tabNodeEntityHandler = {
29267
- handlerName: "tabNodeHandler",
29268
- handler: handleTabNode
29269
- };
29270
29441
  const handlePictNode = (params2) => {
29271
29442
  const { nodes } = params2;
29272
29443
  if (!nodes.length || nodes[0].name !== "w:p") {
@@ -29566,6 +29737,18 @@ const getExtendedDetails = (commentEx) => {
29566
29737
  };
29567
29738
  const IGNORED_NODE_NAMES = ["w:proofErr", "w:lastRenderedPageBreak"];
29568
29739
  const pruneIgnoredNodes = (nodes = []) => nodes.filter((node2) => !IGNORED_NODE_NAMES.includes(node2.name)).map((node2) => node2.elements ? { ...node2, elements: pruneIgnoredNodes(node2.elements) } : node2);
29740
+ const handleTabNode = (params2) => {
29741
+ const { nodes } = params2;
29742
+ if (!nodes.length || nodes[0].name !== "w:tab") {
29743
+ return { nodes: [], consumed: 0 };
29744
+ }
29745
+ const node2 = translator.encode(params2);
29746
+ return { nodes: [node2], consumed: 1 };
29747
+ };
29748
+ const tabNodeEntityHandler = {
29749
+ handlerName: "w:tabTranslator",
29750
+ handler: handleTabNode
29751
+ };
29569
29752
  const createDocumentJson = (docx, converter, editor) => {
29570
29753
  const json = carbonCopy(getInitialJSON(docx));
29571
29754
  if (!json) return null;
@@ -29650,11 +29833,10 @@ const defaultNodeListHandler = () => {
29650
29833
  autoPageHandlerEntity,
29651
29834
  autoTotalPageCountEntity,
29652
29835
  standardNodeHandlerEntity
29653
- // This is the last one as it can handle everything
29654
29836
  ];
29655
- const handler = createNodeListHandler(entities);
29837
+ const handler2 = createNodeListHandler(entities);
29656
29838
  return {
29657
- handler,
29839
+ handler: handler2,
29658
29840
  handlerEntities: entities
29659
29841
  };
29660
29842
  };
@@ -29699,9 +29881,9 @@ const createNodeListHandler = (nodeHandlers) => {
29699
29881
  continue;
29700
29882
  }
29701
29883
  const { nodes, consumed, unhandled } = nodeHandlers.reduce(
29702
- (res, handler) => {
29884
+ (res, handler2) => {
29703
29885
  if (res.consumed > 0) return res;
29704
- return handler.handler({
29886
+ return handler2.handler({
29705
29887
  nodes: nodesToHandle,
29706
29888
  docx,
29707
29889
  nodeListHandler: { handler: nodeListHandlerFn, handlerEntities: nodeHandlers },
@@ -33711,10 +33893,10 @@ function mustPreserveItems(state2) {
33711
33893
  }
33712
33894
  const historyKey = new PluginKey("history");
33713
33895
  const closeHistoryKey = new PluginKey("closeHistory");
33714
- function history(config = {}) {
33715
- config = {
33716
- depth: config.depth || 100,
33717
- newGroupDelay: config.newGroupDelay || 500
33896
+ function history(config2 = {}) {
33897
+ config2 = {
33898
+ depth: config2.depth || 100,
33899
+ newGroupDelay: config2.newGroupDelay || 500
33718
33900
  };
33719
33901
  return new Plugin({
33720
33902
  key: historyKey,
@@ -33723,10 +33905,10 @@ function history(config = {}) {
33723
33905
  return new HistoryState(Branch.empty, Branch.empty, null, 0, -1);
33724
33906
  },
33725
33907
  apply(tr, hist, state2) {
33726
- return applyTransaction(hist, state2, tr, config);
33908
+ return applyTransaction(hist, state2, tr, config2);
33727
33909
  }
33728
33910
  },
33729
- config,
33911
+ config: config2,
33730
33912
  props: {
33731
33913
  handleDOMEvents: {
33732
33914
  beforeinput(view, e) {
@@ -33765,7 +33947,7 @@ function redoDepth(state2) {
33765
33947
  return hist ? hist.undone.eventCount : 0;
33766
33948
  }
33767
33949
  class Extension {
33768
- constructor(config) {
33950
+ constructor(config2) {
33769
33951
  __publicField$1(this, "type", "extension");
33770
33952
  __publicField$1(this, "name", "extension");
33771
33953
  __publicField$1(this, "options");
@@ -33775,7 +33957,7 @@ class Extension {
33775
33957
  });
33776
33958
  this.config = {
33777
33959
  ...this.config,
33778
- ...config
33960
+ ...config2
33779
33961
  };
33780
33962
  this.name = this.config.name;
33781
33963
  if (this.config.addOptions) {
@@ -33859,7 +34041,7 @@ let Node$1 = class Node22 {
33859
34041
  /**
33860
34042
  * @param {import('./types/index.js').EditorNodeConfig} config
33861
34043
  */
33862
- constructor(config) {
34044
+ constructor(config2) {
33863
34045
  __publicField$1(this, "type", "node");
33864
34046
  __publicField$1(this, "name", "node");
33865
34047
  __publicField$1(this, "options");
@@ -33872,7 +34054,7 @@ let Node$1 = class Node22 {
33872
34054
  });
33873
34055
  this.config = {
33874
34056
  ...this.config,
33875
- ...config
34057
+ ...config2
33876
34058
  };
33877
34059
  this.name = this.config.name;
33878
34060
  this.group = this.config.group;
@@ -33896,12 +34078,12 @@ let Node$1 = class Node22 {
33896
34078
  * @param {import('./types/index.js').EditorNodeConfig} config - The node configuration.
33897
34079
  * @returns {Node} A new Node instance.
33898
34080
  */
33899
- static create(config) {
33900
- return new Node22(config);
34081
+ static create(config2) {
34082
+ return new Node22(config2);
33901
34083
  }
33902
34084
  };
33903
34085
  class Mark2 {
33904
- constructor(config) {
34086
+ constructor(config2) {
33905
34087
  __publicField$1(this, "type", "mark");
33906
34088
  __publicField$1(this, "name", "mark");
33907
34089
  __publicField$1(this, "options");
@@ -33912,7 +34094,7 @@ class Mark2 {
33912
34094
  });
33913
34095
  this.config = {
33914
34096
  ...this.config,
33915
- ...config
34097
+ ...config2
33916
34098
  };
33917
34099
  this.name = this.config.name;
33918
34100
  this.isExternal = Boolean(this.config.isExternal);
@@ -39165,10 +39347,10 @@ class InputState {
39165
39347
  }
39166
39348
  function initInput(view) {
39167
39349
  for (let event in handlers) {
39168
- let handler = handlers[event];
39350
+ let handler2 = handlers[event];
39169
39351
  view.dom.addEventListener(event, view.input.eventHandlers[event] = (event2) => {
39170
39352
  if (eventBelongsToView(view, event2) && !runCustomHandler(view, event2) && (view.editable || !(event2.type in editHandlers)))
39171
- handler(view, event2);
39353
+ handler2(view, event2);
39172
39354
  }, passiveHandlers[event] ? { passive: true } : void 0);
39173
39355
  }
39174
39356
  if (safari)
@@ -39195,8 +39377,8 @@ function ensureListeners(view) {
39195
39377
  }
39196
39378
  function runCustomHandler(view, event) {
39197
39379
  return view.someProp("handleDOMEvents", (handlers2) => {
39198
- let handler = handlers2[event.type];
39199
- return handler ? handler(view, event) || event.defaultPrevented : false;
39380
+ let handler2 = handlers2[event.type];
39381
+ return handler2 ? handler2(view, event) || event.defaultPrevented : false;
39200
39382
  });
39201
39383
  }
39202
39384
  function eventBelongsToView(view, event) {
@@ -45531,9 +45713,9 @@ const getFieldAttrs = (field, value, input) => {
45531
45713
  yesno: annotateYesNo,
45532
45714
  date: annotateDate
45533
45715
  };
45534
- const handler = annotatorHandlers[type2];
45535
- if (!handler) return {};
45536
- return handler(value, input);
45716
+ const handler2 = annotatorHandlers[type2];
45717
+ if (!handler2) return {};
45718
+ return handler2(value, input);
45537
45719
  };
45538
45720
  const annotateHtml = (value) => ({ rawHtml: value });
45539
45721
  const annotateText = (value) => ({ displayLabel: value });
@@ -48646,15 +48828,15 @@ class DropCursorView {
48646
48828
  this.color = options.color === false ? void 0 : options.color || "black";
48647
48829
  this.class = options.class;
48648
48830
  this.handlers = ["dragover", "dragend", "drop", "dragleave"].map((name) => {
48649
- let handler = (e) => {
48831
+ let handler2 = (e) => {
48650
48832
  this[name](e);
48651
48833
  };
48652
- editorView.dom.addEventListener(name, handler);
48653
- return { name, handler };
48834
+ editorView.dom.addEventListener(name, handler2);
48835
+ return { name, handler: handler2 };
48654
48836
  });
48655
48837
  }
48656
48838
  destroy() {
48657
- this.handlers.forEach(({ name, handler }) => this.editorView.dom.removeEventListener(name, handler));
48839
+ this.handlers.forEach(({ name, handler: handler2 }) => this.editorView.dom.removeEventListener(name, handler2));
48658
48840
  }
48659
48841
  update(editorView, prevState) {
48660
48842
  if (this.cursorPos != null && prevState.doc != editorView.state.doc) {
@@ -50380,8 +50562,8 @@ const LinkedStyles = Extension.create({
50380
50562
  }
50381
50563
  });
50382
50564
  const generateOrderedListIndex = ({ listLevel, lvlText, listNumberingType, customFormat }) => {
50383
- const handler = listIndexMap[listNumberingType];
50384
- return handler ? handler(listLevel, lvlText, customFormat) : null;
50565
+ const handler2 = listIndexMap[listNumberingType];
50566
+ return handler2 ? handler2(listLevel, lvlText, customFormat) : null;
50385
50567
  };
50386
50568
  const handleDecimal = (path, lvlText) => generateNumbering(path, lvlText, String);
50387
50569
  const handleRoman = (path, lvlText) => generateNumbering(path, lvlText, intToRoman);
@@ -51676,6 +51858,22 @@ const LineBreak = Node$1.create({
51676
51858
  renderDOM() {
51677
51859
  return ["br", {}];
51678
51860
  },
51861
+ addAttributes() {
51862
+ return {
51863
+ /**
51864
+ * @private
51865
+ * @category Attribute
51866
+ * @param {string} [lineBreakType] - Type of line break - passthrough in this node
51867
+ */
51868
+ lineBreakType: { rendered: false },
51869
+ /**
51870
+ * @private
51871
+ * @category Attribute
51872
+ * @param {string} [clear] - Clear attribute - passthrough in this node
51873
+ */
51874
+ clear: { rendered: false }
51875
+ };
51876
+ },
51679
51877
  addCommands() {
51680
51878
  return {
51681
51879
  /**
@@ -51732,7 +51930,19 @@ const HardBreak = Node$1.create({
51732
51930
  pageBreakType: {
51733
51931
  default: null,
51734
51932
  rendered: false
51735
- }
51933
+ },
51934
+ /**
51935
+ * @private
51936
+ * @category Attribute
51937
+ * @param {string} [lineBreakType] - Type of line break - passthrough in this node
51938
+ */
51939
+ lineBreakType: { rendered: false },
51940
+ /**
51941
+ * @private
51942
+ * @category Attribute
51943
+ * @param {string} [clear] - Clear attribute - passthrough in this node
51944
+ */
51945
+ clear: { rendered: false }
51736
51946
  };
51737
51947
  },
51738
51948
  parseDOM() {
@@ -57145,10 +57355,10 @@ const BookmarkStart = Node$1.create({
57145
57355
  * insertBookmark({ name: 'introduction', id: 'intro-001' })
57146
57356
  * @note Bookmarks are invisible markers for navigation and cross-references
57147
57357
  */
57148
- insertBookmark: (config) => ({ commands: commands2 }) => {
57358
+ insertBookmark: (config2) => ({ commands: commands2 }) => {
57149
57359
  return commands2.insertContent({
57150
57360
  type: this.name,
57151
- attrs: config
57361
+ attrs: config2
57152
57362
  });
57153
57363
  },
57154
57364
  /**
@@ -57705,10 +57915,10 @@ const ContentBlock = Node$1.create({
57705
57915
  * })
57706
57916
  * @note Used for spacing, dividers, and special inline content
57707
57917
  */
57708
- insertContentBlock: (config) => ({ commands: commands2 }) => {
57918
+ insertContentBlock: (config2) => ({ commands: commands2 }) => {
57709
57919
  return commands2.insertContent({
57710
57920
  type: this.name,
57711
- attrs: config
57921
+ attrs: config2
57712
57922
  });
57713
57923
  }
57714
57924
  };
@@ -61523,17 +61733,17 @@ function createTippy(reference2, passedProps) {
61523
61733
  updateTransitionEndListener(box, "add", listener);
61524
61734
  currentTransitionEndListener = listener;
61525
61735
  }
61526
- function on2(eventType, handler, options) {
61736
+ function on2(eventType, handler2, options) {
61527
61737
  if (options === void 0) {
61528
61738
  options = false;
61529
61739
  }
61530
61740
  var nodes = normalizeToArray(instance.props.triggerTarget || reference2);
61531
61741
  nodes.forEach(function(node2) {
61532
- node2.addEventListener(eventType, handler, options);
61742
+ node2.addEventListener(eventType, handler2, options);
61533
61743
  listeners.push({
61534
61744
  node: node2,
61535
61745
  eventType,
61536
- handler,
61746
+ handler: handler2,
61537
61747
  options
61538
61748
  });
61539
61749
  });
@@ -61567,8 +61777,8 @@ function createTippy(reference2, passedProps) {
61567
61777
  }
61568
61778
  function removeListeners() {
61569
61779
  listeners.forEach(function(_ref) {
61570
- var node2 = _ref.node, eventType = _ref.eventType, handler = _ref.handler, options = _ref.options;
61571
- node2.removeEventListener(eventType, handler, options);
61780
+ var node2 = _ref.node, eventType = _ref.eventType, handler2 = _ref.handler, options = _ref.options;
61781
+ node2.removeEventListener(eventType, handler2, options);
61572
61782
  });
61573
61783
  listeners = [];
61574
61784
  }
@@ -62408,13 +62618,13 @@ function computeCoordsFromPlacement(_ref, placement, rtl) {
62408
62618
  }
62409
62619
  return coords;
62410
62620
  }
62411
- const computePosition$1 = async (reference2, floating, config) => {
62621
+ const computePosition$1 = async (reference2, floating, config2) => {
62412
62622
  const {
62413
62623
  placement = "bottom",
62414
62624
  strategy = "absolute",
62415
62625
  middleware = [],
62416
62626
  platform: platform2
62417
- } = config;
62627
+ } = config2;
62418
62628
  const validMiddleware = middleware.filter(Boolean);
62419
62629
  const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
62420
62630
  let rects = await platform2.getElementRects({
@@ -64019,15 +64229,15 @@ class SearchQuery {
64019
64229
  /**
64020
64230
  Create a query object.
64021
64231
  */
64022
- constructor(config) {
64023
- this.search = config.search;
64024
- this.caseSensitive = !!config.caseSensitive;
64025
- this.literal = !!config.literal;
64026
- this.regexp = !!config.regexp;
64027
- this.replace = config.replace || "";
64232
+ constructor(config2) {
64233
+ this.search = config2.search;
64234
+ this.caseSensitive = !!config2.caseSensitive;
64235
+ this.literal = !!config2.literal;
64236
+ this.regexp = !!config2.regexp;
64237
+ this.replace = config2.replace || "";
64028
64238
  this.valid = !!this.search && !(this.regexp && !validRegExp(this.search));
64029
- this.wholeWord = !!config.wholeWord;
64030
- this.filter = config.filter || null;
64239
+ this.wholeWord = !!config2.wholeWord;
64240
+ this.filter = config2.filter || null;
64031
64241
  this.impl = !this.valid ? nullQuery : this.regexp ? new RegExpQuery(this) : new StringQuery(this);
64032
64242
  }
64033
64243
  /**
@@ -65749,13 +65959,13 @@ const c$2 = function(instance, $2, props, children) {
65749
65959
  return createCNode(instance, $2, props, null);
65750
65960
  }
65751
65961
  };
65752
- function CssRender(config = {}) {
65962
+ function CssRender(config2 = {}) {
65753
65963
  const cssr2 = {
65754
65964
  c: ((...args) => c$2(cssr2, ...args)),
65755
65965
  use: (plugin2, ...args) => plugin2.install(cssr2, ...args),
65756
65966
  find: queryElement,
65757
65967
  context: {},
65758
- config
65968
+ config: config2
65759
65969
  };
65760
65970
  return cssr2;
65761
65971
  }
@@ -66262,21 +66472,21 @@ function createTrapHandler(name, el, originalHandler) {
66262
66472
  );
66263
66473
  return {};
66264
66474
  }
66265
- function ensureTrapHandlers(name, el, handler) {
66475
+ function ensureTrapHandlers(name, el, handler2) {
66266
66476
  const handlers2 = traps[name];
66267
66477
  let elHandlers = handlers2.get(el);
66268
66478
  if (elHandlers === void 0) {
66269
66479
  handlers2.set(el, elHandlers = /* @__PURE__ */ new WeakMap());
66270
66480
  }
66271
- let trapHandler = elHandlers.get(handler);
66481
+ let trapHandler = elHandlers.get(handler2);
66272
66482
  if (trapHandler === void 0) {
66273
- elHandlers.set(handler, trapHandler = createTrapHandler(name, el, handler));
66483
+ elHandlers.set(handler2, trapHandler = createTrapHandler(name, el, handler2));
66274
66484
  }
66275
66485
  return trapHandler;
66276
66486
  }
66277
- function trapOn(name, el, handler, options) {
66487
+ function trapOn(name, el, handler2, options) {
66278
66488
  if (name === "mousemoveoutside" || name === "clickoutside") {
66279
- const trapHandlers = ensureTrapHandlers(name, el, handler);
66489
+ const trapHandlers = ensureTrapHandlers(name, el, handler2);
66280
66490
  Object.keys(trapHandlers).forEach((key) => {
66281
66491
  on(key, document, trapHandlers[key], options);
66282
66492
  });
@@ -66284,9 +66494,9 @@ function trapOn(name, el, handler, options) {
66284
66494
  }
66285
66495
  return false;
66286
66496
  }
66287
- function trapOff(name, el, handler, options) {
66497
+ function trapOff(name, el, handler2, options) {
66288
66498
  if (name === "mousemoveoutside" || name === "clickoutside") {
66289
- const trapHandlers = ensureTrapHandlers(name, el, handler);
66499
+ const trapHandlers = ensureTrapHandlers(name, el, handler2);
66290
66500
  Object.keys(trapHandlers).forEach((key) => {
66291
66501
  off(key, document, trapHandlers[key], options);
66292
66502
  });
@@ -66376,19 +66586,19 @@ function createDelegate() {
66376
66586
  const handlers2 = captureElToHandlers.get(target2);
66377
66587
  if (handlers2 !== void 0) {
66378
66588
  currentTargets.set(e, target2);
66379
- for (const handler of handlers2) {
66589
+ for (const handler2 of handlers2) {
66380
66590
  if (immediatePropagationStopped.has(e))
66381
66591
  break;
66382
- handler(e);
66592
+ handler2(e);
66383
66593
  }
66384
66594
  }
66385
66595
  if (i === 0 && !bubbles && bubbleElToHandlers !== void 0) {
66386
66596
  const bubbleHandlers = bubbleElToHandlers.get(target2);
66387
66597
  if (bubbleHandlers !== void 0) {
66388
- for (const handler of bubbleHandlers) {
66598
+ for (const handler2 of bubbleHandlers) {
66389
66599
  if (immediatePropagationStopped.has(e))
66390
66600
  break;
66391
- handler(e);
66601
+ handler2(e);
66392
66602
  }
66393
66603
  }
66394
66604
  }
@@ -66403,10 +66613,10 @@ function createDelegate() {
66403
66613
  const handlers2 = bubbleElToHandlers.get(target2);
66404
66614
  if (handlers2 !== void 0) {
66405
66615
  currentTargets.set(e, target2);
66406
- for (const handler of handlers2) {
66616
+ for (const handler2 of handlers2) {
66407
66617
  if (immediatePropagationStopped.has(e))
66408
66618
  break;
66409
- handler(e);
66619
+ handler2(e);
66410
66620
  }
66411
66621
  }
66412
66622
  }
@@ -66426,7 +66636,7 @@ function createDelegate() {
66426
66636
  const handlers2 = typeToWindowEventHandlers[type2];
66427
66637
  if (handlers2 === void 0)
66428
66638
  return;
66429
- handlers2.forEach((handler) => handler(e));
66639
+ handlers2.forEach((handler2) => handler2(e));
66430
66640
  };
66431
66641
  delegateHandler.displayName = "evtdUnifiedWindowEventHandler";
66432
66642
  return delegateHandler;
@@ -66456,35 +66666,35 @@ function createDelegate() {
66456
66666
  }
66457
66667
  return elHandlers;
66458
66668
  }
66459
- function handlerExist(el, phase, type2, handler) {
66669
+ function handlerExist(el, phase, type2, handler2) {
66460
66670
  const elToHandlers = phaseToTypeToElToHandlers[phase][type2];
66461
66671
  if (elToHandlers !== void 0) {
66462
66672
  const handlers2 = elToHandlers.get(el);
66463
66673
  if (handlers2 !== void 0) {
66464
- if (handlers2.has(handler))
66674
+ if (handlers2.has(handler2))
66465
66675
  return true;
66466
66676
  }
66467
66677
  }
66468
66678
  return false;
66469
66679
  }
66470
- function windowEventHandlerExist(type2, handler) {
66680
+ function windowEventHandlerExist(type2, handler2) {
66471
66681
  const handlers2 = typeToWindowEventHandlers[type2];
66472
66682
  if (handlers2 !== void 0) {
66473
- if (handlers2.has(handler)) {
66683
+ if (handlers2.has(handler2)) {
66474
66684
  return true;
66475
66685
  }
66476
66686
  }
66477
66687
  return false;
66478
66688
  }
66479
- function on2(type2, el, handler, options) {
66689
+ function on2(type2, el, handler2, options) {
66480
66690
  let mergedHandler;
66481
66691
  if (typeof options === "object" && options.once === true) {
66482
66692
  mergedHandler = (e) => {
66483
66693
  off2(type2, el, mergedHandler, options);
66484
- handler(e);
66694
+ handler2(e);
66485
66695
  };
66486
66696
  } else {
66487
- mergedHandler = handler;
66697
+ mergedHandler = handler2;
66488
66698
  }
66489
66699
  const trapped = trapOn(type2, el, mergedHandler, options);
66490
66700
  if (trapped)
@@ -66501,8 +66711,8 @@ function createDelegate() {
66501
66711
  }
66502
66712
  }
66503
66713
  }
66504
- function off2(type2, el, handler, options) {
66505
- const trapped = trapOff(type2, el, handler, options);
66714
+ function off2(type2, el, handler2, options) {
66715
+ const trapped = trapOff(type2, el, handler2, options);
66506
66716
  if (trapped)
66507
66717
  return;
66508
66718
  const capture = options === true || typeof options === "object" && options.capture === true;
@@ -66511,17 +66721,17 @@ function createDelegate() {
66511
66721
  const handlers2 = ensureHandlers(elToHandlers, el);
66512
66722
  if (el === window) {
66513
66723
  const mirrorPhase = capture ? "bubble" : "capture";
66514
- if (!handlerExist(el, mirrorPhase, type2, handler) && windowEventHandlerExist(type2, handler)) {
66724
+ if (!handlerExist(el, mirrorPhase, type2, handler2) && windowEventHandlerExist(type2, handler2)) {
66515
66725
  const windowEventHandlers = typeToWindowEventHandlers[type2];
66516
- windowEventHandlers.delete(handler);
66726
+ windowEventHandlers.delete(handler2);
66517
66727
  if (windowEventHandlers.size === 0) {
66518
66728
  window.removeEventListener(type2, unfiendWindowEventHandler);
66519
66729
  typeToWindowEventHandlers[type2] = void 0;
66520
66730
  }
66521
66731
  }
66522
66732
  }
66523
- if (handlers2.has(handler))
66524
- handlers2.delete(handler);
66733
+ if (handlers2.has(handler2))
66734
+ handlers2.delete(handler2);
66525
66735
  if (handlers2.size === 0) {
66526
66736
  elToHandlers.delete(el);
66527
66737
  }
@@ -66667,16 +66877,16 @@ function useKeyboard(options = {}, enabledRef) {
66667
66877
  Object.keys(keydown).forEach((key) => {
66668
66878
  if (key !== e.key)
66669
66879
  return;
66670
- const handler = keydown[key];
66671
- if (typeof handler === "function") {
66672
- handler(e);
66880
+ const handler2 = keydown[key];
66881
+ if (typeof handler2 === "function") {
66882
+ handler2(e);
66673
66883
  } else {
66674
- const { stop = false, prevent = false } = handler;
66884
+ const { stop = false, prevent = false } = handler2;
66675
66885
  if (stop)
66676
66886
  e.stopPropagation();
66677
66887
  if (prevent)
66678
66888
  e.preventDefault();
66679
- handler.handler(e);
66889
+ handler2.handler(e);
66680
66890
  }
66681
66891
  });
66682
66892
  }
@@ -66701,16 +66911,16 @@ function useKeyboard(options = {}, enabledRef) {
66701
66911
  Object.keys(keyup).forEach((key) => {
66702
66912
  if (key !== e.key)
66703
66913
  return;
66704
- const handler = keyup[key];
66705
- if (typeof handler === "function") {
66706
- handler(e);
66914
+ const handler2 = keyup[key];
66915
+ if (typeof handler2 === "function") {
66916
+ handler2(e);
66707
66917
  } else {
66708
- const { stop = false, prevent = false } = handler;
66918
+ const { stop = false, prevent = false } = handler2;
66709
66919
  if (stop)
66710
66920
  e.stopPropagation();
66711
66921
  if (prevent)
66712
66922
  e.preventDefault();
66713
- handler.handler(e);
66923
+ handler2.handler(e);
66714
66924
  }
66715
66925
  });
66716
66926
  }
@@ -67128,9 +67338,9 @@ const mousemoveoutside = {
67128
67338
  }
67129
67339
  },
67130
67340
  unmounted(el) {
67131
- const { handler } = el[ctxKey$1];
67132
- if (handler) {
67133
- off("mousemoveoutside", el, handler);
67341
+ const { handler: handler2 } = el[ctxKey$1];
67342
+ if (handler2) {
67343
+ off("mousemoveoutside", el, handler2);
67134
67344
  }
67135
67345
  el[ctxKey$1].handler = void 0;
67136
67346
  }
@@ -67177,9 +67387,9 @@ const clickoutside = {
67177
67387
  }
67178
67388
  },
67179
67389
  unmounted(el, { modifiers: modifiers2 }) {
67180
- const { handler } = el[ctxKey];
67181
- if (handler) {
67182
- off("clickoutside", el, handler, {
67390
+ const { handler: handler2 } = el[ctxKey];
67391
+ if (handler2) {
67392
+ off("clickoutside", el, handler2, {
67183
67393
  capture: modifiers2.capture
67184
67394
  });
67185
67395
  }
@@ -68168,10 +68378,10 @@ var queueMicroTask = function(callback) {
68168
68378
  if (!trigger) {
68169
68379
  var toggle_1 = 0;
68170
68380
  var el_1 = document.createTextNode("");
68171
- var config = { characterData: true };
68381
+ var config2 = { characterData: true };
68172
68382
  new MutationObserver(function() {
68173
68383
  return notify();
68174
- }).observe(el_1, config);
68384
+ }).observe(el_1, config2);
68175
68385
  trigger = function() {
68176
68386
  el_1.textContent = "".concat(toggle_1 ? toggle_1-- : toggle_1++);
68177
68387
  };
@@ -68415,14 +68625,14 @@ class ResizeObserverDelegate {
68415
68625
  }
68416
68626
  handleResize(entries) {
68417
68627
  for (const entry of entries) {
68418
- const handler = this.elHandlersMap.get(entry.target);
68419
- if (handler !== void 0) {
68420
- handler(entry);
68628
+ const handler2 = this.elHandlersMap.get(entry.target);
68629
+ if (handler2 !== void 0) {
68630
+ handler2(entry);
68421
68631
  }
68422
68632
  }
68423
68633
  }
68424
- registerHandler(el, handler) {
68425
- this.elHandlersMap.set(el, handler);
68634
+ registerHandler(el, handler2) {
68635
+ this.elHandlersMap.set(el, handler2);
68426
68636
  this.observer.observe(el);
68427
68637
  }
68428
68638
  unregisterHandler(el) {
@@ -72691,13 +72901,13 @@ function appendEvents(vNode, trigger2, events2) {
72691
72901
  vNode.props = Object.assign({}, vNode.props);
72692
72902
  }
72693
72903
  const originalHandler = vNode.props[eventName];
72694
- const handler = events2[eventName];
72904
+ const handler2 = events2[eventName];
72695
72905
  if (!originalHandler) {
72696
- vNode.props[eventName] = handler;
72906
+ vNode.props[eventName] = handler2;
72697
72907
  } else {
72698
72908
  vNode.props[eventName] = (...args) => {
72699
72909
  originalHandler(...args);
72700
- handler(...args);
72910
+ handler2(...args);
72701
72911
  };
72702
72912
  }
72703
72913
  });
@@ -78007,7 +78217,7 @@ class SuperToolbar extends EventEmitter2 {
78007
78217
  * @param {ToolbarConfig} config - The configuration for the toolbar
78008
78218
  * @returns {void}
78009
78219
  */
78010
- constructor(config) {
78220
+ constructor(config2) {
78011
78221
  super();
78012
78222
  __privateAdd(this, _SuperToolbar_instances);
78013
78223
  __publicField(this, "config", {
@@ -78286,27 +78496,27 @@ class SuperToolbar extends EventEmitter2 {
78286
78496
  __privateMethod(this, _SuperToolbar_instances, deactivateAll_fn).call(this);
78287
78497
  }
78288
78498
  });
78289
- this.config = { ...this.config, ...config };
78499
+ this.config = { ...this.config, ...config2 };
78290
78500
  this.toolbarItems = [];
78291
78501
  this.overflowItems = [];
78292
- this.documentMode = config.documentMode || "editing";
78293
- this.isDev = config.isDev || false;
78294
- this.superdoc = config.superdoc;
78295
- this.role = config.role || "editor";
78502
+ this.documentMode = config2.documentMode || "editing";
78503
+ this.isDev = config2.isDev || false;
78504
+ this.superdoc = config2.superdoc;
78505
+ this.role = config2.role || "editor";
78296
78506
  this.toolbarContainer = null;
78297
78507
  if (this.config.editor) {
78298
78508
  this.config.mode = this.config.editor.options.mode;
78299
78509
  }
78300
78510
  this.config.icons = {
78301
78511
  ...toolbarIcons,
78302
- ...config.icons
78512
+ ...config2.icons
78303
78513
  };
78304
78514
  this.config.texts = {
78305
78515
  ...toolbarTexts,
78306
- ...config.texts
78516
+ ...config2.texts
78307
78517
  };
78308
- this.config.hideButtons = config.hideButtons ?? true;
78309
- this.config.responsiveToContainer = config.responsiveToContainer ?? false;
78518
+ this.config.hideButtons = config2.hideButtons ?? true;
78519
+ this.config.responsiveToContainer = config2.responsiveToContainer ?? false;
78310
78520
  if (!this.config.selector && this.config.element) {
78311
78521
  this.config.selector = this.config.element;
78312
78522
  }
@@ -78318,7 +78528,7 @@ class SuperToolbar extends EventEmitter2 {
78318
78528
  texts: this.config.texts,
78319
78529
  fonts: this.config.fonts,
78320
78530
  hideButtons: this.config.hideButtons,
78321
- isDev: config.isDev
78531
+ isDev: config2.isDev
78322
78532
  });
78323
78533
  if (this.config.selector && !this.toolbarContainer) {
78324
78534
  return;
@@ -78329,7 +78539,7 @@ class SuperToolbar extends EventEmitter2 {
78329
78539
  if (this.toolbarContainer) {
78330
78540
  this.toolbar = this.app.mount(this.toolbarContainer);
78331
78541
  }
78332
- this.activeEditor = config.editor || null;
78542
+ this.activeEditor = config2.editor || null;
78333
78543
  this.updateToolbarState();
78334
78544
  }
78335
78545
  findElementBySelector(selector) {
@@ -80036,6 +80246,10 @@ const _sfc_main = {
80036
80246
  }
80037
80247
  };
80038
80248
  const SuperInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4d5cff52"]]);
80249
+ const registeredHandlers = Object.freeze({
80250
+ "w:br": translator$1,
80251
+ "w:tab": translator
80252
+ });
80039
80253
  const Extensions = {
80040
80254
  Node: Node$1,
80041
80255
  Attribute: Attribute2,
@@ -80067,5 +80281,6 @@ export {
80067
80281
  getRichTextExtensions as n,
80068
80282
  getStarterExtensions as o,
80069
80283
  helpers as p,
80070
- index as q
80284
+ index as q,
80285
+ registeredHandlers as r
80071
80286
  };