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

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-HREDD6qb.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-BUcY_aLU.es.js → PdfViewer-fT3KFJal.es.js} +1 -1
  3. package/dist/chunks/{index-BfPgSGCT.es.js → index-CSvNxbRW.es.js} +2 -2
  4. package/dist/chunks/{index-Dic-WukZ.cjs → index-wEO3Mdf3.cjs} +2 -2
  5. package/dist/chunks/{super-editor.es-ZzKFiBVd.es.js → super-editor.es-C_ozmHgp.es.js} +91 -4
  6. package/dist/chunks/{super-editor.es-BxWpMXrO.cjs → super-editor.es-D4jQmQ_2.cjs} +91 -4
  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-B0DE5RlJ.js} +3 -3
  10. package/dist/super-editor/chunks/{docx-zipper-CxuVkw7R.js → docx-zipper-CynIq8Em.js} +1 -1
  11. package/dist/super-editor/chunks/{editor-C3cafdFa.js → editor-W_wtetmC.js} +90 -3
  12. package/dist/super-editor/chunks/{toolbar-BSez2SLg.js → toolbar-BzRxJlN2.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 +91 -4
  25. package/dist/superdoc.umd.js.map +1 -1
  26. package/package.json +1 -1
@@ -34728,9 +34728,9 @@ Please report this to https://github.com/markedjs/marked.`, e) {
34728
34728
  const nestedLists = getNestedLists([li.nextSibling]);
34729
34729
  const newList = createSingleItemList({ li, tag, rootNumId, level, listLevel, editor, NodeInterface });
34730
34730
  newLists.push(newList);
34731
- nestedLists.forEach((list) => {
34732
- newLists.push(list.cloneNode(true));
34733
- });
34731
+ if (nestedLists.length > 0) {
34732
+ newLists.push(nestedLists[0].cloneNode(true));
34733
+ }
34734
34734
  if (nestedLists.length && ["OL", "UL"].includes(li.nextSibling.tagName)) {
34735
34735
  li.nextSibling?.remove();
34736
34736
  }
@@ -41876,7 +41876,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
41876
41876
  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
41877
  var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
41878
41878
  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;
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, 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
41880
  var GOOD_LEAF_SIZE = 200;
41881
41881
  var RopeSequence = function RopeSequence2() {
41882
41882
  };
@@ -55718,6 +55718,77 @@ Please report this to https://github.com/markedjs/marked.`, e) {
55718
55718
  doc2.descendants(collectElements);
55719
55719
  return analysis;
55720
55720
  };
