@harbour-enterprises/superdoc 0.18.1-next.2 → 0.19.0-next.0-alpha

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 (34) hide show
  1. package/dist/chunks/{PdfViewer-DPqO7muc.cjs → PdfViewer-Cjkauq08.cjs} +1 -1
  2. package/dist/chunks/{PdfViewer-BM7Ea3yr.es.js → PdfViewer-DhPox0cw.es.js} +1 -1
  3. package/dist/chunks/{index-CyUWXfUG.es.js → index-CFhFJ_ud.es.js} +3 -3
  4. package/dist/chunks/{index-CPLP-MPz.cjs → index-Cejmh9Gr.cjs} +3 -3
  5. package/dist/chunks/{super-editor.es-CzgdqA6a.es.js → super-editor.es-BdzquZlo.es.js} +568 -186
  6. package/dist/chunks/{super-editor.es-BSOX4l_Z.cjs → super-editor.es-CZMzTdMy.cjs} +568 -186
  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-X9LxTGJB.js → converter-Dxe9WVzD.js} +226 -177
  10. package/dist/super-editor/chunks/{docx-zipper-CAu7OzVm.js → docx-zipper-DCWGGMK3.js} +1 -1
  11. package/dist/super-editor/chunks/{editor-BZitQIK-.js → editor-hZAeDOwp.js} +344 -11
  12. package/dist/super-editor/chunks/{toolbar-D1SFDkxX.js → toolbar-BuVS5V_M.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/super-converter/v2/importer/docxImporter.d.ts +2 -2
  18. package/dist/super-editor/src/core/super-converter/v2/importer/hyperlinkImporter.d.ts +2 -6
  19. package/dist/super-editor/src/core/super-converter/v3/handlers/utils.d.ts +1 -0
  20. package/dist/super-editor/src/core/super-converter/v3/handlers/w/hyperlink/hyperlink-translator.d.ts +7 -0
  21. package/dist/super-editor/src/core/super-converter/v3/handlers/w/hyperlink/index.d.ts +1 -0
  22. package/dist/super-editor/src/core/super-converter/v3/node-translator/node-translator.d.ts +2 -1
  23. package/dist/super-editor/src/core/super-validator/validators/xml/index.d.ts +2 -0
  24. package/dist/super-editor/src/core/super-validator/validators/xml/relationships/relationships-validator.d.ts +31 -0
  25. package/dist/super-editor/src/extensions/link/link.d.ts +4 -0
  26. package/dist/super-editor/super-editor.es.js +6 -6
  27. package/dist/super-editor/toolbar.es.js +2 -2
  28. package/dist/super-editor.cjs +1 -1
  29. package/dist/super-editor.es.js +1 -1
  30. package/dist/superdoc.cjs +2 -2
  31. package/dist/superdoc.es.js +2 -2
  32. package/dist/superdoc.umd.js +569 -187
  33. package/dist/superdoc.umd.js.map +1 -1
  34. package/package.json +2 -2
@@ -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-X9LxTGJB.js";
1
+ import { p as process$1, aw as commonjsGlobal, B as Buffer, ax as getDefaultExportFromCjs, ay as getContentTypesFromXml, az as xmljs } from "./converter-Dxe9WVzD.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, 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-X9LxTGJB.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 htmlHandler } from "./converter-Dxe9WVzD.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-CAu7OzVm.js";
17
+ import { D as DocxZipper } from "./docx-zipper-DCWGGMK3.js";
18
18
  var GOOD_LEAF_SIZE = 200;
19
19
  var RopeSequence = function RopeSequence2() {
20
20
  };
@@ -13348,8 +13348,8 @@ function ensureValidLinkRID(links, editor, tr, logger) {
13348
13348
  let modified = false;
13349
13349
  const results = [];
13350
13350
  links.forEach(({ mark, from: from2, to }) => {
13351
- const { rId, href } = mark.attrs;
13352
- if (!rId && href) {
13351
+ const { rId, href, anchor } = mark.attrs;
13352
+ if (!rId && href && !anchor) {
13353
13353
  let newId = editor.converter.docxHelpers.findRelationshipIdFromTarget(href, editor);
13354
13354
  if (newId) logger.debug("Reusing existing rId for link:", newId, "from pos:", from2, "to pos:", to);
13355
13355
  if (!newId) {
@@ -13435,8 +13435,307 @@ function pruneInvalidNumNodes(node, removed) {
13435
13435
  }
13436
13436
  node.elements = next;
13437
13437
  }
13438
+ function createRelationshipsValidator({ editor, logger }) {
13439
+ return () => {
13440
+ const results = [];
13441
+ let modified = false;
13442
+ const convertedXml = editor?.converter?.convertedXml;
13443
+ if (!convertedXml || typeof convertedXml !== "object") {
13444
+ return { results, modified };
13445
+ }
13446
+ const { relsKey, wasNormalized } = findAndNormalizeRelationshipsFile(convertedXml, results);
13447
+ if (!relsKey) {
13448
+ return { results, modified };
13449
+ }
13450
+ if (wasNormalized) modified = true;
13451
+ const { root, wasFixed } = validateRelationshipsRoot(convertedXml[relsKey], relsKey, results);
13452
+ if (!root) {
13453
+ return { results, modified };
13454
+ }
13455
+ if (wasFixed) modified = true;
13456
+ const wasCleaned = cleanupRootChildren(root);
13457
+ if (wasCleaned) modified = true;
13458
+ const { filteredIds, binMediaTargets, wasProcessed } = processRelationships(root, convertedXml, results);
13459
+ if (wasProcessed) modified = true;
13460
+ const wasDocumentFixed = fixMissingDocumentRefs(convertedXml, filteredIds, results, logger);
13461
+ if (wasDocumentFixed) modified = true;
13462
+ const contentTypesKey = "[Content_Types].xml";
13463
+ const contentTypesXml = convertedXml[contentTypesKey];
13464
+ if (binMediaTargets.size > 0 || contentTypesXml) {
13465
+ const wasContentTypesUpdated = updateContentTypes(convertedXml, binMediaTargets, results);
13466
+ if (wasContentTypesUpdated) modified = true;
13467
+ } else {
13468
+ results.push("[Content_Types].xml not found or not parseable. Skipped content types patch.");
13469
+ }
13470
+ return { results, modified };
13471
+ };
13472
+ }
13473
+ function findAndNormalizeRelationshipsFile(convertedXml, results) {
13474
+ const candidateKeys = [
13475
+ "word/_rels/document.xml.rels",
13476
+ "word/document.xml.rels",
13477
+ "_rels/document.xml.rels",
13478
+ "document.xml.rels"
13479
+ ];
13480
+ const relsKey = candidateKeys.find((k) => convertedXml?.[k]?.elements);
13481
+ if (!relsKey) return { relsKey: null, wasNormalized: false };
13482
+ const canonicalKey = "word/_rels/document.xml.rels";
13483
+ if (relsKey !== canonicalKey) {
13484
+ convertedXml[canonicalKey] = convertedXml[relsKey];
13485
+ delete convertedXml[relsKey];
13486
+ results.push(`Normalized relationships location to ${canonicalKey} (was ${relsKey})`);
13487
+ return { relsKey: canonicalKey, wasNormalized: true };
13488
+ }
13489
+ return { relsKey, wasNormalized: false };
13490
+ }
13491
+ function validateRelationshipsRoot(relsTree, relsKey, results) {
13492
+ const root = relsTree?.elements?.[0];
13493
+ if (!root || root.type !== "element") {
13494
+ results.push(`${relsKey} is not a valid xml`);
13495
+ return { root: null, wasFixed: false };
13496
+ }
13497
+ const RELS_NS = "http://schemas.openxmlformats.org/package/2006/relationships";
13498
+ let wasFixed = false;
13499
+ if (root.name !== "Relationships") {
13500
+ root.name = "Relationships";
13501
+ results.push(`Fixed relationships root element name to "Relationships"`);
13502
+ wasFixed = true;
13503
+ }
13504
+ root.attributes = root.attributes || {};
13505
+ if (root.attributes.xmlns !== RELS_NS) {
13506
+ root.attributes.xmlns = RELS_NS;
13507
+ results.push(`Set relationships xmlns to ${RELS_NS}`);
13508
+ wasFixed = true;
13509
+ }
13510
+ return { root, wasFixed };
13511
+ }
13512
+ function cleanupRootChildren(root, results) {
13513
+ const validChildren = root.elements?.filter((child) => child?.type === "element" && child.name === "Relationship") || [];
13514
+ if (root.elements?.length !== validChildren.length) {
13515
+ root.elements = validChildren;
13516
+ return true;
13517
+ }
13518
+ return false;
13519
+ }
13520
+ function processRelationships(root, convertedXml, results) {
13521
+ const binMediaTargets = /* @__PURE__ */ new Set();
13522
+ const filteredIds = /* @__PURE__ */ new Set();
13523
+ let wasProcessed = false;
13524
+ const ridNum = (id) => {
13525
+ const m = /^rId(\d+)$/.exec(String(id || ""));
13526
+ return m ? parseInt(m[1], 10) : null;
13527
+ };
13528
+ const isType2 = (type, tail) => typeof type === "string" && new RegExp(`/relationships/${tail}$`, "i").test(type);
13529
+ const isHyperlinkType = (type) => isType2(type, "hyperlink");
13530
+ const isImageType = (type) => isType2(type, "image");
13531
+ const looksExternal = (target) => /^https?:\/\//i.test(target || "") || /^mailto:/i.test(target || "");
13532
+ const usedIds = /* @__PURE__ */ new Set();
13533
+ let maxRid = 0;
13534
+ for (const el of root.elements) {
13535
+ el.attributes = el.attributes || {};
13536
+ const id = el.attributes.Id;
13537
+ const n = ridNum(id);
13538
+ if (Number.isInteger(n)) maxRid = Math.max(maxRid, n);
13539
+ if (typeof id === "string" && id) {
13540
+ usedIds.add(id);
13541
+ }
13542
+ }
13543
+ let ridCounter = maxRid;
13544
+ const allocateId = (preferred) => {
13545
+ let newId;
13546
+ do {
13547
+ ridCounter += 1;
13548
+ newId = `rId${ridCounter}`;
13549
+ } while (usedIds.has(newId));
13550
+ usedIds.add(newId);
13551
+ return newId;
13552
+ };
13553
+ const seenIds = /* @__PURE__ */ new Set();
13554
+ const filtered = [];
13555
+ function extractStringAttr(attrs, key) {
13556
+ return typeof attrs[key] === "string" ? attrs[key].trim() : "";
13557
+ }
13558
+ for (const rel of root.elements) {
13559
+ rel.attributes = rel.attributes || {};
13560
+ const attrs = rel.attributes;
13561
+ let id = extractStringAttr(attrs, "Id");
13562
+ const type = extractStringAttr(attrs, "Type");
13563
+ let target = extractStringAttr(attrs, "Target");
13564
+ let targetMode = extractStringAttr(attrs, "TargetMode");
13565
+ if (!target) {
13566
+ results.push(`Removed relationship "${id}" without Target`);
13567
+ wasProcessed = true;
13568
+ continue;
13569
+ }
13570
+ if (isHyperlinkType(type) && looksExternal(target) && targetMode.toLowerCase() !== "external") {
13571
+ attrs.TargetMode = "External";
13572
+ targetMode = "External";
13573
+ results.push(`Set TargetMode="External" for hyperlink ${id}`);
13574
+ wasProcessed = true;
13575
+ }
13576
+ if (isImageType(type)) {
13577
+ const relPath = `word/${target.replace(/^\.?\//, "")}`;
13578
+ if (/^media\/.+\.bin$/i.test(target) && relPath in convertedXml) {
13579
+ binMediaTargets.add(`/${relPath}`);
13580
+ }
13581
+ }
13582
+ if (targetMode.toLowerCase() !== "external" && !looksExternal(target)) {
13583
+ const likelyPath = `word/${target.replace(/^\.?\//, "")}`;
13584
+ if (!(likelyPath in convertedXml)) {
13585
+ if (!isImageType(type)) {
13586
+ results.push(`Removed relationship ${id} with missing target: ${target}`);
13587
+ wasProcessed = true;
13588
+ continue;
13589
+ } else {
13590
+ results.push(`Warning: image relationship ${id} target not found: ${target}.`);
13591
+ }
13592
+ }
13593
+ }
13594
+ if (!id) {
13595
+ const newId = allocateId();
13596
+ attrs.Id = newId;
13597
+ results.push(`Assigned missing Id "${newId}"`);
13598
+ wasProcessed = true;
13599
+ id = newId;
13600
+ }
13601
+ if (seenIds.has(id)) {
13602
+ results.push(`Removed duplicate relationship with ID "${id}"`);
13603
+ wasProcessed = true;
13604
+ continue;
13605
+ }
13606
+ seenIds.add(id);
13607
+ filtered.push(rel);
13608
+ }
13609
+ if (root.elements.length !== filtered.length) {
13610
+ root.elements = filtered;
13611
+ wasProcessed = true;
13612
+ } else {
13613
+ const contentChanged = root.elements.some((el, i) => el !== filtered[i]);
13614
+ if (contentChanged) {
13615
+ root.elements = filtered;
13616
+ wasProcessed = true;
13617
+ }
13618
+ }
13619
+ for (const rel of root.elements) {
13620
+ const id = rel.attributes?.Id;
13621
+ if (typeof id === "string" && id) {
13622
+ filteredIds.add(id);
13623
+ }
13624
+ }
13625
+ return { filteredIds, binMediaTargets, wasProcessed };
13626
+ }
13627
+ function fixMissingDocumentRefs(convertedXml, filteredIds, results, logger) {
13628
+ const documentPath = "word/document.xml";
13629
+ const document2 = convertedXml[documentPath];
13630
+ if (document2?.elements?.length) {
13631
+ const documentRoot = document2.elements[0];
13632
+ if (documentRoot?.type === "element") {
13633
+ const missingRefs = [];
13634
+ processDocumentForMissingRefs(documentRoot, filteredIds, missingRefs);
13635
+ if (missingRefs.length) {
13636
+ results.push(`Fixed ${missingRefs.length} missing relationship references`);
13637
+ logger?.debug?.(`Fixed ${missingRefs.length} missing relationship references in document`);
13638
+ return true;
13639
+ }
13640
+ }
13641
+ }
13642
+ return false;
13643
+ }
13644
+ function updateContentTypes(convertedXml, binMediaTargets, results) {
13645
+ const contentTypesKey = "[Content_Types].xml";
13646
+ const contentTypesXml = convertedXml[contentTypesKey];
13647
+ if (typeof contentTypesXml === "string") {
13648
+ return updateContentTypesString(contentTypesXml, binMediaTargets, results, convertedXml, contentTypesKey);
13649
+ } else if (contentTypesXml?.elements?.length) {
13650
+ return updateContentTypesElements(contentTypesXml, binMediaTargets, results);
13651
+ } else {
13652
+ return false;
13653
+ }
13654
+ }
13655
+ function updateContentTypesString(contentTypesXml, binMediaTargets, results, convertedXml, contentTypesKey) {
13656
+ const CONTENT_TYPES_NS = '<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">';
13657
+ const ensureDefault = (xmlString, ext, contentType) => {
13658
+ const defRe = new RegExp(`<Default\\s+Extension="${ext}"\\b`, "i");
13659
+ if (defRe.test(xmlString)) return xmlString;
13660
+ return xmlString.replace(
13661
+ CONTENT_TYPES_NS,
13662
+ `${CONTENT_TYPES_NS}<Default Extension="${ext}" ContentType="${contentType}"/>`
13663
+ );
13664
+ };
13665
+ const ensureOverride = (xmlString, partName, contentType) => {
13666
+ const esc = partName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
13667
+ const ovRe = new RegExp(`<Override\\s+PartName="${esc}"\\b`, "i");
13668
+ if (ovRe.test(xmlString)) return xmlString;
13669
+ return xmlString.replace(
13670
+ CONTENT_TYPES_NS,
13671
+ `${CONTENT_TYPES_NS}<Override PartName="${partName}" ContentType="${contentType}" />`
13672
+ );
13673
+ };
13674
+ let updated = contentTypesXml;
13675
+ updated = ensureDefault(updated, "rels", "application/vnd.openxmlformats-package.relationships+xml");
13676
+ updated = ensureDefault(updated, "xml", "application/xml");
13677
+ for (const partName of binMediaTargets) {
13678
+ updated = ensureOverride(updated, partName, "image/png");
13679
+ results.push(`Added Content Types Override for "${partName}" as image/png`);
13680
+ }
13681
+ if (updated !== contentTypesXml) {
13682
+ convertedXml[contentTypesKey] = updated;
13683
+ return true;
13684
+ }
13685
+ return false;
13686
+ }
13687
+ function updateContentTypesElements(contentTypesXml, binMediaTargets, results) {
13688
+ const typesRoot = contentTypesXml.elements.find((el) => el.name === "Types") || contentTypesXml.elements[0];
13689
+ typesRoot.elements = typesRoot.elements || [];
13690
+ const hasDefault = (ext) => typesRoot.elements.some((el) => el.name === "Default" && el.attributes?.Extension === ext);
13691
+ const addDefault = (ext, ct) => {
13692
+ typesRoot.elements.unshift({
13693
+ type: "element",
13694
+ name: "Default",
13695
+ attributes: { Extension: ext, ContentType: ct }
13696
+ });
13697
+ };
13698
+ const hasOverride = (part) => typesRoot.elements.some((el) => el.name === "Override" && el.attributes?.PartName === part);
13699
+ const addOverride = (part, ct) => {
13700
+ typesRoot.elements.unshift({
13701
+ type: "element",
13702
+ name: "Override",
13703
+ attributes: { PartName: part, ContentType: ct }
13704
+ });
13705
+ };
13706
+ let wasUpdated = false;
13707
+ if (!hasDefault("rels")) {
13708
+ addDefault("rels", "application/vnd.openxmlformats-package.relationships+xml");
13709
+ wasUpdated = true;
13710
+ }
13711
+ if (!hasDefault("xml")) {
13712
+ addDefault("xml", "application/xml");
13713
+ wasUpdated = true;
13714
+ }
13715
+ for (const partName of binMediaTargets) {
13716
+ if (!hasOverride(partName)) {
13717
+ addOverride(partName, "image/png");
13718
+ results.push(`Added Content Types Override for "${partName}" as image/png`);
13719
+ wasUpdated = true;
13720
+ }
13721
+ }
13722
+ return wasUpdated;
13723
+ }
13724
+ function processDocumentForMissingRefs(node, usedIds, fixed) {
13725
+ if (!node?.elements?.length) return;
13726
+ for (const element of node.elements) {
13727
+ if (element?.type !== "element") continue;
13728
+ const rIdValue = element.attributes?.["r:id"];
13729
+ if (typeof rIdValue === "string" && !usedIds.has(rIdValue)) {
13730
+ delete element.attributes["r:id"];
13731
+ fixed.push(`Removed invalid r:id="${rIdValue}"`);
13732
+ }
13733
+ processDocumentForMissingRefs(element, usedIds, fixed);
13734
+ }
13735
+ }
13438
13736
  const XmlValidators = {
13439
- numberingValidator: createNumberingValidator
13737
+ numberingValidator: createNumberingValidator,
13738
+ relationshipsValidator: createRelationshipsValidator
13440
13739
  };
13441
13740
  class SuperValidator {
13442
13741
  /**
@@ -14369,7 +14668,7 @@ const _Editor = class _Editor extends EventEmitter {
14369
14668
  * @returns {Object | void} Migration results
14370
14669
  */
14371
14670
  processCollaborationMigrations() {
14372
- console.debug("[checkVersionMigrations] Current editor version", "0.19.0-next.0");
14671
+ console.debug("[checkVersionMigrations] Current editor version", "0.19.0-next.0-alpha");
14373
14672
  if (!this.options.ydoc) return;
14374
14673
  const metaMap = this.options.ydoc.getMap("meta");
14375
14674
  let docVersion = metaMap.get("version");
@@ -26037,9 +26336,10 @@ const Link = Mark.create({
26037
26336
  */
26038
26337
  protocols: ["http", "https"],
26039
26338
  htmlAttributes: {
26040
- target: "_blank",
26339
+ target: null,
26041
26340
  rel: "noopener noreferrer nofollow",
26042
- class: null
26341
+ class: null,
26342
+ title: null
26043
26343
  }
26044
26344
  };
26045
26345
  },
@@ -26068,9 +26368,16 @@ const Link = Mark.create({
26068
26368
  },
26069
26369
  /**
26070
26370
  * @category Attribute
26071
- * @param {string} [target='_blank'] - Link target window
26371
+ * @param {TargetFrameOptions} [target='_blank'] - Link target window
26072
26372
  */
26073
- target: { default: this.options.htmlAttributes.target },
26373
+ target: {
26374
+ default: this.options.htmlAttributes.target,
26375
+ renderDOM: ({ target, href }) => {
26376
+ if (target) return { target };
26377
+ else if (href && !href.startsWith("#")) return { target: "_blank" };
26378
+ return {};
26379
+ }
26380
+ },
26074
26381
  /**
26075
26382
  * @category Attribute
26076
26383
  * @param {string} [rel='noopener noreferrer nofollow'] - Relationship attributes
@@ -26091,7 +26398,33 @@ const Link = Mark.create({
26091
26398
  * @category Attribute
26092
26399
  * @param {string} [name] - Anchor name for internal references
26093
26400
  */
26094
- name: { default: null }
26401
+ name: { default: null },
26402
+ /**
26403
+ * @category Attribute
26404
+ * @param {boolean} [history] - Specifies whether the target of the hyperlink shall be added to a list of viewed hyperlinks when it is invoked.
26405
+ */
26406
+ history: { default: true, rendered: false },
26407
+ /**
26408
+ * @category Attribute
26409
+ * @param {string|null} [anchor] - Specifies the name of a bookmark that is the target of this link. If the rId and href attributes are specified, then this attribute is ignored.
26410
+ */
26411
+ anchor: { rendered: false },
26412
+ /**
26413
+ * @category Attribute
26414
+ * @param {string|null} [docLocation] - Specifies a location in the target of the hyperlink.
26415
+ */
26416
+ docLocation: { rendered: false },
26417
+ /**
26418
+ * @category Attribute
26419
+ * @param {string|null} [tooltip] - A tooltip for the link
26420
+ */
26421
+ tooltip: {
26422
+ default: null,
26423
+ renderDOM: ({ tooltip }) => {
26424
+ if (tooltip) return { title: tooltip };
26425
+ return {};
26426
+ }
26427
+ }
26095
26428
  };
26096
26429
  },
26097
26430
  addCommands() {
@@ -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-X9LxTGJB.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-BZitQIK-.js";
2
+ import { p as process$1 } from "./converter-Dxe9WVzD.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-hZAeDOwp.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-X9LxTGJB.js";
1
+ import { a5 } from "./chunks/converter-Dxe9WVzD.js";
2
2
  import "vue";
3
3
  export {
4
4
  a5 as SuperConverter
@@ -1,5 +1,5 @@
1
- import "./chunks/converter-X9LxTGJB.js";
2
- import { D } from "./chunks/docx-zipper-CAu7OzVm.js";
1
+ import "./chunks/converter-Dxe9WVzD.js";
2
+ import { D } from "./chunks/docx-zipper-DCWGGMK3.js";
3
3
  export {
4
4
  D as default
5
5
  };
@@ -1,6 +1,6 @@
1
- import { E } from "./chunks/editor-BZitQIK-.js";
2
- import "./chunks/converter-X9LxTGJB.js";
3
- import "./chunks/docx-zipper-CAu7OzVm.js";
1
+ import { E } from "./chunks/editor-hZAeDOwp.js";
2
+ import "./chunks/converter-Dxe9WVzD.js";
3
+ import "./chunks/docx-zipper-DCWGGMK3.js";
4
4
  export {
5
5
  E as Editor
6
6
  };
@@ -1,4 +1,4 @@
1
- import { J as JSZip } from "./chunks/docx-zipper-CAu7OzVm.js";
1
+ import { J as JSZip } from "./chunks/docx-zipper-DCWGGMK3.js";
2
2
  async function createZip(blobs, fileNames) {
3
3
  const zip = new JSZip();
4
4
  blobs.forEach((blob, index) => {
@@ -52,12 +52,12 @@ export type PmMarkJson = {
52
52
  type: string;
53
53
  attrs: {};
54
54
  };
55
- export type NodeListHandlerFn = (nodes: XmlNode[], docx: ParsedDocx, insideTrackCahange: boolean) => PmNodeJson[];
55
+ export type NodeListHandlerFn = (nodes: XmlNode[], docx: ParsedDocx, insideTrackChange: boolean) => PmNodeJson[];
56
56
  export type NodeListHandler = {
57
57
  handler: NodeListHandlerFn;
58
58
  handlerEntities: NodeHandlerEntry[];
59
59
  };
60
- export type NodeHandler = (nodes: XmlNode[], docx: ParsedDocx, nodeListHandler: NodeListHandler, insideTrackCahange: boolean) => {
60
+ export type NodeHandler = (nodes: XmlNode[], docx: ParsedDocx, nodeListHandler: NodeListHandler, insideTrackChange: boolean) => {
61
61
  nodes: PmNodeJson[];
62
62
  consumed: number;
63
63
  };
@@ -1,8 +1,4 @@
1
1
  /**
2
- * @type {import("docxImporter").NodeHandler}
2
+ * @type {import("./docxImporter").NodeHandlerEntry}
3
3
  */
4
- export const handleHyperlinkNode: any;
5
- /**
6
- * @type {import("docxImporter").NodeHandlerEntry}
7
- */
8
- export const hyperlinkNodeHandlerEntity: any;
4
+ export const hyperlinkNodeHandlerEntity: import("./docxImporter").NodeHandlerEntry;
@@ -0,0 +1 @@
1
+ export function generateV2HandlerEntity(handlerName: string, translator: import("../node-translator/").NodeTranslator): import("../../v2/importer/docxImporter").NodeHandlerEntry;
@@ -0,0 +1,7 @@
1
+ /** @type {import('@translator').NodeTranslatorConfig} */
2
+ export const config: import("@translator").NodeTranslatorConfig;
3
+ /**
4
+ * The NodeTranslator instance for the passthrough element.
5
+ * @type {import('@translator').NodeTranslator}
6
+ */
7
+ export const translator: import("@translator").NodeTranslator;
@@ -0,0 +1 @@
1
+ export * from "./hyperlink-translator.js";
@@ -21,7 +21,7 @@ export const TranslatorTypes: Readonly<{
21
21
  */
22
22
  /** @typedef {import('../../v2/importer/types').NodeHandlerParams} SCEncoderConfig */
23
23
  /** @typedef {import('../../v2/types').SuperDocNode} SCEncoderResult */
24
- /** @typedef {{ node: { attrs?: any, marks?: any[], type: string }, children?: any[] }} SCDecoderConfig */
24
+ /** @typedef {{ node: { attrs?: any, marks?: any[], type: string }, children?: any[], relationships?: any[] }} SCDecoderConfig */
25
25
  /** @typedef {{ name: string, elements: any[] }} SCDecoderResult */
26
26
  /**
27
27
  * @callback NodeTranslatorEncodeFn
@@ -152,6 +152,7 @@ export type SCDecoderConfig = {
152
152
  type: string;
153
153
  };
154
154
  children?: any[];
155
+ relationships?: any[];
155
156
  };
156
157
  export type SCDecoderResult = {
157
158
  name: string;
@@ -1,5 +1,6 @@
1
1
  export namespace XmlValidators {
2
2
  export { createNumberingValidator as numberingValidator };
3
+ export { createRelationshipsValidator as relationshipsValidator };
3
4
  }
4
5
  export type XmlValidator = {
5
6
  /**
@@ -8,3 +9,4 @@ export type XmlValidator = {
8
9
  numberingValidator: import("../../types.js").XmlValidator;
9
10
  };
10
11
  import { createNumberingValidator } from './numbering/numbering-validator.js';
12
+ import { createRelationshipsValidator } from './relationships/relationships-validator.js';
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Creates a validator for Word document relationships (word/_rels/document.xml.rels)
3
+ *
4
+ * This validator ensures the relationships file is properly structured and contains
5
+ * valid relationship entries that reference existing files and follow Word's conventions.
6
+ *
7
+ * @typedef {import('../../../types.js').Editor} Editor
8
+ * @typedef {import('../../../types.js').ValidatorLogger} ValidatorLogger
9
+ * @param {Object} params - Validator parameters
10
+ * @param {Editor} params.editor - The editor instance containing the document
11
+ * @param {ValidatorLogger} params.logger - Logger for validation messages
12
+ * @returns {Function} Validator function that returns {results: string[], modified: boolean}
13
+ */
14
+ export function createRelationshipsValidator({ editor, logger }: {
15
+ editor: Editor;
16
+ logger: ValidatorLogger;
17
+ }): Function;
18
+ /**
19
+ * Creates a validator for Word document relationships (word/_rels/document.xml.rels)
20
+ *
21
+ * This validator ensures the relationships file is properly structured and contains
22
+ * valid relationship entries that reference existing files and follow Word's conventions.
23
+ */
24
+ export type Editor = import("../../../types.js").Editor;
25
+ /**
26
+ * Creates a validator for Word document relationships (word/_rels/document.xml.rels)
27
+ *
28
+ * This validator ensures the relationships file is properly structured and contains
29
+ * valid relationship entries that reference existing files and follow Word's conventions.
30
+ */
31
+ export type ValidatorLogger = import("../../../types.js").ValidatorLogger;
@@ -34,4 +34,8 @@ export type LinkAttributes = {
34
34
  */
35
35
  name?: string;
36
36
  };
37
+ /**
38
+ * Target frame options
39
+ */
40
+ export type TargetFrameOptions = "_top" | "_self" | "_parent" | "_blank" | string;
37
41
  import { Mark } from '@core/index.js';
@@ -9,14 +9,14 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
9
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
10
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
11
11
  var _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, runCommandWithArgumentOnly_fn;
12
- import { ax as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, aA as vClickOutside, H as findParentNode, aB as getActiveFormatting, ar as isInTable, aC as readFromClipboard, aD as handleClipboardPaste, aE as getFileObject, aF as translator, aG as translator$1, aH as translator$2, a as Plugin } from "./chunks/converter-X9LxTGJB.js";
13
- import { aI, a5, i, a2 } from "./chunks/converter-X9LxTGJB.js";
14
- import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, s as startImageUpload, y as yUndoPluginKey, d as undoDepth, r as redoDepth, S as SlashMenuPluginKey, E as Editor, e as getStarterExtensions, P as Placeholder, f as getRichTextExtensions, M as Mark, h as Extension, A as Attribute, N as Node } from "./chunks/editor-BZitQIK-.js";
15
- import { k, C, l, T, i as i2, m, j } from "./chunks/editor-BZitQIK-.js";
12
+ import { ax as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, aA as vClickOutside, H as findParentNode, aB as getActiveFormatting, ar as isInTable, aC as readFromClipboard, aD as handleClipboardPaste, aE as getFileObject, aF as translator, aG as translator$1, aH as translator$2, a as Plugin } from "./chunks/converter-Dxe9WVzD.js";
13
+ import { aI, a5, i, a2 } from "./chunks/converter-Dxe9WVzD.js";
14
+ import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, s as startImageUpload, y as yUndoPluginKey, d as undoDepth, r as redoDepth, S as SlashMenuPluginKey, E as Editor, e as getStarterExtensions, P as Placeholder, f as getRichTextExtensions, M as Mark, h as Extension, A as Attribute, N as Node } from "./chunks/editor-hZAeDOwp.js";
15
+ import { k, C, l, T, i as i2, m, j } from "./chunks/editor-hZAeDOwp.js";
16
16
  import { ref, onMounted, createElementBlock, openBlock, normalizeClass, unref, Fragment, renderList, createElementVNode, withModifiers, toDisplayString, createCommentVNode, normalizeStyle, computed, watch, withDirectives, withKeys, vModelText, createTextVNode, createVNode, h, createApp, markRaw, nextTick, onBeforeUnmount, reactive, onUnmounted, renderSlot, shallowRef, createBlock, withCtx, resolveDynamicComponent, normalizeProps, guardReactiveProps } from "vue";
17
- import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, m as magicWandIcon, p as plusIconSvg, a as trashIconSvg, l as linkIconSvg, b as tableIconSvg, c as scissorsIconSvg, d as copyIconSvg, e as pasteIconSvg, f as borderNoneIconSvg, g as arrowsToDotIconSvg, h as arrowsLeftRightIconSvg, w as wrenchIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-D1SFDkxX.js";
17
+ import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, m as magicWandIcon, p as plusIconSvg, a as trashIconSvg, l as linkIconSvg, b as tableIconSvg, c as scissorsIconSvg, d as copyIconSvg, e as pasteIconSvg, f as borderNoneIconSvg, g as arrowsToDotIconSvg, h as arrowsLeftRightIconSvg, w as wrenchIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-BuVS5V_M.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
- import { D } from "./chunks/docx-zipper-CAu7OzVm.js";
19
+ import { D } from "./chunks/docx-zipper-DCWGGMK3.js";
20
20
  import { createZip } from "./file-zipper.es.js";
21
21
  var eventemitter3 = { exports: {} };
22
22
  var hasRequiredEventemitter3;
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-D1SFDkxX.js";
3
- import "./chunks/editor-BZitQIK-.js";
2
+ import { T } from "./chunks/toolbar-BuVS5V_M.js";
3
+ import "./chunks/editor-hZAeDOwp.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-BSOX4l_Z.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-CZMzTdMy.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-CzgdqA6a.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-BdzquZlo.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-BSOX4l_Z.cjs");
4
- const superdoc = require("./chunks/index-CPLP-MPz.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-CZMzTdMy.cjs");
4
+ const superdoc = require("./chunks/index-Cejmh9Gr.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");