@harbour-enterprises/superdoc 0.20.0-next.2 → 0.20.0-next.4

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 (49) hide show
  1. package/dist/chunks/{PdfViewer-_tL5RYr9.es.js → PdfViewer-BjZBgs8x.es.js} +1 -1
  2. package/dist/chunks/{PdfViewer-B6adMXJl.cjs → PdfViewer-Ne_-LxpG.cjs} +1 -1
  3. package/dist/chunks/{index-DwXeHvLq.es.js → index-BVjAJUtV.es.js} +2 -2
  4. package/dist/chunks/{index-mjjKSLDT.cjs → index-OFvCtpf7.cjs} +2 -2
  5. package/dist/chunks/{super-editor.es-DJHyk0Zs.cjs → super-editor.es-CCU9etUT.cjs} +1101 -715
  6. package/dist/chunks/{super-editor.es-CPrd1wq8.es.js → super-editor.es-DgTNVbvS.es.js} +1101 -715
  7. package/dist/core/SuperDoc.d.ts.map +1 -1
  8. package/dist/style.css +38 -0
  9. package/dist/super-editor/ai-writer.es.js +2 -2
  10. package/dist/super-editor/chunks/{converter-KHB8spG5.js → converter-BPTfSIJf.js} +919 -813
  11. package/dist/super-editor/chunks/{docx-zipper-B-vl4ISA.js → docx-zipper-ikgI-2vM.js} +1 -1
  12. package/dist/super-editor/chunks/{editor-Df2sUgT0.js → editor-C1C_smD4.js} +294 -10
  13. package/dist/super-editor/chunks/{toolbar-C6JoUIM_.js → toolbar-pP4CmNcz.js} +2 -2
  14. package/dist/super-editor/converter.es.js +1 -1
  15. package/dist/super-editor/docx-zipper.es.js +2 -2
  16. package/dist/super-editor/editor.es.js +3 -3
  17. package/dist/super-editor/file-zipper.es.js +1 -1
  18. package/dist/super-editor/src/core/helpers/index.d.ts +1 -0
  19. package/dist/super-editor/src/core/helpers/updateDOMAttributes.d.ts +1 -0
  20. package/dist/super-editor/src/core/super-converter/exporter.d.ts +7 -1
  21. package/dist/super-editor/src/core/super-converter/v2/importer/imageImporter.d.ts +0 -1
  22. package/dist/super-editor/src/core/super-converter/v3/handlers/index.d.ts +2 -0
  23. package/dist/super-editor/src/core/super-converter/v3/handlers/w/drawing/drawing-translator.d.ts +6 -0
  24. package/dist/super-editor/src/core/super-converter/v3/handlers/w/drawing/index.d.ts +1 -0
  25. package/dist/super-editor/src/core/super-converter/v3/handlers/wp/anchor/anchor-translator.d.ts +6 -0
  26. package/dist/super-editor/src/core/super-converter/v3/handlers/wp/anchor/helpers/handle-anchor-node.d.ts +6 -0
  27. package/dist/super-editor/src/core/super-converter/v3/handlers/wp/anchor/helpers/translate-anchor-node.d.ts +6 -0
  28. package/dist/super-editor/src/core/super-converter/v3/handlers/wp/anchor/index.d.ts +1 -0
  29. package/dist/super-editor/src/core/super-converter/v3/handlers/wp/helpers/decode-image-node-helpers.d.ts +18 -0
  30. package/dist/super-editor/src/core/super-converter/v3/handlers/wp/helpers/encode-image-node-helpers.d.ts +6 -0
  31. package/dist/super-editor/src/core/super-converter/v3/handlers/wp/inline/helpers/handle-inline-node.d.ts +6 -0
  32. package/dist/super-editor/src/core/super-converter/v3/handlers/wp/inline/helpers/translate-inline-node.d.ts +6 -0
  33. package/dist/super-editor/src/core/super-converter/v3/handlers/wp/inline/index.d.ts +1 -0
  34. package/dist/super-editor/src/core/super-converter/v3/handlers/wp/inline/inline-translator.d.ts +6 -0
  35. package/dist/super-editor/src/extensions/structured-content/StructuredContentBlockView.d.ts +10 -0
  36. package/dist/super-editor/src/extensions/structured-content/StructuredContentInlineView.d.ts +10 -0
  37. package/dist/super-editor/src/extensions/structured-content/StructuredContentViewBase.d.ts +24 -0
  38. package/dist/super-editor/src/extensions/structured-content/structured-content-block.d.ts +3 -1
  39. package/dist/super-editor/src/extensions/structured-content/structured-content.d.ts +3 -1
  40. package/dist/super-editor/style.css +38 -0
  41. package/dist/super-editor/super-editor.es.js +8 -13
  42. package/dist/super-editor/toolbar.es.js +2 -2
  43. package/dist/super-editor.cjs +1 -1
  44. package/dist/super-editor.es.js +1 -1
  45. package/dist/superdoc.cjs +2 -2
  46. package/dist/superdoc.es.js +2 -2
  47. package/dist/superdoc.umd.js +1101 -715
  48. package/dist/superdoc.umd.js.map +1 -1
  49. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { p as process$1, aw as commonjsGlobal, B as Buffer, ax as getDefaultExportFromCjs, ay as getContentTypesFromXml, az as xmljs } from "./converter-KHB8spG5.js";