55721
+ const transformListsInCopiedContent = (html) => {
55722
+ const container = document.createElement("div");
55723
+ container.innerHTML = html;
55724
+ const result = [];
55725
+ const stack2 = [];
55726
+ const flushStackUntil = (level) => {
55727
+ while (stack2.length && stack2[stack2.length - 1].level >= level) {
55728
+ const top2 = stack2.pop();
55729
+ if (stack2.length) {
55730
+ stack2[stack2.length - 1].el.appendChild(top2.el);
55731
+ } else {
55732
+ result.push(top2.el.outerHTML);
55733
+ }
55734
+ }
55735
+ };
55736
+ Array.from(container.childNodes).forEach((node) => {
55737
+ if (node.nodeType !== Node.ELEMENT_NODE) {
55738
+ result.push(node.outerHTML || node.textContent);
55739
+ return;
55740
+ }
55741
+ if (node.tagName.toLowerCase() === "ol" || node.tagName.toLowerCase() === "ul") {
55742
+ const child = getFirstElementChild(node);
55743
+ const level = getLevel(child);
55744
+ const numFmt = child.getAttribute("data-num-fmt");
55745
+ const lvlText = child.getAttribute("data-lvl-text");
55746
+ const tag = node.tagName.toLowerCase();
55747
+ const li = child.cloneNode(true);
55748
+ li.setAttribute("aria-level", level + 1);
55749
+ li.style["list-style-type"] = getListStyleType(numFmt, lvlText);
55750
+ if (!stack2.length || stack2[stack2.length - 1].level < level) {
55751
+ const newList = document.createElement(tag);
55752
+ stack2.push({ tag, level, el: newList });
55753
+ } else if (stack2[stack2.length - 1].level > level) {
55754
+ flushStackUntil(level + 1);
55755
+ } else if (stack2[stack2.length - 1].tag !== tag) {
55756
+ flushStackUntil(level);
55757
+ const newList = document.createElement(tag);
55758
+ stack2.push({ tag, level, el: newList });
55759
+ }
55760
+ stack2[stack2.length - 1].el.appendChild(li);
55761
+ } else {
55762
+ flushStackUntil(0);
55763
+ result.push(node.outerHTML);
55764
+ }
55765
+ });
55766
+ flushStackUntil(0);
55767
+ return result.join("");
55768
+ };
55769
+ const getListStyleType = (numFmt, lvlText) => {
55770
+ const bulletFmtMap = /* @__PURE__ */ new Map([
55771
+ ["●", "disc"],
55772
+ ["◦", "circle"],
55773
+ ["▪", "square"]
55774
+ ]);
55775
+ if (numFmt === "bullet") return bulletFmtMap.get(lvlText) || "disc";
55776
+ const fmtMap = /* @__PURE__ */ new Map([
55777
+ ["decimal", "decimal"],
55778
+ ["lowerLetter", "lower-alpha"],
55779
+ ["upperLetter", "upper-alpha"],
55780
+ ["lowerRoman", "lower-roman"],
55781
+ ["upperRoman", "upper-roman"]
55782
+ ]);
55783
+ return lvlText.startsWith("0") ? "decimal-leading-zero" : fmtMap.get(numFmt);
55784
+ };
55785
+ function getFirstElementChild(node) {
55786
+ return Array.from(node.childNodes).find((n) => n.nodeType === Node.ELEMENT_NODE) || null;
55787
+ }
55788
+ const getLevel = (node) => {
55789
+ const lvl = node.getAttribute("data-level");
55790
+ return lvl ? parseInt(lvl, 10) : 0;
55791
+ };
55721
55792
  const _Editor = class _Editor2 extends EventEmitter$2 {
55722
55793
  /**
55723
55794
  * Create a new Editor instance
@@ -56713,6 +56784,7 @@ Please report this to https://github.com/markedjs/marked.`, e) {
56713
56784
  }
56714
56785
  }
56715
56786
  __privateMethod$1(this, _Editor_instances, initDevTools_fn).call(this);
56787
+ __privateMethod$1(this, _Editor_instances, registerCopyHandler_fn).call(this);
56716
56788
  };
56717
56789
  initRichText_fn = function() {
56718
56790
  if (!this.options.extensions || !this.options.extensions.length) {
@@ -56751,6 +56823,21 @@ Please report this to https://github.com/markedjs/marked.`, e) {
56751
56823
  global$3.window = options.mockWindow;
56752
56824
  }
56753
56825
  };
56826
+ registerCopyHandler_fn = function() {
56827
+ this.view.dom.addEventListener("copy", (event) => {
56828
+ const clipboardData = event.clipboardData;
56829
+ if (!clipboardData) return;
56830
+ event.preventDefault();
56831
+ const { from: from2, to } = this.view.state.selection;
56832
+ const slice2 = this.view.state.doc.slice(from2, to);
56833
+ const fragment = slice2.content;
56834
+ const div2 = document.createElement("div");
56835
+ const serializer = DOMSerializer.fromSchema(this.view.state.schema);
56836
+ div2.appendChild(serializer.serializeFragment(fragment));
56837
+ const html = transformListsInCopiedContent(div2.innerHTML);
56838
+ clipboardData.setData("text/html", html);
56839
+ });
56840
+ };
56754
56841
  insertNewFileData_fn = function() {
56755
56842
  if (!this.options.isNewFile) return;
56756
56843
  this.options.isNewFile = false;