@harbour-enterprises/superdoc 0.19.0-next.7 → 0.19.0-next.9

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 (26) hide show
  1. package/dist/chunks/{PdfViewer-DtzjcoY1.cjs → PdfViewer-Br7tqQjO.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-BUcY_aLU.es.js → PdfViewer-Dt_ISEZh.es.js} +1 -1
  3. package/dist/chunks/{index-BfPgSGCT.es.js → index-BijsfKdg.es.js} +2 -2
  4. package/dist/chunks/{index-Dic-WukZ.cjs → index-DroNZHhs.cjs} +2 -2
  5. package/dist/chunks/{super-editor.es-BxWpMXrO.cjs → super-editor.es-D7MlgnUc.cjs} +99 -7
  6. package/dist/chunks/{super-editor.es-ZzKFiBVd.es.js → super-editor.es-DT9O7SCK.es.js} +99 -7
  7. package/dist/core/SuperDoc.d.ts.map +1 -1
  8. package/dist/super-editor/ai-writer.es.js +2 -2
  9. package/dist/super-editor/chunks/{converter-D7JstO1X.js → converter-DPiYwzDY.js} +11 -6
  10. package/dist/super-editor/chunks/{docx-zipper-CxuVkw7R.js → docx-zipper-CS-lB2JG.js} +1 -1
  11. package/dist/super-editor/chunks/{editor-C3cafdFa.js → editor-BqdYfCl0.js} +90 -3
  12. package/dist/super-editor/chunks/{toolbar-BSez2SLg.js → toolbar-Dr4JWMZ7.js} +2 -2
  13. package/dist/super-editor/converter.es.js +1 -1
  14. package/dist/super-editor/docx-zipper.es.js +2 -2
  15. package/dist/super-editor/editor.es.js +3 -3
  16. package/dist/super-editor/file-zipper.es.js +1 -1
  17. package/dist/super-editor/src/core/inputRules/html/transform-copied-lists.d.ts +3 -0
  18. package/dist/super-editor/super-editor.es.js +6 -6
  19. package/dist/super-editor/toolbar.es.js +2 -2
  20. package/dist/super-editor.cjs +1 -1
  21. package/dist/super-editor.es.js +1 -1
  22. package/dist/superdoc.cjs +2 -2
  23. package/dist/superdoc.es.js +2 -2
  24. package/dist/superdoc.umd.js +99 -7
  25. package/dist/superdoc.umd.js.map +1 -1
  26. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-BSez2SLg.js";