1
+ import { p as process$1, ax as commonjsGlobal, B as Buffer, ay as getDefaultExportFromCjs, az as getContentTypesFromXml, aA as xmljs } from "./converter-BPTfSIJf.js";
2
2
  function commonjsRequire(path) {
3
3
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
4
4
  }
@@ -12,9 +12,9 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
12
12
  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;
13
13
  import * as Y from "yjs";
14
14
  import { UndoManager, Item as Item$1, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
15
- import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as InputRule, ah as kebabCase, ai as findParentNodeClosestToPos, aj as getListItemStyleDefinitions, ak as docxNumberigHelpers, al as parseIndentElement, am as combineIndents, an as StepMap, ao as getColStyleDeclaration, ap as SelectionRange, aq as Transform, ar as isInTable$1, as as createColGroup, at as generateDocxRandomId, au as insertNewRelationship, av as htmlHandler } from "./converter-KHB8spG5.js";
15
+ import { P as PluginKey, a as Plugin, M as Mapping, N as NodeSelection, S as Selection, T as TextSelection, b as Slice, D as DOMSerializer, F as Fragment, c as DOMParser$1, d as Mark$1, e as dropPoint, A as AllSelection, p as process$1, B as Buffer2, f as callOrGet, g as getExtensionConfigField, h as getMarkType, i as getMarksFromSelection, j as getNodeType, k as getSchemaTypeNameByName, l as Schema$1, m as cleanSchemaItem, n as canSplit, o as defaultBlockAt$1, q as liftTarget, r as canJoin, s as joinPoint, t as replaceStep$1, R as ReplaceAroundStep$1, u as isTextSelection, v as getMarkRange, w as isMarkActive, x as isNodeActive, y as deleteProps, z as processContent, C as ReplaceStep, E as NodeRange, G as findWrapping, L as ListHelpers, H as findParentNode, I as isMacOS, J as isIOS, K as getSchemaTypeByName, O as inputRulesPlugin, Q as TrackDeleteMarkName, U as TrackInsertMarkName, V as v4, W as TrackFormatMarkName, X as comments_module_events, Y as findMark, Z as objectIncludes, _ as AddMarkStep, $ as RemoveMarkStep, a0 as twipsToLines, a1 as pixelsToTwips, a2 as helpers, a3 as posToDOMRect, a4 as CommandService, a5 as SuperConverter, a6 as createDocument, a7 as createDocFromMarkdown, a8 as createDocFromHTML, a9 as EditorState, aa as hasSomeParentWithClass, ab as isActive, ac as unflattenListsInHtml, ad as parseSizeUnit, ae as minMax, af as getLineHeightValueString, ag as InputRule, ah as kebabCase, ai as findParentNodeClosestToPos, aj as getListItemStyleDefinitions, ak as docxNumberigHelpers, al as parseIndentElement, am as combineIndents, an as StepMap, ao as getColStyleDeclaration, ap as SelectionRange, aq as Transform, ar as isInTable$1, as as createColGroup, at as generateDocxRandomId, au as insertNewRelationship, av as updateDOMAttributes, aw as htmlHandler } from "./converter-BPTfSIJf.js";
16
16
  import { ref, computed, createElementBlock, openBlock, withModifiers, Fragment as Fragment$1, renderList, normalizeClass, createCommentVNode, toDisplayString, createElementVNode, createApp } from "vue";
17
- import { D as DocxZipper } from "./docx-zipper-B-vl4ISA.js";
17
+ import { D as DocxZipper } from "./docx-zipper-ikgI-2vM.js";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
20
20
  };
@@ -25439,69 +25439,353 @@ const ContentBlock = Node$1.create({
25439
25439
  };
25440
25440
  }
25441
25441
  });
25442
+ class StructuredContentViewBase {
25443
+ constructor(props) {
25444
+ __publicField(this, "node");
25445
+ __publicField(this, "view");
25446
+ __publicField(this, "getPos");
25447
+ __publicField(this, "decorations");
25448
+ __publicField(this, "innerDecorations");
25449
+ __publicField(this, "editor");
25450
+ __publicField(this, "extension");
25451
+ __publicField(this, "htmlAttributes");
25452
+ __publicField(this, "root");
25453
+ __publicField(this, "isDragging", false);
25454
+ this.node = props.node;
25455
+ this.view = props.editor.view;
25456
+ this.getPos = props.getPos;
25457
+ this.decorations = props.decorations;
25458
+ this.innerDecorations = props.innerDecorations;
25459
+ this.editor = props.editor;
25460
+ this.extension = props.extension;
25461
+ this.htmlAttributes = props.htmlAttributes;
25462
+ this.mount(props);
25463
+ }
25464
+ mount(props) {
25465
+ return;
25466
+ }
25467
+ get dom() {
25468
+ return this.root;
25469
+ }
25470
+ get contentDOM() {
25471
+ return null;
25472
+ }
25473
+ update(node, decorations, innerDecorations) {
25474
+ if (node.type !== this.node.type) {
25475
+ return false;
25476
+ }
25477
+ this.node = node;
25478
+ this.decorations = decorations;
25479
+ this.innerDecorations = innerDecorations;
25480
+ this.updateHTMLAttributes();
25481
+ return true;
25482
+ }
25483
+ stopEvent(event) {
25484
+ if (!this.dom) return false;
25485
+ const target = event.target;
25486
+ const isInElement = this.dom.contains(target) && !this.contentDOM?.contains(target);
25487
+ if (!isInElement) return false;
25488
+ const isDragEvent = event.type.startsWith("drag");
25489
+ const isDropEvent = event.type === "drop";
25490
+ const isInput = ["INPUT", "BUTTON", "SELECT", "TEXTAREA"].includes(target.tagName) || target.isContentEditable;
25491
+ if (isInput && !isDropEvent && !isDragEvent) return true;
25492
+ const { isEditable } = this.editor;
25493
+ const { isDragging } = this;
25494
+ const isDraggable = !!this.node.type.spec.draggable;
25495
+ const isSelectable = NodeSelection.isSelectable(this.node);
25496
+ const isCopyEvent = event.type === "copy";
25497
+ const isPasteEvent = event.type === "paste";
25498
+ const isCutEvent = event.type === "cut";
25499
+ const isClickEvent = event.type === "mousedown";
25500
+ if (!isDraggable && isSelectable && isDragEvent && event.target === this.dom) {
25501
+ event.preventDefault();
25502
+ }
25503
+ if (isDraggable && isDragEvent && !isDragging && event.target === this.dom) {
25504
+ event.preventDefault();
25505
+ return false;
25506
+ }
25507
+ if (isDraggable && isEditable && !isDragging && isClickEvent) {
25508
+ const dragHandle = target.closest("[data-drag-handle]");
25509
+ const isValidDragHandle = dragHandle && (this.dom === dragHandle || this.dom.contains(dragHandle));
25510
+ if (isValidDragHandle) {
25511
+ this.isDragging = true;
25512
+ document.addEventListener(
25513
+ "dragend",
25514
+ () => {
25515
+ this.isDragging = false;
25516
+ },
25517
+ { once: true }
25518
+ );
25519
+ document.addEventListener(
25520
+ "drop",
25521
+ () => {
25522
+ this.isDragging = false;
25523
+ },
25524
+ { once: true }
25525
+ );
25526
+ document.addEventListener(
25527
+ "mouseup",
25528
+ () => {
25529
+ this.isDragging = false;
25530
+ },
25531
+ { once: true }
25532
+ );
25533
+ }
25534
+ }
25535
+ if (isDragging || isDropEvent || isCopyEvent || isPasteEvent || isCutEvent || isClickEvent && isSelectable) {
25536
+ return false;
25537
+ }
25538
+ return true;
25539
+ }
25540
+ ignoreMutation(mutation) {
25541
+ if (!this.dom || !this.contentDOM) return true;
25542
+ if (this.node.isLeaf || this.node.isAtom) return true;
25543
+ if (mutation.type === "selection") return false;
25544
+ if (this.contentDOM === mutation.target && mutation.type === "attributes") return true;
25545
+ if (this.contentDOM.contains(mutation.target)) return false;
25546
+ return true;
25547
+ }
25548
+ destroy() {
25549
+ this.dom.remove();
25550
+ this.contentDOM?.remove();
25551
+ }
25552
+ updateAttributes(attrs) {
25553
+ const pos = this.getPos();
25554
+ if (typeof pos !== "number") {
25555
+ return;
25556
+ }
25557
+ return this.view.dispatch(
25558
+ this.view.state.tr.setNodeMarkup(pos, void 0, {
25559
+ ...this.node.attrs,
25560
+ ...attrs
25561
+ })
25562
+ );
25563
+ }
25564
+ updateHTMLAttributes() {
25565
+ const { extensionService } = this.editor;
25566
+ const { attributes } = extensionService;
25567
+ const extensionAttrs = attributes.filter((i) => i.type === this.node.type.name);
25568
+ this.htmlAttributes = Attribute.getAttributesToRender(this.node, extensionAttrs);
25569
+ }
25570
+ createDragHandle() {
25571
+ const dragHandle = document.createElement("span");
25572
+ dragHandle.classList.add("sd-structured-content-draggable");
25573
+ dragHandle.draggable = true;
25574
+ dragHandle.contentEditable = "false";
25575
+ dragHandle.dataset.dragHandle = "";
25576
+ const textElement = document.createElement("span");
25577
+ textElement.textContent = "Structured content";
25578
+ dragHandle.append(textElement);
25579
+ return dragHandle;
25580
+ }
25581
+ onDragStart(event) {
25582
+ const { view } = this.editor;
25583
+ const target = event.target;
25584
+ const dragHandle = target.nodeType === 3 ? target.parentElement?.closest("[data-drag-handle]") : target.closest("[data-drag-handle]");
25585
+ if (!this.dom || this.contentDOM?.contains(target) || !dragHandle) {
25586
+ return;
25587
+ }
25588
+ let x = 0;
25589
+ let y = 0;
25590
+ if (this.dom !== dragHandle) {
25591
+ const domBox = this.dom.getBoundingClientRect();
25592
+ const handleBox = dragHandle.getBoundingClientRect();
25593
+ const offsetX = event.offsetX ?? event.nativeEvent?.offsetX;
25594
+ const offsetY = event.offsetY ?? event.nativeEvent?.offsetY;
25595
+ x = handleBox.x - domBox.x + offsetX;
25596
+ y = handleBox.y - domBox.y + offsetY;
25597
+ }
25598
+ event.dataTransfer?.setDragImage(this.dom, x, y);
25599
+ const pos = this.getPos();
25600
+ if (typeof pos !== "number") {
25601
+ return;
25602
+ }
25603
+ const selection = NodeSelection.create(view.state.doc, pos);
25604
+ const transaction = view.state.tr.setSelection(selection);
25605
+ view.dispatch(transaction);
25606
+ }
25607
+ }
25608
+ class StructuredContentInlineView extends StructuredContentViewBase {
25609
+ constructor(props) {
25610
+ super(props);
25611
+ }
25612
+ mount() {
25613
+ this.buildView();
25614
+ }
25615
+ get contentDOM() {
25616
+ const contentElement = this.dom?.querySelector(`.${structuredContentInnerClass$1}`);
25617
+ return contentElement || null;
25618
+ }
25619
+ createElement() {
25620
+ const element = document.createElement("span");
25621
+ element.classList.add(structuredContentClass$1);
25622
+ element.setAttribute("data-structured-content", "");
25623
+ const contentElement = document.createElement("span");
25624
+ contentElement.classList.add(structuredContentInnerClass$1);
25625
+ element.append(contentElement);
25626
+ const domAttrs = Attribute.mergeAttributes(this.htmlAttributes);
25627
+ updateDOMAttributes(element, { ...domAttrs });
25628
+ return { element, contentElement };
25629
+ }
25630
+ buildView() {
25631
+ const { element } = this.createElement();
25632
+ const dragHandle = this.createDragHandle();
25633
+ element.prepend(dragHandle);
25634
+ element.addEventListener("dragstart", (e) => this.onDragStart(e));
25635
+ this.root = element;
25636
+ }
25637
+ updateView() {
25638
+ const domAttrs = Attribute.mergeAttributes(this.htmlAttributes);
25639
+ updateDOMAttributes(this.dom, { ...domAttrs });
25640
+ }
25641
+ update(node, decorations, innerDecorations) {
25642
+ const result = super.update(node, decorations, innerDecorations);
25643
+ if (!result) return false;
25644
+ this.updateView();
25645
+ return true;
25646
+ }
25647
+ }
25648
+ const structuredContentClass$1 = "sd-structured-content";
25649
+ const structuredContentInnerClass$1 = "sd-structured-content__content";
25442
25650
  const StructuredContent = Node$1.create({
25443
25651
  name: "structuredContent",
25444
- group: "inline",
25652
+ group: "inline structuredContent",
25445
25653
  inline: true,
25446
25654
  content: "inline*",
25655
+ isolating: true,
25656
+ atom: false,
25657
+ // false - has editable content.
25658
+ draggable: true,
25447
25659
  addOptions() {
25448
25660
  return {
25449
- structuredContentClass: "sd-structured-content-tag",
25450
25661
  htmlAttributes: {
25662
+ class: structuredContentClass$1,
25451
25663
  "aria-label": "Structured content node"
25452
25664
  }
25453
25665
  };
25454
25666
  },
25455
25667
  addAttributes() {
25456
25668
  return {
25669
+ id: {
25670
+ default: null,
25671
+ parseDOM: (elem) => elem.getAttribute("data-id"),
25672
+ renderDOM: (attrs) => {
25673
+ if (!attrs.id) return {};
25674
+ return { "data-id": attrs.id };
25675
+ }
25676
+ },
25457
25677
  sdtPr: {
25458
25678
  rendered: false
25459
25679
  }
25460
25680
  };
25461
25681
  },
25462
25682
  parseDOM() {
25463
- return [{ tag: `span.${this.options.structuredContentClass}` }];
25683
+ return [{ tag: "span[data-structured-content]" }];
25464
25684
  },
25465
25685
  renderDOM({ htmlAttributes }) {
25466
25686
  return [
25467
25687
  "span",
25468
25688
  Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes, {
25469
- class: this.options.structuredContentClass
25689
+ "data-structured-content": ""
25470
25690
  }),
25471
25691
  0
25472
25692
  ];
25693
+ },
25694
+ addNodeView() {
25695
+ return (props) => {
25696
+ return new StructuredContentInlineView({ ...props });
25697
+ };
25473
25698
  }
25474
25699
  });