3
- import "./chunks/editor-C3cafdFa.js";
2
+ import { T } from "./chunks/toolbar-Dr4JWMZ7.js";
3
+ import "./chunks/editor-BqdYfCl0.js";
4
4
  export {
5
5
  T as default
6
6
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-BxWpMXrO.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-D7MlgnUc.cjs");
4
4
  require("./chunks/vue-DWle4Cai.cjs");
5
5
  exports.AIWriter = superEditor_es.AIWriter;
6
6
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
@@ -1,4 +1,4 @@
1
- import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-ZzKFiBVd.es.js";
1
+ import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-DT9O7SCK.es.js";
2
2
  import "./chunks/vue-CXxsqYcP.es.js";
3
3
  export {
4
4
  A as AIWriter,
package/dist/superdoc.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-BxWpMXrO.cjs");
4
- const superdoc = require("./chunks/index-Dic-WukZ.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-D7MlgnUc.cjs");
4
+ const superdoc = require("./chunks/index-DroNZHhs.cjs");
5
5
  require("./chunks/vue-DWle4Cai.cjs");
6
6
  require("./chunks/jszip-b7l8QkfH.cjs");
7
7
  const blankDocx = require("./chunks/blank-docx-CPqX9RF5.cjs");
@@ -1,5 +1,5 @@
1
- import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-ZzKFiBVd.es.js";
2
- import { D, H, P, S as S2, m, l } from "./chunks/index-BfPgSGCT.es.js";
1
+ import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-DT9O7SCK.es.js";
2
+ import { D, H, P, S as S2, m, l } from "./chunks/index-BijsfKdg.es.js";
3
3
  import "./chunks/vue-CXxsqYcP.es.js";
4
4
  import "./chunks/jszip-B8KIZSNe.es.js";
5
5
  import { B } from "./chunks/blank-docx-iwdyG9RH.es.js";
@@ -33800,11 +33800,16 @@ Please report this to https://github.com/markedjs/marked.`, e) {
33800
33800
  };
33801
33801
  const translator$1 = NodeTranslator.from(config$1);
33802
33802
  function parseTagValueJSON(json) {
33803
+ if (typeof json !== "string") {
33804
+ return {};
33805
+ }
33806
+ const trimmed = json.trim();
33807
+ if (!trimmed) {
33808
+ return {};
33809
+ }
33803
33810
  try {
33804
- const attrs = JSON.parse(json);
33805
- return attrs;
33811
+ return JSON.parse(trimmed);
33806
33812
  } catch (err) {
33807
- console.error(err);
33808
33813
  return {};
33809
33814
  }
33810
33815
  }
@@ -34728,9 +34733,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34728
34733
  const nestedLists = getNestedLists([li.nextSibling]);
34729
34734
  const newList = createSingleItemList({ li, tag, rootNumId, level, listLevel, editor, NodeInterface });
34730
34735
  newLists.push(newList);
34731
- nestedLists.forEach((list) => {
34732
- newLists.push(list.cloneNode(true));
34733
- });
34736
+ if (nestedLists.length > 0) {
34737
+ newLists.push(nestedLists[0].cloneNode(true));
34738
+ }
34734
34739
  if (nestedLists.length && ["OL", "UL"].includes(li.nextSibling.tagName)) {
34735
34740
  li.nextSibling?.remove();
34736
34741
  }
@@ -41876,7 +41881,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
41876
41881
  var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
41877
41882
  var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
41878
41883
  var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
41879
- var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _ListItemNodeView_instances, init_fn2, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _DocumentSectionView_instances, init_fn3, addToolTip_fn;
41884
+ var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _editor, _stateValidators, _xmlValidators, _requiredNodeTypes, _requiredMarkTypes, _SuperValidator_instances, initializeValidators_fn, collectValidatorRequirements_fn, analyzeDocument_fn, _commandService, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, registerCopyHandler_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, createSchema_fn, generatePmData_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, handleNodeSelection_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, validateDocumentInit_fn, validateDocumentExport_fn, initDevTools_fn, _ListItemNodeView_instances, init_fn2, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn, _DocumentSectionView_instances, init_fn3, addToolTip_fn;
41880
41885
  var GOOD_LEAF_SIZE = 200;
41881
41886
  var RopeSequence = function RopeSequence2() {
41882
41887
  };
@@ -55718,6 +55723,77 @@ Please report this to https://github.com/markedjs/marked.`, e) {
55718
55723
  doc2.descendants(collectElements);
55719
55724
  return analysis;
55720
55725
  };