25700
+ class StructuredContentBlockView extends StructuredContentViewBase {
25701
+ constructor(props) {
25702
+ super(props);
25703
+ }
25704
+ mount() {
25705
+ this.buildView();
25706
+ }
25707
+ get contentDOM() {
25708
+ const contentElement = this.dom?.querySelector(`.${structuredContentInnerClass}`);
25709
+ return contentElement || null;
25710
+ }
25711
+ createElement() {
25712
+ const element = document.createElement("div");
25713
+ element.classList.add(structuredContentClass);
25714
+ element.setAttribute("data-structured-content-block", "");
25715
+ const contentElement = document.createElement("div");
25716
+ contentElement.classList.add(structuredContentInnerClass);
25717
+ element.append(contentElement);
25718
+ const domAttrs = Attribute.mergeAttributes(this.htmlAttributes);
25719
+ updateDOMAttributes(element, { ...domAttrs });
25720
+ return { element, contentElement };
25721
+ }
25722
+ buildView() {
25723
+ const { element } = this.createElement();
25724
+ const dragHandle = this.createDragHandle();
25725
+ element.prepend(dragHandle);
25726
+ element.addEventListener("dragstart", (e) => this.onDragStart(e));
25727
+ this.root = element;
25728
+ }
25729
+ updateView() {
25730
+ const domAttrs = Attribute.mergeAttributes(this.htmlAttributes);
25731
+ updateDOMAttributes(this.dom, { ...domAttrs });
25732
+ }
25733
+ update(node, decorations, innerDecorations) {
25734
+ const result = super.update(node, decorations, innerDecorations);
25735
+ if (!result) return false;
25736
+ this.updateView();
25737
+ return true;
25738
+ }
25739
+ }
25740
+ const structuredContentClass = "sd-structured-content-block";
25741
+ const structuredContentInnerClass = "sd-structured-content-block__content";
25475
25742
  const StructuredContentBlock = Node$1.create({
25476
25743
  name: "structuredContentBlock",
25477
- group: "block",
25744
+ group: "block structuredContent",
25478
25745
  content: "block*",
25746
+ isolating: true,
25747
+ atom: false,
25748
+ // false - has editable content.
25749
+ draggable: true,
25479
25750
  addOptions() {
25480
25751
  return {
25481
- structuredContentClass: "sd-structured-content-block-tag",
25482
25752
  htmlAttributes: {
25753
+ class: structuredContentClass,
25483
25754
  "aria-label": "Structured content block node"
25484
25755
  }
25485
25756
  };
25486
25757
  },
25487
25758
  addAttributes() {
25488
25759
  return {
25760
+ id: {
25761
+ default: null,
25762
+ parseDOM: (elem) => elem.getAttribute("data-id"),
25763
+ renderDOM: (attrs) => {
25764
+ if (!attrs.id) return {};
25765
+ return { "data-id": attrs.id };
25766
+ }
25767
+ },
25489
25768
  sdtPr: {
25490
25769
  rendered: false
25491
25770
  }
25492
25771
  };
25493
25772
  },
25494
25773
  parseDOM() {
25495
- return [{ tag: `div.${this.options.structuredContentClass}` }];
25774
+ return [{ tag: "div[data-structured-content-block]" }];
25496
25775
  },
25497
25776
  renderDOM({ htmlAttributes }) {
25498
25777
  return [
25499
25778
  "div",
25500
25779
  Attribute.mergeAttributes(this.options.htmlAttributes, htmlAttributes, {
25501
- class: this.options.structuredContentClass
25780
+ "data-structured-content-block": ""
25502
25781
  }),
25503
25782
  0
25504
25783
  ];
25784
+ },
25785
+ addNodeView() {
25786
+ return (props) => {
25787
+ return new StructuredContentBlockView({ ...props });
25788
+ };
25505
25789
  }
25506
25790
  });
25507
25791
  class DocumentSectionView {
@@ -1,6 +1,6 @@
1
1
  import { computed, createElementBlock, openBlock, createElementVNode, createCommentVNode, normalizeClass, normalizeStyle, ref, withKeys, unref, withModifiers, createBlock, toDisplayString, withDirectives, vModelText, nextTick, getCurrentInstance, createVNode, readonly, watch, onMounted, onBeforeUnmount, reactive, onBeforeMount, inject, onActivated, onDeactivated, createTextVNode, Fragment, Comment, defineComponent, provide, h, Teleport, toRef, renderSlot, isVNode, shallowRef, watchEffect, mergeProps, Transition, vShow, cloneVNode, Text, renderList, withCtx } from "vue";
2
- import { p as process$1 } from "./converter-KHB8spG5.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-Df2sUgT0.js";
2
+ import { p as process$1 } from "./converter-BPTfSIJf.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-C1C_smD4.js";
4
4
  const sanitizeNumber = (value, defaultNumber) => {
5
5
  let sanitized = value.replace(/[^0-9.]/g, "");
6
6
  sanitized = parseFloat(sanitized);
@@ -1,4 +1,4 @@
1
- import { a5 } from "./chunks/converter-KHB8spG5.js";
1
+ import { a5 } from "./chunks/converter-BPTfSIJf.js";
2
2
  import "vue";
3
3
  export {
4
4
  a5 as SuperConverter
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-KHB8spG5.js";
2
- import { D } from "./chunks/docx-zipper-B-vl4ISA.js";
1
+ import "./chunks/converter-BPTfSIJf.js";
2
+ import { D } from "./chunks/docx-zipper-ikgI-2vM.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-Df2sUgT0.js";
2
- import "./chunks/converter-KHB8spG5.js";
3
- import "./chunks/docx-zipper-B-vl4ISA.js";
1
+ import { E } from "./chunks/editor-C1C_smD4.js";
2
+ import "./chunks/converter-BPTfSIJf.js";
3
+ import "./chunks/docx-zipper-ikgI-2vM.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-B-vl4ISA.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-ikgI-2vM.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -27,3 +27,4 @@ export * from "./isInTable.js";
27
27
  export * from "./importHtml.js";
28
28
  export * from "./importMarkdown.js";
29
29
  export * from "./contentProcessor.js";
30
+ export * from "./updateDOMAttributes.js";
@@ -0,0 +1 @@
1
+ export function updateDOMAttributes(dom: any, attrs?: {}, options?: {}): void;
@@ -53,6 +53,13 @@ export function translateParagraphNode(params: any): XmlReadyNode;
53
53
  * @returns {XmlReadyNode} The translated text node
54
54
  */
55
55
  export function getTextNodeForExport(text: string, marks: any[], params: any): XmlReadyNode;
56
+ /**
57
+ * Wrap a text node in a run
58
+ *
59
+ * @param {XmlReadyNode} node
60
+ * @returns {XmlReadyNode} The wrapped run node
61
+ */
62
+ export function wrapTextInRun(nodeOrNodes: any, marks: any): XmlReadyNode;
56
63
  /**
57
64
  * Generate a w:rPr node (run properties) from marks
58
65
  *
@@ -79,7 +86,6 @@ export function processLinkContentNode(node: any): any;
79
86
  * @returns {string} The new relationship ID
80
87
  */
81
88
  export function addNewLinkRelationship(params: ExportParams, link: string): string;
82
- export function translateImageNode(params: any, imageSize: any): any;
83
89
  export function translateHardBreak(params: any): {
84
90
  name: string;
85
91
  elements: {
@@ -1,4 +1,3 @@
1
- export function handleImageImport(node: any, currentFileName: any, params: any): any;
2
1
  /**
3
2
  * @type {import("docxImporter").NodeHandler}
4
3
  */
@@ -5,5 +5,7 @@ export const registeredHandlers: Readonly<{
5
5
  'w:br': import("../node-translator/node-translator.js").NodeTranslator;
6
6
  'w:tab': import("../node-translator/node-translator.js").NodeTranslator;
7
7
  'w:p': import("../node-translator/node-translator.js").NodeTranslator;
8
+ 'wp:anchor': import("../node-translator/node-translator.js").NodeTranslator;
9
+ 'wp:inline': import("../node-translator/node-translator.js").NodeTranslator;
8
10
  }>;
9
11
  export type RegisteredHandlers = any;
@@ -0,0 +1,6 @@
1
+ /** @type {import('@translator').NodeTranslatorConfig} */
2
+ export const config: import("@translator").NodeTranslatorConfig;
3
+ /**
4
+ * @type {import('@translator').NodeTranslator}
5
+ */
6
+ export const translator: import("@translator").NodeTranslator;
@@ -0,0 +1 @@
1
+ export * from "./drawing-translator.js";
@@ -0,0 +1,6 @@
1
+ /** @type {import('@translator').NodeTranslatorConfig} */
2
+ export const config: import("@translator").NodeTranslatorConfig;
3
+ /**
4
+ * @type {import('@translator').NodeTranslator}
5
+ */
6
+ export const translator: import("@translator").NodeTranslator;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Anchor image node handler
3
+ * @param {import('@translator').SCEncoderConfig} params
4
+ * @returns {Object|null} Handler result
5
+ */
6
+ export function handleAnchorNode(params: import("@translator").SCEncoderConfig): any | null;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Translates anchor image
3
+ * @param {Object} params - The parameters for translation.
4
+ * @returns {Object} The XML representation.
5
+ */
6
+ export function translateAnchorNode(params: any): any;
@@ -0,0 +1 @@
1
+ export * from "./anchor-translator.js";
@@ -0,0 +1,18 @@
1
+ export function translateImageNode(params: any): any;
2
+ /**
3
+ * Decodes image into export XML
4
+ */
5
+ export type ExportParams = {
6
+ /**
7
+ * JSON node to translate (from PM schema)
8
+ */
9
+ node: any;
10
+ /**
11
+ * The stored body node to restore, if available
12
+ */
13
+ bodyNode: any;
14
+ /**
15
+ * The relationships to add to the document
16
+ */
17
+ relationships: any[];
18
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Encodes image xml into Editor node
3
+ * @param {Object} params
4
+ * @returns {Object|null}
5
+ */
6
+ export function handleImageNode(node: any, params: any, isAnchor: any): any | null;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Inline image node handler
3
+ * @param {import('@translator').SCEncoderConfig} params
4
+ * @returns {Object|null} Handler result
5
+ */
6
+ export function handleInlineNode(params: import("@translator").SCEncoderConfig): any | null;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Translates inline image
3
+ * @param {Object} params - The parameters for translation.
4
+ * @returns {Object} The XML representation.
5
+ */
6
+ export function translateInlineNode(params: any): any;
@@ -0,0 +1 @@
1
+ export * from "./inline-translator.js";
@@ -0,0 +1,6 @@
1
+ /** @type {import('@translator').NodeTranslatorConfig} */
2
+ export const config: import("@translator").NodeTranslatorConfig;
3
+ /**
4
+ * @type {import('@translator').NodeTranslator}
5
+ */
6
+ export const translator: import("@translator").NodeTranslator;
@@ -0,0 +1,10 @@
1
+ export class StructuredContentBlockView extends StructuredContentViewBase {
2
+ mount(): void;
3
+ createElement(): {
4
+ element: HTMLDivElement;
5
+ contentElement: HTMLDivElement;
6
+ };
7
+ buildView(): void;
8
+ updateView(): void;
9
+ }
10
+ import { StructuredContentViewBase } from './StructuredContentViewBase';
@@ -0,0 +1,10 @@
1
+ export class StructuredContentInlineView extends StructuredContentViewBase {
2
+ mount(): void;
3
+ createElement(): {
4
+ element: HTMLSpanElement;
5
+ contentElement: HTMLSpanElement;
6
+ };
7
+ buildView(): void;
8
+ updateView(): void;
9
+ }
10
+ import { StructuredContentViewBase } from './StructuredContentViewBase';
@@ -0,0 +1,24 @@
1
+ export class StructuredContentViewBase {
2
+ constructor(props: any);
3
+ node: any;
4
+ view: any;
5
+ getPos: any;
6
+ decorations: any;
7
+ innerDecorations: any;
8
+ editor: any;
9
+ extension: any;
10
+ htmlAttributes: any;
11
+ root: any;
12
+ isDragging: boolean;
13
+ mount(props: any): void;
14
+ get dom(): any;
15
+ get contentDOM(): any;
16
+ update(node: any, decorations: any, innerDecorations: any): boolean;
17
+ stopEvent(event: any): boolean;
18
+ ignoreMutation(mutation: any): boolean;
19
+ destroy(): void;
20
+ updateAttributes(attrs: any): any;
21
+ updateHTMLAttributes(): void;
22
+ createDragHandle(): HTMLSpanElement;
23
+ onDragStart(event: any): void;
24
+ }
@@ -1,2 +1,4 @@
1
+ export const structuredContentClass: "sd-structured-content-block";
2
+ export const structuredContentInnerClass: "sd-structured-content-block__content";
1
3
  export const StructuredContentBlock: Node;
2
- import { Node } from '@core/index.js';
4
+ import { Node } from '@core/index';
@@ -1,2 +1,4 @@
1
+ export const structuredContentClass: "sd-structured-content";
2
+ export const structuredContentInnerClass: "sd-structured-content__content";
1
3
  export const StructuredContent: Node;
2
- import { Node } from '@core/index.js';
4
+ import { Node } from '@core/index';