55726
+ const transformListsInCopiedContent = (html) => {
55727
+ const container = document.createElement("div");
55728
+ container.innerHTML = html;
55729
+ const result = [];
55730
+ const stack2 = [];
55731
+ const flushStackUntil = (level) => {
55732
+ while (stack2.length && stack2[stack2.length - 1].level >= level) {
55733
+ const top2 = stack2.pop();
55734
+ if (stack2.length) {
55735
+ stack2[stack2.length - 1].el.appendChild(top2.el);
55736
+ } else {
55737
+ result.push(top2.el.outerHTML);
55738
+ }
55739
+ }
55740
+ };
55741
+ Array.from(container.childNodes).forEach((node) => {
55742
+ if (node.nodeType !== Node.ELEMENT_NODE) {
55743
+ result.push(node.outerHTML || node.textContent);
55744
+ return;
55745
+ }
55746
+ if (node.tagName.toLowerCase() === "ol" || node.tagName.toLowerCase() === "ul") {
55747
+ const child = getFirstElementChild(node);
55748
+ const level = getLevel(child);
55749
+ const numFmt = child.getAttribute("data-num-fmt");
55750
+ const lvlText = child.getAttribute("data-lvl-text");
55751
+ const tag = node.tagName.toLowerCase();
55752
+ const li = child.cloneNode(true);
55753
+ li.setAttribute("aria-level", level + 1);
55754
+ li.style["list-style-type"] = getListStyleType(numFmt, lvlText);
55755
+ if (!stack2.length || stack2[stack2.length - 1].level < level) {
55756
+ const newList = document.createElement(tag);
55757
+ stack2.push({ tag, level, el: newList });
55758
+ } else if (stack2[stack2.length - 1].level > level) {
55759
+ flushStackUntil(level + 1);
55760
+ } else if (stack2[stack2.length - 1].tag !== tag) {
55761
+ flushStackUntil(level);
55762
+ const newList = document.createElement(tag);
55763
+ stack2.push({ tag, level, el: newList });
55764
+ }
55765
+ stack2[stack2.length - 1].el.appendChild(li);
55766
+ } else {
55767
+ flushStackUntil(0);
55768
+ result.push(node.outerHTML);
55769
+ }
55770
+ });
55771
+ flushStackUntil(0);
55772
+ return result.join("");
55773
+ };
55774
+ const getListStyleType = (numFmt, lvlText) => {
55775
+ const bulletFmtMap = /* @__PURE__ */ new Map([
55776
+ ["●", "disc"],
55777
+ ["◦", "circle"],
55778
+ ["▪", "square"]
55779
+ ]);
55780
+ if (numFmt === "bullet") return bulletFmtMap.get(lvlText) || "disc";
55781
+ const fmtMap = /* @__PURE__ */ new Map([
55782
+ ["decimal", "decimal"],
55783
+ ["lowerLetter", "lower-alpha"],
55784
+ ["upperLetter", "upper-alpha"],
55785
+ ["lowerRoman", "lower-roman"],
55786
+ ["upperRoman", "upper-roman"]
55787
+ ]);
55788
+ return lvlText.startsWith("0") ? "decimal-leading-zero" : fmtMap.get(numFmt);
55789
+ };
55790
+ function getFirstElementChild(node) {
55791
+ return Array.from(node.childNodes).find((n) => n.nodeType === Node.ELEMENT_NODE) || null;
55792
+ }
55793
+ const getLevel = (node) => {
55794
+ const lvl = node.getAttribute("data-level");
55795
+ return lvl ? parseInt(lvl, 10) : 0;
55796
+ };
55721
55797
  const _Editor = class _Editor2 extends EventEmitter$2 {
55722
55798
  /**
55723
55799
  * Create a new Editor instance
@@ -56713,6 +56789,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
56713
56789
  }
56714
56790
  }
56715
56791
  __privateMethod$1(this, _Editor_instances, initDevTools_fn).call(this);
56792
+ __privateMethod$1(this, _Editor_instances, registerCopyHandler_fn).call(this);
56716
56793
  };
56717
56794
  initRichText_fn = function() {
56718
56795
  if (!this.options.extensions || !this.options.extensions.length) {
@@ -56751,6 +56828,21 @@ Please report this to https://github.com/markedjs/marked.`, e) {
56751
56828
  global$3.window = options.mockWindow;
56752
56829
  }
56753
56830
  };
56831
+ registerCopyHandler_fn = function() {
56832
+ this.view.dom.addEventListener("copy", (event) => {
56833
+ const clipboardData = event.clipboardData;
56834
+ if (!clipboardData) return;
56835
+ event.preventDefault();
56836
+ const { from: from2, to } = this.view.state.selection;
56837
+ const slice2 = this.view.state.doc.slice(from2, to);
56838
+ const fragment = slice2.content;
56839
+ const div2 = document.createElement("div");
56840
+ const serializer = DOMSerializer.fromSchema(this.view.state.schema);
56841
+ div2.appendChild(serializer.serializeFragment(fragment));
56842
+ const html = transformListsInCopiedContent(div2.innerHTML);
56843
+ clipboardData.setData("text/html", html);
56844
+ });
56845
+ };
56754
56846
  insertNewFileData_fn = function() {
56755
56847
  if (!this.options.isNewFile) return;
56756
56848
  this.options.isNewFile = false;